Surface Triangulation File Formats



There are several Cart3D file formats, which differ depending on the type of information that they include. The format is both extensible and hierarchical. Subsequent formats are built upon one another, so that additional information is always "appended" to the end of the more basic format. For backward compatibility All ASCII files are assumed to be written with FORTRAN free format "WRITE(iUnit,*)" and all unformatted files are written with FORTRAN unformatted "WRITE(*)".
The hierarchy goes as follows:
 
 
 Level of Information 
 Contents 
 Filename Extension 
1.
(least info)
 single component
*.tri or *.a.tri (ascii)
2.
 
  configuration 
 (multiple components) 
*.tri or *.a.tri (ascii)
3.
 
 wetted surface
 (multiple components)
*.i.tri
4.
(most info)
 annotated triangulation
(wetted surface + nodal quantities)
*.triq

The Good News: While the information contained in these files is different its all based on the same file format. This gives backward compatibility down the hierarchy. For example a "*.triq" file could be read as a single component file, you just would stop reading before you hit the flow variables.

What's in the files?

1. Component file format :: The file format for a component may be either (fortran) unformatted or ascii, and it is currently a "standard" finite element type data format. Triangles should be oriented such that the circuit v1,v2,v3 is COUNTERCLOCKWISE as viewed from an observer on the FLOW side of the surface.

       nVerts  nTri            <- integer  integer
       x_1 y_1 z_1           <- Geometry of Vertex 1 (float float float)
       x_2 y_2 z_2           <- Geometry of Vertex 2 (float float float)
       x_3 y_3 z_3           <- ...
       .
       .
       .
       x_nVerts y_nVerts z_nVerts <- geom of last unique vertex (nVerts)
       v1_t1 v2_t1 v3_t1          <- Vertices of triangle 1 (int int int)
       v1_t2 v2_t2 v3_t2          <- Vertices of triangle 2 (int int int)
       v1_t3 v2_t3 v3_t3          <- Vertices of triangle 3 (int int int)
       .
       .
       .
       v1_nTri v2_nTri v3_nTri    <-Vertices of last triangle (int int int)

Example of F77 code for reading a *.tri file
           read(iUnit,*) nVerts, nTri
           read(iUnit,*) ( x(j), y(j), z(j)  ,j=1,nVerts) 
           read(iUnit,*) ( v1(j),v2(j),v3(j) ,j=1,nTri  )


(top)

2. Configuration file format :: The file format for a configuration is an extention of that used for individual components. It may be either (fortran) unformatted or ascii. These files are exactly the same as component triangulations, but with component information for each triangle appended onto the triangle list. The triangles for all the components in a configuration are sequentially numbered into global triangle and vertex lists. Triangles should be oriented such that the circuit v1,v2,v3 is COUNTERCLOCKWISE as viewed from an observer on the FLOW side of the surface.


       nVerts  nTri            <- total # of unique verts/tris  (int  int)
       x_1 y_1 z_1           <- Geometry of Vertex 1 (float float float)
       x_2 y_2 z_2           <- Geometry of Vertex 2 (float float float)
       x_3 y_3 z_3           <- ...
       .
       .
       .
       x_nVerts y_nVerts z_nVerts <- geom of last unique vertex (nVerts)
       v1_t1 v2_t1 v3_t1          <- Vertices of triangle 1 (int int int)
       v1_t2 v2_t2 v3_t2          <- Vertices of triangle 2 (int int int)
       v1_t3 v2_t3 v3_t3          <- Vertices of triangle 3 (int int int)
       .
       .
       .
       v1_nTri v2_nTri v3_nTri    <- Vertices of last triangle (int int int)
       1 1 1 1 1 . . . 1 1 1 2 2 2 . . . 2 2 2 <-component numbers of all 
                                                 triangles in the configuraiton
                                                 sequentially starting at "1"

 Example of F77 code for reading a *.tri file
           read(iUnit,*) nVerts, nTri
           read(iUnit,*) ( x(j), y(j), z(j)  ,j=1,nVerts) 
           read(iUnit,*) ( v1(j),v2(j),v3(j) ,j=1,nTri  ) 
           read(iUnit,*) ( comp(j)           ,j=1,nTri  )

(top)

3. Wetted Surface Triangulation Format :: This format is IDENTICAL to that for a CONFIGURATION file. So, why call it a different file? Well, a Configuration file, has multiple components, each of which has a unique set of vertices and triangles. So, in a "configuration file", a triangle on one component will never share a common vertex with a triangle from a different component. In other words, in a "configuration file" the index spaces of the different components are completely disjoint. In a "Wetted surface file" the index spaces of different components are free to overlap. So a triangle on one component may use one or more of the vertices from another component. Think of the intersection between two components, vertices along the line of intersection, will be used in the triangle lists of BOTH of the components. For this reason these triangulations are often called "Intersected Triangulations".


Example of F77 code for reading a *.i.tri file
           read(iUnit,*) nVerts, nTri
           read(iUnit,*) ( x(j), y(j), z(j)  ,j=1,nVerts) 
           read(iUnit,*) ( v1(j),v2(j),v3(j) ,j=1,nTri  ) 
           read(iUnit,*) ( comp(j)           ,j=1,nTri  )

(top)

4. Annotated Triangulation:: This is a triangulation that has been annotated by attaching a list of scalar quantities to each vertex. The filename "*.triq" indicates that the "tri" file has been appended with the solution vector or "q" information. By convention the first scalar is always the pressure coefficient.


     nVerts nTri nScal   --> # of vertices, # of triangles, # of scalars
     x1 y1 z1            --> coordinates of the vertices
     x2 y2 z2 
     x3 y3 z3 
     ..... 
     ..... 
     v11 v12 v13         --> triangles connectivity (3 integers)
     v21 v22 v23 
     ..... 
     ..... 
     ..... 
     1 1 1 1 1 2 2 2 3 3 3 3 1 2... --> component number for each tri
     ..... 
     0.0000 0.0000 0.0000 .....-->scalars values (1,..,nScal) for each vertex 
     ..... 
     .....

Example of F77 code for reading a *.triq file
           read(iUnit,*) nVerts, nTri, nScal 
           read(iUnit,*) ( x(j), y(j), z(j)  ,j=1,nVerts) 
           read(iUnit,*) ( v1(j),v2(j),v3(j) ,j=1,nTri  ) 
           read(iUnit,*) ( comp(j)           ,j=1,nTri  ) 
           read(iUnit,*) ((scalar(j,k),k=1,nScal),j=1,nVerts)
(top)



last update 7 Jun 00, M. Aftosmis