ImplicitExplicitIntegrator< dim, number > Class Template Reference

Developer Documentation: MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number > Class Template Reference
Developer Documentation
MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number > Class Template Referencefinal

#include <implicit_explicit_integrator.hpp>

Inheritance diagram for MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >:
[legend]
Collaboration diagram for MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >:
[legend]

Classes

struct  SolverFunctions
 

Public Types

using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 
using ExplicitRhsFunctionType = std::function< void(number, number, VectorType &, const VectorType &, const bool, const std::function< void(unsigned, unsigned)> &)>
 
using JacobianType = std::function< void(number time, number time_step, VectorType &dst, const VectorType &src)>
 
using ResidualType = std::function< void(number time, number time_step, const VectorType &src, VectorType &dst, const VectorType &explicit_solution)>
 
using DistributeConstraintsType = std::function< void(VectorType &dst)>
 
using CustomSolverType = std::function< void(number time, number time_step, const VectorType &explicit_step_solution, const VectorType &solution)>
 

Public Member Functions

 ImplicitExplicitIntegrator (const TimeIntegratorData< number > &time_integrator_data, const SolverFunctions solver_functions, Preconditioner< dim, VectorType, number > &&preconditioner_in=Preconditioner< dim, VectorType, number >(IdentityPreconditioner< dim, VectorType, number >()))
 
unsigned required_solution_history_size () const override
 
void reinit (const VectorType &vector_template) override
 
void reinit (const SolutionHistory< VectorType > &solution_history) override
 
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
 
- Public Member Functions inherited from MeltPoolDG::TimeIntegration::TimeIntegratorBase< number >
 TimeIntegratorBase (const TimeIntegratorData< number > &time_integrator_data_in)
 
virtual ~TimeIntegratorBase ()=default
 
TimeIntegratorSchemes get_integrator_type () const
 
void set_monitoring_vector (VectorType &monitoring_vector_in)
 
void reset_monitoring_vector ()
 

Private Member Functions

void apply_explicit_step (number time, number time_step, const VectorType &src, VectorType &dst) const
 
void apply_implicit_step (number time, number time_step, VectorType &explicit_solution, VectorType &solution)
 

Private Attributes

ResidualType compute_residual
 Compute the negative residual for the implicit step of the time integrator.
 
JacobianType compute_jacobian
 Apply the Jacobian of the residual operator to a given vector.
 
DistributeConstraintsType distribute_constraints
 
ExplicitRhsFunctionType explicit_compute_rhs
 
VectorType intermediate_explicit_solution
 Vector to store the solution of the explicit step.
 
NewtonRaphsonSolver< number, VectorTypesolver
 Nonlinear solver used when no custom solver is provided.
 
Preconditioner< dim, VectorType, number > preconditioner
 Preconditioner for the linear solver used within each nonlinear solver iteration.
 
bool preconditioner_update_flag = false
 Boolean to indicate whether the preconditioner needs to be updated before the next solve.
 
unsigned n_steps_performed = 0
 Number of time steps already performed by the integrator.
 

Additional Inherited Members

- Protected Attributes inherited from MeltPoolDG::TimeIntegration::TimeIntegratorBase< number >
const TimeIntegratorData< number > time_integrator_data
 
VectorTypemonitoring_vector = nullptr
 

Member Typedef Documentation

◆ CustomSolverType

template<unsigned int dim, typename number >
using MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::CustomSolverType = std::function<void(number time, number time_step, const VectorType &explicit_step_solution, const VectorType &solution)>

◆ DistributeConstraintsType

template<unsigned int dim, typename number >
using MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::DistributeConstraintsType = std::function<void(VectorType &dst)>

◆ ExplicitRhsFunctionType

template<unsigned int dim, typename number >
using MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::ExplicitRhsFunctionType = std::function<void(number, number, VectorType &, const VectorType &, const bool, const std::function<void(unsigned, unsigned)> &)>

◆ JacobianType

template<unsigned int dim, typename number >
using MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::JacobianType = std::function<void(number time, number time_step, VectorType &dst, const VectorType &src)>

◆ ResidualType

