**UG_IO SimSys UGRID 3D Grid File Type**

A UGRID file contains a tria/quad face boundary surface grid and (optionally) a polyhedral element volume grid. The optional boundary reconnection, boundary condition, initial normal spacing, and boundary-layer thickness data records are identical for FGRID and UGRID file types.

{ Number_of_Nodes, Number_of_Surf_Trias, Number_of_Surf_Quads, Number_of_Vol_Tets, Number_of_Vol_Pents_5, Number_of_Vol_Pents_6, Number_of_Vol_Hexs } { [ ( X for node 1, Y for node 1, Z for node 1 ), ( X for node 2, Y for node 2, Z for node 2 ), ... ( X for node Number_of_Nodes, Y for node Number_of_Nodes, Z for node Number_of_Nodes ) ] [ ( index for node 1 of tria boundary face 1, index for node 2 of tria boundary face 1, index for node 3 of tria boundary face 1 ), ( index for node 1 of tria boundary face 2, index for node 2 of tria boundary face 2, index for node 3 of tria boundary face 2 ), ... ( index for node 1 of tria boundary face Number_of_Surf_Trias, index for node 2 of tria boundary face Number_of_Surf_Trias, index for node 3 of tria boundary face Number_of_Surf_Trias ) ] [ ( index for node 1 of quad boundary face 1, index for node 2 of quad boundary face 1, index for node 3 of quad boundary face 1, index for node 4 of quad boundary face 1 ), ( index for node 1 of quad boundary face 2, index for node 2 of quad boundary face 2, index for node 3 of quad boundary face 2, index for node 4 of quad boundary face 2 ), ... ( index for node 1 of quad boundary face Number_of_Surf_Quads, index for node 2 of quad boundary face Number_of_Surf_Quads, index for node 3 of quad boundary face Number_of_Surf_Quads, index for node 4 of quad boundary face Number_of_Surf_Quads ) ] [ surface ID for boundary face 1, surface ID for boundary face 2, ... surface ID for boundary face Number_of_Surf_Trias+Number_of_Surf_Quads ] [ ( index for node 1 of tet element 1, index for node 2 of tet element 1, index for node 3 of tet element 1, index for node 4 of tet element 1 ), ( index for node 1 of tet element 2, index for node 2 of tet element 2, index for node 3 of tet element 2, index for node 4 of tet element 2 ), ... ( index for node 1 of tet element Number_of_Vol_Tets, index for node 2 of tet element Number_of_Vol_Tets, index for node 3 of tet element Number_of_Vol_Tets, index for node 4 of tet element Number_of_Vol_Tets ) ] [ ( index for node 1 of pent_5 element 1, index for node 2 of pent_5 element 1, index for node 3 of pent_5 element 1, index for node 4 of pent_5 element 1, index for node 5 of pent_5 element 1 ), ( index for node 1 of pent_5 element 2, index for node 2 of pent_5 element 2, index for node 3 of pent_5 element 2, index for node 4 of pent_5 element 2, index for node 5 of pent_5 element 2 ), ... ( index for node 1 of pent_5 element Number_of_Vol_Pents_5, index for node 2 of pent_5 element Number_of_Vol_Pents_5, index for node 3 of pent_5 element Number_of_Vol_Pents_5, index for node 4 of pent_5 element Number_of_Vol_Pents_5, index for node 5 of pent_5 element Number_of_Vol_Pents_5 ) ] [ ( index for node 1 of pent_6 element 1, index for node 2 of pent_6 element 1, index for node 3 of pent_6 element 1, index for node 4 of pent_6 element 1, index for node 5 of pent_6 element 1, index for node 6 of pent_6 element 1 ), ( index for node 1 of pent_6 element 2, index for node 2 of pent_6 element 2, index for node 3 of pent_6 element 2, index for node 4 of pent_6 element 2, index for node 5 of pent_6 element 2, index for node 6 of pent_6 element 2 ), ... ( index for node 1 of pent_6 element Number_of_Vol_Pents_6, index for node 2 of pent_6 element Number_of_Vol_Pents_6, index for node 3 of pent_6 element Number_of_Vol_Pents_6, index for node 4 of pent_6 element Number_of_Vol_Pents_6, index for node 5 of pent_6 element Number_of_Vol_Pents_6, index for node 6 of pent_6 element Number_of_Vol_Pents_6 ) ] [ ( index for node 1 of hex element 1, index for node 2 of hex element 1, index for node 3 of hex element 1, index for node 4 of hex element 1, index for node 5 of hex element 1, index for node 6 of hex element 1, index for node 7 of hex element 1, index for node 8 of hex element 1 ), ( index for node 1 of hex element 2, index for node 2 of hex element 2, index for node 3 of hex element 2, index for node 4 of hex element 2, index for node 5 of hex element 2, index for node 6 of hex element 2, index for node 7 of hex element 2, index for node 8 of hex element 2 ), ... ( index for node 1 of hex element Number_of_Vol_Hexs, index for node 2 of hex element Number_of_Vol_Hexs, index for node 3 of hex element Number_of_Vol_Hexs, index for node 4 of hex element Number_of_Vol_Hexs, index for node 5 of hex element Number_of_Vol_Hexs, index for node 6 of hex element Number_of_Vol_Hexs, index for node 7 of hex element Number_of_Vol_Hexs, index for node 8 of hex element Number_of_Vol_Hexs ) ] } +{ Number_of_BL_Vol_Tets +{ [ volume ID for element 1, volume ID for element 2, ... volume ID for element Number_of_Vol_Tets+Number_of_Pents_5+Number_of_Pents_6+Number_of_Hexs ] }+ *{ [ reconnection flag for boundary face 1, reconnection flag for boundary face 2, ... reconnection flag for boundary face Number_of_Surf_Trias+Number_of_Surf_Quads ] }* *{ [ grid boundary condition flag for boundary face 1, grid boundary condition flag for boundary face 2, ... grid boundary condition flag for boundary face Number_of_Surf_Trias+Number_of_Surf_Quads ] }* **{ [ initial normal spacing for node 1, initial normal spacing for node 2, ... initial normal spacing for node Number_of_Nodes ] }** **{ [ boundary-layer thickness for node 1, boundary-layer thickness for node 2, ... boundary-layer thickness for node Number_of_Nodes ] }** Number_of_Surf_Quads : Number of quadrilateral boundary surface faces. Number_of_Surf_Trias : Number of triangular boundary surface faces. Number_of_Vol_Hexs : Number of hexahedral volume elements. Number_of_Vol_Pents_5 : Number of pentahedral volume elements with five nodes (pyramid). Number_of_Vol_Pents_6 : Number of pentahedral volume elements with six nodes (prismatic). Number_of_Vol_Tets : Number of tetrahedral volume elements. Number_of_BL_Vol_Tets : Number of Number_of_Nodes : Number of grid nodes.

Note that in the above description the loops over all boundary faces (1,2,..., Number_of_Surf_Trias+Number_of_Surf_Quads) the triangular faces are first, followed by the quadrilateral faces. In the above description, the parentheses ( ... ) are for grouping, the brackets [ ... ] enclose items in a loop, and braces { ... } enclose items in a single logical record. The items in plus braces +{ ... }+ are optional records for grid files that describe a volume grid. If Number_of_Vol_Hexs, Number_of_Vol_Pents_5, Number_of_Vol_Pents_6, or Number_of_Vol_Tets is greater than zero (the grid is a volume grid and not a surface grid) then this data is read in and written out. The optional records can be included in whole or in part as long as they are in the correct order. The UG_IO grid file reader will attempt to read the "Number_of_BL_Vol_Tets" first. If it is not found then reading of the file will end. Next, the reader will attempt to read the "volume ID". If it is not found then reading of the file will end. The items in starred braces *{ ... }* are optional records for grid files that describe either a surface or volume grid. The items in double starred braces **{ ... }** are optional records for grid files that describe only a surface grid. If Number_of_Vol_Hexs, Number_of_Vol_Pents_5, Number_of_Vol_Pents_6, or Number_of_Vol_Tets is greater than zero (the grid is a volume grid and not a surface grid) then the douuble starred brace data is not read in or written out. The optional records can be included in whole or in part as long as they are in the correct order. The UG_IO grid file reader will attempt to read the "reconnection flag" first. If it is not found then reading of the file will end. Next, the reader will attempt to read the "grid boundary condition". If it is not found then reading of the file will end. Then the reader will attempt to read the "initial normal spacing". If it is not found then reading of the file will end. Finally, the reader will attempt to read the "boundary-layer thickness". If it is not found then reading of the file will end.

In FORTRAN unformatted form, the data must be written out or read in using the record format defined above. The floating point data items must all be either real*4 or real*8 data. In C binary form, the data may be written out or read in using records the length of loops or of the individual data items. The floating point data items must all be either float or double data. In ASCII formatted form, the data may be written out or read in using records the length of loops or of the individual data items. Data items may be written out in free format of any specific form.

An example UGRID grid file can easily be created for the cube case shown below. There are 12 tria surface faces, eight nodes, and six tet-elements.

The UGRID grid file representing the cube volume grid can be written as shown below. Note that their are no BL volume tets, the volume element ids are all 1, the boundary surface face ID flags are numbered 1 through 6 and correspond to faces of the cube, the boundary surface face reconnection flags are all 7, and the boundary surface face grid BCs are all 1.

8 12 0 6 0 0 0 0.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1 2 3 1 3 4 3 2 7 7 2 6 1 6 2 1 5 6 1 4 8 8 5 1 4 3 7 7 8 4 7 6 5 8 7 5 1 1 2 2 5 5 4 4 3 3 6 6 7 1 5 8 6 1 5 7 6 1 7 2 3 1 2 7 7 4 3 1 7 4 1 8 0 1 1 1 1 1 1 7 7 7 7 7 7 7 7 7 7 7 7 1 1 1 1 1 1 1 1 1 1 1 1