ExaDG
Loading...
Searching...
No Matches
time_int_explicit_runge_kutta_base.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef INCLUDE_EXADG_TIME_INTEGRATION_TIME_INT_EXPLICIT_RUNGE_KUTTA_BASE_H_
23#define INCLUDE_EXADG_TIME_INTEGRATION_TIME_INT_EXPLICIT_RUNGE_KUTTA_BASE_H_
24
25// deal.II
26#include <deal.II/lac/la_parallel_vector.h>
27
28// ExaDG
29#include <exadg/time_integration/time_int_base.h>
30
31namespace ExaDG
32{
33template<typename Number>
35{
36public:
37 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
38
39 TimeIntExplRKBase(double const & start_time_,
40 double const & end_time_,
41 unsigned int const max_number_of_time_steps_,
42 RestartData const & restart_data_,
43 bool const adaptive_time_stepping_,
44 MPI_Comm const & mpi_comm_,
45 bool const is_test_);
46
47 void
48 setup(bool const do_restart) final;
49
50 double
51 get_time_step_size() const final;
52
53 void
54 set_current_time_step_size(double const & time_step_size) final;
55
56protected:
57 // solution vectors
58 VectorType solution_n, solution_np;
59
60 // time step size
61 double time_step;
62
63 // use adaptive time stepping?
64 bool const adaptive_time_stepping;
65
66private:
67 void
68 do_timestep_pre_solve(bool const print_header) final;
69
70 void
71 do_timestep_post_solve() final;
72
73 void
74 prepare_vectors_for_next_timestep();
75
76 virtual void
77 initialize_time_integrator() = 0;
78
79 virtual void
80 initialize_vectors() = 0;
81
82 virtual void
83 initialize_solution() = 0;
84
85 virtual void
86 calculate_time_step_size() = 0;
87
88 virtual double
89 recalculate_time_step_size() const = 0;
90
91 /*
92 * returns whether solver info has to be written in the current time step.
93 */
94 virtual bool
95 print_solver_info() const = 0;
96
97 void
98 do_write_restart(std::string const & filename) const final;
99
100 void
101 do_read_restart(std::ifstream & in) final;
102};
103
104} // namespace ExaDG
105
106#endif /* INCLUDE_EXADG_TIME_INTEGRATION_TIME_INT_EXPLICIT_RUNGE_KUTTA_BASE_H_ */
Definition time_int_base.h:46
Definition time_int_explicit_runge_kutta_base.h:35
Definition driver.cpp:33
Definition restart_data.h:38