UCD File Format


Read_UCD module

     A UCD data structure consists of an irregular coordinate structure (or “model) made up of cells. Cells may be points, lines, quadrilaterals, triangles, tetrahedrons, pyramids, prisms, or hexahedrons. Each cell has a corresponding number of nodes. Data can be associated with the entire structure, with each cell, and with each node. The data is structured as a set of components. Each component can be either a scalar or a vector. Unstructured Cell Data is commonly used in structural analysis and computational fluid dynamics.

 

Using the read UCD module

     The read UCD module reads an AVS-compatible UCD structure from a file. The file must have a .inp suffix or it will not be displayed in read ucd’s file browser. The file may be ASCII or binary.

 

UCD File Format

ASCII UCD File Format

     The input file cannot contain blank lines or lines with leading blanks. Comments, if present, must precede all data in the file. Comments within the data will cause read errors. The general order of the data is as follows

 

1. Numbers defining the overall structure, including the number of nodes, the number of cells, and the length of the vector of data associated with the nodes, cells, and the model.

 

2. For each node, its node­id and the coordinates of that node in space. Node­ids must be integers, but any number including non­sequential numbers can be used. Mid­edge nodes are treated like
any other node.

 

3. For each cell: its cell­id, material, cell type (hexahedral, pyramid, etc.), and the list of node­ids that correspond to each of the cell's vertices. The below table specifies the different cell types and the keyword used to represent them in the file.

 

     Line line

     Triangle tri

     Quadrilateral quad

     Hexahedron hex

     Prism prism

     Tetrahedron tet

     Pyramid pyr

     Point pt

 

Note :

 

The read ucd module only accepts integer node-ids and cell-ids. The ids do not have to be consecutively numbered. At present, model based data of UCD module is not implemented and number of model data (num-mdata) will be “0”. The material_id defines subsets of cell sets that one can use. If material_id for all cell_sets = 0 then ignored by the reader. It is safe to leave material_id = 0, if you don’t know what it means.

 

4. Node based data descriptions, if present, the data vector associated with nodes, how many components that vector is divided into (e.g., a vector of 5 floating point numbers may be treated as 3 components: a scalar, a vector of 3, and another scalar, which would be specified as 3 1 3 1).

 

5. For each node data component in a separate line, a component label/unit label pair, separated by a comma.


6. For each node in a separate line, the vector of data values associated with it. This is the end of node definitions.


7.Cell­based data descriptions, if present, then follow in the same order and format as items 4, 5, and 6.

 

 

 

So this is how the ASCII UCD file will look like.

 

# <comment 1>
.
.
.
# <comment n>
1. <num_nodes> <num_cells> <num_ndata> <num_cdata> <num_mdata>
2. <node_id 1> <x> <y> <z>
<node_id 2> <x> <y> <z>

.
.
.
<node_id num_nodes> <x> <y> <z>
3. <cell_id 1> <mat_id> <cell_type> <cell_vert 1> ... <cell_vert n>
<cell_id 2> <mat_id> <cell_type> <cell_vert 1> ... <cell_vert n>
.
.
.
<cell_id num_cells> <mat_id> <cell_type> <cell_vert 1> ...<cell_vert n>
4. <num_comp for node data> <size comp 1> <size comp 2>...<size comp n>
5. <node_comp_label 1> , <units_label 1>
<node_comp_label 2> , <units_label 2>
.
.
.
<node_comp_label num_comp> , <units_label num_comp>

6. <node_id 1> <node_data 1> ... <node_data num_ndata>
<node_id 2> <node_data 1> ... <node_data num_ndata>
.
.
.
<node_id num_nodes> <node_data 1> ... <node_data num_ndata>
7. <num_comp for cell's data> <size comp 1> <size comp 2>...<size comp n>
<cell­component­label 1> , <units­label 1>
<cell­component­label 2> , <units­label 2>
.
.
.
<cell­component­label n> , <units­label n>
8. <cell­id 1> <cell­data 1> ... <cell­data num_cdata>
<cell­id 2> <cell­data 1> ... <cell­data num_cdata>
.
.
.
<cell­id num_cells> <cell­data 1> <cell­data num_cdata>


 

 

 

 


Example ASCII UCD File

The following is an example of a simple UCD file. This UCD structure has 8 nodes in 1 hexahedral cell. Associated with each node is a single scalar data value, making up one component that this person labels "stress," and specifies a "lb/in**2" unit label. There is no cell data.


#
# Simple AVS UCD File
#
8 1 1 0 0 <­­8 nodes, 1 cell, 1 component of node data
1 0.000 0.000 1.000 <­­Node coordinates
2 1.000 0.000 1.000
3 1.000 1.000 1.000
4 0.000 1.000 1.000
5 0.000 0.000 0.000
6 1.000 0.000 0.000
7 1.000 1.000 0.000
8 0.000 1.000 0.000
1 1 hex 1 2 3 4 5 6 7 8 <­­cell id, material id, cell type, cell vertices
1 1 <­­num data components, size of each component
stress, lb/in**2 <­­Component name, units name
1 4999.9999 <­­Data value for each node component
2 18749.9999
3 37500.0000
4 56250.0000
5 74999.9999
6 93750.0001
7 107500.0003
8 5000.0001

 

