Skip to content

Solver wrappers

The goal of solver wrappers is to provide communication with the solvers. This means that a solver wrapper must implement a way to communicate input to the solver (at the fluid-structure interface), run the solver with the provided input and obtain the solution from the solver (at the fluid-structure interface).

Important: To avoid conflicts, each solver is run in its own environment. These environments are established on runtime, but the actions required to do so can differ between systems. Therefore, it is necessary to first check (and if needed adapt) the file coconut/solver_modules.py after installing or updating CoCoNuT, as described in the front documentation page.

As each solver is different, the solver wrappers are highly customized too. Nevertheless, they all inherit from the SolverWrapper class, which inherits from the Component class, and must all implement the following methods: initialize, initialize_solution_step, solve_solution_step, finalize_solution_step, output_solution_step and finalize.

Upon instantiation of the solver wrapper object, the solver wrapper has to create a Model containing one or more ModelParts which correspond to (a part of) the fluid-structure interface. The interface coordinates at time step 0 should be stored in the ModelPart, even for a simulation that is restarted from a later time step, in order to have consistent mapping over restarts.

The solve_solution_step method is called in each coupling iteration by the coupled solver, which provides input data stored in an Interface object. The solver wrapper extracts the data and supplies it to the actual solver, starts the calculation and reads the output data when the solver has finished. The solver wrapper then returns this data to the coupled solver as an Interface object.

Available solver wrappers

There are currently two solver wrappers for computational fluid dynamics (CFD) packages:

There are currently also two solver wrappers for computational structural mechanics (CSM) packages :

CoCoNuT also implements several 1D Python-based solver wrappers to provide a fast and easy way to test new algorithms and implementations. These are: