ExaDG
Loading...
Searching...
No Matches
time_int_bdf.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_CONVECTION_DIFFUSION_TIME_INT_BDF_H_
23#define INCLUDE_CONVECTION_DIFFUSION_TIME_INT_BDF_H_
24
25// deal.II
26#include <deal.II/lac/la_parallel_vector.h>
27
28// ExaDG
29#include <exadg/time_integration/lambda_functions_ale.h>
30#include <exadg/time_integration/time_int_bdf_base.h>
31
32namespace ExaDG
33{
34namespace ConvDiff
35{
36class Parameters;
37
38template<int dim, typename Number>
39class Operator;
40
41template<typename Number>
43} // namespace ConvDiff
44
45
46namespace ConvDiff
47{
48template<int dim, typename Number>
49class TimeIntBDF : public TimeIntBDFBase
50{
51public:
52 using VectorType = dealii::LinearAlgebra::distributed::Vector<Number>;
53 using BoostInputArchiveType = TimeIntBase::BoostInputArchiveType;
54 using BoostOutputArchiveType = TimeIntBase::BoostOutputArchiveType;
55
56 TimeIntBDF(std::shared_ptr<Operator<dim, Number>> operator_in,
57 std::shared_ptr<HelpersALE<dim, Number> const> helpers_ale_in,
58 std::shared_ptr<PostProcessorInterface<Number>> postprocessor_in,
59 Parameters const & param_in,
60 MPI_Comm const & mpi_comm_in,
61 bool const is_test_in);
62
63 void
64 set_velocities_and_times(std::vector<VectorType const *> const & velocities_in,
65 std::vector<double> const & times_in);
66
67 void
68 extrapolate_solution(VectorType & vector);
69
70 VectorType const &
71 get_solution_np() const;
72
73 void
74 ale_update();
75
76 void
77 print_iterations() const;
78
79 void
80 prepare_coarsening_and_refinement() final;
81
82 void
83 interpolate_after_coarsening_and_refinement() final;
84
85private:
86 void
87 allocate_vectors() final;
88
89 std::shared_ptr<std::vector<VectorType *>>
90 get_vectors();
91
92 void
93 initialize_current_solution() final;
94
95 void
96 initialize_former_multistep_dof_vectors() final;
97
98 void
99 initialize_vec_convective_term();
100
101 double
102 calculate_time_step_size() final;
103
104 double
105 recalculate_time_step_size() const final;
106
107 void
108 prepare_vectors_for_next_timestep() final;
109
110 void
111 do_timestep_solve() final;
112
113 void
114 setup_derived() final;
115
116 bool
117 print_solver_info() const final;
118
119 void
120 read_restart_vectors(BoostInputArchiveType & ia) final;
121
122 void
123 write_restart_vectors(BoostOutputArchiveType & oa) const final;
124
125 void
126 postprocessing() const final;
127
128 std::shared_ptr<Operator<dim, Number>> pde_operator;
129
130 Parameters const & param;
131
132 unsigned int const refine_steps_time;
133
134 double const cfl;
135
136 // solution vectors
137 VectorType solution_np;
138 std::vector<VectorType> solution;
139 std::vector<VectorType> vec_convective_term;
140 VectorType convective_term_np;
141
142 VectorType rhs_vector;
143
144 // numerical velocity field
145 std::vector<VectorType const *> velocities;
146 std::vector<double> times;
147
148 // iteration counts
149 std::pair<unsigned int /* calls */, unsigned long long /* iteration counts */> iterations;
150
151 // postprocessor
152 std::shared_ptr<PostProcessorInterface<Number>> postprocessor;
153
154 // This object allows to access utility functions needed for ALE
155 std::shared_ptr<HelpersALE<dim, Number> const> helpers_ale;
156
157 // ALE
158 VectorType grid_velocity;
159 std::vector<VectorType> vec_grid_coordinates;
160 VectorType grid_coordinates_np;
161};
162
163} // namespace ConvDiff
164} // namespace ExaDG
165
166#endif /* INCLUDE_CONVECTION_DIFFUSION_TIME_INT_BDF_H_ */
Definition operator.h:49
Definition parameters.h:46
Definition postprocessor_base.h:44
Definition lambda_functions_ale.h:40
Definition driver.cpp:33