![]() |
OGS
|
Time loop capable of time-integrating several processes at once.
Definition at line 36 of file TimeLoop.h.
#include <TimeLoop.h>
Public Member Functions | |
TimeLoop (std::unique_ptr< Output > &&output, std::vector< std::unique_ptr< ProcessData >> &&per_process_data, const int global_coupling_max_iterations, std::vector< std::unique_ptr< NumLib::ConvergenceCriterion >> &&global_coupling_conv_crit, const double start_time, const double end_time) | |
void | initialize () |
initialize output, convergence criterion, etc. More... | |
bool | loop () |
~TimeLoop () | |
Private Member Functions | |
void | setCoupledSolutions () |
NumLib::NonlinearSolverStatus | solveUncoupledEquationSystems (const double 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. More... | |
NumLib::NonlinearSolverStatus | solveCoupledEquationSystemsByStaggeredScheme (const double t, const double dt, const std::size_t timestep_id) |
Member to solver coupled systems of equations by the staggered scheme. More... | |
double | computeTimeStepping (const double prev_dt, double &t, std::size_t &accepted_steps, std::size_t &rejected_steps) |
template<typename OutputClass , typename OutputClassMember > | |
void | outputSolutions (bool const output_initial_condition, unsigned timestep, const double t, OutputClass &output_object, OutputClassMember output_class_member) const |
Private Attributes | |
std::vector< GlobalVector * > | _process_solutions |
std::vector< GlobalVector * > | _process_solutions_prev |
std::unique_ptr< Output > | _output |
std::vector< std::unique_ptr< ProcessData > > | _per_process_data |
bool | _last_step_rejected = false |
int | _repeating_times_of_rejected_step = 0 |
const double | _start_time |
const double | _end_time |
const int | _global_coupling_max_iterations |
Maximum iterations of the global coupling. More... | |
std::vector< std::unique_ptr< NumLib::ConvergenceCriterion > > | _global_coupling_conv_crit |
Convergence criteria of processes for the global coupling iterations. More... | |
std::vector< GlobalVector * > | _solutions_of_last_cpl_iteration |
std::vector< std::size_t > | _xdot_vector_ids |
ProcessLib::TimeLoop::TimeLoop | ( | std::unique_ptr< Output > && | output, |
std::vector< std::unique_ptr< ProcessData >> && | per_process_data, | ||
const int | global_coupling_max_iterations, | ||
std::vector< std::unique_ptr< NumLib::ConvergenceCriterion >> && | global_coupling_conv_crit, | ||
const double | start_time, | ||
const double | end_time | ||
) |
Definition at line 328 of file TimeLoop.cpp.
ProcessLib::TimeLoop::~TimeLoop | ( | ) |
Definition at line 945 of file TimeLoop.cpp.
References _process_solutions, _process_solutions_prev, _solutions_of_last_cpl_iteration, NumLib::GlobalVectorProvider::provider, and NumLib::VectorProvider::releaseVector().
|
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. |
Definition at line 358 of file TimeLoop.cpp.
References _end_time, _last_step_rejected, _output, _per_process_data, _process_solutions, _process_solutions_prev, _repeating_times_of_rejected_step, MathLib::LinAlg::copy(), DBUG(), MathLib::NORM2, OGS_FATAL, NumLib::possiblyClampDtToNextFixedTime(), and WARN().
Referenced by loop().
void ProcessLib::TimeLoop::initialize | ( | ) |
initialize output, convergence criterion, etc.
Definition at line 525 of file TimeLoop.cpp.
References _output, _per_process_data, _process_solutions, _process_solutions_prev, _start_time, ProcessLib::Output::doOutput(), anonymous_namespace{TimeLoop.cpp}::isMonolithicProcess(), outputSolutions(), setCoupledSolutions(), ProcessLib::setInitialConditions(), and ProcessLib::setTimeDiscretizedODESystem().
Referenced by main().
bool ProcessLib::TimeLoop::loop | ( | ) |
Definition at line 572 of file TimeLoop.cpp.
References _end_time, _last_step_rejected, _output, _per_process_data, _process_solutions, _process_solutions_prev, _start_time, _xdot_vector_ids, ProcessLib::calculateNonEquilibriumInitialResiduum(), computeTimeStepping(), ProcessLib::Output::doOutput(), ProcessLib::Output::doOutputLastTimestep(), BaseLib::RunTime::elapsed(), NumLib::NonlinearSolverStatus::error_norms_met, INFO(), anonymous_namespace{TimeLoop.cpp}::isMonolithicProcess(), outputSolutions(), ProcessLib::postTimestepForAllProcesses(), ProcessLib::preTimestepForAllProcesses(), solveCoupledEquationSystemsByStaggeredScheme(), solveUncoupledEquationSystems(), BaseLib::RunTime::start(), and WARN().
|
private |
Definition at line 868 of file TimeLoop.cpp.
References _per_process_data, _process_solutions, _start_time, NumLib::VectorProvider::getVector(), anonymous_namespace{TimeLoop.cpp}::isMonolithicProcess(), NumLib::GlobalVectorProvider::provider, NumLib::VectorProvider::releaseVector(), and MathLib::EigenVector::setZero().
Referenced by initialize(), and loop().
|
private |
This function fills the vector of solutions of coupled processes of processes, _solutions_of_coupled_processes, and initializes the vector of solutions of the previous coupling iteration, _solutions_of_last_cpl_iteration.
Definition at line 343 of file TimeLoop.cpp.
References _per_process_data, _process_solutions, _solutions_of_last_cpl_iteration, MathLib::LinAlg::copy(), NumLib::VectorProvider::getVector(), and NumLib::GlobalVectorProvider::provider.
Referenced by initialize().
|
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 747 of file TimeLoop.cpp.
References _global_coupling_conv_crit, _global_coupling_max_iterations, _last_step_rejected, _output, _per_process_data, _process_solutions, _process_solutions_prev, _solutions_of_last_cpl_iteration, _xdot_vector_ids, MathLib::LinAlg::axpy(), MathLib::LinAlg::copy(), BaseLib::RunTime::elapsed(), INFO(), ProcessLib::solveOneTimeStepOneProcess(), BaseLib::RunTime::start(), and WARN().
Referenced by loop().
|
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 706 of file TimeLoop.cpp.
References _output, _per_process_data, _process_solutions, _process_solutions_prev, _xdot_vector_ids, ERR(), NumLib::NonlinearSolverStatus::error_norms_met, OGS_FATAL, ProcessLib::solveMonolithicProcess(), and ProcessLib::timestepper_cannot_reduce_dt.
Referenced by loop().
|
private |
Definition at line 116 of file TimeLoop.h.
Referenced by computeTimeStepping(), and loop().
|
private |
Convergence criteria of processes for the global coupling iterations.
Definition at line 122 of file TimeLoop.h.
Referenced by solveCoupledEquationSystemsByStaggeredScheme().
|
private |
Maximum iterations of the global coupling.
Definition at line 119 of file TimeLoop.h.
Referenced by solveCoupledEquationSystemsByStaggeredScheme().
|
private |
Definition at line 113 of file TimeLoop.h.
Referenced by computeTimeStepping(), loop(), and solveCoupledEquationSystemsByStaggeredScheme().
|
private |
Definition at line 110 of file TimeLoop.h.
Referenced by computeTimeStepping(), initialize(), loop(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 111 of file TimeLoop.h.
Referenced by computeTimeStepping(), initialize(), loop(), outputSolutions(), setCoupledSolutions(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 108 of file TimeLoop.h.
Referenced by ~TimeLoop(), computeTimeStepping(), initialize(), loop(), outputSolutions(), setCoupledSolutions(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 109 of file TimeLoop.h.
Referenced by ~TimeLoop(), computeTimeStepping(), initialize(), loop(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().
|
private |
Definition at line 114 of file TimeLoop.h.
Referenced by computeTimeStepping().
|
private |
Solutions of the previous coupling iteration for the convergence criteria of the coupling iteration.
Definition at line 126 of file TimeLoop.h.
Referenced by ~TimeLoop(), setCoupledSolutions(), and solveCoupledEquationSystemsByStaggeredScheme().
|
private |
Definition at line 115 of file TimeLoop.h.
Referenced by initialize(), loop(), and outputSolutions().
|
private |
store the ids of the global xdot vectors in the global vector provider for reuse, needed in postTimestepForAllProcesses the length of the vector is the size of _per_process_data
Definition at line 131 of file TimeLoop.h.
Referenced by loop(), solveCoupledEquationSystemsByStaggeredScheme(), and solveUncoupledEquationSystems().