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

Introduce tolerances for triggering dt related warnings #312

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Adapter.C
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ void preciceAdapter::Adapter::adjustSolverTimeStepAndReadData()
If the solver tries to use a bigger timestep, then it needs to use
the same timestep as the one determined by preCICE.
*/

if (timestepSolverDetermined < timestepPrecice_)
double tolerance = 1e-14;
if (timestepPrecice_ - timestepSolverDetermined > tolerance)
{
// Add a bool 'subCycling = true' which is checked in the storeMeshPoints() function.
adapterInfo(
Expand All @@ -668,13 +668,17 @@ void preciceAdapter::Adapter::adjustSolverTimeStepAndReadData()
"warning");
}
}
else if (timestepSolverDetermined > timestepPrecice_)
else if (timestepSolverDetermined - timestepPrecice_ > tolerance)
{
adapterInfo(
"The solver's timestep cannot be larger than the coupling timestep."
" Adjusting from "
+ std::to_string(timestepSolverDetermined) + " to " + std::to_string(timestepPrecice_),
"warning");
// In the last time-step, we adjust to dt = 0, but we don't need to trigger the warning here
if (precice_->isCouplingOngoing())
{
adapterInfo(
"The solver's timestep cannot be larger than the coupling timestep."
" Adjusting from "
+ std::to_string(timestepSolverDetermined) + " to " + std::to_string(timestepPrecice_),
"warning");
}
timestepSolver_ = timestepPrecice_;
}
else
Expand Down
Loading