FSI for code_aster: our new open-source preCICE connector, presented at AsterLab

Published by Ruggero Poletto on

Elastic tube 3D at t = 5 ms: fluid pressure and wall displacement, OpenFOAM + code_aster and OpenFOAM + CalculiX

We recently presented a webinar for the AsterLab network on fluid-structure interaction (FSI) with code_aster. The topic: precice_aster, a new open-source connector that couples code_aster with OpenFOAM, and with any other preCICE participant, for two-way FSI and conjugate heat transfer (CHT). This post summarises what we showed: the approach, how to set up a coupled case, the validation results and what comes next.

Why code_aster needed a two-way FSI connector

code_aster already covers part of the fluid-structure world on its own: acoustic and added-mass fluid elements, tube-bundle flow-induced vibration (CALC_FLUI_STRU), and CFD pressures imported one way. But when the flow is viscous, turbulent or separated, and the structural motion feeds back on the flow (flaps, membranes, vortex shedding, flutter), you need a real CFD partner.

preCICE is the natural choice: an open-source coupling library (LGPL-3.0), not a solver, with official adapters for OpenFOAM, CalculiX, SU2, FEniCS, deal.II and more. Until now, though, the official code_aster adapter covered heat transfer only, was written for code_aster 14 and offered no mechanical FSI. That is the gap precice_aster fills.

Partitioned coupling: two solvers you have, three pieces you add

We use a partitioned approach: best-in-class CFD and FEA codes, each with its own mesh, time step and parallelism, exchanging data only at the interface. The fluid sends forces to the solid, the solid sends displacements back. For light structures in dense fluids (strong added-mass effect) the coupling must be implicit: each time window is sub-iterated until convergence, accelerated by a quasi-Newton scheme (IQN-ILS).

Neither solver is modified. You keep OpenFOAM and code_aster as they are and add three pieces:

  • the OpenFOAM adapter, a function object loaded at run time;
  • preCICE and its Python bindings (pyprecice);
  • precice_aster, a Python package imported by the code_aster .comm file.

The two processes talk to each other directly, peer to peer, with no central server.

preCICE coupling architecture: OpenFOAM adapter, preCICE and the precice_aster code_aster adapter
Two solvers you have, three pieces you add: neither OpenFOAM nor code_aster is modified.

precice_aster: what is new

  • Mechanical FSI: force in, displacement out, implicit coupling with IQN.
  • Heat transfer too (Robin–Robin), on code_aster 17 with run_aster.
  • One import and one call in your .comm file.
  • Implicit coupling without code_aster save/restore: a checkpoint is simply a reference to the result at the start of the window.
  • The interface load is built once: new forces only refresh the arrays read by a FORMULE, with no load rebuilt at every step.
  • Self-test, flap and heated-plate examples, and tests included.
  • Open source, GPL-3.0-or-later.

At each time window the connector puts the preCICE forces on the interface nodes (FORCE_NODALE), runs one DYNA_NON_LINE Newmark step from the last accepted state, reads the displacement of the interface nodes and sends it back. If preCICE asks to repeat the window, it restarts from the stored result. The thermal module, run_cht, does the same with THER_LINEAIRE and a Robin (ECHANGE) load.

One preCICE coupling time window between OpenFOAM and code_aster, step by step
One implicit coupling time window, step by step.

Setting up a coupled case

The recipe is three ingredients, each tested on its own first: a code_aster case that runs alone with a dummy load, an OpenFOAM case that runs alone with a rigid wall, and one shared precice-config.xml. On the code_aster side, your study stays an ordinary study plus two lines:

# flap.comm: an ordinary code_aster study
mesh  = LIRE_MAILLAGE(UNITE=20, FORMAT='ASTER')
model = AFFE_MODELE(MAILLAGE=mesh, AFFE=_F(TOUT='OUI',
        PHENOMENE='MECANIQUE', MODELISATION='D_PLAN'))
mat   = DEFI_MATERIAU(ELAS=_F(E=4.0e6, NU=0.3, RHO=3000.0))
mater = AFFE_MATERIAU(MAILLAGE=mesh, AFFE=_F(TOUT='OUI', MATER=mat))
clamp = AFFE_CHAR_MECA(MODELE=model,
        DDL_IMPO=_F(GROUP_MA='base', DX=0.0, DY=0.0))

# the coupling: one import, one call
from precice_aster.fsi import run_fsi
run_fsi(mesh, model, mater, interface_group='flap',
        loads=[clamp], newmark=(0.25, 0.5))

On the OpenFOAM side you add a system/preciceDict, load the adapter in controlDict, enable mesh motion in dynamicMeshDict and set movingWallVelocity on the coupled patch. Then you start the two solvers in two terminals: preCICE is a library, so there is no third process.

Two practical tips from the webinar: map forces conservatively and displacements consistently (the meshes do not need to match), and use an absolute exchange directory, because code_aster runs in a temporary folder.

Results

We compared OpenFOAM + code_aster against OpenFOAM + CalculiX, solids4foam and an OpenFOAM-only CHT reference on three cases. All full runs were done on cloudHPC.

Case 1: a flexible flap in a channel (2D FSI)

