CutUtil Namespace Reference

Developer Documentation: MeltPoolDG::CutUtil Namespace Reference
Developer Documentation
MeltPoolDG::CutUtil Namespace Reference

Utilities for the weighted repartitioning of a parallel::distributed::Triangulation in cutFEM/cutDG applications. More...

Classes

class  PartitionWeights
 Cell weights for the repartitioning of a parallel::distributed::Triangulation according to the location of the cells with respect to the level set. More...
 
class  SolutionTransferOperator
 Operator for the solution transfer in moving boundary/interface simulations. More...
 

Typedefs

using NormType = dealii::VectorTools::NormType
 
template<int dim, typename number >
using MappingInfoType = dealii::NonMatching::MappingInfo< dim, dim, dealii::VectorizedArray< number > >
 
template<int dim, typename number >
using MappingInfoVectorType = std::vector< std::shared_ptr< MappingInfoType< dim, number > > >
 

Enumerations

enum  CellCategory { liquid = 0 , intersected = 1 , gas = 2 }
 Definition of the cell category numbering (active FE index). More...
 
enum  FaceType {
  inside_face_liquid , inside_face_gas , intersected_face , mixed_face_liquid_intersected ,
  mixed_face_intersected_liquid , mixed_face_gas_intersected , mixed_face_intersected_gas
}
 Enumeration for the face type. More...
 

Functions

template<int dim, typename VectorType , typename number = typename VectorType::value_type>
void refine_grid (const AMR::MarkCellsForRefinementType< dim > &mark_cells_for_refinement, const AttachDoFHandlerAndVectorsType< dim, VectorType > &attach_vectors, const std::function< void()> &post, const std::function< void()> &distribute_level_set_dofs, const dealii::DoFHandler< dim > &level_set_dof_handler, VectorType &level_set_dof_vector, const std::function< void()> &setup_dof_system, const AdaptiveMeshingData< number > &amr, dealii::Triangulation< dim > &tria, const int n_time_step)
 same as AMR::refine_grid(), but adapted for cases where one or more DoFHandler objects are used in CutFEM operations.
 
template<int dim, typename number >
number compute_cut_norm (const dealii::LinearAlgebra::distributed::Vector< number > &solution, const dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > &matrix_free, const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< dim, dim, dealii::VectorizedArray< number > > > > &mapping_info_cells, const bool is_two_phase, const dealii::FE_Q< dim > &reference_element, const unsigned int dof_idx, const unsigned int quad_idx, const NormType norm_type=NormType::L2_norm)
 Compute the norm of a solution vector with a non-fitted (cut) domain representation.
 
template<int dim, typename VectorType >
bool repartition_triangulation (dealii::Triangulation< dim > &tria, const AttachDoFHandlerAndVectorsType< dim, VectorType > &attach_vectors, const std::function< void()> &distribute_level_set_dofs, const dealii::DoFHandler< dim > &level_set_dof_handler, VectorType &level_set_dof_vector, const std::function< void()> &setup_dof_system, const std::function< void()> &post={})
 Repartition the triangulation tria among the MPI processes and transfer the attached DoF vectors and the level-set field to the new partitioning.
 
bool do_repartition (const unsigned int n_time_step, const CutRepartitionData &repartition_data)
 Determine whether the triangulation should be repartitioned at time step number n_time_step.
 
template<int dim, typename VectorType >
void deserialize_internal (const AttachDoFHandlerAndVectorsType< dim, VectorType > &attach_vectors, const std::function< void()> &post, const std::function< void()> &distribute_level_set_dofs, const dealii::DoFHandler< dim > &level_set_dof_handler, const std::function< void()> &setup_dof_system, const std::string &prefix)
 Same as Restart::deserialize_internal(), but adapted for cases where one or more DoFHandler objects are used in CutFEM operations.
 
template<int dim>
CutPhaseType get_cut_type (const dealii::DoFHandler< dim > &dof_handler)
 Enum that names a type of CutFEM in use.
 
FaceType get_face_type (const std::pair< unsigned int, unsigned int > &adjacent_cell_categories)
 This function categorizes the FaceType of the current face range.
 
template<int dim>
void set_fe_index (const dealii::DoFHandler< dim > &dof_handler, const dealii::NonMatching::MeshClassifier< dim > &mesh_classifier, const bool set_future)
 This function is setting the FE index for every cell.
 
template<int dim>
bool cell_classifications_changed (const dealii::Triangulation< dim > &tria, const dealii::NonMatching::MeshClassifier< dim > &mesh_classifier_old, const dealii::NonMatching::MeshClassifier< dim > &mesh_classifier, const MPI_Comm mpi_comm)
 
template<int dim, typename number , typename VectorType >
void compute_intersected_quadrature (MappingInfoVectorType< dim, number > mapping_info_cells, MappingInfoType< dim, number > &mapping_info_surface, const dealii::DoFHandler< dim > &level_set_dof_handler, const VectorType &level_set, const dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > &matrix_free, const int fe_degree, const bool is_two_phase, const bool is_dg=false, MappingInfoVectorType< dim, number > mapping_info_faces={})
 This function generates the immersed quadrature rules in the case that the domain is described by a discrete level-set function.
 