Binary UCD File Format

     

The following describes the binary format for the UCD data files. The order in which the UCD information is different from the ASCII UCD. The general order of the binary data is as follows. The Binary UCD file format describing each consecutive chunk of bytes is described in the next page.

     

1.    Magic Number , number of nodes, number of cells, number of node data, number of cell data, number of model data. The magic number is the ASCII character BEL whose decimal value is 7. The number of node data is zero if no node data is present. Similarly the number of cell data is zero if no cell data is present.

2.    Number of nlist nodes. This is equal to the product of the number of cells in each cell set and

the number of nodes present in each cell set. This is for cell topology.

3.    Cell information for each cell. The cell information contains cell_id, material_id, number of nodes , cell_ty

 

·     Cell id must be integers.

·     The material_id defines subsets of cell sets that one can use. If material_id for all cell_sets = 0 then ignored by the reader. It is safe to leave material_id = 0, if you don’t know what it means.

Number of nodes is equal to number of nodes in that cell.

Cell_type should be one of the integer specified below depending on the cell structure.

 

Line 1

Triangle 2

Quadrilateral 3

Tetrahedron 4

Pyramid 5

Prism 6

Hexahedron 7

 

4. x coordinates for nodes .y coordinates for nodes. z coordinates for nodes in an interleaved fashion. If there are n nodes, then X0, X1, X2 ….X N, Y0, Y1, Y2, ….Y N, Z0,Z1, Z2,…..Z N

 

5. If there is node data :

node data labels. Each node data label should be separated with a ‘.’ Character. The total length of the node data labels cannot exceed 1024 bytes and the 1024th byte should be a ‘0’ character.

 

node data units. Each node data unit should be separated with a ‘.’ character. The total length of the node data labels cannot exceed 1024 bytes and the 1024th byte should be a ‘0’ character

 

number of node components. This is the total number of components the node data contains.

 

Note : The node can contain multiple components and each component may contain a scalar (veclen = 1) or a vector (veclen >1). The number of node data is equal to sum of these scalars and vectors, whereas the number of node components is equal to just the number of components in each node.

 

Node component list . This is the total number of vectors and scalars a component may have. for each component.

 

Minimums for node data The is the minimums for each component. Express does not compute minimums using the node data nor provide default values in binary format. The minimums are set directly using the values provided from the file.

 

Maximums for node data The is the maximums for each component. Express does not compute maximums using the node data nor provide default values in binary format. The maximums are set directly using the values provided from the file.

 

Node data The number of node data is the product of the number of nodes and number of node data.

 

Node Active List. This has no meaning with AVS/Express but it is not redundant since the UCD reader of AVS/Express reads the data so num_cell_data number of zeros (ints) could be read.

Note: Node active list can be omitted if only either node data or cell data is present in UDC data file.

.

6. Cell­based data descriptions, if present, then follow in the same order and format as described in item 5.

Note :

At present, model based data of UCD module is not implemented and number of model data (num-mdata) will be “0”.

 

The BINARY UCD file format describing each consecutive chunk of bytes is as follows.

 

1 byte      -      magic number. This should be 7.

 

4 bytes      -      number of nodes.            ( int )

 

4 bytes      -      number of cells.            ( int )

 

4 bytes      -      number of node data.      ( int )

 

4 bytes      -      number of cell data      ( int )

 

4 bytes      -      number of model data      ( int )      ( “0”)

 

4 bytes      -      number of nlist nodes (for cell topology) ( int )

 

(num_cells*16) bytes -      cell information. ( 4 ints per cell :

                             id, material id, number of nodes, cell type).

 

(num_nlist_nodes*4) bytes      - cell topology lists. ( ints )

 

(num_nodes*4) bytes -      x coordinates for nodes. (floats)

(num_nodes*4) bytes -      y coordinates for nodes. (floats)

(num_nodes*4) bytes -      z coordinates for nodes. (floats)

 

If there is node data :

     1024 bytes -      node data labels.      (string)

 

     1024 bytes -      node data units.      (string)

 

      4 bytes -      number of node components. ( int )

 

     (num_node_data*4) bytes       -      node component list. ( ints )

 

     (num_node_data*4) bytes       -      minimums for node data. ( floats ).

 

     (num_node_data*4) bytes       -      maximums for node data. ( floats ).

 

     (num_nodes*num_node_data*4) bytes -       node data.      (floats).

 

     (num_node_data*4) bytes       -      node data. (floats)

 

If there is cell data :

     1024 bytes -      cell data labels.      (string)

 

     1024 bytes -      cell data units.      (string)

 

      4 bytes -      number of cell components. ( int )

 

     (num_cell_data*4) bytes       -      cell component list. ( ints )

 

     (num_cell_data*4) bytes       -      minimums for cell data. ( floats ).

 

     (num_cell_data*4) bytes       -      maximums for cell data. ( floats ).

 

     (num_cells*num_cell_data*4) bytes -       cell data.      (floats).

 

     (num_cell_data*4) bytes       -      cell active list (ints)