OGS
TimeLoop.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <functional>
14#include <memory>
15
19#include "Process.h"
21
22namespace NumLib
23{
24class ConvergenceCriterion;
25class StaggeredCoupling;
26struct Time;
27}
28
29namespace ChemistryLib
30{
31class ChemicalSolverInterface;
32}
33
34namespace ProcessLib
35{
36struct ProcessData;
37
40{
41public:
42 TimeLoop(std::vector<Output>&& outputs,
43 std::vector<std::unique_ptr<ProcessData>>&& per_process_data,
44 std::unique_ptr<NumLib::StaggeredCoupling>&& staggered_coupling,
45 const NumLib::Time& start_time, const NumLib::Time& end_time);
46
47 void initialize();
48 void outputLastTimeStep() const;
49
50 ~TimeLoop();
51
52 bool executeTimeStep();
53
62
63 NumLib::Time endTime() const { return _end_time; }
66
67private:
68 bool preTsNonlinearSolvePostTs(NumLib::Time const& t, double const dt,
69 std::size_t const timesteps);
70
83 const NumLib::Time& t, const double dt, const std::size_t timestep_id);
84
96 const NumLib::Time& t, const double dt, const std::size_t timestep_id);
97
99 std::function<double(NumLib::Time const&, double)>;
115 std::pair<NumLib::TimeIncrement, bool> computeTimeStepping(
116 const double prev_dt, NumLib::Time& t, std::size_t& accepted_steps,
117 std::size_t& rejected_steps,
118 std::vector<TimeStepConstraintCallback> const& time_step_constraints);
119
120 template <typename OutputClassMember>
121 void outputSolutions(unsigned timestep,
122 const double t,
123 OutputClassMember output_class_member) const;
124
125private:
126 std::vector<TimeStepConstraintCallback> generateOutputTimeStepConstraints(
127 std::vector<double>&& fixed_times) const;
129 const double dt) const;
130 std::vector<GlobalVector*> _process_solutions;
131 std::vector<GlobalVector*> _process_solutions_prev;
132 std::vector<Output> _outputs;
133 std::vector<std::unique_ptr<ProcessData>> _per_process_data;
134
138 std::size_t _accepted_steps = 0;
139 std::size_t _rejected_steps = 0;
143
144 std::unique_ptr<NumLib::StaggeredCoupling> _staggered_coupling;
145};
146} // namespace ProcessLib
Time loop capable of time-integrating several processes at once.
Definition TimeLoop.h:40
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,...
Definition TimeLoop.cpp:641
NumLib::Time currentTime() const
Definition TimeLoop.h:64
void outputLastTimeStep() const
Definition TimeLoop.cpp:568
void preOutputInitialConditions(NumLib::Time const &t, const double dt) const
Definition TimeLoop.cpp:746
NumLib::TimeIncrement _dt
Definition TimeLoop.h:140
NumLib::Time _current_time
Definition TimeLoop.h:137
std::function< double(NumLib::Time const &, double)> TimeStepConstraintCallback
Definition TimeLoop.h:98
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)
Definition TimeLoop.cpp:295
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 TimeLoop.cpp:269
std::vector< std::unique_ptr< ProcessData > > _per_process_data
Definition TimeLoop.h:133
void outputSolutions(unsigned timestep, const double t, OutputClassMember output_class_member) const
Definition TimeLoop.cpp:709
std::vector< Output > _outputs
Definition TimeLoop.h:132
std::size_t _accepted_steps
Definition TimeLoop.h:138
std::vector< GlobalVector * > _process_solutions
Definition TimeLoop.h:130
std::unique_ptr< NumLib::StaggeredCoupling > _staggered_coupling
Definition TimeLoop.h:144
void initialize()
initialize output, convergence criterion, etc.
Definition TimeLoop.cpp:462
int _repeating_times_of_rejected_step
Definition TimeLoop.h:141
std::size_t _rejected_steps
Definition TimeLoop.h:139
const NumLib::Time _end_time
Definition TimeLoop.h:136
bool preTsNonlinearSolvePostTs(NumLib::Time const &t, double const dt, std::size_t const timesteps)
Definition TimeLoop.cpp:583
NumLib::Time endTime() const
Definition TimeLoop.h:63
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.
Definition TimeLoop.cpp:683
std::vector< TimeStepConstraintCallback > generateOutputTimeStepConstraints(std::vector< double > &&fixed_times) const
Definition TimeLoop.cpp:444
const NumLib::Time _start_time
Definition TimeLoop.h:135
std::vector< GlobalVector * > _process_solutions_prev
Definition TimeLoop.h:131
Status of the non-linear solver.