Layout of the YAML configuration file
The layout of the YAML configuration file, which should be named
config.yml (default name), is explained by means of an example for an FSI simulation:
participants: Calculix: interfaces: - nodes-mesh: Calculix_Mesh patch: interface read-data: [Forces] write-data: [DisplacementDeltas] precice-config-file: ../precice-config.xml
The adapter allows us to use several participants in one simulation (e.g., several instances of Calculix if several solid objects are taken into account). The name of the participant
Calculix must match the specification of the participant on the command line when running the executable of
CCX with the adapter being used (this is described later). Also, the name must be the same as the one used in the preCICE configuration file
One participant may have several coupling interfaces. Note that each interface specification starts with a dash.
Depending on the data you need to read and write, the interface should define either a
faces-mesh (or simply
mesh as a synonym) where the data points are centers of faces (computed by the adapter) or a mesh made of CalculiX vertices, with the keyword
nodes-mesh. An interface made of faces should be defined in the CalculiX case using the
*SURFACE command, whereas meshes with nodes should define these nodes using
*NSET. Using the wrong family of mesh (e.g. reading forces on faces) throws an error. If you need both kinds of meshes, you should define more than one interface.
For FSI simulations the mesh type of an interface is always
nodes-mesh, as forces and displacement are defined on nodes. The name of this mesh,
Calculix_Mesh, must match the mesh name given in the preCICE configuration file. In CHT simulations,
faces-meshes are usually chosen, as they are needed to apply heat fluxes or convective heat transfer.
For defining which nodes of the CalculiX domain belong to the FSI interface, a node set needs to be defined in the CalculiX input files. The name of this node set must match the name of the patch (here: “interface”).
In the current FSI example, the adapter reads forces from preCICE and feeds displacement deltas (not absolute displacements, but the change of the displacements relative to the last time step) to preCICE. This is defined with the keywords
write-data, respectively. The names (here:
DisplacementDeltas) again need to match the specifications in the preCICE configuration file. In the current example, the coupled fluid solver expects displacement deltas instead of displacements. However, the adapter is capable of writing either type. Just use
write-data: [Displacements] for absolute displacements rather than relative changes being transferred in each time step. Valid
readData keywords in CalculiX are:
- Pressure (Use a
- Heat-Flux (Use a
- Sink-Temperature (Use
- Heat-Transfer-Coefficient (Use
- Forces (Use a
- Displacements (Use
- Temperature (Use
writeData keywords are:
From CalculiX version 2.15, additional
writeData keywords are available:
* Positions * Velocities
Note that the square brackets imply that several read- and write-data types can be used on a single interface. This is not needed for FSI simulations (but for CHT simulations). Lastly, the
precice-config-file needs to be identified including its location. In this example, the file is called
precice-config.xml and is located one directory above the folder, in which the YAML configuration file lies.
CalculiX case input file
CalculiX is designed to be compatible with the Abaqus file format. Here is an example of a CalculiX input file:
*INCLUDE, INPUT=all.msh *INCLUDE, INPUT=fix1.nam *INCLUDE, INPUT=fix2.nam *INCLUDE, INPUT=fix3.nam *INCLUDE, INPUT=interface.nam *MATERIAL, Name=EL *ELASTIC 100000000, 0.3 *DENSITY 10000.0 *SOLID SECTION, Elset=Eall, Material=EL *STEP, NLGEOM, INC=1000000 *DYNAMIC 0.01, 5.0 *BOUNDARY Nfix1, 3, 3, 0 Nfix2, 1, 1, 0 Nfix2, 3, 3, 0 Nfix3, 1, 3, 0 *CLOAD Ninterface, 1, 0.0 Ninterface, 2, 0.0 Ninterface, 3, 0.0 *NODE FILE U *EL FILE S, E *END STEP
The adapter internally uses the CalculiX data format for point forces to apply the FSI forces at the coupling interface. This data structure is only initialized for those nodes, which are loaded at the beginning of a CalculiX analysis step via the input file. Thus, it is necessary to load all nodes of the node set, which defines the FSI interface in CalculiX (referring to the above example, the nodes of set
interface (Note that in CalculiX a node set always begins with an
N followed by the actual name of the set, which is here
interface.) are loaded via the
CLOAD keyword.), in each spatial direction. However, the values of these initial forces can (and should) be chosen to zero, such that the simulation result is not affected.
When using “faces-meshes”, instead of a node set (
\*SURFACE must be sent, defined by a list of elements and face numbers. Instead of starting with a “N”, the name must start with a “S”.
CalculiX CCX offers both a geometrically linear as well as a geometrically non-linear solver. Both are coupled via the adapter. The keyword “NLGEOM” (as shown in the example) needs to be included in the CalculiX case input file in order to select the geometrically non-linear solver. It is also automatically triggered if material non-linearities are included in the analysis. In case the keyword “NLGEOM” does not appear in the CalculiX case input file and the chosen materials are linear, the geometrically linear CalculiX solver is used. In any case, for FSI simulations via preCICE the keyword “DYNAMIC” (enabling a dynamic computation) must appear in the CalculiX input file.
More input files that you may find in the CalculiX tutorial cases:
<name>.inp: The main case configuration file. Through this, several other files are included.
<name>.msh: The mesh file.
<name>.nam: Names, e.g. indices of boundary nodes
Running the adapted CalculiX executable
Running the adapted executable is pretty similar to running the original CalculiX CCX solver. The syntax is as follows:
ccx_preCICE -i [CalculiX input file] -precice-participant [participant name]
ccx_preCICE -i flap -precice-participant Calculix
The input file for this example would be
flap.inp. Note that the suffix
.inp needs to be omitted on the command line. The flag
-precice-participant triggers the usage of the preCICE adapter. If the flag is not used, the original unmodified solver of CalculiX is executed. Therefore, the new executable
ccx_preCICE can be used both for coupled preCICE simulations and CalculiX-only runs. Note that as mentioned above, the participant name used on the command line must match the name given in the YAML configuration file and the preCICE configuration file.
The preCICE CalculiX adapter should support most elements when using
nodes-meshes. It has been used with both linear and quadratic tetrahedral (C3D4 and C3D10) and hexahedral (C3D8, C3D8I, and C3D20) elements. There is however a restriction when using nearest-projection mapping: in that case, you have to use tetrahedral elements.
When using face meshes, only tetrahedra and hexaedra are supported.
Coupling to 2D simulations
The adapter supports quasi 2D simulations when the z-direction is ignored. If you set the preCICE interface dimension to 2, the adapter will map data from the CalculiX 3D simulation to 2D space and vice-versa. The 3D simulation should be made of solid elements (or shells) of unit thickness.
When writing continuous fields (such as temperature and displacements), the adapter will send data that is averaged over thickness. For conservative data (such as forces), sums are computed. When reading forces, the load applied to a 2D point will be spread evenly between the 3D points sharing the same x and y coordinates.
faces-mesh, the behavior in unchanged and the z-component is simply discarded.
In order to use nearest-projection mapping, a few additional changes are required. The first is that the interface surface file (
.sur) must be added to the CalculiX input file. An example of the addition to the input file is given below
*INCLUDE, INPUT=all.msh *INCLUDE, INPUT=fix1.nam *INCLUDE, INPUT=fix2.nam *INCLUDE, INPUT=fix3.nam *INCLUDE, INPUT=interface.nam *INCLUDE, INPUT=interface.sur *MATERIAL, Name=EL
This surface file is generated during the mesh generation process. The second addition is to the config.yml. In order for the adapter to know that the surface mesh must be read, the line
must be changed to
Note that an error will only occur if nodes-mesh-with-connectivity is specified without a
.sur file. The CalculiX adapter with nearest-projection mapping only supports tetrahedral elements (C3D4 and C3D10) as preCICE only works with surface triangles for nearest-projection mapping.
Modal dynamic simulations
The adapter supports modal dynamic simulations, where eigenmodes from a frequency analysis are used. Instead of solving the full system of equations, CalculiX solves the problem as a linear combination of osicllating eigenmodes. This can be faster but slightly less accurate. It can be particularly useful if you need many runs of the simulation, as frequency analysis can be run only once. Run the frequency analysis without preCICE (
ccx_preCICE -i [CalculiX input file]), then run a regular coupled simulation (configured as modal dynamic in the input file). Note that reading displacements is not supported in these simulations.
CalculiX comes with OpenMP and the SPOOLES library which itself can use OpenMP. The adapter also supports this and parallel runs can be used in the same way as with the uncoupled version of CalculiX. You can specify the number of threads via the
OMP_NUM_THREADS environment variable. For a finer configuration, look at the CalculiX documentation.
You can also try GPU acceleration with PaStiX.