From 33c909470b599aa6c71f37403e2008dc6df534bf Mon Sep 17 00:00:00 2001 From: David Schneider Date: Tue, 23 Jan 2024 09:59:28 +0100 Subject: [PATCH 1/2] Introduce tolerances for triggering warnings --- Adapter.C | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Adapter.C b/Adapter.C index b92f3d00..151d6a1a 100644 --- a/Adapter.C +++ b/Adapter.C @@ -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-12; + if (timestepPrecice_ - timestepSolverDetermined > tolerance) { // Add a bool 'subCycling = true' which is checked in the storeMeshPoints() function. adapterInfo( @@ -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 From cb1076b86f60c0785b95999a6304779bb610424c Mon Sep 17 00:00:00 2001 From: David Schneider Date: Wed, 24 Jan 2024 17:17:46 +0100 Subject: [PATCH 2/2] Use 10^-14 instead of 12 --- Adapter.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adapter.C b/Adapter.C index 151d6a1a..1aca14f3 100644 --- a/Adapter.C +++ b/Adapter.C @@ -651,7 +651,7 @@ 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. */ - double tolerance = 1e-12; + double tolerance = 1e-14; if (timestepPrecice_ - timestepSolverDetermined > tolerance) { // Add a bool 'subCycling = true' which is checked in the storeMeshPoints() function.