Tutorials are meant as starting points to build your own coupled simulations. Our collection has grown rapidly over the past few years and your contribution is very welcome!
You can find all tutorial case files in the tutorials repository. Get the latest release, or clone the Git repository to easily update them in the future:
git clone --branch=master --depth 1 https://github.com/precice/tutorials.git
Basic cases
We recommend that you start from one of the following cases, which you can quickly run on your laptop:
- Flow in a channel with an elastic perpendicular flap: A fluid-structure interaction scenario. Feel free to combine different solvers, among OpenFOAM, SU2, deal.II, FEniCS, Nutils, CalculiX, and DUNE.
- Flow over a heated plate: A conjugate heat transfer scenario. Try OpenFOAM, FEniCS, or Nutils.
- Partitioned heat conduction: The mathematician’s dream: split the heat equation in two and glue it again. Pick your Dirichlet and Neumann solvers among FEniCS, Nutils, and OpenFOAM.
Further cases
In the following cases, you can explore different aspects of preCICE:
- Turek-Hron FSI3: The well-known fluid-structure interaction benchmark, with OpenFOAM and deal.II.
- Multiple perpendicular flaps: A three-field fluid-structure interaction case (fully implicit coupling, transient).
- 3D elastic tube: A 3D fluid-structure interaction scenario, with OpenFOAM, CalculiX, and FEniCS.
- 1D elastic tube: A 1D fluid-structure interaction scenario, with toy solvers in Python and C++.
- Channel transport: A channel flow coupled to a transport (of, e.g., a chemistry species) in a uni-directional way, with Nutils.
- Flow over a heated plate: nearest projection: A nearest-projection mapping version, with two OpenFOAM solvers.
- Flow over a heated plate: steady-state: A steady-state version, with OpenFOAM and code_aster.
- Heat exchanger: A three-field conjugate heat transfer case (explicit coupling, steady state), with OpenFOAM and CalculiX.
- Partitioned heat conduction: complex setup: A partitioned heat conduction case with FEniCS, showcasing advanced features and geometries.
- Partitioned beam: An experimental structure-structure coupling scenario, with two CalculiX solvers.
- Partitioned pipe: An experimental fluid-fluid coupling scenario, with two OpenFOAM solvers.
- Volume-coupled diffusion: An experimental volume coupling scenario, with two FEniCS solvers.
Community projects
Apart from these simple tutorial cases, the community has tried preCICE in different setups. Check out our new community projects section in our forum, or read the community stories.
General hints
You can start any tutorial by opening multiple terminals, navigating to each participant case, and running ./run.sh
. To make the “multiple terminals” part easier, it is often convenient to use a terminal multiplexer, such as Tilix or tmux.
Before running a case again, cleanup previous results with the included cleaning scripts.
Visualization
When visualizing partitioned simulation results, there are a few hints you may want to consider.
Synchronizing results
Most of the solvers support a format that ParaView can read. However, the results may not always be synchronized, as some solvers include timestamps in the file names, while others only include a counter. You may want to use the TemporalShiftScale filter of ParaView to map from a constant time step size to a time.
Visualizing OpenFOAM results
To visualize OpenFOAM results, you can either use the bundled OpenFOAM file reader (open the empty .foam
or .OpenFOAM
file you can find at the case directory), or convert the results to VTK with foamToVTK
and load these files in ParaView.
Some versions of OpenFOAM produce additional empty result files when using the preCICE-OpenFOAM adapter, which may lead to a strange “flashing” effect in animations. To work around this, we are deleting such files in the end of each simulation.
Visualizing CalculiX results
CalculiX exports results in its own .frd
format, which you can visualize in CalculiX CGX (cgx flap.frd
). In the CGX window, you can click-and-hold to select different times and fields, or to animate the geometry.
If you prefer to work with VTK files, you can also use tools such as ccx2paraview or a converter included in the calculix-adapter/tools directory.
Are you new to CalculiX? Watch this contributed video tutorial to find out more about pre- and post-processing CalculiX cases for preCICE.
Visualizing results of other solvers
- Our FEniCS examples write
.pvd
files, which you can open in ParaView. - Our deal.II examples write
.vtk
files. - SU2 writes
.vtk
files. - code_aster writes
.rmed
files, which you can open in GMSH. See an example.