OlssonOperator< dim, number > Class Template Reference

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

Operator for the Olsson reinitialization method used in level set methods. More...

#include <olsson_CG_operator.hpp>

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

Public Types

using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 Distributed vector type used for matrix-free and matrix-based computations.
 
using BlockVectorType = dealii::LinearAlgebra::distributed::BlockVector< number >
 Distributed block vector type used for storing the interface normal field.
 
using SparseMatrixType = dealii::TrilinosWrappers::SparseMatrix
 Sparse matrix type used for assembling and storing the system matrix.
 
using VectorizedArrayType = dealii::VectorizedArray< number >
 Vectorized scalar type used in SIMD computations.
 
using vector = dealii::Tensor< 1, dim, VectorizedArrayType >
 Vector type with SIMD-enabled entries in dim dimensions.
 
using scalar = VectorizedArrayType
 Scalar type with SIMD-enabled entries.
 
- Public Types inherited from MeltPoolDG::OperatorMatrixBased< dim, number >
using SparseMatrixType = dealii::TrilinosWrappers::SparseMatrix
 
using SparsityPatternType = dealii::TrilinosWrappers::SparsityPattern
 
using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 
using BlockVectorType = dealii::LinearAlgebra::distributed::BlockVector< number >
 
- 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

 OlssonOperator (const ScratchData< dim, dim, number > &scratch_data_in, const ReinitializationData< number > &reinit_data_in, const int ls_n_subdivisions, const BlockVectorType &n_in, const unsigned int reinit_dof_idx_in, const unsigned int reinit_quad_idx_in, const unsigned int ls_dof_idx_in, const unsigned int normal_dof_idx_in)
 Constructor.
 
void compute_system_matrix_and_rhs (const VectorType &old_level_set, VectorType &rhs) const final
 Assemble the system matrix and right-hand side using a matrix-based approach.
 
void vmult (VectorType &dst, const VectorType &src) const final
 Apply the operator in a matrix-free fashion.
 
void create_rhs (VectorType &rhs, const VectorType &old_level_set) const final
 Create the right-hand side vector using a matrix-free evaluation.
 
void compute_system_matrix_from_matrixfree (dealii::TrilinosWrappers::SparseMatrix &system_matrix) const final
 Compute and assemble the system matrix from matrix-free operator evaluations.
 
void compute_inverse_diagonal_from_matrixfree (VectorType &diagonal) const final
 Compute an approximation of the inverse diagonal of the system matrix.
 
void reinit () final
 Reinitialize internal data structures, typically after mesh changes.
 
void set_wetting_boundary_condition_ids (std::vector< dealii::types::boundary_id > &&wetting_bc_ids)
 Specify the boundary IDs where wetting boundary conditions should be applied.
 
- Public Member Functions inherited from MeltPoolDG::OperatorMatrixBased< dim, number >
virtual ~OperatorMatrixBased ()=default
 
virtual void compute_system_matrix_and_rhs (const BlockVectorType &, VectorType &) const
 Compute the system matrix and right-hand side vector for block vectors.
 
virtual void compute_system_matrix_and_rhs (const VectorType &, BlockVectorType &) const
 Compute the system matrix and right-hand side block vector.
 
virtual void reinit_sparsity_pattern (const ScratchData< dim, dim, number > &scratch_data)
 Reinitialize the sparsity pattern of the system matrix.
 
const SparseMatrixTypeget_system_matrix () const
 
SparseMatrixTypeget_system_matrix ()
 
- 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 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.
 

Private Member Functions

void tangent_cell_operation (FECellIntegrator< dim, 1, number > &delta_psi) const
 Compute the contribution of a single cell integral to the tangent.
 
void tangent_boundary_face_operation (FEFaceIntegrator< dim, 1, number > &face_eval, FEFaceIntegrator< dim, dim, number > &normal_face_eval) const
 Compute the contribution of a single boundary face integral to the tangent.
 
