include/meltpooldg/time_integration/bdf_time_integration.hpp Source File

Developer Documentation: include/meltpooldg/time_integration/bdf_time_integration.hpp Source File
Developer Documentation
bdf_time_integration.hpp
Go to the documentation of this file.
1#pragma once
2
3
4
5#include <deal.II/lac/la_parallel_vector.h>
6
12
13#include <functional>
14#include <memory>
15#include <vector>
16
18{
20 inline static constexpr std::array<TimeIntegratorSchemes, 6> bdf_supported_schemes{
21 {TimeIntegratorSchemes::bdf_1,
22 TimeIntegratorSchemes::bdf_2,
23 TimeIntegratorSchemes::bdf_3,
24 TimeIntegratorSchemes::bdf_4,
25 TimeIntegratorSchemes::bdf_5,
26 TimeIntegratorSchemes::bdf_6}};
27
28 template <int dim, typename number>
29 class BDFIntegrator final : public TimeIntegratorBase<number>
30 {
31 public:
32 using VectorType = dealii::LinearAlgebra::distributed::Vector<number>;
33
35 std::function<void(number time_step, VectorType &src, const VectorType &dst)>;
36
37 using ResidualType = std::function<void(number time,
38 number time_step,
39 const VectorType &src,
40 VectorType &dst,
41 const VectorType &old_solution)>;
42
43 using DistributeConstraintsType = std::function<void(VectorType &dst)>;
44
52 explicit BDFIntegrator(const TimeIntegratorData<number> &time_integrator_data);
53
66 void
68 JacobianType jacobian,
69 ResidualType residual,
70 DistributeConstraintsType constraints = [](VectorType &) {});
71
78 void
80
85 unsigned int
86 required_solution_history_size() const override;
87
95 void
96 reinit(const VectorType &vector_template) override;
97
102 void
103 reinit(const SolutionHistory<VectorType> &solution_history) override;
104
117 void
118 perform_time_step(const number current_time,
119 const number time_step,
120 SolutionHistory<VectorType> &solution_history,
121 const std::function<void(number, number, VectorType &, const VectorType &)>
122 &stage_pre_processing,
123 const std::function<void(number, number, VectorType &, const VectorType &)>
124 &stage_post_processing) override;
125
126 private:
154
177
191
193 std::unique_ptr<NewtonRaphsonSolver<number, VectorType>> solver;
194
197
199 struct
200 {
202 number rhs;
204 std::vector<number> old_solutions;
206
209
212
214 unsigned n_steps_performed = 0;
215
221 void
223
232 void
233 set_up_bdf_parameters(const unsigned int bdf_scheme);
234 };
235} // namespace MeltPoolDG::TimeIntegration
Definition preconditioner.hpp:42
Definition bdf_time_integration.hpp:30
number rhs
Prefactor for the right hand side f(y).
Definition bdf_time_integration.hpp:202
JacobianType compute_jacobian
Apply the Jacobian of the residual operator to a given vector.
Definition bdf_time_integration.hpp:176
struct MeltPoolDG::TimeIntegration::BDFIntegrator::@9 bdf_weights
BDF prefactors and weights.
void compute_weighted_old_solution_sum(SolutionHistory< VectorType > &solution_history)
Compute sum of old solutions weighted with the BDF prefactors bdf_weights.old_solutions .
Definition bdf_time_integration.cpp:181
bool preconditioner_update_flag
Boolean to indicate whether the preconditioner needs to be updated before the next solve.
Definition bdf_time_integration.hpp:211
std::vector< number > old_solutions
Weights for the old solutions y^{n}, y^{n-1}, ...
Definition bdf_time_integration.hpp:204
unsigned int required_solution_history_size() const override
Definition bdf_time_integration.cpp:51
void set_up_bdf_parameters(const unsigned int bdf_scheme)
Set the up bdf parameters object.
Definition bdf_time_integration.cpp:198
DistributeConstraintsType distribute_constraints
Definition bdf_time_integration.hpp:190
void reinit(const VectorType &vector_template) override
Definition bdf_time_integration.cpp:74
std::function< void(number time_step, VectorType &src, const VectorType &dst)> JacobianType
Definition bdf_time_integration.hpp:35
Preconditioner< dim, VectorType, number > preconditioner
Preconditioner for the linear solver used in each nonlinear iteration.
Definition bdf_time_integration.hpp:196
std::unique_ptr< NewtonRaphsonSolver< number, VectorType > > solver
Nonlinear solver.
Definition bdf_time_integration.hpp:193
void set_preconditioner(Preconditioner< dim, VectorType, number > &&preconditioner_in)
Definition bdf_time_integration.cpp:42
unsigned n_steps_performed
Number of time steps already performed by the integrator.
Definition bdf_time_integration.hpp:214
VectorType summed_old_solution
Sum of old solution with prefactors from BDF method.
Definition bdf_time_integration.hpp:208
std::function< void(VectorType &dst)> DistributeConstraintsType
Definition bdf_time_integration.hpp:43
void perform_time_step(const number current_time, const number time_step, SolutionHistory< VectorType > &solution_history, const std::function< void(number, number, VectorType &, const VectorType &)> &stage_pre_processing, const std::function< void(number, number, VectorType &, const VectorType &)> &stage_post_processing) override
Definition bdf_time_integration.cpp:90
ResidualType compute_residual
Compute the negative residual for the implicit step of the time integrator.
Definition bdf_time_integration.hpp:153
std::function< void(number time, number time_step, const VectorType &src, VectorType &dst, const VectorType &old_solution)> ResidualType
Definition bdf_time_integration.hpp:41
void configure_solver_functions(JacobianType jacobian, ResidualType residual, DistributeConstraintsType constraints=[](VectorType &) {})
Configure the functions used by the internal nonlinear solver to solve the implicit step....
Definition bdf_time_integration.cpp:22
dealii::LinearAlgebra::distributed::Vector< number > VectorType
Definition bdf_time_integration.hpp:32
Definition solution_history.hpp:21
Definition time_integrator_base.hpp:17
const TimeIntegratorData< number > time_integrator_data
Definition time_integrator_base.hpp:105
Class providing different low storage explicit Runge-Kutta schemes. The schemes implemented in this c...
Definition bdf_time_integration.hpp:18
static constexpr std::array< TimeIntegratorSchemes, 6 > bdf_supported_schemes
The time integrator schemes supported by the bdf time integrator.
Definition bdf_time_integration.hpp:20