From 95fc817f6e26376927af5bb61b5caf6066a980b3 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Fri, 12 Jul 2024 10:56:53 +0200 Subject: [PATCH] Introduce subcycling earlier. --- .../couple-your-code-steering-methods.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/docs/couple-your-code/couple-your-code-steering-methods.md b/pages/docs/couple-your-code/couple-your-code-steering-methods.md index 325c3865062..63a98417557 100644 --- a/pages/docs/couple-your-code/couple-your-code-steering-methods.md +++ b/pages/docs/couple-your-code/couple-your-code-steering-methods.md @@ -19,16 +19,18 @@ void finalize(); What do they do? * `initialize` establishes communication channels and sets up data structures of preCICE. -* `advance` needs to be called after the computation of every time step to _advance_ the coupling. As an argument, you have to pass the solver's last time step size (`dt`). Additionally, it maps coupling data between the coupling meshes, it communicates coupling data between the coupled participants, and it accelerates coupling data. One could say the complete coupling happens within this single function. +* `advance` needs to be called after the computation of every time step to _advance_ the coupling. As an argument, you have to pass the solver's last _time step_ size (`dt`). Additionally, it maps coupling data between the coupling meshes, it communicates coupling data between the coupled participants, and it accelerates coupling data. One could say the complete coupling happens within this single function. * `finalize` frees the preCICE data structures and closes communication channels. -The following function allows us to query the maximum allowed time step size from preCICE: +Synchronization of the participants etc. happens at the end of a _time window_. A time window consists of one or multiple time steps of size `dt` or $\delta t$ performed by the participants. Consequently, the participants must always use a time step size smaller than the time window size, i.e. $\delta t \leq \Delta t$. The following function allows us to query the maximum allowed time step size from preCICE such that a participant does not move beyond the synchronization point: ```cpp double getMaxTimeStepSize(); ``` -But let's ignore the details of time step sizes for the moment. This will be the topic of [Step 5](couple-your-code-time-step-sizes.html). We can now extend the code of our fluid solver: +With this mechanism we can either use a time step size equal to the time window size resulting in synchronization of the participants after every single time step or we can perform multiple time steps before we synchronize. We refer to the latter as _subcycling_ and will discuss this feature in more detail in [Step 5](couple-your-code-time-step-sizes.html). + +Using the API methods introduced above we can now extend the code of our fluid solver: ```cpp #include @@ -45,7 +47,7 @@ precice.initialize(); while (not simulationDone()){ // time loop preciceDt = getMaxTimeStepSize(); solverDt = beginTimeStep(); // e.g. compute adaptive dt - dt = min(preciceDt, solverDt); // more about this in Step 5 + dt = min(preciceDt, solverDt); // determine actual dt solveTimeStep(dt); precice.advance(dt); endTimeStep(); // e.g. update variables, increment time