Perpendicular flap FSI test case: 2D channel with a flexible flap clamped at the base
Case 1: a flexible flap in a 6 × 4 m channel, inflow 10 m/s.

A 1 × 0.1 m flap (E = 4 MPa), clamped at the base, in a 6 × 4 m channel with a 10 m/s inflow; implicit IQN-ILS coupling, Δt = 0.01 s, 5 s simulated (500 windows). code_aster and CalculiX give practically the same tip displacement: first peak 0.199 m vs 0.198 m, with 2.0 coupling iterations per window for both.

Flap tip displacement: OpenFOAM + code_aster vs OpenFOAM + CalculiX vs solids4foam
Tip displacement over 5 s: code_aster and CalculiX overlap; solids4foam needs about 1000 cells to match.

The comparison with solids4foam shows one of the advantages of coupled FEM–CFD: each physics runs on the discretisation it is best at. 160 quadratic elements in code_aster get the bending right, while a finite-volume solid needs about 1000 cells for the same answer (45 cells give a 0.123 m peak, 1000 cells 0.204 m).

Flap at t = 0.8 s: fluid velocity and solid displacement for four FSI runs
Flap at t = 0.8 s: fluid velocity and solid displacement, four runs.

Case 2: a pressure pulse through an elastic tube (3D FSI)

Elastic tube 3D FSI test case: pressure pulse through a tube with an elastic wall
Case 2: a 1.33 kPa pressure pulse through a 50 mm elastic tube.

A 50 mm long elastic tube (r = 5 mm, 1 mm wall, E = 300 kPa) filled with water and hit by a 1.33 kPa pressure pulse for 3 ms: a case with strong added mass. Over 100 windows (10 ms), the peak radial wall displacement is 0.112 mm with code_aster vs 0.110 mm with CalculiX, and code_aster needs fewer coupling iterations: 3.6 vs 4.2 per window on average.

Elastic tube radial wall displacement at mid-tube: code_aster vs CalculiX
Radial wall displacement at mid-tube: code_aster vs CalculiX, 100 windows.
Elastic tube 3D at t = 5 ms: fluid pressure and wall displacement, OpenFOAM + code_aster and OpenFOAM + CalculiX
t = 5 ms: fluid pressure and wall displacement (×10), half wall removed.

Case 3: a heated plate cooled by a flow (2D CHT)

Heated plate CHT test case: OpenFOAM buoyantSimpleFoam fluid and code_aster solid
Case 3: a heated plate cooled by a flow, Robin–Robin coupling.

A 1 × 0.25 m plate (k = 100 W/m/K) with the bottom at 310 K, cooled by a 300 K flow computed with buoyantSimpleFoam; serial explicit Robin–Robin coupling, 400 windows. Against the OpenFOAM-only chtMultiRegionSimpleFoam reference, the interface temperature differs by at most 0.16 K and the heat through the plate by −0.8 % (1453 vs 1464 W/m), in about 3 minutes on 4 cores.

Heated plate interface temperature: OpenFOAM + code_aster vs OpenFOAM-only chtMultiRegionSimpleFoam
Interface temperature: OpenFOAM + code_aster (precice_aster) vs the OpenFOAM-only reference.

Convergence and cost

Full run on cloudHPCcode_asterCalculiX
Flap 2D, 500 windows, 4 cores: wall time2 min 15 s1 min 06 s
Flap: coupling iterations per window2.02.0
Tube 3D, 100 windows, 8 cores: wall time13 min 38 s8 min 25 s
Tube: coupling iterations per window (max)3.6 (8)4.2 (13)
Coupling iterations per time window: code_aster vs CalculiX, flap 2D and elastic tube 3D
Coupling iterations per window: same on the flap, fewer for code_aster on the 3D tube.

In short: fewer iterations, slower steps. code_aster converges quickly, but each step is a fresh DYNA_NON_LINE call, so elements and factorisation are recomputed every time. Reusing the solver between steps is on the roadmap.

An early release: current limits

  • Cost per step: DYNA_NON_LINE restarts every step (fast coupling, slower steps).
  • Serial coupling process: code_aster runs on one MPI process in the coupled run; the linear solver can use threads.
  • Nodal forces only: conservative force mapping, no pressure or traction loads yet.
  • Large rotations: forces are applied at the initial node positions (no follower loads).
  • Heat transfer: steady 2D CHT validated; transient and 3D heat transfer still to test.

code_aster can now couple with any preCICE participant

preCICE sees solvers as black boxes: any two participants couple if they exchange compatible data. OpenFOAM is the first partner, but with the new mechanical connector the FSI-capable fluid solvers of the preCICE ecosystem (SU2, ExaDG, Alya and others) become potential partners for code_aster, and changing partner only touches the preCICE configuration.

Try it, break it, extend it

precice_aster is open source (GPL-3.0) and available on GitHub, with an official mirror in the AsterLab toolbox:

Test cases, issues and pull requests are very welcome: the code_aster community is the right place to grow it. Many thanks to AsterLab for hosting the webinar.

If you want to run coupled code_aster + OpenFOAM simulations without installing and matching preCICE versions yourself, the connector is part of the code_aster environment on cloudHPC. Questions? Write to [email protected].


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


Categories: Code AsterpreCICE