template<int dim, typename number , typename VectorType >
void compute_immersed_surface_quadrature (MappingInfoType< dim, number > &mapping_info_surface, const dealii::DoFHandler< dim > &level_set_dof_handler, const VectorType &level_set, const dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > &matrix_free, const int fe_degree)
 This function generates the immersed quadrature rules in the case that the domain is described by a discrete level-set function.
 
template<int dim, typename number , int n_components = 1>
void evaluate_intersected_domain (dealii::FEPointEvaluation< n_components, dim, dim, dealii::VectorizedArray< number > > &point_eval, const FECellIntegrator< dim, n_components, number > &cell_eval, const dealii::EvaluationFlags::EvaluationFlags evaluation_flags, const unsigned int cell_batch, const unsigned int cell_lane, const unsigned int n_dofs_per_cell)
 Evaluates solution values in the intersected domain for a specific SIMD lane within a cell batch.
 
template<int dim>
bool face_has_ghost_penalty (const dealii::NonMatching::MeshClassifier< dim > &mesh_classifier, const typename dealii::Triangulation< dim >::active_cell_iterator &cell, const unsigned int face_index, const dealii::NonMatching::LocationToLevelSet &inactive_location=dealii::NonMatching::LocationToLevelSet::inside)
 This function checks whether the currently considered face requires the application of ghost-penalty stabilization or not.
 
constexpr bool face_type_has_ghost_penalty (const FaceType face_type, const bool is_liquid_phase)
 Checks whether the ghost penalty stabilization applies on a face.
 
template<int dim>
bool is_new_intersected_face (const dealii::NonMatching::MeshClassifier< dim > &mesh_classifier, const dealii::NonMatching::MeshClassifier< dim > &mesh_classifier_old, const typename dealii::Triangulation< dim >::active_cell_iterator &cell, const unsigned int face_index, const dealii::NonMatching::LocationToLevelSet &inactive_location=dealii::NonMatching::LocationToLevelSet::inside)
 This function checks whether the considered face is a newly created intersected face.
 
template void refine_grid (const AMR::MarkCellsForRefinementType< 1 > &, const AttachDoFHandlerAndVectorsType< 1, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const std::function< void()> &, const dealii::DoFHandler< 1 > &, dealii::LinearAlgebra::distributed::Vector< double > &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::Triangulation< 1 > &, const int)
 
template void refine_grid (const AMR::MarkCellsForRefinementType< 2 > &, const AttachDoFHandlerAndVectorsType< 2, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const std::function< void()> &, const dealii::DoFHandler< 2 > &, dealii::LinearAlgebra::distributed::Vector< double > &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::Triangulation< 2 > &, const int)
 
template void refine_grid (const AMR::MarkCellsForRefinementType< 3 > &, const AttachDoFHandlerAndVectorsType< 3, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const std::function< void()> &, const dealii::DoFHandler< 3 > &, dealii::LinearAlgebra::distributed::Vector< double > &, const std::function< void()> &, const AdaptiveMeshingData< double > &, dealii::Triangulation< 3 > &, const int)
 
template double compute_cut_norm (const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 1, double, dealii::VectorizedArray< double > > &, const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > > > &, const bool, const dealii::FE_Q< 1 > &, const unsigned int, const unsigned int, const NormType)
 
template double compute_cut_norm (const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 2, double, dealii::VectorizedArray< double > > &, const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > > > &, const bool, const dealii::FE_Q< 2 > &, const unsigned int, const unsigned int, const NormType)
 
template double compute_cut_norm (const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 3, double, dealii::VectorizedArray< double > > &, const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > > > &, const bool, const dealii::FE_Q< 3 > &, const unsigned int, const unsigned int, const NormType)
 
template void deserialize_internal (const AttachDoFHandlerAndVectorsType< 1, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const std::function< void()> &, const dealii::DoFHandler< 1 > &, const std::function< void()> &, const std::string &)
 
template void deserialize_internal (const AttachDoFHandlerAndVectorsType< 2, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const std::function< void()> &, const dealii::DoFHandler< 2 > &, const std::function< void()> &, const std::string &)
 
template void deserialize_internal (const AttachDoFHandlerAndVectorsType< 3, dealii::LinearAlgebra::distributed::Vector< double > > &, const std::function< void()> &, const std::function< void()> &, const dealii::DoFHandler< 3 > &, const std::function< void()> &, const std::string &)
 
template CutPhaseType get_cut_type (const dealii::DoFHandler< 1 > &dof_handler)
 
template CutPhaseType get_cut_type (const dealii::DoFHandler< 2 > &dof_handler)
 
template CutPhaseType get_cut_type (const dealii::DoFHandler< 3 > &dof_handler)
 
template void set_fe_index< 1 > (const dealii::DoFHandler< 1 > &, const dealii::NonMatching::MeshClassifier< 1 > &, const bool)
 
template void set_fe_index< 2 > (const dealii::DoFHandler< 2 > &, const dealii::NonMatching::MeshClassifier< 2 > &, const bool)
 
template void set_fe_index< 3 > (const dealii::DoFHandler< 3 > &, const dealii::NonMatching::MeshClassifier< 3 > &, const bool)
 
template bool cell_classifications_changed (const dealii::Triangulation< 1 > &, const dealii::NonMatching::MeshClassifier< 1 > &, const dealii::NonMatching::MeshClassifier< 1 > &, const MPI_Comm)
 
