Utilities Namespace Reference

Developer Documentation: MeltPoolDG::Utilities Namespace Reference
Developer Documentation
MeltPoolDG::Utilities Namespace Reference

Namespaces

namespace  MatrixFree
 

Classes

struct  LimiterData
 

Functions

template<int n_components, typename TensorType , typename Container >
TensorType tvd_minmod (const Container &values)
 
template<typename number , int n_components, typename TensorType , typename Container >
TensorType tvb_minmod (const Container &values, const std::vector< number > &tvb_constant, const number cell_size)
 
template<int dim, int n_components, typename number >
std::array< dealii::Tensor< 1, n_components, number >, dim > compute_minmod_type_limited_slopes (const std::vector< std::pair< dealii::Tensor< 1, n_components, number >, dealii::Tensor< 1, n_components, dealii::Tensor< 1, dim, number > > > > &cell_average_values, const typename dealii::Triangulation< dim >::active_cell_iterator &cell, const LimiterData< number > &limiter_data)
 
template<int dim, int n_components, typename number , typename VectorizedArrayType = dealii::VectorizedArray<number>, typename VectorType = dealii::LinearAlgebra::distributed::Vector<number>>
void apply_minmod_type_limiter (const MatrixFreeContext< dim, number > &mf_context, VectorType &dst, const VectorType &src, const LimiterData< number > &limiter_data)
 

Function Documentation

◆ apply_minmod_type_limiter()

template<int dim, int n_components, typename number , typename VectorizedArrayType = dealii::VectorizedArray<number>, typename VectorType = dealii::LinearAlgebra::distributed::Vector<number>>
void MeltPoolDG::Utilities::apply_minmod_type_limiter ( const MatrixFreeContext< dim, number > &  mf_context,
VectorType &  dst,
const VectorType &  src,
const LimiterData< number > &  limiter_data 
)

This function applies a minmod-type limiter to the solution vector in a cell-wise manner using the provided matrix-free context. It basically iterates over each cell to compute the limited solution based on the specified limiter type in the limiter data struct. For more details see Cockburn and Shu, "The Runge-Kutta Discontinuous Galerkin Method for Conservation Laws V: Multidimensional Systems", Journal of Computational Physics, 141(2):199–224, 1998.

Parameters
mf_contextContext containing a reference to the matrix-free object and relevant indices for dofs and quadrature.
dstThe destination vector where the limited solution will be stored.
srcThe source vector containing the current solution values to be limited.
limiter_dataStruct containing the limiter type and relevant parameters for the limiter.

◆ compute_minmod_type_limited_slopes()

template<int dim, int n_components, typename number >
std::array< dealii::Tensor< 1, n_components, number >, dim > MeltPoolDG::Utilities::compute_minmod_type_limited_slopes ( const std::vector< std::pair< dealii::Tensor< 1, n_components, number >, dealii::Tensor< 1, n_components, dealii::Tensor< 1, dim, number > > > > &  cell_average_values,
const typename dealii::Triangulation< dim >::active_cell_iterator &  cell,
const LimiterData< number > &  limiter_data 
)

This function computes the limited slopes for a given cell using a minmod-type limiter. It computes the finite difference slopes with respect to the cell averages of the current cell and its neighbors in all direction separately and passes them together with the average cell gradient to the appropriate minmod-type limiter function (TVD or TVB) based on the specified limiter type in the limiter data struct. The resulting limited slopes are returned as an array of tensors, where each tensor corresponds to a spatial direction.

Parameters
cell_average_valuesA vector containing the cell average values for all cells in the domain.
cellThe active cell iterator for the current cell for which the limited slopes are being computed.
average_cell_gradientThe average cell gradient for the current cell, i.e. a linearized representation of the solution gradient in the cell.
limiter_dataStruct containing the limiter type and relevant parameters for the limiter.
Returns
An array of tensors containing the limited slopes for each spatial direction.

◆ tvb_minmod()

template<typename number , int n_components, typename TensorType , typename Container >
TensorType MeltPoolDG::Utilities::tvb_minmod ( const Container &  values,
const std::vector< number > &  tvb_constant,
const number  cell_size 
)

Computes the Total Variation Bounded (TVB) modified minmod of a container of tensors. The TVB minmod variant relaxes the strict TVD minmod criteria near smooth extrema to avoid unnecessary clipping of physical peaks. For each component, if the initial candidate slope (values[0]) is bounded by the threshold $M \cdot \Delta x^2$ (where $M$ is tvb_constant and $\Delta x$ is cell_size), the slope is considered smooth and left entirely unmodified. If it exceeds this threshold, the function falls back to the standard tvd_minmod routine for that component.

Template Parameters
numberThe numeric type used int the computations.
n_componentsThe number of components in the solution vector which are being limited.
TensorTypeThe type of the tensor representing the solution values. This should be a dealii::Tensor type with the first template parameter equal to 1 and the second template parameter equal to n_components.
ContainerThe type of the container holding the values. This can be any standard container (e.g., std::vector, std::array, boost::container::small_vector) that supports iterating over it and contains elements of type TensorType.
Parameters
valuesThe container of tensors to evaluate. The first element (values[0]) represents the current cell slope on the cell of interest.
tvb_constantThe tuning constant $M > 0$ determining the strictness of the bound.
cell_sizeThe characteristic mesh size of the local cell block, e.g. the mesh size in the direction of the slope being limited.
Returns
A tensor containing the component-wise TVB limited slopes.

◆ tvd_minmod()

template<int n_components, typename TensorType , typename Container >
TensorType MeltPoolDG::Utilities::tvd_minmod ( const Container &  values)

This function computes the component-wise minmod operator over all tensors in the given container. The standard minmod calculation for each component index $i$ is:

  • If all candidate values share the same sign, it returns the value with the smallest absolute magnitude.
  • If there is any sign change (indicating a local extremum), it returns zero to damp oscillations.
Template Parameters
ContainerThe type of the container holding the values. This can be any standard container (e.g., std::vector, std::array, boost::container::small_vector) that supports iterating over it and contains elements of type TensorType.
Parameters
valuesThe container of values for which to compute the minmod.
Returns
The minmod of the given values.