Skip to content

Commit

Permalink
Move computation of adaptive dt before read. (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminRodenberg authored Apr 24, 2023
1 parent 8741474 commit 3b82480
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ while (precice.isCouplingOngoing()){
saveOldState(); // save checkpoint
precice.markActionFulfilled(cowic);
}
precice.readBlockVectorData(displID, vertexSize, vertexIDs, displacements);
setDisplacements(displacements);
solverDt = beginTimeStep(); // e.g. compute adaptive dt
dt = min(preciceDt, solverDt);
precice.readBlockVectorData(displID, vertexSize, vertexIDs, displacements);
setDisplacements(displacements);
solveTimeStep(dt);
computeForces(forces);
precice.writeBlockVectorData(forceID, vertexSize, vertexIDs, forces);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ double dt; // actual time step size

preciceDt = precice.initialize();
while (not simulationDone()){ // time loop
precice.readBlockVectorData(displID, vertexSize, vertexIDs, displacements);
setDisplacements(displacements);
solverDt = beginTimeStep(); // e.g. compute adaptive dt
dt = min(preciceDt, solverDt);
precice.readBlockVectorData(displID, vertexSize, vertexIDs, displacements);
setDisplacements(displacements);
solveTimeStep(dt);
computeForces(forces);
precice.writeBlockVectorData(forceID, vertexSize, vertexIDs, forces);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ You can use them as follows:
```c++
while (not simulationDone()){ // time loop
solverDt = beginTimeStep(); // e.g. compute adaptive dt
dt = min(preciceDt, solverDt);
if (precice.isReadDataAvailable()){
precice.readBlockVectorData(displID, vertexSize, vertexIDs, displacements);
setDisplacements(displacements);
}
solverDt = beginTimeStep(); // e.g. compute adaptive dt
dt = min(preciceDt, solverDt);
solveTimeStep(dt);
if (precice.isWriteDataRequired(dt)){
computeForces(forces);
Expand Down

0 comments on commit 3b82480

Please sign in to comment.