Skip to content

carme-hp/elastictube1d

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

preCICE example for FSI: 1D elastic tube

First Step: Choose a version

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.


Python version

This version is realized using the Python API for preCICE. Check this entry in the preCICE wiki for more information on this example.

Requirements

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).

How to run

  1. Clone this repository:

    $ git clone https://github.com/precice/elastictube1d.git
  2. Navigate into the python directory and execute the Allrun script to run both solver participants directly:

    $ cd python/ && ./Allrun
  3. After the script exits, you can view the output .vtk files in the VTK folder located in the root directory.

  4. 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.

C++ version

Check this preCICE wiki page for a detailed description of this tutorial. For more information see [1]. Elastictube scenario taken from [2].

Requirements

  • preCICE

  • LAPACK. On Ubuntu-like Linux distributions, you can also install via executing:

    $ sudo apt-get install liblapack-dev

How to run

  1. Clone this repository:

    $ git clone https://github.com/precice/elastictube1d.git
  2. Navigate into the cxx directory and build the Makefiles:

    $ cd cxx/ && cmake .

    Note: if cmake cannot find libprecice.so, please make sure that you are linking to preCICE correctly.

  3. Make the tutorial:

    $ make all
  4. 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.

  5. 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.


References

[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.

About

A simple 1D preCICE example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 51.6%
  • Python 37.4%
  • Shell 6.5%
  • CMake 2.7%
  • C 1.8%