ReinitializationEllipticOperatorNewton< dim, number > Class Template Reference

Developer Documentation: MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number > Class Template Reference
Developer Documentation
MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number > Class Template Reference

Operator for the matrix-free evaluation of diffusive reinitialization of the level set function. More...

#include <reinitialization_elliptic_operator_CG_newton.hpp>

Inheritance diagram for MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >:
[legend]
Collaboration diagram for MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >:
[legend]

Public Types

using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 
using VectorizedArrayType = dealii::VectorizedArray< number >
 
using MappingInfoType = CutUtil::MappingInfoType< dim, number >
 
using PointEvaluationType = dealii::FEPointEvaluation< 1, dim, dim, VectorizedArrayType >
 
- Public Types inherited from MeltPoolDG::OperatorMatrixFree< dim, number >
using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 
using BlockVectorType = dealii::LinearAlgebra::distributed::BlockVector< number >
 
using SparseMatrixType = dealii::TrilinosWrappers::SparseMatrix
 

Public Member Functions

 ReinitializationEllipticOperatorNewton (const MeltPoolDG::ScratchData< dim, dim, number > &scratch_data_in, const ReinitializationData< number > &reinit_data_in, const unsigned int reinit_dof_idx_in, const unsigned int reinit_quad_idx_in, const MappingInfoType &mapping_info_surface_in, const unsigned int ls_dof_idx_in)
 Constructor.
 
void vmult (VectorType &dst, const VectorType &src) const final
 Apply the operator in a matrix-free fashion. Top-level function for the evaluation of the left-hand side.
 
void create_residual (VectorType &rhs, const VectorType &level_set) const
 Create the right-hand side vector using a matrix-free evaluation. Top-level function.
 
void reinit () final
 Reinitialize internal data structures, typically after mesh changes.
 
void compute_system_matrix_from_matrixfree (dealii::TrilinosWrappers::SparseMatrix &system_matrix) const final
 Compute and assemble the system matrix from matrix-free operator evaluations. Used by the preconditioner.
 
void compute_inverse_diagonal_from_matrixfree (VectorType &diagonal) const final
 Compute the inverse diagonal of the system matrix. Used by the preconditioner.
 
- Public Member Functions inherited from MeltPoolDG::OperatorMatrixFree< dim, number >
virtual ~OperatorMatrixFree ()=default
 
virtual void create_rhs (VectorType &, const VectorType &) const
 Compute the right-hand side vector.
 
virtual void create_rhs (BlockVectorType &, const VectorType &) const
 Compute the right-hand side vector for block vectors dst.
 
virtual void create_rhs (VectorType &, const BlockVectorType &) const
 Compute the right-hand side vector for block vectors src.
 
virtual void vmult (BlockVectorType &, const BlockVectorType &) const
 
virtual void compute_inverse_diagonal_from_matrixfree (BlockVectorType &) const
 Compute the inverse diagonal using matrix-free techniques for block vectors.
 
- Public Member Functions inherited from MeltPoolDG::OperatorBase< number >
virtual ~OperatorBase ()=default
 
void reset_dof_index (const unsigned int dof_idx_in)
 Set the index for the current degrees of freedom (DoF).
 
void reset_time_increment (const number dt)
 Set the time increment for the operator.
 
virtual void pre ()
 Prepare for computations (e.g. update ghost values). Can be overridden by derived classes.
 
virtual void post ()
 Finalize for computations (e.g. zero out ghost values). Can be overridden by derived classes.
 

Public Attributes

VectorType solution_old
 Solution vector from the previous iteration or time step (used in matrix-free mode).
 

Private Member Functions

template<int n_components>
VectorizedArrayType evaluate_coefficient (const FECellIntegrator< dim, n_components, number > &phi_old, const unsigned int q_index) const
 This evaluates the coefficient for the rhs integral.
 
template<int n_components>
VectorizedArrayType evaluate_coefficient_derivative (const FECellIntegrator< dim, n_components, number > &phi_old, const unsigned int q_index) const
 This evaluates the coefficient derivative for the analytical form.
 
template<int n_components>
VectorizedArrayType evaluate_coefficient_derivative (const FEFaceIntegrator< dim, n_components, number > &phi_old, const unsigned int q_index) const
 
void residual_laplace_operation (FECellIntegrator< dim, 1, number > &cell_eval) const
 Calculate the contribution of the weigted Laplace operator of a cell to the rhs.
 
void tangent_laplace_operation (FECellIntegrator< dim, 1, number > &cell_eval, FECellIntegrator< dim, 1, number > &phi_old) const
 Calculate the contribution of the weighted Laplace operator to the lhs.
 
void cell_operation (FECellIntegrator< dim, 1, number > &interface_penalty, FECellIntegrator< dim, 1, number > &cell_eval, PointEvaluationType &interface_penalty_surface) const
 Compute the contribution of a single cell integral to the right-hand side. First-level function for the evaluation of the volume integrals.
 
