Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move computation of adaptive dt before read #261

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

BenjaminRodenberg
Copy link
Member

@BenjaminRodenberg BenjaminRodenberg commented Apr 22, 2023

Currently, the computation of the adaptive solverDt happens after the read. I would argue that it should happen before the read. I guess the original idea here was that the computation of the solverDt depends on the quantity that was read. However, I think this does not make sense for the following two reasons:

  1. If we use waveforms, we need the dt before reading, not after. See also v3: Make dt mandatory in documentation #257
  2. If the adaptive solverDt depends on the quantity read from preCICE, then we need to read that quantity also at the right location in time. This leads somehow to a deadlock, that we could, for example, solve by iterating:
bool solverDtChanging = true;
solverDt = beginTimeStep(displacements); // e.g. compute adaptive dt that depends on displacements
while(solverDtChanging) {
  dt = min(preciceDt, solverDt);
  precice.readBlockVectorData(displID, vertexSize, vertexIDs, dt, displacements);
  oldSolverDt = solverDt;
  solverDt = beginTimeStep(displacements);
  solverDtChanging = check(solverDt, oldSolverDt, tol);
}

Copy link
Member

@uekerman uekerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

@BenjaminRodenberg BenjaminRodenberg merged commit 3b82480 into master Apr 24, 2023
@BenjaminRodenberg BenjaminRodenberg deleted the adaptive-dt-before-read branch April 24, 2023 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants