This tutorial comes in two distinct versions, one written in C++ and one in Python. The code for each are located in the folders cxx
and python
respectively.
Choose a version, then navigate down to the corresponding sections for Python and C++ instructions.
This version is realized using the Python API for preCICE. Check this entry in the preCICE wiki for more information on this example.
-
matplotlib
andvtk
for plotting and output
Note: these requirements are specific to the Python variant of the code. If you wish to run the C++ version, you require different packages (see this section).
-
Clone this repository:
$ git clone https://github.com/precice/elastictube1d.git
-
Navigate into the
python
directory and execute theAllrun
script to run both solver participants directly:$ cd python/ && ./Allrun
-
After the script exits, you can view the output
.vtk
files in theVTK
folder located in the root directory. -
To clean up the log files and vtk files created during a run, execute the
Allclean
script.$ ./Allclean
Optional: Visualization and video output can be triggered via the options --enable-plot
and --write-video
of FluidSolver.py
. If you want to use Allrun
, you can set these options via environment variables:
$ ENABLE_PLOT=1 ./Allrun
: plots the simulation over time$ ENABLE_PLOT=1 WRITE_VIDEO=1 ./Allrun
: plots the simulation over time and creates a video.
Check this preCICE wiki page for a detailed description of this tutorial. For more information see [1]. Elastictube scenario taken from [2].
-
LAPACK. On Ubuntu-like Linux distributions, you can also install via executing:
$ sudo apt-get install liblapack-dev
-
Clone this repository:
$ git clone https://github.com/precice/elastictube1d.git
-
Navigate into the
cxx
directory and build the Makefiles:$ cd cxx/ && cmake .
Note: if
cmake
cannot findlibprecice.so
, please make sure that you are linking to preCICE correctly. -
Make the tutorial:
$ make all
-
After successful compilation, you can now launch preset configuration by calling the
Allrun
script located in the current folder:$ ./Allrun
Results will be stored as .vtk files in the
cxx/Postproc
folder. -
To quickly clean the folder of log files and results from previous runs, execute
Allclean
:$ ./Allclean
Optional: You can visualize the results with the Postproc/fluid.py
script:
$ python Postproc/fluid.py <quantity> Postproc/<prefix>
Note the required arguments specifying which quantity to plot (pressure
, velocity
or diameter
) and a name prefix for the target vtk files.
For example, to plot the diameter using the default prefix for vtk files, we execute:
$ python Postproc/fluid.py diameter Postproc/out_fluid_
An image of this diameter plot can be found in the cxx/example
folder.
Alternative:: If you wish to run the parallel versions of each solver, run the Allrun_parallel
script instead. Note that no vtk output is generated for this solver configuration!
Note: The tutorial can also be run manually by launching both participants by hand. See this preCICE wiki page for instructions.
[1] M. Mehl, B. Uekermann, H. Bijl, D. Blom, B. Gatzhammer, and A. van Zuijlen.
Parallel coupling numerics for partitioned fluid-structure interaction simulations. CAMWA, 2016.
[2] J. Degroote, P. Bruggeman, R. Haelterman, and J. Vierendeels. Stability of a coupling technique
for partitioned solvers in FSI applications. Computers & Structures, 2008.