void rhs_boundary_face_operation (FEFaceIntegrator< dim, 1, number > &face_eval, FEFaceIntegrator< dim, dim, number > &normal_face_eval) const
 Compute the contribution of a single boundary face integral to the right-hand side.
 
void tangent_boundary_loop (const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, std::pair< unsigned int, unsigned int > face_range) const
 Loop over boundary faces to compute tangent (left-hand side) contributions in matrix-free mode.
 
void rhs_boundary_loop (const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, std::pair< unsigned int, unsigned int > face_range) const
 Loop over boundary faces to compute right-hand side contributions in matrix-free mode.
 

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 number ls_n_subdivisions
 Number of subdivisions used to define the interface thickness parameter.
 
const BlockVectorTypenormal_vec
 Reference to the vector field representing the interface normals.
 
const unsigned int reinit_quad_idx
 Quadrature index for evaluating terms during reinitialization.
 
const unsigned int normal_dof_idx
 DOF handler index for the normal vector field.
 
const unsigned int ls_dof_idx
 DOF handler index for the level set field.
 
std::vector< dealii::types::boundary_id > wetting_bc_ids
 List of boundary IDs where wetting boundary conditions are applied.
 
bool enable_boundary_face_integral = false
 Flag to enable or disable boundary face integral contributions.
 
const number tolerance_normal_vector
 Tolerance threshold used for validating or correcting normal vectors.
 
dealii::AlignedVector< dealii::VectorizedArray< number > > normal_diffusion_length
 Precomputed diffusive length scale in the normal direction at each quadrature point.
 
dealii::AlignedVector< dealii::VectorizedArray< number > > tangential_diffusion_length
 Precomputed diffusive length scale in the tangential direction at each quadrature point.
 
dealii::AlignedVector< dealii::VectorizedArray< number > > solution_old
 
dealii::AlignedVector< dealii::Tensor< 1, dim, dealii::VectorizedArray< number > > > unit_normal
 

Additional Inherited Members

- Protected Attributes inherited from MeltPoolDG::OperatorMatrixBased< dim, number >
SparseMatrixType system_matrix
 
SparsityPatternType dsp
 
- 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::OlssonOperator< dim, number >

Operator for the Olsson reinitialization method used in level set methods.

This class implements both matrix-based and matrix-free variants of the operator, enabling flexible assembly and application of the reinitialization system used to maintain signed distance properties of level set functions. It supports tangential diffusion, compressive fluxes, and optional wetting boundary conditions.

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

E. Olsson, G. Kreiss, and S. Zahedi, "A conservative level set method for two phase flow II," Journal of Computational Physics, 225(1), 785–807, 2007. https://doi.org/10.1016/j.jcp.2007.01.026

and for wetting consideration, we add the tangential component as described in:

S. Zahedi, K. Gustavsson, and G. Kreiss, “A conservative level set method for contact line dynamics,” J. Comput. Phys., vol. 228, no. 17, pp. 6361–6375, Sep. 2009, doi: 10.1016/j.jcp.2009.05.043.

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

Member Typedef Documentation

◆ BlockVectorType

template<int dim, typename number >
using MeltPoolDG::LevelSet::OlssonOperator< dim, number >::BlockVectorType = dealii::LinearAlgebra::distributed::BlockVector<number>

Distributed block vector type used for storing the interface normal field.

◆ scalar

template<int dim, typename number >
using MeltPoolDG::LevelSet::OlssonOperator< dim, number >::scalar = VectorizedArrayType

Scalar type with SIMD-enabled entries.

◆ SparseMatrixType

template<int dim, typename number >
using MeltPoolDG::LevelSet::OlssonOperator< dim, number >::SparseMatrixType = dealii::TrilinosWrappers::SparseMatrix

Sparse matrix type used for assembling and storing the system matrix.

◆ vector

template<int dim, typename number >
using MeltPoolDG::LevelSet::OlssonOperator< dim, number >::vector = dealii::Tensor<1, dim, VectorizedArrayType>