void interface_penalty_cell_operation (PointEvaluationType &interface_penalty_surface, FECellIntegrator< dim, 1, number > &interface_penalty, const unsigned int lane, const number penalty_coefficient) const
 Calculate the contribution of a single cell surface integral to the penalty term for the weak imposition of interface Dirichlet boundary condition.
 

Private Attributes

const ScratchData< dim, dim, number > & scratch_data
 Reference to scratch data containing mesh, geometry, and FE evaluation utilities.
 
const ReinitializationData< number > & reinit_data
 Reference to the reinitialization parameters and coefficients.
 
const unsigned int reinit_quad_idx
 Quadrature index for evaluating terms during reinitialization.
 
const MappingInfoType & mapping_info_surface
 Mapping information for integration over the interface.
 
dealii::FE_Q< dim > fe_point_level_set
 Temporary FE object required by FEPointEvaluation.
 
const unsigned int n_dofs_per_cell
 Number of DoFs per cell of the temporary FE.
 
const unsigned int ls_dof_idx
 DOF handler index for the level set field.
 
VectorType zero_interface
 

Additional Inherited Members

- Protected Attributes inherited from MeltPoolDG::OperatorBase< number >
unsigned int dof_idx = dealii::numbers::invalid_unsigned_int
 
number time_increment = numbers::invalid_double
 
number time_increment_inv = numbers::invalid_double
 

Detailed Description

template<int dim, typename number>
class MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >

Operator for the matrix-free evaluation of diffusive reinitialization of the level set function.

The implementation is based on the elliptic level set reinitialization method described in:

T. Adams, S. Giani, and W. M. Coombs, "A high-order elliptic PDE based level set reinitialisation method using a discontinuous Galerkin discretisation," Journal of Computational Physics, vol. 379, pp. 373–391, 2019. https://doi.org/10.1016/j.jcp.2018.12.003

Template Parameters
dimSpatial dimension.
numberScalar number type (e.g., double or float).

Member Typedef Documentation

◆ MappingInfoType

template<int dim, typename number >
using MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::MappingInfoType = CutUtil::MappingInfoType<dim, number>

◆ PointEvaluationType

template<int dim, typename number >
using MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::PointEvaluationType = dealii::FEPointEvaluation<1, dim, dim, VectorizedArrayType>

◆ VectorizedArrayType

template<int dim, typename number >
using MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::VectorizedArrayType = dealii::VectorizedArray<number>

◆ VectorType

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

Constructor & Destructor Documentation

◆ ReinitializationEllipticOperatorNewton()

template<int dim, typename number >
MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::ReinitializationEllipticOperatorNewton ( const MeltPoolDG::ScratchData< dim, dim, number > &  scratch_data_in,
const ReinitializationData< number > &  reinit_data_in,
const unsigned int  reinit_dof_idx_in,
const unsigned int  reinit_quad_idx_in,
const MappingInfoType &  mapping_info_surface_in,
const unsigned int  ls_dof_idx_in 
)

Constructor.

Operator for the matrix-free solution of the nonlinear elliptic reinitialization.

Parameters
scratch_data_inReference to the used ScratchData object.
reinit_data_inReference to the object for reinitialization-specific data.
reinit_dof_idx_inIndex of the used dof-handler object in scratch_data_in.
reinit_quad_idx_inIndex of the used quadrature object in scratch_data_in.
mapping_info_surface_inMapping information for the interface surface.
ls_dof_idx_inDOF handler index for the level set function.

Member Function Documentation

◆ cell_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::cell_operation ( FECellIntegrator< dim, 1, number > &  interface_penalty,
FECellIntegrator< dim, 1, number > &  cell_eval,
PointEvaluationType &  interface_penalty_surface 
) const
private

Compute the contribution of a single cell integral to the right-hand side. First-level function for the evaluation of the volume integrals.

Parameters
interface_penaltyCell integrator for the penalty term.
cell_evalCell integrator for the Laplace operator (plus, provides function values for the penalty term).
interface_penalty_surfacePoint evaluation object for the surface integral.

◆ compute_inverse_diagonal_from_matrixfree()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::compute_inverse_diagonal_from_matrixfree ( VectorType &  diagonal) const
finalvirtual

Compute the inverse diagonal of the system matrix. Used by the preconditioner.

Parameters
diagonalOutput vector containing the diagonal inverse values.

Reimplemented from MeltPoolDG::OperatorMatrixFree< dim, number >.

◆ compute_system_matrix_from_matrixfree()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::compute_system_matrix_from_matrixfree ( dealii::TrilinosWrappers::SparseMatrix &  system_matrix) const
finalvirtual

Compute and assemble the system matrix from matrix-free operator evaluations. Used by the preconditioner.

Parameters
system_matrixOutput sparse matrix.

Reimplemented from MeltPoolDG::OperatorMatrixFree< dim, number >.

◆ create_residual()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::create_residual ( VectorType &  rhs,
const VectorType &  level_set 
) const