template bool cell_classifications_changed (const dealii::Triangulation< 2 > &, const dealii::NonMatching::MeshClassifier< 2 > &, const dealii::NonMatching::MeshClassifier< 2 > &, const MPI_Comm)
 
template bool cell_classifications_changed (const dealii::Triangulation< 3 > &, const dealii::NonMatching::MeshClassifier< 3 > &, const dealii::NonMatching::MeshClassifier< 3 > &, const MPI_Comm)
 
template void compute_intersected_quadrature (std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > > >, dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > &, const dealii::DoFHandler< 1 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 1, double, dealii::VectorizedArray< double > > &, const int, const bool, const bool, std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > > >)
 
template void compute_intersected_quadrature (std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > > >, dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > &, const dealii::DoFHandler< 2 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 2, double, dealii::VectorizedArray< double > > &, const int, const bool, const bool, std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > > >)
 
template void compute_intersected_quadrature (std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > > >, dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > &, const dealii::DoFHandler< 3 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 3, double, dealii::VectorizedArray< double > > &, const int, const bool, const bool, std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > > >)
 
template void compute_immersed_surface_quadrature (dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > &, const dealii::DoFHandler< 1 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 1, double, dealii::VectorizedArray< double > > &, const int)
 
template void compute_immersed_surface_quadrature (dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > &, const dealii::DoFHandler< 2 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 2, double, dealii::VectorizedArray< double > > &, const int)
 
template void compute_immersed_surface_quadrature (dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > &, const dealii::DoFHandler< 3 > &, const dealii::LinearAlgebra::distributed::Vector< double > &, const dealii::MatrixFree< 3, double, dealii::VectorizedArray< double > > &, const int)
 

Detailed Description

Utilities for the weighted repartitioning of a parallel::distributed::Triangulation in cutFEM/cutDG applications.

The cost of a cell in a cut application strongly depends on its location with respect to the zero level-set isosurface: Intersected cells require non-matching quadrature rules, FEPointEvaluation and ghost-penalty stabilization (and, for two-phase problems, carry the DoFs of both phases), while cells completely inside or outside are evaluated with the standard matrix-free kernels. The tools in this file allow to repartition the triangulation such that the sum of the cell weights is balanced among the MPI processes.

Typedef Documentation

◆ MappingInfoType

template<int dim, typename number >
using MeltPoolDG::CutUtil::MappingInfoType = typedef dealii::NonMatching::MappingInfo<dim, dim, dealii::VectorizedArray<number> >

Definition of aliases for dealii::MappingInfo types.

◆ MappingInfoVectorType

template<int dim, typename number >
using MeltPoolDG::CutUtil::MappingInfoVectorType = typedef std::vector<std::shared_ptr<MappingInfoType<dim, number> >>

◆ NormType

using MeltPoolDG::CutUtil::NormType = typedef dealii::VectorTools::NormType

Enumeration Type Documentation

◆ CellCategory

Definition of the cell category numbering (active FE index).

Enumerator
liquid 
intersected 
gas 

◆ FaceType

Enumeration for the face type.

Enumerator
inside_face_liquid 
inside_face_gas 
intersected_face 
mixed_face_liquid_intersected 
mixed_face_intersected_liquid 
mixed_face_gas_intersected 
mixed_face_intersected_gas 

Function Documentation

◆ cell_classifications_changed() [1/4]

template bool MeltPoolDG::CutUtil::cell_classifications_changed ( const dealii::Triangulation< 1 > &  ,
const dealii::NonMatching::MeshClassifier< 1 > &  ,
const dealii::NonMatching::MeshClassifier< 1 > &  ,
const MPI_Comm   
)

◆ cell_classifications_changed() [2/4]

template bool MeltPoolDG::CutUtil::cell_classifications_changed ( const dealii::Triangulation< 2 > &  ,
const dealii::NonMatching::MeshClassifier< 2 > &  ,
const dealii::NonMatching::MeshClassifier< 2 > &  ,
const MPI_Comm   
)

◆ cell_classifications_changed() [3/4]

template bool MeltPoolDG::CutUtil::cell_classifications_changed ( const dealii::Triangulation< 3 > &  ,
const dealii::NonMatching::MeshClassifier< 3 > &  ,
const dealii::NonMatching::MeshClassifier< 3 > &  ,
const MPI_Comm   
)

◆ cell_classifications_changed() [4/4]

template<int dim>
bool MeltPoolDG::CutUtil::cell_classifications_changed ( const dealii::Triangulation< dim > &  tria,
const dealii::NonMatching::MeshClassifier< dim > &  mesh_classifier_old,
const dealii::NonMatching::MeshClassifier< dim > &  mesh_classifier,
const MPI_Comm  mpi_comm 
)

Return true if at least one cell (on any MPI rank) changed its location with respect to the level set between mesh_classifier_old and mesh_classifier.

Since the FE index of a cell (liquid / intersected / gas) is determined solely by its location (see CutUtil::set_fe_index), an unchanged classification on a fixed mesh implies an unchanged DoF layout, i.e. the same number of DoFs, the same DoF numbering and parallel partitioning, and the same coupling (sparsity) structure.

