Skip to content

Commit

Permalink
Fix tolerance check for subcycling
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonis committed Jan 29, 2024
1 parent fa6f48f commit 848a181
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Adapter.C
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,13 @@ void preciceAdapter::Adapter::adjustSolverTimeStepAndReadData()
the same timestep as the one determined by preCICE.
*/
double tolerance = 1e-14;
if (timestepPrecice_ - timestepSolverDetermined > tolerance)
if (abs(timestepPrecice_ - timestepSolverDetermined) < tolerance)
{
DEBUG(adapterInfo("The solver's timestep is the same as the "
"coupling timestep."));
timestepSolver_ = timestepPrecice_;
}
else if (timestepPrecice_ - timestepSolverDetermined > tolerance)
{
// Add a bool 'subCycling = true' which is checked in the storeMeshPoints() function.
adapterInfo(
Expand All @@ -668,7 +674,7 @@ void preciceAdapter::Adapter::adjustSolverTimeStepAndReadData()
"warning");
}
}
else if (timestepSolverDetermined - timestepPrecice_ > tolerance)
else
{
// In the last time-step, we adjust to dt = 0, but we don't need to trigger the warning here
if (precice_->isCouplingOngoing())
Expand All @@ -681,12 +687,6 @@ void preciceAdapter::Adapter::adjustSolverTimeStepAndReadData()
}
timestepSolver_ = timestepPrecice_;
}
else
{
DEBUG(adapterInfo("The solver's timestep is the same as the "
"coupling timestep."));
timestepSolver_ = timestepPrecice_;
}

// Update the solver's timestep (but don't trigger the adjustDeltaT(),
// which also triggers the functionObject's adjustTimeStep())
Expand Down

0 comments on commit 848a181

Please sign in to comment.