include/meltpooldg/time_integration/implicit_explicit_integrator.hpp Source File

Developer Documentation: include/meltpooldg/time_integration/implicit_explicit_integrator.hpp Source File
Developer Documentation
implicit_explicit_integrator.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <deal.II/lac/la_parallel_vector.h>
4
11
12#include <functional>
13
15{
17 inline static constexpr std::array<TimeIntegratorSchemes, 1> imex_supported_schemes{
18 {TimeIntegratorSchemes::imex}};
19
20
21 template <unsigned int dim, typename number>
23 {
24 public:
25 using VectorType = dealii::LinearAlgebra::distributed::Vector<number>;
26
28 std::function<void(number,
29 number,
30 VectorType &,
31 const VectorType &,
32 const bool,
33 const std::function<void(unsigned, unsigned)> &)>;
34
36 std::function<void(number time, number time_step, VectorType &dst, const VectorType &src)>;
37
38 using ResidualType = std::function<void(number time,
39 number time_step,
40 const VectorType &src,
41 VectorType &dst,
42 const VectorType &explicit_solution)>;
43
44 using DistributeConstraintsType = std::function<void(VectorType &dst)>;
45
46 using CustomSolverType = std::function<void(number time,
47 number time_step,
48 const VectorType &explicit_step_solution,
49 const VectorType &solution)>;
50
72
83 const TimeIntegratorData<number> &time_integrator_data,
84 const SolverFunctions solver_functions,
85 Preconditioner<dim, VectorType, number> &&preconditioner_in =
87
92 unsigned
93 required_solution_history_size() const override;
94
102 void
103 reinit(const VectorType &vector_template) override;
104
109 void
110 reinit(const SolutionHistory<VectorType> &solution_history) override;
111
126 void
127 perform_time_step(const number current_time,
128 const number time_step,
129 SolutionHistory<VectorType> &solution_history,
130 const std::function<void(number, number, VectorType &, const VectorType &)>
131 &stage_pre_processing,
132 const std::function<void(number, number, VectorType &, const VectorType &)>
133 &stage_post_processing) override;
134
135 private:
170
195
211
241
244
247
250
253
255 unsigned n_steps_performed = 0;
256
261 void
262 apply_explicit_step(number time,
263 number time_step,
264 const VectorType &src,
265 VectorType &dst) const;
266
273 void
274 apply_implicit_step(number time,
275 number time_step,
276 VectorType &explicit_solution,
277 VectorType &solution);
278 };
279} // namespace MeltPoolDG::TimeIntegration
Definition preconditioner_trilinos_wrapper.hpp:190
Definition newton_raphson_solver.hpp:13
Definition preconditioner.hpp:42
Definition implicit_explicit_integrator.hpp:23
NewtonRaphsonSolver< number, VectorType > solver
Nonlinear solver used when no custom solver is provided.
Definition implicit_explicit_integrator.hpp:246
std::function< void(number time, number time_step, const VectorType &explicit_step_solution, const VectorType &solution)> CustomSolverType
Definition implicit_explicit_integrator.hpp:49
void apply_explicit_step(number time, number time_step, const VectorType &src, VectorType &dst) const
Definition implicit_explicit_integrator.cpp:93
unsigned required_solution_history_size() const override
Definition implicit_explicit_integrator.cpp:31
std::function< void(number, number, VectorType &, const VectorType &, const bool, const std::function< void(unsigned, unsigned)> &)> ExplicitRhsFunctionType
Definition implicit_explicit_integrator.hpp:33
ResidualType compute_residual
Compute the negative residual for the implicit step of the time integrator.
Definition implicit_explicit_integrator.hpp:169
std::function< void(number time, number time_step, const VectorType &src, VectorType &dst, const VectorType &explicit_solution)> ResidualType
Definition implicit_explicit_integrator.hpp:42
JacobianType compute_jacobian
Apply the Jacobian of the residual operator to a given vector.
Definition implicit_explicit_integrator.hpp:194
ExplicitRhsFunctionType explicit_compute_rhs
Definition implicit_explicit_integrator.hpp:240
void reinit(const VectorType &vector_template) override
Definition implicit_explicit_integrator.cpp:38
unsigned n_steps_performed
Number of time steps already performed by the integrator.
Definition implicit_explicit_integrator.hpp:255
bool preconditioner_update_flag
Boolean to indicate whether the preconditioner needs to be updated before the next solve.
Definition implicit_explicit_integrator.hpp:252
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 implicit_explicit_integrator.cpp:55
void apply_implicit_step(number time, number time_step, VectorType &explicit_solution, VectorType &solution)
Definition implicit_explicit_integrator.cpp:116
Preconditioner< dim, VectorType, number > preconditioner
Preconditioner for the linear solver used within each nonlinear solver iteration.
Definition implicit_explicit_integrator.hpp:249
dealii::LinearAlgebra::distributed::Vector< number > VectorType
Definition implicit_explicit_integrator.hpp:25
std::function< void(number time, number time_step, VectorType &dst, const VectorType &src)> JacobianType
Definition implicit_explicit_integrator.hpp:36
DistributeConstraintsType distribute_constraints
Definition implicit_explicit_integrator.hpp:210
VectorType intermediate_explicit_solution
Vector to store the solution of the explicit step.
Definition implicit_explicit_integrator.hpp:243
std::function< void(VectorType &dst)> DistributeConstraintsType
Definition implicit_explicit_integrator.hpp:44
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:19
static constexpr std::array< TimeIntegratorSchemes, 1 > imex_supported_schemes
The time integrator schemes supported by the implicit-explicit time integrator.
Definition implicit_explicit_integrator.hpp:17
ResidualType compute_residual
Function that computes the negative residual for the implicit step of the time integrator.
Definition implicit_explicit_integrator.hpp:62
JacobianType compute_jacobian
Definition implicit_explicit_integrator.hpp:59
DistributeConstraintsType distribute_constraints
Definition implicit_explicit_integrator.hpp:66
ExplicitRhsFunctionType compute_explicit_rhs
Definition implicit_explicit_integrator.hpp:70