Parameters
triaThe triangulation whose cells are checked for changes in their classification.
mesh_classifier_oldThe mesh classifier from the previous state, used as the reference classification.
mesh_classifierThe current mesh classifier against which mesh_classifier_old is compared.
mpi_commThe MPI communicator over which the result is reduced, so that the function returns true if a change occurred on any MPI rank.
Returns
true if at least one cell changed its location with respect to the level set; false otherwise.

◆ compute_cut_norm() [1/4]

template double MeltPoolDG::CutUtil::compute_cut_norm ( const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 1, double, dealii::VectorizedArray< double > > &  ,
const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > > > &  ,
const bool  ,
const dealii::FE_Q< 1 > &  ,
const unsigned int  ,
const unsigned int  ,
const NormType   
)

◆ compute_cut_norm() [2/4]

template double MeltPoolDG::CutUtil::compute_cut_norm ( const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 2, double, dealii::VectorizedArray< double > > &  ,
const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > > > &  ,
const bool  ,
const dealii::FE_Q< 2 > &  ,
const unsigned int  ,
const unsigned int  ,
const NormType   
)

◆ compute_cut_norm() [3/4]

template double MeltPoolDG::CutUtil::compute_cut_norm ( const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 3, double, dealii::VectorizedArray< double > > &  ,
const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > > > &  ,
const bool  ,
const dealii::FE_Q< 3 > &  ,
const unsigned int  ,
const unsigned int  ,
const NormType   
)

◆ compute_cut_norm() [4/4]

template<int dim, typename number >
number MeltPoolDG::CutUtil::compute_cut_norm ( const dealii::LinearAlgebra::distributed::Vector< number > &  solution,
const dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > &  matrix_free,
const std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< dim, dim, dealii::VectorizedArray< number > > > > &  mapping_info_cells,
const bool  is_two_phase,
const dealii::FE_Q< dim > &  reference_element,
const unsigned int  dof_idx,
const unsigned int  quad_idx,
const NormType  norm_type = NormType::L2_norm 
)

Compute the norm of a solution vector with a non-fitted (cut) domain representation.

This function computes either the L1 or L2 norm of the given solution vector on a mesh that may include non-fitted (sub)domain boundaries (e.g., liquid, gas, or intersected cells). The norm is computed with optional two-phase support.

Parameters
solutionThe current solution vector.
matrix_freeThe MatrixFree object.
mapping_info_cellsVector of MappingInfo objects for subdomains (e.g., liquid/gas), required for intersected cells.
is_two_phaseIf true, handles the two-phase setup, processing both components separately (liquid and gas).
reference_elementReference finite element used for FEPointEvaluation.
dof_idxIndex of the DoFHandler inside the MatrixFree object.
quad_idxIndex of the quadrature rule inside the MatrixFree object.
norm_typeThe type of norm to compute (L1 or L2), defined by NormType enum.
Returns
The computed norm (L1 or L2) over the mesh, correctly reduced across MPI processes.
Note
Currently implemented only for scalar fields (n_components == 1). An assertion fails if this is not satisfied.

◆ compute_immersed_surface_quadrature() [1/4]

template void MeltPoolDG::CutUtil::compute_immersed_surface_quadrature ( dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > &  ,
const dealii::DoFHandler< 1 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 1, double, dealii::VectorizedArray< double > > &  ,
const int   
)

◆ compute_immersed_surface_quadrature() [2/4]

template void MeltPoolDG::CutUtil::compute_immersed_surface_quadrature ( dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > &  ,
const dealii::DoFHandler< 2 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 2, double, dealii::VectorizedArray< double > > &  ,
const int   
)

◆ compute_immersed_surface_quadrature() [3/4]

template void MeltPoolDG::CutUtil::compute_immersed_surface_quadrature ( dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > &  ,
const dealii::DoFHandler< 3 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 3, double, dealii::VectorizedArray< double > > &  ,
const int   
)

◆ compute_immersed_surface_quadrature() [4/4]

template<int dim, typename number , typename VectorType >
void MeltPoolDG::CutUtil::compute_immersed_surface_quadrature ( MappingInfoType< dim, number > &  mapping_info_surface,
const dealii::DoFHandler< dim > &  level_set_dof_handler,
const VectorType &  level_set,
const dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > &  matrix_free,
const int  fe_degree 
)

This function generates the immersed quadrature rules in the case that the domain is described by a discrete level-set function.

It is an overload of the above function, which is used when the cut quadrature rules are only needed for the surface integrals.

The class NonMatching::DiscreteQuadratureGenerator<dim> is used to generate the immersed quadrature rules, for the immersed geometry described by discrete level-set function via a (level_set_dof_handler, level_set) pair.

Template Parameters
dimDimension in which this function is to be used.
numberFloating-point value type used for this function.
VectorTypeVector type used for this function.
Parameters
mapping_info_surfacedealii::NonMatching::MappingInfo object, provides the mapping information computation and mapping data storage of the surface.
level_set_dof_handlerDoFHandler object of the discrete level-set.
level_setDiscrete level-set vector.
matrix_freeMatrix free object, provides the iterators.
fe_degree
Note
Currently, the fe_degree has to be the same for both subdomains in the case of a two-domain problem.
Keep attention of the definition of the level-set field orientation. Currently, the single-phase region is assigned to the positive level-set region.

