40 using Number =
typename VectorType::value_type;
44 double const start_time_,
45 double const end_time_,
46 unsigned int const max_number_of_time_steps_,
47 unsigned int const order_,
48 bool const start_with_low_order_,
49 bool const adaptive_time_stepping_,
51 MPI_Comm
const & mpi_comm_,
55 max_number_of_time_steps_,
57 start_with_low_order_,
58 adaptive_time_stepping_,
62 pde_operator(pde_operator_in),
64 ab(order_ - 1, start_with_low_order_),
65 am(order_, start_with_low_order_),
66 vec_evaluated_operators(order_ - 1)
68 AssertThrow(order_ >= 1,
69 dealii::ExcMessage(
"Oder of ABM time integrator has to be at least 1."));
73 print_iterations()
const
76 print_list_of_iterations(pcout, {
"Adams-Bashforth-Moulton"}, {0});
82 AssertThrow(
false, dealii::ExcMessage(
"not yet implemented"));
93 get_underlying_operator()
const
100 update_time_integrator_constants()
final
102 ab.update(time_step_number, adaptive_time_stepping, time_steps);
103 am.update(time_step_number, adaptive_time_stepping, time_steps);
107 allocate_vectors()
final
109 pde_operator->initialize_dof_vector(solution);
110 pde_operator->initialize_dof_vector(prediction);
112 pde_operator->initialize_dof_vector(evaluated_operator_np);
113 for(
auto & evaluated_operator : vec_evaluated_operators)
114 pde_operator->initialize_dof_vector(evaluated_operator);
118 initialize_current_solution()
final
120 pde_operator->prescribe_initial_conditions(solution, get_time());
124 initialize_former_multistep_dof_vectors()
final
126 if(start_with_low_order)
128 if(vec_evaluated_operators.size() > 0)
129 pde_operator->evaluate(vec_evaluated_operators[0], solution, get_time());
135 pde_operator->initialize_dof_vector(temp_sol);
136 for(
unsigned int i = 0; i < vec_evaluated_operators.size(); ++i)
138 pde_operator->prescribe_initial_conditions(temp_sol, get_previous_time(i));
139 pde_operator->evaluate(vec_evaluated_operators[i], temp_sol, get_previous_time(i));
145 setup_derived()
final
150 do_timestep_predict()
155 predrict_solution(prediction, solution, vec_evaluated_operators);
157 timer_tree->insert({
"Timeloop",
"Adams-Bashforth-Moulton"}, timer.wall_time());
161 do_timestep_correct()
167 pde_operator->evaluate(evaluated_operator_np, prediction, get_next_time());
169 correct_solution(solution, evaluated_operator_np, vec_evaluated_operators);
171 pde_operator->evaluate(evaluated_operator_np, solution, get_next_time());
174 if(this->print_solver_info() and not(this->is_test))
176 pcout << std::endl <<
"Adams-Bashforth-Moulton:";
177 print_wall_time(pcout, timer.wall_time());
180 timer_tree->insert({
"Timeloop",
"Adams-Bashforth-Moulton"}, timer.wall_time());
184 do_timestep_solve()
final
186 do_timestep_predict();
187 do_timestep_correct();
191 correct_solution(VectorType & dst,
192 VectorType
const & op_np,
193 std::vector<VectorType>
const & ops)
const
195 dst.add(
static_cast<Number
>(get_time_step_size() * am.get_gamma0()), op_np);
196 for(
unsigned int i = 0; i < this->am.get_order() - 1; ++i)
197 dst.add(
static_cast<Number
>(get_time_step_size() * am.get_alpha(i)), ops[i]);
201 predrict_solution(VectorType & dst,
202 VectorType
const & src,
203 std::vector<VectorType>
const & ops)
const
206 for(
unsigned int i = 0; i < this->ab.get_order(); ++i)
207 dst.add(
static_cast<Number
>(get_time_step_size() * ab.get_alpha(i)), ops[i]);
211 prepare_vectors_for_next_timestep()
final
213 if(vec_evaluated_operators.size() > 0)
215 push_back(vec_evaluated_operators);
216 std::swap(vec_evaluated_operators[0], evaluated_operator_np);
221 read_restart_vectors(boost::archive::binary_iarchive & ia)
final
228 write_restart_vectors(boost::archive::binary_oarchive & oa)
const final
235 solve_steady_problem()
final
237 AssertThrow(
false, dealii::ExcMessage(
"Steady not implemented."));
241 std::shared_ptr<Operator> pde_operator;
250 VectorType prediction;
253 VectorType evaluated_operator_np;
254 std::vector<VectorType> vec_evaluated_operators;