Skip to content

Commit

Permalink
Remove unnecessary timestepPrecice_ member (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminRodenberg authored Mar 10, 2024
1 parent 8175b7a commit a353484
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 5 additions & 7 deletions Adapter.C
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ void preciceAdapter::Adapter::initialize()

DEBUG(adapterInfo("Initializing preCICE data..."));
precice_->initialize();
timestepPrecice_ = precice_->getMaxTimeStepSize();
preciceInitialized_ = true;
ACCUMULATE_TIMER(timeInInitialize_);

Expand Down Expand Up @@ -587,7 +586,6 @@ void preciceAdapter::Adapter::advance()

SETUP_TIMER();
precice_->advance(timestepSolver_);
timestepPrecice_ = precice_->getMaxTimeStepSize();
ACCUMULATE_TIMER(timeInAdvance_);

return;
Expand Down Expand Up @@ -652,7 +650,7 @@ void preciceAdapter::Adapter::adjustSolverTimeStepAndReadData()
the same timestep as the one determined by preCICE.
*/
double tolerance = 1e-14;
if (timestepPrecice_ - timestepSolverDetermined > tolerance)
if (precice_->getMaxTimeStepSize() - timestepSolverDetermined > tolerance)
{
// Add a bool 'subCycling = true' which is checked in the storeMeshPoints() function.
adapterInfo(
Expand All @@ -668,24 +666,24 @@ void preciceAdapter::Adapter::adjustSolverTimeStepAndReadData()
"warning");
}
}
else if (timestepSolverDetermined - timestepPrecice_ > tolerance)
else if (timestepSolverDetermined - precice_->getMaxTimeStepSize() > tolerance)
{
// 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_),
+ std::to_string(timestepSolverDetermined) + " to " + std::to_string(precice_->getMaxTimeStepSize()),
"warning");
}
timestepSolver_ = timestepPrecice_;
timestepSolver_ = precice_->getMaxTimeStepSize();
}
else
{
DEBUG(adapterInfo("The solver's timestep is the same as the "
"coupling timestep."));
timestepSolver_ = timestepPrecice_;
timestepSolver_ = precice_->getMaxTimeStepSize();
}

// Update the solver's timestep (but don't trigger the adjustDeltaT(),
Expand Down
3 changes: 0 additions & 3 deletions Adapter.H
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ private:

// Timesteps

//- Timestep dictated by preCICE
double timestepPrecice_;

//- Timestep used by the solver
double timestepSolver_;

Expand Down

0 comments on commit a353484

Please sign in to comment.