Vector type with SIMD-enabled entries in dim dimensions.

◆ VectorizedArrayType

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

Vectorized scalar type used in SIMD computations.

◆ VectorType

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

Distributed vector type used for matrix-free and matrix-based computations.

Constructor & Destructor Documentation

◆ OlssonOperator()

template<int dim, typename number >
MeltPoolDG::LevelSet::OlssonOperator< dim, number >::OlssonOperator ( const ScratchData< dim, dim, number > &  scratch_data_in,
const ReinitializationData< number > &  reinit_data_in,
const int  ls_n_subdivisions,
const BlockVectorType n_in,
const unsigned int  reinit_dof_idx_in,
const unsigned int  reinit_quad_idx_in,
const unsigned int  ls_dof_idx_in,
const unsigned int  normal_dof_idx_in 
)

Constructor.

Parameters
scratch_data_inScratch data containing mesh and FE information.
reinit_data_inParameters used during the reinitialization process.
ls_n_subdivisionsNumber of subdivisions for the level_set_framework.
n_inPrecomputed normal vector field.
reinit_dof_idx_inDOF handler index for reinitialization.
reinit_quad_idx_inQuadrature index for reinitialization.
ls_dof_idx_inDOF handler index for the level set function.
normal_dof_idx_inDOF handler index for the normal vector.

Member Function Documentation

◆ compute_inverse_diagonal_from_matrixfree()

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

Compute an approximation of the inverse diagonal of the system matrix.

Parameters
diagonalOutput vector containing the diagonal inverse values.

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

◆ compute_system_matrix_and_rhs()

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

Assemble the system matrix and right-hand side using a matrix-based approach.

Parameters
old_level_setThe level set vector from the previous pseudo time step.
rhsOutput vector for the right-hand side.

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

◆ compute_system_matrix_from_matrixfree()

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

Parameters
system_matrixOutput sparse matrix.

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

◆ create_rhs()

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

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

Parameters
rhsRight-hand side vector.
old_level_setThe level set vector from the previous pseudo time step.

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

◆ reinit()

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

Reinitialize internal data structures, typically after mesh changes.

Reimplemented from MeltPoolDG::OperatorBase< number >.

◆ rhs_boundary_face_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::OlssonOperator< dim, number >::rhs_boundary_face_operation ( FEFaceIntegrator< dim, 1, number > &  face_eval,
FEFaceIntegrator< dim, dim, number > &  normal_face_eval 
) const
private

Compute the contribution of a single boundary face integral to the right-hand side.

Parameters
face_evalFace integrator for the solution field (increment of level set).
normal_face_evalFace integrator for the normal vector field.

◆ rhs_boundary_loop()

template<int dim, typename number >
void MeltPoolDG::LevelSet::OlssonOperator< dim, number >::rhs_boundary_loop ( const dealii::MatrixFree< dim, number > &  matrix_free,
VectorType dst,
const VectorType src,
std::pair< unsigned int, unsigned int >  face_range 
) const
private

Loop over boundary faces to compute right-hand side contributions in matrix-free mode.

Parameters
matrix_freeMatrix-free data structure.
dstOutput vector for the right-hand side.
srcInput solution vector (increment of level set).
face_rangeRange of face indices to process.

◆ set_wetting_boundary_condition_ids()

template<int dim, typename number >
void MeltPoolDG::LevelSet::OlssonOperator< dim, number >::set_wetting_boundary_condition_ids ( std::vector< dealii::types::boundary_id > &&  wetting_bc_ids)

Specify the boundary IDs where wetting boundary conditions should be applied.

Parameters
wetting_bc_idsA vector of boundary IDs.

◆ tangent_boundary_face_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::OlssonOperator< dim, number >::tangent_boundary_face_operation ( FEFaceIntegrator< dim, 1, number > &  face_eval,
FEFaceIntegrator< dim, dim, number > &  normal_face_eval 
) const
private

Compute the contribution of a single boundary face integral to the tangent.