◆ compute_intersected_quadrature() [1/4]

template<int dim, typename number , typename VectorType >
void MeltPoolDG::CutUtil::compute_intersected_quadrature ( MappingInfoVectorType< dim, number >  mapping_info_cells,
MappingInfoType< dim, number > &  mapping_info_surface,
const dealii::DoFHandler< dim > &  level_set_dof_handler,
const VectorType &  level_set,
const dealii::MatrixFree< dim, number, dealii::VectorizedArray< number > > &  matrix_free,
const int  fe_degree,
const bool  is_two_phase,
const bool  is_dg = false,
MappingInfoVectorType< dim, number >  mapping_info_faces = {} 
)

This function generates the immersed quadrature rules in the case that the domain is described by a discrete level-set function.

The class NonMatching::DiscreteQuadratureGenerator<dim> is used to generate the immersed quadrature rules, for the immersed geometry described by discrete level-set function via a (level_set_dof_handler, level_set) pair.

Template Parameters
dimDimension in which this function is to be used.
numberFloating-point value type used for this function.
VectorTypeVector type used for this function.
Parameters
level_set_dof_handlerDoFHandler object of the discrete level-set.
level_setDiscrete level-set vector.
matrix_freeMatrix free object, provides the iterators.
mapping_info_cellsVector of dealii::NonMatching::MappingInfo objects, provides the mapping information computation and mapping data storage of the cells on the inner subdomain and the outer subdomain, respectively.
mapping_info_surfacedealii::NonMatching::MappingInfo object, provides the mapping information computation and mapping data storage of the surface.
fe_degree
is_two_phase
is_dgConsider FE_DGQ elements?
mapping_info_facesVector of dealii::NonMatching::MappingInfo objects, provides the mapping information computation and mapping data storage of the faces on the inner subdomain and the outer subdomain, respectively.
Note
Currently, the fe_degree has to be the same for both subdomains in the case of a two-domain problem.
Keep attention of the definition of the level-set field orientation. Currently, the single-phase region is assigned to the positive level-set region.

◆ compute_intersected_quadrature() [2/4]

template void MeltPoolDG::CutUtil::compute_intersected_quadrature ( std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > > >  ,
dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > &  ,
const dealii::DoFHandler< 1 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 1, double, dealii::VectorizedArray< double > > &  ,
const int  ,
const bool  ,
const bool  ,
std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 1, 1, dealii::VectorizedArray< double > > > >   
)

◆ compute_intersected_quadrature() [3/4]

template void MeltPoolDG::CutUtil::compute_intersected_quadrature ( std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > > >  ,
dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > &  ,
const dealii::DoFHandler< 2 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 2, double, dealii::VectorizedArray< double > > &  ,
const int  ,
const bool  ,
const bool  ,
std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 2, 2, dealii::VectorizedArray< double > > > >   
)

◆ compute_intersected_quadrature() [4/4]

template void MeltPoolDG::CutUtil::compute_intersected_quadrature ( std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > > >  ,
dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > &  ,
const dealii::DoFHandler< 3 > &  ,
const dealii::LinearAlgebra::distributed::Vector< double > &  ,
const dealii::MatrixFree< 3, double, dealii::VectorizedArray< double > > &  ,
const int  ,
const bool  ,
const bool  ,
std::vector< std::shared_ptr< dealii::NonMatching::MappingInfo< 3, 3, dealii::VectorizedArray< double > > > >   
)

◆ deserialize_internal() [1/4]

template void MeltPoolDG::CutUtil::deserialize_internal ( const AttachDoFHandlerAndVectorsType< 1, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const std::function< void()> &  ,
const dealii::DoFHandler< 1 > &  ,
const std::function< void()> &  ,
const std::string &   
)

◆ deserialize_internal() [2/4]

template void MeltPoolDG::CutUtil::deserialize_internal ( const AttachDoFHandlerAndVectorsType< 2, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const std::function< void()> &  ,
const dealii::DoFHandler< 2 > &  ,
const std::function< void()> &  ,
const std::string &   
)

◆ deserialize_internal() [3/4]

template void MeltPoolDG::CutUtil::deserialize_internal ( const AttachDoFHandlerAndVectorsType< 3, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const std::function< void()> &  ,
const dealii::DoFHandler< 3 > &  ,
const std::function< void()> &  ,
const std::string &   
)

◆ deserialize_internal() [4/4]

template<int dim, typename VectorType >
void MeltPoolDG::CutUtil::deserialize_internal ( const AttachDoFHandlerAndVectorsType< dim, VectorType > &  attach_vectors,
const std::function< void()> &  post,
const std::function< void()> &  distribute_level_set_dofs,
const dealii::DoFHandler< dim > &  level_set_dof_handler,
const std::function< void()> &  setup_dof_system,
const std::string &  prefix 
)

Same as Restart::deserialize_internal(), but adapted for cases where one or more DoFHandler objects are used in CutFEM operations.

Similarly to CutUtil::refine_grid(), the level set must be transferred first, so the CutFEM operation can classify the mesh to distribute its DoFs before transferring its solution.

Parameters
distribute_level_set_dofsLambda function, that distributes the DoFs of the level_set_dof_handler.
level_set_dof_handlerDoF-Handler for the level-set field.

same as in Restart::deserialize_internal():

Parameters
attach_vectorsLambda function of type AttachDoFHandlerAndVectorsType, that attaches all DoFHandlers and their respective DoFVectors that ought to be reconstructed.
postThis lambda function is run after AMR was executed.
setup_dof_systemSet up the dof system, this includes:
  • distribute DoFs on the new mesh
  • create partitioning for the new mesh
  • setup constraints on the new mesh
  • reinit the MatrixFree object for the new DoFs (ScratchData::build())
  • initialize all DoF vectors for the new DoF layout
prefixFile basename.

◆ do_repartition()

bool MeltPoolDG::CutUtil::do_repartition ( const unsigned int  n_time_step,
const CutRepartitionData &  repartition_data 
)
inline

Determine whether the triangulation should be repartitioned at time step number n_time_step.

Parameters
n_time_stepCurrent time step number.
repartition_dataRepartitioning parameters.
Returns
True if repartitioning is enabled and n_time_step is a multiple of repartition_data.every_n_step.

◆ evaluate_intersected_domain()

template<int dim, typename number , int n_components = 1>
void MeltPoolDG::CutUtil::evaluate_intersected_domain ( dealii::FEPointEvaluation< n_components, dim, dim, dealii::VectorizedArray< number > > &  point_eval,
const FECellIntegrator< dim, n_components, number > &  cell_eval,
const dealii::EvaluationFlags::EvaluationFlags  evaluation_flags,
const unsigned int  cell_batch,
const unsigned int  cell_lane,
const unsigned int  n_dofs_per_cell 
)
inline

Evaluates solution values in the intersected domain for a specific SIMD lane within a cell batch.

This function performs finite element point evaluation on a single lane (i.e., SIMD vector entry) of a cell batch in the context of vectorized matrix-free computations.

It uses the given FECellIntegrator to access DoF values and performs an evaluation at the point corresponding to the provided lane index.

Template Parameters
dimDimension in which this function is to be used.
numberFloating-point value type used for this function.
n_componentsNumber of solution components (per phase). The default value is 1, which corresponds to scalar problems.
Parameters
point_evalFEPointEvaluation object in which the evaluations are stored.
cell_evalFECellIntegrator providing the DoF values.
evaluation_flagsFlags indicating what kind of evaluation (values, gradients, etc.) to perform.
cell_batchCell batch index
cell_laneThe SIMD lane within the batch to evaluate.
n_dofs_per_cellNumber of DoFs per cell in the evaluated system.

◆ face_has_ghost_penalty()

template<int dim>
bool MeltPoolDG::CutUtil::face_has_ghost_penalty ( const dealii::NonMatching::MeshClassifier< dim > &  mesh_classifier,
const typename dealii::Triangulation< dim >::active_cell_iterator &  cell,
const unsigned int  face_index,
const dealii::NonMatching::LocationToLevelSet &  inactive_location = dealii::NonMatching::LocationToLevelSet::inside 
)

This function checks whether the currently considered face requires the application of ghost-penalty stabilization or not.

A face is a ghost-penalty face if one of the two adjacent cells is an intersected cell and the other cell is either inside the active domain or is also an intersected cell.

Template Parameters
dimDimension in which this function is to be used.
Parameters
mesh_classifierThe NonMatching::MeshClassifier object which contains the information, how the active cells and faces of the triangulation are related to the sign of a level set function. Note that the reclassify() function has to be called before, so that the cell and face locations are categorized as one of the values of LocationToLevelSet: inside, outside or intersected.
cellThe considered cell for the function evaluation.
face_indexThe index of the considered face, for which the check is done, whether this face is a ghost-penalty-face or not.
inactive_locationLocation of the domain, which is not active (location for which a FE_Nothing element is set).
Note
For multiple component problems, the inactive_location has to be chosen carefully at the relevant code section, at which this function is called, as the inactive_location depends on the currently considered component. For single component problems, the default value of the inactive location is outside.

◆ face_type_has_ghost_penalty()

constexpr bool MeltPoolDG::CutUtil::face_type_has_ghost_penalty ( const FaceType  face_type,
const bool  is_liquid_phase 
)
constexpr

Checks whether the ghost penalty stabilization applies on a face.

The ghost penalty of a phase is applied on faces where that phase is present in the cells on both sides and at least one of them is cut:

  • intersected faces (both cells cut): true for both phases
  • liquid phase: also true on liquid–intersected faces (mixed_face_liquid_intersected, mixed_face_intersected_liquid)
  • gas phase: also true on gas–intersected faces (mixed_face_gas_intersected, mixed_face_intersected_gas)

For all other face types the function returns false.

Parameters
face_typeFace type, as returned by CutUtil::get_face_type().
is_liquid_phasetrue to query the liquid phase, false for the gas phase.
Returns
true if the ghost penalty must be applied for the given phase on this face.

◆ get_cut_type() [1/4]

template CutPhaseType MeltPoolDG::CutUtil::get_cut_type ( const dealii::DoFHandler< 1 > &  dof_handler)

◆ get_cut_type() [2/4]

template CutPhaseType MeltPoolDG::CutUtil::get_cut_type ( const dealii::DoFHandler< 2 > &  dof_handler)

◆ get_cut_type() [3/4]

template CutPhaseType MeltPoolDG::CutUtil::get_cut_type ( const dealii::DoFHandler< 3 > &  dof_handler)

◆ get_cut_type() [4/4]

template<int dim>
CutPhaseType MeltPoolDG::CutUtil::get_cut_type ( const dealii::DoFHandler< dim > &  dof_handler)

Enum that names a type of CutFEM in use.

  • not_cut: no CutFEM in use, the field in continuous
  • one_phase_cut: The domain of the field is restricted to the liquid domain, i.e., positive level set values. CutFEM is used for cells that contain the interface.
  • two_phase_cut: The domain is cut at the interface with the liquid domain

Determine the CutPhaseType of the dof_handler.

Template Parameters
dimDimension in which this function is to be used.
Parameters
dof_handlerGiven DoF-Handler.
Returns
CutPhaseType of the considered dof_handler.

◆ get_face_type()

FaceType MeltPoolDG::CutUtil::get_face_type ( const std::pair< unsigned int, unsigned int > &  adjacent_cell_categories)

This function categorizes the FaceType of the current face range.

Parameters
adjacent_cell_categoriesPair which contains the category of the cells on the two sides of the current range of faces.

@retrun FaceType of the shared face between the provided cell pair.

◆ is_new_intersected_face()

template<int dim>
bool MeltPoolDG::CutUtil::is_new_intersected_face ( const dealii::NonMatching::MeshClassifier< dim > &  mesh_classifier,
const dealii::NonMatching::MeshClassifier< dim > &  mesh_classifier_old,
const typename dealii::Triangulation< dim >::active_cell_iterator &  cell,
const unsigned int  face_index,
const dealii::NonMatching::LocationToLevelSet &  inactive_location = dealii::NonMatching::LocationToLevelSet::inside 
)

This function checks whether the considered face is a newly created intersected face.

This occurs when both adjacent cells of the face are currently intersected cells and were in the inactive location in the old state. This function is created for handling moving interface problems.

Template Parameters
dimDimension in which this function is to be used.
Parameters
mesh_classifier_oldThe NonMatching::MeshClassifier object which contains the information, how the active cells and faces of the triangulation are related to the sign of a level set function at the old state. The cell and face locations are categorized as one of the values of LocationToLevelSet: inside, outside or intersected.
mesh_classifierThe NonMatching::MeshClassifier object which contains the information, how the active cells and faces of the triangulation are related to the sign of a level set function at the current state. The cell and face locations are categorized as one of the values of LocationToLevelSet: inside, outside or intersected.
cellThe considered cell for the function evaluation.
face_indexThe index of the considered face, for which the check is done, whether this face is a newly created intersected face or not.
inactive_locationLocation of the domain, which is not active (location for which a FE_Nothing element is set).
Note
For multiple component problems, the inactive_location has to be chosen carefully at the relevant code section, at which this function is called, as the inactive_location depends on the currently considered component. For single component problems, the default value of the inactive location is outside. It has to be ensured that the mesh_classifier_old and mesh_classifier are reclassified according to the correct states.

◆ refine_grid() [1/4]

template void MeltPoolDG::CutUtil::refine_grid ( const AMR::MarkCellsForRefinementType< 1 > &  ,
const AttachDoFHandlerAndVectorsType< 1, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const std::function< void()> &  ,
const dealii::DoFHandler< 1 > &  ,
dealii::LinearAlgebra::distributed::Vector< double > &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::Triangulation< 1 > &  ,
const int   
)

◆ refine_grid() [2/4]

template void MeltPoolDG::CutUtil::refine_grid ( const AMR::MarkCellsForRefinementType< 2 > &  ,
const AttachDoFHandlerAndVectorsType< 2, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const std::function< void()> &  ,
const dealii::DoFHandler< 2 > &  ,
dealii::LinearAlgebra::distributed::Vector< double > &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::Triangulation< 2 > &  ,
const int   
)

◆ refine_grid() [3/4]

template void MeltPoolDG::CutUtil::refine_grid ( const AMR::MarkCellsForRefinementType< 3 > &  ,
const AttachDoFHandlerAndVectorsType< 3, dealii::LinearAlgebra::distributed::Vector< double > > &  ,
const std::function< void()> &  ,
const std::function< void()> &  ,
const dealii::DoFHandler< 3 > &  ,
dealii::LinearAlgebra::distributed::Vector< double > &  ,
const std::function< void()> &  ,
const AdaptiveMeshingData< double > &  ,
dealii::Triangulation< 3 > &  ,
const int   
)

◆ refine_grid() [4/4]

template<int dim, typename VectorType , typename number = typename VectorType::value_type>
void MeltPoolDG::CutUtil::refine_grid ( const AMR::MarkCellsForRefinementType< dim > &  mark_cells_for_refinement,
const AttachDoFHandlerAndVectorsType< dim, VectorType > &  attach_vectors,
const std::function< void()> &  post,
const std::function< void()> &  distribute_level_set_dofs,
const dealii::DoFHandler< dim > &  level_set_dof_handler,
VectorType &  level_set_dof_vector,
const std::function< void()> &  setup_dof_system,
const AdaptiveMeshingData< number > &  amr,
dealii::Triangulation< dim > &  tria,
const int  n_time_step 
)

same as AMR::refine_grid(), but adapted for cases where one or more DoFHandler objects are used in CutFEM operations.

Similarly to CutUtil::deserialize_internal(), the level set must be transferred first, so the CutFEM operation can classify the mesh to distribute its DoFs before transferring its solution.

Parameters
distribute_level_set_dofsLambda function, that distributes the DoFs of the level_set_dof_handler. If no data is attached by attach_vectors, e.g., for AMR at the initial condition, this lambda function must also interpolate the initial level set solution onto the level_set_dof_vector.
level_set_dof_handlerDoF-Handler for the level-set field.
level_set_dof_vectorLevel-set DoF vector.

same as in AMR::refine_grid():

Parameters
mark_cells_for_refinementLambda function of type MarkCellsForRefinementType, see its documentation for info.
attach_vectorsLambda function of type AttachDoFHandlerAndVectorsType, that attaches all DoFHandlers and their respective DoFVectors that ought to be transferred to the new mesh.
postThis lambda function is run after AMR was executed.
setup_dof_systemSet up the dof system, this includes:
  • distribute DoFs on the new mesh
  • create partitioning for the new mesh
  • set up constraints on the new mesh
  • reinit the MatrixFree object for the new DoFs (ScratchData::build())
  • initialize all DoF vectors for the new DoF
amrData struct for adaptive meshing parameters.
triaTriangulation object.
n_time_stepCurrent time step number.

◆ repartition_triangulation()

template<int dim, typename VectorType >
bool MeltPoolDG::CutUtil::repartition_triangulation ( dealii::Triangulation< dim > &  tria,
const AttachDoFHandlerAndVectorsType< dim, VectorType > &  attach_vectors,
const std::function< void()> &  distribute_level_set_dofs,
const dealii::DoFHandler< dim > &  level_set_dof_handler,
VectorType &  level_set_dof_vector,
const std::function< void()> &  setup_dof_system,
const std::function< void()> &  post = {} 
)

Repartition the triangulation tria among the MPI processes and transfer the attached DoF vectors and the level-set field to the new partitioning.

This function is designed similarly to CutUtil::refine_grid() for applications where one or more DoFHandler objects are used in cut operations: The level set is transferred first, so that the cut operations can classify the mesh according to it, before their DoFs are distributed and their solution vectors are transferred.

The following steps are performed:

  1. Prepare the solution transfer of the level set and of the attached vectors.
  2. Repartition the triangulation.
  3. Distribute the level-set DoFs via distribute_level_set_dofs and transfer the level set.
  4. Call setup_dof_system.
  5. Transfer the attached vectors.
  6. Call post.

The cells are weighted with the function connected to the weight signal of tria. Call PartitionWeights::update() directly before this function. The cached weights are transferred to the new partitioning automatically.

Parameters
triaTriangulation, which must be of type parallel::distributed::Triangulation.
attach_vectorsLambda function of type AttachDoFHandlerAndVectorsType, that attaches all DoFHandlers (except the one of the level set) and their respective DoF vectors that ought to be transferred.
distribute_level_set_dofsLambda function, that distributes the DoFs of the level_set_dof_handler and reinitializes the level_set_dof_vector for the new partitioning.
level_set_dof_handlerDoFHandler of the level-set field.
level_set_dof_vectorLevel-set DoF vector. After the transfer, its ghost values are updated, as required by the cut operations.
setup_dof_systemSet up the dof system.
postOptional lambda function, which is run at the end.
Returns
True if the triangulation has been repartitioned, false if tria is not a parallel::distributed::Triangulation (e.g. for dim = 1).

◆ set_fe_index()

template<int dim>
void MeltPoolDG::CutUtil::set_fe_index ( const dealii::DoFHandler< dim > &  dof_handler,
const dealii::NonMatching::MeshClassifier< dim > &  mesh_classifier,
const bool  set_future 
)

This function is setting the FE index for every cell.

Template Parameters
dimDimension in which this function is to be used.
Parameters
dof_handlerDoFHandler object, provides the cell iterator.
mesh_classifierThe dealii::NonMatching::MeshClassifier object which contains the information, how the active cells and faces of the triangulation are related to the sign of a level set function. Note that the reclassify() function has to be called before, so that the cell and face locations are categorized as one of the values of dealii::NonMatching::LocationToLevelSet: inside, outside or intersected.
set_futureCriteria, whether the active FE index should be set (false) or the future FE index should be set (true) in this function.

◆ set_fe_index< 1 >()

template void MeltPoolDG::CutUtil::set_fe_index< 1 > ( const dealii::DoFHandler< 1 > &  ,
const dealii::NonMatching::MeshClassifier< 1 > &  ,
const bool   
)

◆ set_fe_index< 2 >()

template void MeltPoolDG::CutUtil::set_fe_index< 2 > ( const dealii::DoFHandler< 2 > &  ,
const dealii::NonMatching::MeshClassifier< 2 > &  ,
const bool   
)

◆ set_fe_index< 3 >()

template void MeltPoolDG::CutUtil::set_fe_index< 3 > ( const dealii::DoFHandler< 3 > &  ,
const dealii::NonMatching::MeshClassifier< 3 > &  ,
const bool   
)