template<unsigned int dim, typename number >
using MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::ResidualType = std::function<void(number time, number time_step, const VectorType &src, VectorType &dst, const VectorType &explicit_solution)>

◆ VectorType

template<unsigned int dim, typename number >
using MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::VectorType = dealii::LinearAlgebra::distributed::Vector<number>

Constructor & Destructor Documentation

◆ ImplicitExplicitIntegrator()

template<unsigned int dim, typename number >
MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::ImplicitExplicitIntegrator ( const TimeIntegratorData< number > &  time_integrator_data,
const SolverFunctions  solver_functions,
Preconditioner< dim, VectorType, number > &&  preconditioner_in = Preconditioner<dim, VectorType, number>(IdentityPreconditioner<dim, VectorType, number>()) 
)
explicit

Constructor. After construction it is still make a call to reinit() before the integrator can be used.

Parameters
time_integrator_dataTime integrator data struct setting the scheme of the integrator.
solver_functionsStruct containing the functions used by the internal solver to solve the explicit and implicit step.
preconditioner_inPreconditioner to be used in the linear solver of the implicit step.

Member Function Documentation

◆ apply_explicit_step()

template<unsigned int dim, typename number >
void MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::apply_explicit_step ( number  time,
number  time_step,
const VectorType src,
VectorType dst 
) const
private

Apply the explicit and store the result in dst. The solution at \( t^n \) is given by the vector src.

◆ apply_implicit_step()

template<unsigned int dim, typename number >
void MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::apply_implicit_step ( number  time,
number  time_step,
VectorType explicit_solution,
VectorType solution 
)
private

Solve the implicit step of the implicit-explicit scheme. If the function custom_solver has been set this function is used, otherwise the default nonlinear solver of the class is used. The result, i.e., the solution at the new time step, is stored in solution. The solution after the explicit step is given by explicit_solution.

◆ perform_time_step()

template<unsigned int dim, typename number >
void MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::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 
)
overridevirtual

Perform a single time step by first computing an intermediate explicit solution using an explicit Euler step for the part of the pde which is treated explicitly. The explicit step is followed by an implicit Euler step for the implicit part of the PDE resulting in the solution at the new time step.

Parameters
current_timeCurrent time.
time_stepCurrent time step size.
solution_historySolution history object providing the current and all required previous solutions.
stage_pre_processingFunction which is executed before the explicit step.
stage_post_processingFunction which is executed after the solution at the new time step has been computed.

Implements MeltPoolDG::TimeIntegration::TimeIntegratorBase< number >.

◆ reinit() [1/2]

template<unsigned int dim, typename number >
void MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::reinit ( const SolutionHistory< VectorType > &  solution_history)
overridevirtual

Sets up the necessary internal data structures by internally calling reinit(solution_history.get_current_solution()).

Reimplemented from MeltPoolDG::TimeIntegration::TimeIntegratorBase< number >.

◆ reinit() [2/2]

template<unsigned int dim, typename number >
void MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::reinit ( const VectorType vector_template)
overridevirtual

Allocate memory for the required vectors used during the integration. This function needs to be called once before the function perform_time_step() can be called.

Parameters
vector_templateReference vector used to define the partitioning for all internal vectors.

Implements MeltPoolDG::TimeIntegration::TimeIntegratorBase< number >.

◆ required_solution_history_size()

template<unsigned int dim, typename number >
unsigned MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::required_solution_history_size ( ) const
overridevirtual

Returns the number of previous solutions, that is solutions at time step n - x, where x >= 0, required by the time integrator.

Implements MeltPoolDG::TimeIntegration::TimeIntegratorBase< number >.

Member Data Documentation

◆ compute_jacobian

template<unsigned int dim, typename number >
JacobianType MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::compute_jacobian
private

Apply the Jacobian of the residual operator to a given vector.

This function computes the action of the Jacobian, associated with the residual

\[ R = \frac{y^{n+1} - \tilde{y}}{\Delta t} - G(y^{n+1}), \]

on the input vector src and stores the result in dst.

Function Signature:

