FSI analysis: OpenFOAM + Calculix with preCICE

Published by rupole1185 on

Let’s break down how to set up a Fluid-Structure Interaction (FSI) analysis using PreCICE, OpenFOAM, and Calculix.

1. Overview and Key Concepts

  • PreCICE: This is a coupling library designed to connect different simulation codes. It acts as an intermediary, exchanging data between OpenFOAM (fluid solver) and Calculix (structural solver) at defined coupling interfaces.
  • OpenFOAM: A powerful and open-source CFD (Computational Fluid Dynamics) solver, ideal for simulating the fluid flow.
  • Calculix: A general-purpose finite element analysis (FEA) code, suitable for structural mechanics calculations.

2. The General Workflow

  1. Geometry Preparation:
    • Create your geometry in a CAD software (e.g., SolidWorks, FreeCAD). Ensure the geometry is watertight and ready for meshing.
    • Split the geometry into separate fluid and solid regions (if not already separate).
  2. Mesh Generation:
    • Use a meshing tool (e.g., Salome, Gmsh) to create separate meshes for the fluid and solid domains.
    • The meshes should be compatible, meaning they have matching nodes and elements at the fluid-solid interface.
  3. PreCICE Configuration:
    • Create a PreCICE configuration file (typically .xml). This file defines:
      • Coupling interfaces: Specify the regions where fluid and structural data will be exchanged (e.g., shared surfaces).
      • Data fields: Determine the variables to be exchanged (e.g., pressure, velocity, displacement).
      • Coupling schemes: Select the method for transferring data (e.g., direct coupling, partitioned coupling).
  4. OpenFOAM Setup:
    • Create a case directory for your OpenFOAM simulation.
    • Set up the OpenFOAM case files:
      • system/controlDict: Define simulation parameters (time step, solver settings).
      • system/fvSchemes: Select discretization schemes.
      • system/fvSolution: Specify solvers and convergence criteria.
      • constant/polyMesh: Provide the mesh details.
      • constant/transportProperties: Specify fluid properties.
      • 0/U0/p: Define initial conditions (velocity and pressure).
      • Crucially: Modify the OpenFOAM solver to interact with PreCICE (using PreCICE’s OpenFOAM interface).
  5. Calculix Setup:
    • Prepare an input file for Calculix (often .inp).
    • Define the structural mesh and materials.
    • Specify boundary conditions, including any loads or constraints.
    • Include the PreCICE interface to exchange data with OpenFOAM.
  6. Coupling and Simulation:
    • Execute PreCICE, OpenFOAM, and Calculix simultaneously.
    • PreCICE will manage the data exchange between the two solvers, enabling them to communicate and iterate at each time step.

3. Detailed Steps (Example with OpenFOAM’s pimpleFoam and Calculix)

  1. PreCICE Configuration:<Interface name="FSI_Interface"> <Mesh name="fluid" type="OpenFOAM" file="fluid.msh"/> <Mesh name="solid" type="Calculix" file="solid.msh"/> <CouplingPoint name="Interface"> <Data name="velocity" field="U" mesh="fluid" direction="send"/> <Data name="displacement" field="disp" mesh="solid" direction="receive"/> </CouplingPoint> </Interface>
    • Adjust fluid.msh and solid.msh to match your mesh file names.
    • velocity (from OpenFOAM) and displacement (from Calculix) are being exchanged.
  2. OpenFOAM Setup:
    • In your OpenFOAM case directory, create a precicecoupling subdirectory.
    • Within precicecoupling, add a precicecoupling file:precicecoupling -server -interface FSI_Interface
    • In your OpenFOAM solver’s system/controlDict, set endTime for the simulation duration.
    • Include the PreCICE library in your OpenFOAM solver code.
    • Adjust the solver to read and write data to PreCICE at each iteration.
  3. Calculix Setup:
    • In your Calculix input file:*INCLUDE, FILE=precicecoupling.f
    • Create a precicecoupling.f file with the PreCICE interface for Calculix:SUBROUTINE PRECICECOUPLING(...) ! Code to handle data exchange with PreCICE END SUBROUTINE
    • Configure Calculix to read and write data from/to PreCICE.
  4. Simulation:
    • Run the simulations using commands like:
      • OpenFOAM: mpirun -np <num_cores> pimpleFoam
      • Calculix: calculix <input_file.inp>
    • PreCICE will manage the communication and coupling between the two solvers.

4. Key Points

  • Mesh Compatibility: The fluid and solid meshes must have matching nodes and elements at the coupling interface.
  • Data Exchange: Choose appropriate data fields for exchange (e.g., pressure, velocity, displacement).
  • Stability: FSI simulations can be complex and require careful selection of solver parameters and coupling schemes.
  • Documentation: Consult the PreCICE, OpenFOAM, and Calculix documentation for specific instructions and examples.

5. Advanced Considerations

  • Coupling Schemes: Explore different coupling approaches, such as direct, partitioned, or loosely coupled methods.
  • Time Integration: Choose suitable time integration schemes (e.g., explicit or implicit) to ensure stability.
  • Solver Convergence: Monitor the convergence of both the fluid and structural solvers.
  • Visualization: Use visualization tools (e.g., ParaView) to analyze the simulation results.

6. Getting Started

Feel free to ask if you have more specific questions about setting up your particular FSI simulation!


CloudHPC is a HPC provider to run engineering simulations on the cloud. CloudHPC provides from 1 to 224 vCPUs for each process in several configuration of HPC infrastructure - both multi-thread and multi-core. Current software ranges includes several CAE, CFD, FEA, FEM software among which OpenFOAM, FDS, Blender and several others.

New users benefit of a FREE trial of 300 vCPU/Hours to be used on the platform in order to test the platform, all each features and verify if it is suitable for their needs



0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *