ReinitializationEllipticOperator< dim, number > Class Template Reference

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

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

#include <reinitialization_elliptic_operator.hpp>

Inheritance diagram for MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >:
[legend]
Collaboration diagram for MeltPoolDG::LevelSet::ReinitializationEllipticOperator< 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

 ReinitializationEllipticOperator (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, const std::shared_ptr< dealii::NonMatching::MeshClassifier< dim > > mesh_classifier_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_rhs (VectorType &rhs, const VectorType &old_level_set) const final
 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 rhs_cell_operation (FECellIntegrator< dim, 1, number > &cell_eval, const FECellIntegrator< dim, 1, number > &psi_old) 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.
 
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 (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.
 

Private Member Functions

template<int n_components>
VectorizedArrayType evaluate_rhs_coefficient (const FECellIntegrator< dim, n_components, number > &psi_old, const unsigned int q_index) const
 This evaluates the coefficient for the rhs integral.
 
void lhs_cell_operation (FECellIntegrator< dim, 1, number > &interface_penalty, FECellIntegrator< dim, 1, number > &cell_eval, PointEvaluationType &interface_penalty_surface, const unsigned int cell_batch) const
 Calculate the contribution of a single cell integral to the left-hand side. First-level function for the evaluation of the laplace operator and the surface penalty term.
 
void laplace_cell_operation (FECellIntegrator< dim, 1, number > &cell_eval) const
 Calculate the contribution of the laplace operator of a cell to the lhs.
 

Private Attributes

std::shared_ptr< dealii::NonMatching::MeshClassifier< dim > > mesh_classifier
 
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 MappingInfoTypemapping_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.
 
dealii::AlignedVector< dealii::VectorizedArray< number > > solution_old
 Solution vector from the previous iteration or time step (used in matrix-free mode).
 
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::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< dim, number >::MappingInfoType = CutUtil::MappingInfoType<dim, number>

◆ PointEvaluationType

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

◆ VectorizedArrayType

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

◆ VectorType

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

Constructor & Destructor Documentation

◆ ReinitializationEllipticOperator()

template<int dim, typename number >
MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >::ReinitializationEllipticOperator ( 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,
const std::shared_ptr< dealii::NonMatching::MeshClassifier< dim > >  mesh_classifier_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.
mesh_classifier_inShared pointer to the mesh classifier object containing information about cut cells.

Member Function Documentation

◆ compute_inverse_diagonal_from_matrixfree()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< 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_rhs()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >::create_rhs ( VectorType rhs,
const VectorType old_level_set 
) const
finalvirtual

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.

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

◆ evaluate_rhs_coefficient()

template<int dim, typename number >
template<int n_components>
ReinitializationEllipticOperator< dim, number >::VectorizedArrayType MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >::evaluate_rhs_coefficient ( const FECellIntegrator< dim, n_components, number > &  psi_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 source term.

◆ interface_penalty_cell_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperator< 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

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.

◆ laplace_cell_operation()

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

Calculate the contribution of the laplace operator of a cell to the lhs.

Parameters
cell_evalCell integrator.

◆ lhs_cell_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >::lhs_cell_operation ( FECellIntegrator< dim, 1, number > &  interface_penalty,
FECellIntegrator< dim, 1, number > &  cell_eval,
PointEvaluationType interface_penalty_surface,
const unsigned int  cell_batch 
) const
private

Calculate the contribution of a single cell integral to the left-hand side. First-level function for the evaluation of the laplace operator and the surface penalty term.

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.
cell_batchBatch index for the current cell.

◆ reinit()

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

Reinitialize internal data structures, typically after mesh changes.

Reimplemented from MeltPoolDG::OperatorBase< number >.

◆ rhs_cell_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >::rhs_cell_operation ( FECellIntegrator< dim, 1, number > &  cell_eval,
const FECellIntegrator< dim, 1, number > &  psi_old 
) const

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

Parameters
cell_evalCell integrator for the right-hand side.
psi_oldCell integrator for the old level set values.

◆ vmult()

template<int dim, typename number >
void MeltPoolDG::LevelSet::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< dim, number >::mapping_info_surface
private

Mapping information for integration over the interface.

◆ mesh_classifier

template<int dim, typename number >
std::shared_ptr<dealii::NonMatching::MeshClassifier<dim> > MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >::mesh_classifier
private

Mesh classifier, which contains information if a cell is inside or outside the physically relevant region, or cut by the immersed boundary. It corresponds to the current level set position.

◆ n_dofs_per_cell

template<int dim, typename number >
const unsigned int MeltPoolDG::LevelSet::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< 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::ReinitializationEllipticOperator< dim, number >::scratch_data
private

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

◆ solution_old

template<int dim, typename number >
dealii::AlignedVector<dealii::VectorizedArray<number> > MeltPoolDG::LevelSet::ReinitializationEllipticOperator< dim, number >::solution_old
private

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

◆ zero_interface

template<int dim, typename number >
VectorType MeltPoolDG::LevelSet::ReinitializationEllipticOperator< 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: