ExaDG
Loading...
Searching...
No Matches
time_int_explicit_runge_kutta.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 EXADG_CONVECTION_DIFFUSION_TIME_INTEGRATION_TIME_INT_EXPLICIT_RUNGE_KUTTA_H_
23#define EXADG_CONVECTION_DIFFUSION_TIME_INTEGRATION_TIME_INT_EXPLICIT_RUNGE_KUTTA_H_
24
25// deal.II
26#include <deal.II/base/timer.h>
27#include <deal.II/lac/la_parallel_vector.h>
28
29// ExaDG
30#include <exadg/time_integration/explicit_runge_kutta.h>
31#include <exadg/time_integration/time_int_explicit_runge_kutta_base.h>
32
33namespace ExaDG
34{
35namespace ConvDiff
36{
37// forward declarations
38class Parameters;
39
40template<typename Number>
42
43namespace Interface
44{
45template<typename Number>
46class Operator;
47}
48
49template<typename Number>
50class OperatorExplRK;
51
52template<typename Number>
53class TimeIntExplRK : public TimeIntExplRKBase<Number>
54{
55public:
56 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
57
58 TimeIntExplRK(std::shared_ptr<Interface::Operator<Number>> operator_in,
59 std::shared_ptr<PostProcessorInterface<Number>> postprocessor_in,
60 Parameters const & param_in,
61 MPI_Comm const & mpi_comm_in,
62 bool const is_test_in);
63
64 void
65 set_velocities_and_times(std::vector<VectorType const *> const & velocities_in,
66 std::vector<double> const & times_in);
67
68 void
69 extrapolate_solution(VectorType & vector);
70
71 VectorType const &
72 get_solution_np() const;
73
74 void
75 prepare_coarsening_and_refinement() final;
76
77 void
78 interpolate_after_coarsening_and_refinement() final;
79
80private:
81 std::shared_ptr<std::vector<VectorType *>>
82 get_vectors();
83
84 void
85 initialize_vectors() final;
86
87 void
88 initialize_solution() final;
89
90 void
91 postprocessing() const final;
92
93 bool
94 print_solver_info() const final;
95
96 void
97 do_timestep_solve() final;
98
99 void
100 calculate_time_step_size() final;
101
102 double
103 recalculate_time_step_size() const final;
104
105 void
106 initialize_time_integrator() final;
107
108 void
109 read_restart_vectors(std::vector<VectorType *> const & vectors) final;
110
111 void
112 write_restart_vectors(std::vector<VectorType const *> const & vectors) const final;
113
114 std::shared_ptr<Interface::Operator<Number>> pde_operator;
115
116 std::shared_ptr<OperatorExplRK<Number>> expl_rk_operator;
117
118 std::shared_ptr<ExplicitTimeIntegrator<OperatorExplRK<Number>, VectorType>> rk_time_integrator;
119
120 Parameters const & param;
121
122 unsigned int const refine_steps_time;
123
124 std::vector<VectorType const *> velocities;
125 std::vector<double> times;
126
127 // store time step size according to diffusion condition so that it does not have to be
128 // recomputed in case of adaptive time stepping
129 double time_step_diff;
130
131 double const cfl;
132 double const diffusion_number;
133
134 std::shared_ptr<PostProcessorInterface<Number>> postprocessor;
135};
136
137} // namespace ConvDiff
138} // namespace ExaDG
139
140#endif /* EXADG_CONVECTION_DIFFUSION_TIME_INTEGRATION_TIME_INT_EXPLICIT_RUNGE_KUTTA_H_ */
Definition interface.h:39
Definition interface.h:126
Definition parameters.h:46
Definition postprocessor_base.h:44
Definition driver.cpp:33