Do you wonder why there is no `sendData` and `receiveData` in preCICE? Instead, there is simply `advance`. We call this a high-level API. On this page, you learn which advantages a high-level API has and how communication and control flow in preCICE works.

preCICE distinguishes between serial and parallel coupling schemes:

  • serial: the participants run after one another,
  • parallel: the participants run simultaneously.

Serial coupling schemes

In our example, we currently use a serial coupling scheme:

<coupling-scheme:serial-explicit>
  <participants first="FluidSolver" second="SolidSolver"/>
  ...  
</coupling-scheme:serial-explicit>

FluidSolver is first and SolidSolver second. This means that FluidSolver starts the simulation and computes the first timestep, while SolidSolver still waits. Where does it wait? Well, communciation in preCICE only happens within initialize and advance (and initializeData, but more about this in Step 7):

  • FluidSolver computes the first timestep and then sends and receives data in advance. The receive call blocks.
  • SolidSolver waits in initialize for the first data. When it receives the data it computes its first timestep and then calls advance.
  • Now, FluidSolver receives data and SolidSolver blocks again.

Serial coupling flow


Try to swap the roles of first and second in your example. Do you see the difference? If everything is just too fast, add some sleep calls.

Parallel coupling schemes

In a way, parallel coupling schemes are much easier here (numerically, they are not, but that’s a different story). Everything is symmetric:


Parallel coupling flow