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++.
- Flow over a heated plate: nearest projection: A nearest-projection mapping version, with two OpenFOAM solvers.
- Flow over a heated plate: two meshes: A variant where the mesh used to transfer temperature is not the same as the one transferring heat fluxes. This allows us to use CalculiX as a solid solver.
- 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, Robin-Robin coupling), with OpenFOAM and CalculiX.
- Heat exchanger: simplified: A simplified version of the heat exchanger tutorial. Apart from a simpler geometry, that case is transient and using the implicit multi-coupling scheme, with Dirichlet-Neumann coupling..
- Partitioned heat conduction: complex setup: A partitioned heat conduction case with FEniCS, showcasing advanced features and geometries.
- Partitioned heat conduction: direct access: A partitioned heat conduction case with Nutils, showcasing the direct mesh access feature.
- Partitioned elastic beam: An experimental structure-structure coupling scenario, with two CalculiX solvers.
- Partitioned pipe: A fluid-fluid coupling scenario, with two OpenFOAM solvers.
- Partitioned flow over a backwards-facing step: A fluid-fluid coupling scenario, demonstrating inlet-outlet boundary conditions in OpenFOAM.
- Partitioned flow over a heated plate: A three-participant case, similar to the flow over a heated plate with OpenFOAM solvers, but with a partitioned channel flow.
- Oscillator: A simple mass-spring oscillator with two masses, coupling two instances of a Python solver.
- Volume-coupled diffusion: An experimental volume coupling scenario, with two FEniCS solvers.
- ASTE turbine: An example case for ASTE to investigate different preCICE mappings using a turbine geometry.
- Channel transport: A channel flow coupled to a transport (of, e.g., a chemistry species) in a uni-directional way, with Nutils.
- Channel transport reaction: A channel flow coupled to a transport of a chemical species with reaction in a uni-directional way, with FEniCS.
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. A more complete pre- and post-processing tool for CalculiX is PrePoMax (open-source, only available for Windows).
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.