# Resources for Co-design at POP CoE

## CalculiX IO

Program's name: CalculiX IO
Available version(s): CalculiX I/O (buffered) · CalculiX I/O unbuffered ·
Programming language(s): C · Fortran ·
Programming model(s):
Uses following algorithm(s):
Used in following discipline(s): Computational Fluid Dynamics ·

CalculiX is a free three dimensional structural finite element analysis program. It supports linear and non-linear calculations of static, dynamic and thermal problems. The code is written in C and Fortran. Parallelization is achieved using the pthread programming model.

This kernel represents the I/O behavior of the original CalculiX application. The application writes results to a file after a user-defined number of timesteps have been simulated. These results are stored in a fixed format called frd-format. The format structure consists of different types of blocks:

1. Nodal Point Coordinate Block
2. Element Definition Block
3. Nodal Results Block

A short overview about this format will be given in the following. More detailed information can be found in the CalculiX user’s manual.

### Nodal Point Coordinate Block

The Nodal Point Coordinate Block stores the position coordinates of the simulation mesh nodes. The block is started by a header line with a unique key 2C followed by the number of nodes and a format indicator. The format indicator indicates whether data is stored in short format (0), long format (1) or binary format (2). Each node is then stored in a separate line starting with a -1 key followed by the X-, Y- and Z-coordinate of the node. The block is closed by a key of -3.
For example a unit cube could be stored as follows, where the Z-axis represents the height of the cube:

    2C                  8                                    0
-1    1  0.5 -0.5 -0.5
-1    2  0.5  0.5 -0.5
-1    3 -0.5  0.5 -0.5
-1    4 -0.5 -0.5 -0.5
-1    5  0.5 -0.5  0.5
-1    6  0.5  0.5  0.5
-1    7 -0.5  0.5  0.5
-1    8 -0.5 -0.5  0.5
-3


### Element Definition Block

The Element Definition Block stores the topology information how nodes are connected to form a mesh of finite elements.
This block is identified by a unique key of 3C followed by the number of elements and the same format indicator as in the Nodal Point Coordinate Block. Then for each element two separate lines are stored. The first one starts with a -1 key followed by the element number, the element type, the element group and the element material. The second one starts with a -2 key followed by a list of node numbers that form this element. Finally this block is also closed by a key of -3.
The unit cube from the previous example would be a “8 node brick element (he8)” which has a type of 1. For simplicity assume the element group and the element material is just 0. Then the unit cube would be stored as follows:

    3C                  1                                    0
-1     1    1    0    0
-2     1    2    3    4    5    6    7    8
-3


### Nodal Results Blocks

The Nodal Results Block contains arbitrary values stored at the node positions. For example, these values could be (viscous) stresses, heat fluxes or other physical quantities. The start of the block is indicated by a key of 100C followed by a name, the simulation time at which the data is collected, the number of nodes, the analysis type, the timestep and again the format indicator. It follows a line to define the name of the dataset used in the menu starting with a key of -4 followed by the number of entities that the numeric attribute consists of and a type indicator that describes whether the nodal data is material independent (1), material dependent (2), or it is element data stored at the nodes (3). Then for each entity a line starting with a key of -5 follows. These lines also contain an entitiy name, a type of the entity (1 = scalar, 2 = 3D vector, 4 = matrix), a sub-component index or row number and a column number (only for matrix types). Then for each node a line starting with a key of -1 followed by the value of the attribute is stored. This block is also closed by a key of -3.
Assume that we want to store a force vector that points from the node position to the center of mass of the unit cube. So basically we store the negative position vector for each node. The corresponding Nodal Result Block could look like this:

  100CL  100 0.12345E+2        8                     3    1           0
-4  FORCE        3    1
-5  F1           1    2    1    0
-5  F2           1    2    2    0
-5  F3           1    2    3    0
-1    1 -0.5  0.5  0.5
-1    2 -0.5 -0.5  0.5
-1    3  0.5 -0.5  0.5
-1    4  0.5  0.5  0.5
-1    5 -0.5  0.5 -0.5
-1    6 -0.5 -0.5 -0.5
-1    7  0.5 -0.5 -0.5
-1    8  0.5  0.5 -0.5
-3