Parameters
face_evalFace integrator for the solution field (increment of level set).
normal_face_evalFace integrator for the normal vector field.

◆ tangent_boundary_loop()

template<int dim, typename number >
void MeltPoolDG::LevelSet::OlssonOperator< dim, number >::tangent_boundary_loop ( const dealii::MatrixFree< dim, number > &  matrix_free,
VectorType dst,
const VectorType src,
std::pair< unsigned int, unsigned int >  face_range 
) const
private

Loop over boundary faces to compute tangent (left-hand side) contributions in matrix-free mode.

Parameters
matrix_freeMatrix-free data structure.
dstOutput vector for the right-hand side.
srcInput solution vector (increment of level set).
face_rangeRange of face indices to process.

◆ tangent_cell_operation()

template<int dim, typename number >
void MeltPoolDG::LevelSet::OlssonOperator< dim, number >::tangent_cell_operation ( FECellIntegrator< dim, 1, number > &  delta_psi) const
private

Compute the contribution of a single cell integral to the tangent.

Parameters
delta_psiCell integrator for the solution field (increment of level set).

◆ vmult()

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

Apply the operator in a matrix-free fashion.

Parameters
dstOutput vector.
srcInput vector.

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

Member Data Documentation

◆ enable_boundary_face_integral

template<int dim, typename number >
bool MeltPoolDG::LevelSet::OlssonOperator< dim, number >::enable_boundary_face_integral = false
private

Flag to enable or disable boundary face integral contributions.

◆ ls_dof_idx

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

DOF handler index for the level set field.

◆ ls_n_subdivisions

template<int dim, typename number >
const number MeltPoolDG::LevelSet::OlssonOperator< dim, number >::ls_n_subdivisions
private

Number of subdivisions used to define the interface thickness parameter.

◆ normal_diffusion_length

template<int dim, typename number >
dealii::AlignedVector<dealii::VectorizedArray<number> > MeltPoolDG::LevelSet::OlssonOperator< dim, number >::normal_diffusion_length
private

Precomputed diffusive length scale in the normal direction at each quadrature point.

◆ normal_dof_idx

template<int dim, typename number >
const unsigned int MeltPoolDG::LevelSet::OlssonOperator< dim, number >::normal_dof_idx
private

DOF handler index for the normal vector field.

◆ normal_vec

template<int dim, typename number >
const BlockVectorType& MeltPoolDG::LevelSet::OlssonOperator< dim, number >::normal_vec
private

Reference to the vector field representing the interface normals.

◆ reinit_data

template<int dim, typename number >
const ReinitializationData<number>& MeltPoolDG::LevelSet::OlssonOperator< 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::OlssonOperator< 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::OlssonOperator< 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::OlssonOperator< dim, number >::solution_old
mutableprivate

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

Note
Marked as mutable to allow updates in const functions.

◆ tangential_diffusion_length

template<int dim, typename number >
dealii::AlignedVector<dealii::VectorizedArray<number> > MeltPoolDG::LevelSet::OlssonOperator< dim, number >::tangential_diffusion_length
private

Precomputed diffusive length scale in the tangential direction at each quadrature point.

◆ tolerance_normal_vector

template<int dim, typename number >
const number MeltPoolDG::LevelSet::OlssonOperator< dim, number >::tolerance_normal_vector
private

Tolerance threshold used for validating or correcting normal vectors.

◆ unit_normal

template<int dim, typename number >
dealii::AlignedVector<dealii::Tensor<1, dim, dealii::VectorizedArray<number> > > MeltPoolDG::LevelSet::OlssonOperator< dim, number >::unit_normal
mutableprivate

Precomputed unit normals at quadrature points (used during face integration).

Note
Marked as mutable to allow updates in const functions.

◆ wetting_bc_ids

template<int dim, typename number >
std::vector<dealii::types::boundary_id> MeltPoolDG::LevelSet::OlssonOperator< dim, number >::wetting_bc_ids
private

List of boundary IDs where wetting boundary conditions are applied.


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