void f(number time,
number time_step,
VectorType &dst,
const VectorType &src);
dealii::LinearAlgebra::distributed::Vector< number > VectorType
Definition implicit_explicit_integrator.hpp:25

Parameters:

  • time : Current simulation time \(t^n\).
  • time_step : Current time step size \(\Delta t\).
  • dst : Destination vector to store the Jacobian–vector product.
  • src : Input vector to which the Jacobian is applied.
Note
This function is only used if the internal nonlinear solver of the class is used.

◆ compute_residual

template<unsigned int dim, typename number >
ResidualType MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::compute_residual
private

Compute the negative residual for the implicit step of the time integrator.

Assuming that the explicit part of the update

\[ \tilde{y} = y^{n} + \Delta t F(y^{n}) \]

has already been computed and is provided as explicit_step_solution, this function evaluates the residual of the implicit equation

\[ R = \frac{y^{n+1} - \tilde{y}}{\Delta t} - G(y^{n+1}), \]

and returns its negative, i.e., \( -R \). The negative residual is required directly by the internal nonlinear solver.

Function Signature:

void f(number time,
number time_step,
VectorType &dst,
const VectorType &src,
const VectorType &explicit_step_solution);

Parameters:

  • time : Current simulation time \(t^n\).
  • time_step : Current time step size \(\Delta t\).
  • dst : Destination vector to store the negative residual.
  • src : Current solution vector, i.e., \( y^{n+1} \).
  • explicit_step_solution : Result \(\tilde{y}\) from the explicit step. This vector may be modified safely, as it will be overwritten during the next integration step.
Note
This function is only used if the internal nonlinear solver of the class is used.

◆ distribute_constraints

template<unsigned int dim, typename number >
DistributeConstraintsType MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::distribute_constraints
private

Apply constraints to a given vector.

This function enforces problem-specific constraints (e.g., boundary conditions or degrees of freedom restrictions) directly on the input vector dst.

Function Signature:

void f(VectorType &dst);

Parameters:

  • dst : Vector to which the constraints are applied (modified in place).
Note
This function is only used if the internal nonlinear solver of the class is used.

◆ explicit_compute_rhs

template<unsigned int dim, typename number >
ExplicitRhsFunctionType MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::explicit_compute_rhs
private

Explicit right-hand side function for the ODE system

\[ y' = F(y) + G(y), \]

where \(F\) is treated explicitly and \(G\) implicitly. This function computes the explicit part \(F(y)\).

Function Signature:

void f(number time,
number time_step,
VectorType &dst,
const VectorType &src,
const bool zero_dst_vec,
std::function<void(unsigned, unsigned)> post);

Parameters:

  • time : Current simulation time at \(t^n\).
  • time_step : Current step size \(\Delta t\).
  • dst : Destination vector for the explicit RHS contribution.
  • src : Source solution vector \(y^n\).
  • zero_dst_vec : If true, zero out dst before adding contributions. This allows efficient accumulation while computing values.
  • post : Post-processing function applied after computing the RHS. Receives a range of global indices [begin, end) to process, ensuring all indices are handled. Designed for efficient integration with deal.II’s matrix-free framework.

◆ intermediate_explicit_solution

template<unsigned int dim, typename number >
VectorType MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::intermediate_explicit_solution
private

Vector to store the solution of the explicit step.

◆ n_steps_performed

template<unsigned int dim, typename number >
unsigned MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::n_steps_performed = 0
private

Number of time steps already performed by the integrator.

◆ preconditioner

template<unsigned int dim, typename number >
Preconditioner<dim, VectorType, number> MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::preconditioner
private

Preconditioner for the linear solver used within each nonlinear solver iteration.

◆ preconditioner_update_flag

template<unsigned int dim, typename number >
bool MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::preconditioner_update_flag = false
private

Boolean to indicate whether the preconditioner needs to be updated before the next solve.

◆ solver

template<unsigned int dim, typename number >
NewtonRaphsonSolver<number, VectorType> MeltPoolDG::TimeIntegration::ImplicitExplicitIntegrator< dim, number >::solver
private

Nonlinear solver used when no custom solver is provided.


The documentation for this class was generated from the following files: