BDFIntegrator< dim, number > Class Template Reference

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

#include <bdf_time_integration.hpp>

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

Public Types

using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 
using JacobianType = std::function< void(number time_step, VectorType &src, const VectorType &dst)>
 
using ResidualType = std::function< void(number time, number time_step, const VectorType &src, VectorType &dst, const VectorType &old_solution)>
 
using DistributeConstraintsType = std::function< void(VectorType &dst)>
 

Public Member Functions

 BDFIntegrator (const TimeIntegratorData< number > &time_integrator_data)
 
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. For details on the functions see the corresponding class member descriptions.
 
void set_preconditioner (Preconditioner< dim, VectorType, number > &&preconditioner_in)
 
unsigned int 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 compute_weighted_old_solution_sum (SolutionHistory< VectorType > &solution_history)
 Compute sum of old solutions weighted with the BDF prefactors bdf_weights.old_solutions .
 
void set_up_bdf_parameters (const unsigned int bdf_scheme)
 Set the up bdf parameters object.
 

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
 
std::unique_ptr< NewtonRaphsonSolver< number, VectorType > > solver
 Nonlinear solver.
 
Preconditioner< dim, VectorType, number > preconditioner
 Preconditioner for the linear solver used in each nonlinear iteration.
 
struct { 
 
   number   rhs 
 Prefactor for the right hand side f(y). More...
 
   std::vector< number >   old_solutions 
 Weights for the old solutions y^{n}, y^{n-1}, ... More...
 
bdf_weights 
 BDF prefactors and weights.
 
VectorType summed_old_solution
 Sum of old solution with prefactors from BDF method.
 
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

◆ DistributeConstraintsType

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

◆ JacobianType

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

◆ ResidualType

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

◆ VectorType

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

Constructor & Destructor Documentation

◆ BDFIntegrator()

template<int dim, typename number >
MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::BDFIntegrator ( const TimeIntegratorData< number > &  time_integrator_data)
explicit

Constructor. Sets up the nonlinear solver. After construction it is still required to set the required functions by calling configure_solver_functions() and calling reinit() to allocate required memory before the integrator can be used.

Parameters
time_integrator_dataTime integrator data struct setting the scheme of the integrator.

Member Function Documentation

◆ compute_weighted_old_solution_sum()

template<int dim, typename number >
void MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::compute_weighted_old_solution_sum ( SolutionHistory< VectorType > &  solution_history)
private

Compute sum of old solutions weighted with the BDF prefactors bdf_weights.old_solutions .

Parameters
solution_historyHistory object containing the required old solutions.

◆ configure_solver_functions()

template<int dim, typename number >
void MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::configure_solver_functions ( JacobianType  jacobian,
ResidualType  residual,
DistributeConstraintsType  constraints = [](VectorType &) {} 
)

Configure the functions used by the internal nonlinear solver to solve the implicit step. For details on the functions see the corresponding class member descriptions.

Sets the class member compute_jacobian , compute_residual and distribute_constraints to the provided functions. For details on the expected function signatures and behavior, see the documentation of the corresponding class member.

Parameters
jacobianFunction used to apply the Jacobian to a vector.
residualFunction used to compute the residual.
constraintsFunction used to apply constraints to a vector.

◆ perform_time_step()

template<int dim, typename number >
void MeltPoolDG::TimeIntegration::BDFIntegrator< 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 the actual time integration for a single time step using the low storage explicit Runge-Kutta scheme.

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 bdf update step.
stage_post_processingFunction which is executed after the bdf update step. Runge-Kutta stage.

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

◆ reinit() [1/2]

template<int dim, typename number >
void MeltPoolDG::TimeIntegration::BDFIntegrator< 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<int dim, typename number >
void MeltPoolDG::TimeIntegration::BDFIntegrator< 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<int dim, typename number >
unsigned MeltPoolDG::TimeIntegration::BDFIntegrator< 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 >.

◆ set_preconditioner()

template<int dim, typename number >
void MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::set_preconditioner ( Preconditioner< dim, VectorType, number > &&  preconditioner_in)

Set the preconditioner used in the linear solver of the implicit step. If this function is never called an identity preconditioner is used.

Parameters
preconditioner_inPreconditioner to be used in the linear solver of the implicit step.

◆ set_up_bdf_parameters()

template<int dim, typename number >
void MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::set_up_bdf_parameters ( const unsigned int  bdf_scheme)
private

Set the up bdf parameters object.

This function internally sets the bdf weights and coefficients used in the time integration scheme.

Parameters
bdf_schemeNumber of tbe bdf scheme to be used.

Member Data Documentation

◆ [struct]

struct { ... } MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::bdf_weights

BDF prefactors and weights.

◆ compute_jacobian

template<int dim, typename number >
JacobianType MeltPoolDG::TimeIntegration::BDFIntegrator< 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} - y^{n}}{\Delta t} - F(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 bdf_time_integration.hpp:32

Parameters:

  • time : Current simulation time \(t^n\).
  • time_step : Current time step size \(\Delta t\) (modified by the BDF prefactor).
  • dst : Destination vector to store the Jacobian–vector product.
  • src : Input vector to which the Jacobian is applied.

◆ compute_residual

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

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

This function evaluates the residual given by

\[ R = \frac{y^{n+1} - y^{n}}{\Delta t} - F(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 &old_solution);

Parameters:

  • time : Current simulation time \(t^n\).
  • time_step : Current time step size \(\Delta t\) (modified by the BDF prefactor).
  • dst : Destination vector to store the negative residual.
  • src : Current solution vector, i.e., \( y^{n+1} \).
  • old_solution : Previous time step resut, i.e., \( y^n \) in the above formula. in fact this is a modification of the previous solution including all previous solutions scaled by their weights for the corresponding BDF scheme.

◆ distribute_constraints

template<int dim, typename number >
DistributeConstraintsType MeltPoolDG::TimeIntegration::BDFIntegrator< 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).

◆ n_steps_performed

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

Number of time steps already performed by the integrator.

◆ old_solutions

template<int dim, typename number >
std::vector<number> MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::old_solutions

Weights for the old solutions y^{n}, y^{n-1}, ...

◆ preconditioner

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

Preconditioner for the linear solver used in each nonlinear iteration.

◆ preconditioner_update_flag

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

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

◆ rhs

template<int dim, typename number >
number MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::rhs

Prefactor for the right hand side f(y).

◆ solver

template<int dim, typename number >
std::unique_ptr<NewtonRaphsonSolver<number, VectorType> > MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::solver
private

Nonlinear solver.

◆ summed_old_solution

template<int dim, typename number >
VectorType MeltPoolDG::TimeIntegration::BDFIntegrator< dim, number >::summed_old_solution
private

Sum of old solution with prefactors from BDF method.


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