OGS
|
Time loop capable of time-integrating several processes at once.
Definition at line 39 of file TimeLoop.h.
#include <TimeLoop.h>
Public Member Functions | |
TimeLoop (std::vector< Output > &&outputs, std::vector< std::unique_ptr< ProcessData > > &&per_process_data, std::unique_ptr< NumLib::StaggeredCoupling > &&staggered_coupling, const NumLib::Time &start_time, const NumLib::Time &end_time) | |
void | initialize () |
initialize output, convergence criterion, etc. | |
void | outputLastTimeStep () const |
~TimeLoop () | |
bool | executeTimeStep () |
bool | calculateNextTimeStep () |
NumLib::Time | endTime () const |
NumLib::Time | currentTime () const |
Public Attributes | |
bool | successful_time_step = true |
Private Types | |
using | TimeStepConstraintCallback |
Private Member Functions | |
bool | preTsNonlinearSolvePostTs (NumLib::Time const &t, double const dt, std::size_t const timesteps) |
NumLib::NonlinearSolverStatus | solveUncoupledEquationSystems (const NumLib::Time &t, const double dt, const std::size_t timestep_id) |
Member to solver non coupled systems of equations, which can be a single system of equations, or several systems of equations without any dependency among the different systems. | |
NumLib::NonlinearSolverStatus | solveCoupledEquationSystemsByStaggeredScheme (const NumLib::Time &t, const double dt, const std::size_t timestep_id) |
Member to solver coupled systems of equations by the staggered scheme. | |
std::pair< NumLib::TimeIncrement, bool > | computeTimeStepping (const double prev_dt, NumLib::Time &t, std::size_t &accepted_steps, std::size_t &rejected_steps, std::vector< TimeStepConstraintCallback > const &time_step_constraints) |
template<typename OutputClassMember > | |
void | outputSolutions (unsigned timestep, const double t, OutputClassMember output_class_member) const |
std::vector< TimeStepConstraintCallback > | generateOutputTimeStepConstraints (std::vector< double > &&fixed_times) const |
void | preOutputInitialConditions (NumLib::Time const &t, const double dt) const |
Private Attributes | |
std::vector< GlobalVector * > | _process_solutions |
std::vector< GlobalVector * > | _process_solutions_prev |
std::vector< Output > | _outputs |
std::vector< std::unique_ptr< ProcessData > > | _per_process_data |
const NumLib::Time | _start_time |
const NumLib::Time | _end_time |
NumLib::Time | _current_time = _start_time |
std::size_t | _accepted_steps = 0 |
std::size_t | _rejected_steps = 0 |
NumLib::TimeIncrement | _dt {0.} |
int | _repeating_times_of_rejected_step = 0 |
bool | _last_step_rejected = false |
std::unique_ptr< NumLib::StaggeredCoupling > | _staggered_coupling |
|
private |
Definition at line 98 of file TimeLoop.h.
ProcessLib::TimeLoop::TimeLoop | ( | std::vector< Output > && | outputs, |
std::vector< std::unique_ptr< ProcessData > > && | per_process_data, | ||
std::unique_ptr< NumLib::StaggeredCoupling > && | staggered_coupling, | ||
const NumLib::Time & | start_time, | ||
const NumLib::Time & | end_time ) |
Definition at line 269 of file TimeLoop.cpp.
ProcessLib::TimeLoop::~TimeLoop | ( | ) |
Definition at line 734 of file TimeLoop.cpp.
References _process_solutions, _process_solutions_prev, NumLib::GlobalVectorProvider::provider, and NumLib::VectorProvider::releaseVector().
bool ProcessLib::TimeLoop::calculateNextTimeStep | ( | ) |
Computes and sets the next timestep.
Definition at line 532 of file TimeLoop.cpp.
References _accepted_steps, _current_time, _dt, _end_time, _last_step_rejected, _outputs, _rejected_steps, ProcessLib::calculateUniqueFixedTimesForAllOutputs(), computeTimeStepping(), ProcessLib::Output::doOutput(), ERR(), generateOutputTimeStepConstraints(), and outputSolutions().
|
private |
Find the minimum time step size among the predicted step sizes of processes and step it as common time step size.
prev_dt | Previous time step size. |
t | Current time. |
accepted_steps | Accepted time steps that are counted in this function. |
rejected_steps | Rejected time steps that are counted in this function. |
time_step_constraints | Functions that are evaluate to influence the time step size (for instance a fixed output time) |
Definition at line 295 of file TimeLoop.cpp.
References _end_time, _per_process_data, _process_solutions, _process_solutions_prev, _repeating_times_of_rejected_step, ProcessLib::computationOfChangeNeeded(), MathLib::LinAlg::computeRelativeNorm(), MathLib::LinAlg::copy(), DBUG(), MathLib::NORM2, OGS_FATAL, NumLib::updateTimeSteps(), and WARN().
Referenced by calculateNextTimeStep(), and initialize().
|
inline |
|
inline |
bool ProcessLib::TimeLoop::executeTimeStep | ( | ) |
Definition at line 511 of file TimeLoop.cpp.
References _accepted_steps, _current_time, _dt, _per_process_data, BaseLib::RunTime::elapsed(), INFO(), preTsNonlinearSolvePostTs(), BaseLib::RunTime::start(), and successful_time_step.
|
private |
Definition at line 444 of file TimeLoop.cpp.
References _end_time, and NumLib::possiblyClampDtToNextFixedTime().
Referenced by calculateNextTimeStep(), and initialize().
void ProcessLib::TimeLoop::initialize | ( | ) |
initialize output, convergence criterion, etc.
Definition at line 462 of file TimeLoop.cpp.
References _accepted_steps, _current_time, _dt, _last_step_rejected, _outputs, _per_process_data, _process_solutions, _process_solutions_prev, _rejected_steps, _staggered_coupling, _start_time, ProcessLib::calculateNonEquilibriumInitialResiduum(), ProcessLib::calculateUniqueFixedTimesForAllOutputs(), computeTimeStepping(), ProcessLib::Output::doOutput(), generateOutputTimeStepConstraints(), outputSolutions(), preOutputInitialConditions(), ProcessLib::setInitialConditions(), and ProcessLib::setTimeDiscretizedODESystem().
void ProcessLib::TimeLoop::outputLastTimeStep | ( | ) | const |
Definition at line 568 of file TimeLoop.cpp.
References _accepted_steps, _current_time, _rejected_steps, ProcessLib::Output::doOutputLastTimestep(), INFO(), outputSolutions(), and successful_time_step.
|
private |
Definition at line 709 of file TimeLoop.cpp.
References _outputs, _per_process_data, and _process_solutions.
Referenced by calculateNextTimeStep(), initialize(), and outputLastTimeStep().
|
private |
Definition at line 746 of file TimeLoop.cpp.
References _per_process_data, _process_solutions, _process_solutions_prev, and _start_time.
Referenced by initialize().
|
private |
Definition at line 583 of file TimeLoop.cpp.
References _end_time, _outputs, _per_process_data, _process_solutions, _process_solutions_prev, _staggered_coupling, NumLib::NonlinearSolverStatus::error_norms_met, ProcessLib::postTimestepForAllProcesses(), ProcessLib::preTimestepForAllProcesses(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
Referenced by executeTimeStep().
|
private |
Member to solver coupled systems of equations by the staggered scheme.
t | Current time |
dt | Time step size |
timestep_id | Index of the time step |
Definition at line 683 of file TimeLoop.cpp.
References _last_step_rejected, _outputs, _per_process_data, _process_solutions, _process_solutions_prev, _staggered_coupling, and ProcessLib::solveOneTimeStepOneProcess().
Referenced by preTsNonlinearSolvePostTs().
|
private |
Member to solver non coupled systems of equations, which can be a single system of equations, or several systems of equations without any dependency among the different systems.
t | Current time |
dt | Time step size |
timestep_id | Index of the time step |
Definition at line 641 of file TimeLoop.cpp.
References _outputs, _per_process_data, _process_solutions, _process_solutions_prev, ERR(), NumLib::NonlinearSolverStatus::error_norms_met, OGS_FATAL, ProcessLib::solveMonolithicProcess(), and ProcessLib::timestepper_cannot_reduce_dt.
Referenced by preTsNonlinearSolvePostTs().
|
private |
Definition at line 138 of file TimeLoop.h.
Referenced by calculateNextTimeStep(), executeTimeStep(), initialize(), and outputLastTimeStep().
|
private |
Definition at line 137 of file TimeLoop.h.
Referenced by calculateNextTimeStep(), currentTime(), executeTimeStep(), initialize(), and outputLastTimeStep().
|
private |
Definition at line 140 of file TimeLoop.h.
Referenced by calculateNextTimeStep(), executeTimeStep(), and initialize().
|
private |
Definition at line 136 of file TimeLoop.h.
Referenced by calculateNextTimeStep(), computeTimeStepping(), endTime(), generateOutputTimeStepConstraints(), and preTsNonlinearSolvePostTs().
|
private |
Definition at line 142 of file TimeLoop.h.
Referenced by calculateNextTimeStep(), initialize(), and solveCoupledEquationSystemsByStaggeredScheme().
|
private |
Definition at line 132 of file TimeLoop.h.
Referenced by calculateNextTimeStep(), initialize(), outputSolutions(), preTsNonlinearSolvePostTs(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 133 of file TimeLoop.h.
Referenced by computeTimeStepping(), executeTimeStep(), initialize(), outputSolutions(), preOutputInitialConditions(), preTsNonlinearSolvePostTs(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 130 of file TimeLoop.h.
Referenced by ~TimeLoop(), computeTimeStepping(), initialize(), outputSolutions(), preOutputInitialConditions(), preTsNonlinearSolvePostTs(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 131 of file TimeLoop.h.
Referenced by ~TimeLoop(), computeTimeStepping(), initialize(), preOutputInitialConditions(), preTsNonlinearSolvePostTs(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 139 of file TimeLoop.h.
Referenced by calculateNextTimeStep(), initialize(), and outputLastTimeStep().
|
private |
Definition at line 141 of file TimeLoop.h.
Referenced by computeTimeStepping().
|
private |
Definition at line 144 of file TimeLoop.h.
Referenced by initialize(), preTsNonlinearSolvePostTs(), and solveCoupledEquationSystemsByStaggeredScheme().
|
private |
Definition at line 135 of file TimeLoop.h.
Referenced by initialize(), and preOutputInitialConditions().
bool ProcessLib::TimeLoop::successful_time_step = true |
Definition at line 65 of file TimeLoop.h.
Referenced by executeTimeStep(), and outputLastTimeStep().