Create the right-hand side vector using a matrix-free evaluation. Top-level function.

Parameters
rhsRight-hand side vector.
old_level_setThe level set vector where the signed distance property needs to be restored.

◆ evaluate_coefficient()

template<int dim, typename number >
template<int n_components>
ReinitializationEllipticOperatorNewton< dim, number >::VectorizedArrayType MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::evaluate_coefficient ( const FECellIntegrator< dim, n_components, number > &  phi_old,
const unsigned int  q_index 
) const
private

This evaluates the coefficient for the rhs integral.

Parameters
psi_oldCell integrator for the old level set values.
q_indexIndex of the quadrature point.
Returns
Value of the coefficient.

◆ evaluate_coefficient_derivative() [1/2]

template<int dim, typename number >
template<int n_components>
ReinitializationEllipticOperatorNewton< dim, number >::VectorizedArrayType MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::evaluate_coefficient_derivative ( const FECellIntegrator< dim, n_components, number > &  phi_old,
const unsigned int  q_index 
) const
private

This evaluates the coefficient derivative for the analytical form.

Parameters
psi_oldCell integrator for the old level set values.
q_indexIndex of the quadrature point.
Returns
Value of the coefficient derivative.

◆ evaluate_coefficient_derivative() [2/2]

template<int dim, typename number >
template<int n_components>
ReinitializationEllipticOperatorNewton< dim, number >::VectorizedArrayType MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::evaluate_coefficient_derivative ( const FEFaceIntegrator< dim, n_components, number > &  phi_old,
const unsigned int  q_index 
) const
private

◆ interface_penalty_cell_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::interface_penalty_cell_operation ( PointEvaluationType &  interface_penalty_surface,
FECellIntegrator< dim, 1, number > &  interface_penalty,
const unsigned int  lane,
const number  penalty_coefficient 
) const
private

Calculate the contribution of a single cell surface integral to the penalty term for the weak imposition of interface Dirichlet boundary condition.

Parameters
interface_penalty_surfacePoint evaluation object for the surface integral.
interface_penaltyCell integrator for the penalty term.
laneThe SIMD lane for which the operation is performed. Corresponds to one cell in the cell batch.
penalty_coefficientPenalty coefficient for the interface penalty term.

◆ reinit()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::reinit ( )
finalvirtual

Reinitialize internal data structures, typically after mesh changes.

Reimplemented from MeltPoolDG::OperatorBase< number >.

◆ residual_laplace_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::residual_laplace_operation ( FECellIntegrator< dim, 1, number > &  cell_eval) const
private

Calculate the contribution of the weigted Laplace operator of a cell to the rhs.

Parameters
cell_evalCell integrator.

◆ tangent_laplace_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::tangent_laplace_operation ( FECellIntegrator< dim, 1, number > &  cell_eval,
FECellIntegrator< dim, 1, number > &  phi_old 
) const
private

Calculate the contribution of the weighted Laplace operator to the lhs.

Parameters
cell_evalCell integrator.

◆ vmult()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::vmult ( VectorType &  dst,
const VectorType &  src 
) const
finalvirtual

Apply the operator in a matrix-free fashion. Top-level function for the evaluation of the left-hand side.

Parameters
dstOutput vector.
srcInput vector.

Reimplemented from MeltPoolDG::OperatorMatrixFree< dim, number >.

Member Data Documentation

◆ fe_point_level_set

template<int dim, typename number >
dealii::FE_Q<dim> MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::fe_point_level_set
private

Temporary FE object required by FEPointEvaluation.

◆ ls_dof_idx

template<int dim, typename number >
const unsigned int MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::ls_dof_idx
private

DOF handler index for the level set field.

◆ mapping_info_surface

template<int dim, typename number >
const MappingInfoType& MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::mapping_info_surface
private

Mapping information for integration over the interface.

◆ n_dofs_per_cell

template<int dim, typename number >
const unsigned int MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::n_dofs_per_cell
private

Number of DoFs per cell of the temporary FE.

◆ reinit_data

template<int dim, typename number >
const ReinitializationData<number>& MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::reinit_data
private

Reference to the reinitialization parameters and coefficients.

◆ reinit_quad_idx

template<int dim, typename number >
const unsigned int MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::reinit_quad_idx
private

Quadrature index for evaluating terms during reinitialization.

◆ scratch_data

template<int dim, typename number >
const ScratchData<dim, dim, number>& MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::scratch_data
private

Reference to scratch data containing mesh, geometry, and FE evaluation utilities.

◆ solution_old

template<int dim, typename number >
VectorType MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::solution_old

Solution vector from the previous iteration or time step (used in matrix-free mode).

◆ zero_interface

template<int dim, typename number >
VectorType MeltPoolDG::LevelSet::ReinitializationEllipticOperatorNewton< dim, number >::zero_interface
private

This vector is used to create an empty cell integrator buffer for cut cells. The buffer accumulates penalty contribution. This vector is initialized to zero every reinit() operation.


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