FESubcellEvaluation< dim, n_components, number > Class Template Reference

Developer Documentation: MeltPoolDG::FESubcellEvaluation< dim, n_components, number > Class Template Reference
Developer Documentation
MeltPoolDG::FESubcellEvaluation< dim, n_components, number > Class Template Reference

#include <fe_subcell_evaluation.hpp>

Public Member Functions

 FESubcellEvaluation (const dealii::MatrixFree< dim, number > &matrix_free, const unsigned int dof_no, const unsigned int quad_no)
 
 FESubcellEvaluation (const dealii::FEEvaluation< dim, -1, 0, n_components, number, VectorizedArrayType > &fe_evaluation)
 
void reinit (const unsigned int cell_batch_index)
 
void read_dof_values (const dealii::LinearAlgebra::distributed::Vector< number > &src_vector, const std::bitset< n_lanes > &mask=std::bitset< n_lanes >().flip())
 
void evaluate (const dealii::EvaluationFlags::EvaluationFlags evaluation_flags)
 
void gather_evaluate (const dealii::LinearAlgebra::distributed::Vector< number > &input_vector, const dealii::EvaluationFlags::EvaluationFlags evaluation_flags, const std::bitset< n_lanes > &mask=std::bitset< n_lanes >().flip())
 
value_type get_value (const unsigned int subcell_index) const
 
value_type get_face_value (const unsigned int subcell_face_index, const bool interior_value) const
 
gradient_type get_gradient (const unsigned int subcell_index) const
 
void submit_value (const unsigned int subcell_index, const value_type &value)
 
void submit_flux (const unsigned int subcell_face_index, const value_type &flux)
 
void integrate ()
 
void distribute_local_to_global (dealii::LinearAlgebra::distributed::Vector< number > &dst_vector, const std::bitset< n_lanes > &mask=std::bitset< n_lanes >().flip())
 
void integrate_scatter (dealii::LinearAlgebra::distributed::Vector< number > &dst_vector, const std::bitset< n_lanes > &mask=std::bitset< n_lanes >().flip())
 
void set_dof_values (dealii::LinearAlgebra::distributed::Vector< number > &dst, const std::bitset< n_lanes > &mask=std::bitset< n_lanes >().flip())
 
std::ranges::iota_view< unsigned int, unsigned int > subcell_indices () const
 
std::ranges::iota_view< unsigned int, unsigned int > subcell_face_indices () const
 
template<typename T >
T read_cell_data (const dealii::AlignedVector< T > &data) const
 
template<typename T >
void set_cell_data (dealii::AlignedVector< T > &data, const T &value) const
 
VectorizedArrayType subcell_size (const unsigned int subcell_index) const
 
VectorizedArrayType subcell_face_size (const unsigned int subcell_face_index) const
 
dealii::Point< dim, VectorizedArrayType > subcell_location (const unsigned int subcell_index) const
 
unsigned n_subcells () const
 
dealii::Tensor< 1, dim, VectorizedArrayType > subcell_face_normal_vector (const unsigned int subcell_face_index) const
 
std::pair< unsigned int, unsigned int > subcell_face_interior_exterior_indices (const unsigned int subcell_face_index) const
 

Private Types

using VectorizedArrayType = dealii::VectorizedArray< number >
 
using value_type = dealii::FEEvaluation< dim, -1, 0, n_components, number, VectorizedArrayType >::value_type
 
using gradient_type = dealii::FEEvaluation< dim, -1, 0, n_components, number, VectorizedArrayType >::gradient_type
 

Private Member Functions

void setup_internal_data_structures ()
 
void compute_intra_cell_face_sizes ()
 
void project_dof_values_to_subcell_values (const dealii::EvaluationFlags::EvaluationFlags evaluation_flags)
 
void project_subcell_values_to_dof_values (const std::vector< value_type > &values_to_project)
 
unsigned int compute_reference_coordinates_normal_direction (const unsigned int subcell_face_index) const
 
unsigned int face_adjacent_subcell_index (const unsigned int subcell_face_index, const bool interior_face) const
 

Private Attributes

unsigned int cell_batch_index
 
dealii::FEEvaluation< dim, -1, 0, n_components, number, VectorizedArrayType > fe_cell_evaluator
 
std::vector< value_type > subcell_values
 
std::vector< gradient_type > subcell_gradients
 
std::vector< value_type > submitted_subcell_values
 
std::vector< value_type > intra_cell_face_fluxes
 
std::vector< VectorizedArrayType > intra_cell_face_sizes
 
std::vector< value_type > integrated_values_buffer
 
std::vector< VectorizedArrayType > subcell_values_to_project_buffer
 
unsigned int n_subcells_1d
 
unsigned int n_subcells_total
 The total number of subcells on the current cell.
 
unsigned int n_intra_cell_faces
 
bool is_reinitialized = false
 
bool dof_values_initialized = false
 A flag indicating whether the DoF values have been set. Used for debug information.
 
bool subcell_values_initialized = false
 A flag indicating whether the subcell values have been set. Used for debug information.
 
bool subcell_gradients_initialized = false
 A flag indicating whether the subcell gradients have been set. Used for debug information.
 
bool subcell_values_submitted = false
 
bool subcell_fluxes_submitted = false
 

Static Private Attributes

static constexpr unsigned int n_lanes = VectorizedArrayType::size()
 

Detailed Description

template<int dim, int n_components, typename number>
class MeltPoolDG::FESubcellEvaluation< dim, n_components, number >

General Description

This class transfers a finite element solution on a matrix-free cell batch to a finite volume subcell representation and back. Each cell is split into subcells that are associated one-to-one with the quadrature points of the underlying dealii::FEEvaluation object, following Sonntag and Munz [1]:

  • DG to FV (evaluate()): the DG solution is evaluated at the quadrature points, and the value at quadrature point q is taken as the mean value of subcell s. The subcell volume is the corresponding quadrature weight times the Jacobian determinant. Note that the mean values used here are actually not the exact mean values over the corresponding subcells but as shown in [1], this choice can be justified as it still guarantees conservation.
  • FV to DG (integrate()): the subcell values submitted via submit_value() and the fluxes over the intra cell subcell faces submitted via submit_flux() are combined into one value per subcell. Each flux is multiplied by the face size and divided by the subcell size, and then added to the interior subcell and subtracted from the exterior subcell of its face. The result is then transformed back to the DG coefficients. To provide a more convenient interface, integrate_scatter() additionally adds these coefficients to the global solution vector.

Without fluxes, both transformations are inverse to each other and preserve the cell integral if the quadrature integrates the DG solution exactly. Since every flux enters its two adjacent subcells with opposite signs, the fluxes do not change the cell integral either.

The class does not compute any fluxes itself. Instead, it provides access to the subcell values, gradients and sizes as well as to the values, sizes and normal vectors of the intra cell subcell faces, i.e. the faces shared by two subcells of the same cell. The fluxes over the subcell faces on the boundary of the DG cell are handled by FESubcellFaceEvaluation in the matrix-free face loop. To integrate seamlessly with the deal.II matrix-free framework, the interface of this class mirrors that of dealii::FEEvaluation whenever possible.

Subcell Indexing and Face Ordering

For most of the normal use cases of this class, the ordering of the subcells and the subcell faces should not be relevant. However, for the case that you anyway need to know them or you work on the internals of the class, here is a short description of the ordering of both the subcells and the intra cell subcell faces.

The subcells are numbered lexicographically with the x-index varying fastest, i.e. in the same order as the quadrature points. The example below shows a two-dimensional cell with n_subcells_1d == 4. In general, the subcell widths follow the quadrature weights and are not equidistant.

    y
    ^
    |   +------+------+------+------+
    |   |  12  |  13  |  14  |  15  |
    |   +------+------+------+------+
    |   |   8  |   9  |  10  |  11  |
    |   +------+------+------+------+
    |   |   4  |   5  |   6  |   7  |
    |   +------+------+------+------+
    |   |   0  |   1  |   2  |   3  |
    |   +------+------+------+------+
    +----------------------------------> x
* 

In a three-dimensional cell, the above sketch would show the cells in the x-y plane with z being zero, i.e. the first layer in the z-direction. The next layer in the z-direction would then be numbered 16 to 31, where cell 16 would sit in the bottom-left corner of the layer and so on.

The intra cell subcell faces are numbered in a similar way, but the faces are grouped by their normal orientation d: first all faces normal to the x-direction, then those normal to the y-direction, and in 3D those normal to the z-direction. With n = n_subcells_1d, each group holds (n - 1) * n^(dim - 1) faces. Within a group, a face is identified by the indices of its interior subcell in all directions, where the index in its normal direction d runs from 0 to n - 2 and all others from 0 to n - 1. The faces are numbered lexicographically in these indices with the x-index varying fastest.

As it is common in DG and FV methods, we also use the definition of interior and exterior subcells. The interior subcell of a face is the subcell below the face in its normal direction d, the exterior subcell the one above. Thus, the index of the exterior subcell is the index of the interior subcell plus n^d. As for dealii::FEFaceEvaluation, the normal vector points out of the interior subcell, i.e. into the exterior subcell in the direction of increasing reference coordinate d.

To better illustrate this, let's consider a short example. Below you find a sketch of a two-dimensional case with n == 3 including the subcell and face numbering:

      subcells        faces normal to x   faces normal to y
   +---+---+---+       +---+---+---+       +---+---+---+
   | 6 | 7 | 8 |       |   4   5   |       |   |   |   |
   +---+---+---+       +---+---+---+       +-9-+-10+-11+
   | 3 | 4 | 5 |       |   2   3   |       |   |   |   |
   +---+---+---+       +---+---+---+       +-6-+-7-+-8-+
   | 0 | 1 | 2 |       |   0   1   |       |   |   |   |
   +---+---+---+       +---+---+---+       +---+---+---+
* 

For example, face 3 has the interior subcell 4 and the exterior subcell 5, and face 7 has the interior subcell 1 and the exterior subcell 4.

Note
The above description already shows a limitation of the current implementation: For physical cells that are rotated e.g. by 180° into the reference coordinates the returned normal vectors of subcell_face_normal_vector() point in the wrong direction. This is because the current implementation assumes that the reference coordinate directions coincide with the real ones. This is the case for Cartesian cells, but not for rotated cells. The current implementation therefore only supports Cartesian cells.

Usage Example

Let's have a short look on how this class can be used. The following example shows the cell part of a finite volume operator on the subcells within a matrix-free cell loop:

FESubcellEvaluation<dim, n_components, double> phi(matrix_free, dof_no, quad_no);
for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell)
{
phi.reinit(cell);
phi.gather_evaluate(src, dealii::EvaluationFlags::values);
for (const unsigned int f : phi.subcell_face_indices())
{
const auto flux = numerical_flux(phi.get_face_value(f, true),
phi.get_face_value(f, false),
phi.subcell_face_normal_vector(f));
phi.submit_flux(f, -flux);
}
phi.integrate_scatter(dst);
}
Definition fe_subcell_evaluation.hpp:188
std::ranges::iota_view< unsigned int, unsigned int > subcell_face_indices() const
Definition fe_subcell_evaluation.templates.hpp:225

Exactly one flux is submitted per intra cell subcell face. integrate() adds it, multiplied by the face size and divided by the subcell size, to the interior subcell and subtracts it from the exterior subcell. Hence, as on the interior side of FESubcellFaceEvaluation, a flux in the direction of the normal vector has to be submitted with a negative sign. The subcell faces on the boundary of the DG cell are not handled by this class. Their fluxes are submitted in the face loop using FESubcellFaceEvaluation, and both loops together add the complete finite volume right-hand side to dst.

If the subcell values themselves are to be modified, e.g. by a limiter, they are submitted with submit_value() instead, and the resulting DoF values overwrite the ones in dst:

for (unsigned int cell = cell_range.first; cell < cell_range.second; ++cell)
{
phi.reinit(cell);
phi.gather_evaluate(src, dealii::EvaluationFlags::values);
for (const unsigned int q : phi.subcell_indices())
phi.submit_value(q, limit(phi.get_value(q)));
phi.integrate();
phi.set_dof_values(dst);
}
void submit_value(const unsigned int subcell_index, const value_type &value)
Definition fe_subcell_evaluation.templates.hpp:130
value_type get_value(const unsigned int subcell_index) const
Definition fe_subcell_evaluation.templates.hpp:92
std::ranges::iota_view< unsigned int, unsigned int > subcell_indices() const
Definition fe_subcell_evaluation.templates.hpp:218

If both values and fluxes are submitted on the same cell, integrate() adds the flux contributions to the submitted values.

Literature References

[1] M. Sonntag, C.-D. Munz, Efficient parallelization of a shock capturing for discontinuous Galerkin methods using finite volume sub-cells, J. Sci. Comput. 70, 2017.

Member Typedef Documentation

◆ gradient_type

template<int dim, int n_components, typename number >
using MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::gradient_type = dealii::FEEvaluation<dim, -1, 0, n_components, number, VectorizedArrayType>::gradient_type
private

◆ value_type

template<int dim, int n_components, typename number >
using MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::value_type = dealii::FEEvaluation<dim, -1, 0, n_components, number, VectorizedArrayType>::value_type
private

◆ VectorizedArrayType

template<int dim, int n_components, typename number >
using MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::VectorizedArrayType = dealii::VectorizedArray<number>
private

Constructor & Destructor Documentation

◆ FESubcellEvaluation() [1/2]

template<int dim, int n_components, typename number >
MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::FESubcellEvaluation ( const dealii::MatrixFree< dim, number > &  matrix_free,
const unsigned int  dof_no,
const unsigned int  quad_no 
)

Constructor from a dealii::MatrixFree object, the DoF index and the quadrature index. The sets up all internal data structures.

Parameters
matrix_freeThe dealii::MatrixFree object used for evaluating the finite element solution on the cell and interacting with the matrix-free framework.
dof_noThe index of the DoF to be used for evaluating the finite element solution on the cell.
quad_noThe index of the quadrature to be used for evaluating the finite element solution on the cell.

◆ FESubcellEvaluation() [2/2]

template<int dim, int n_components, typename number >
MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::FESubcellEvaluation ( const dealii::FEEvaluation< dim, -1, 0, n_components, number, VectorizedArrayType > &  fe_evaluation)

Constructor from an FEEvaluation object.

Member Function Documentation

◆ compute_intra_cell_face_sizes()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::compute_intra_cell_face_sizes ( )
private

Compute the sizes of the intra cell subcell faces (are in 3D and the lengths in 2D) and store them internally.

◆ compute_reference_coordinates_normal_direction()

template<int dim, int n_components, typename number >
unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::compute_reference_coordinates_normal_direction ( const unsigned int  subcell_face_index) const
private

Return the reference coordinate direction d normal to the intra cell subcell face with the given index subcell_face_index. On the supported Cartesian cells, the physical normal vector is the unit vector in direction d.

◆ distribute_local_to_global()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::distribute_local_to_global ( dealii::LinearAlgebra::distributed::Vector< number > &  dst_vector,
const std::bitset< n_lanes > &  mask = std::bitset<n_lanes>().flip() 
)

Add the currently stored local DoF values to the corresponding entries in the given vector. The values in the vector are not overwritten, but rather the local values are added to the existing values in the vector.

Parameters
dst_vectorThe vector to which the local DoF values are to be added.
maskA bitset indicating which vectorization lanes are active and therefore which DoF values are to be added. If a lane is inactive, the corresponding DoF values will not be added to the vector.

◆ evaluate()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::evaluate ( const dealii::EvaluationFlags::EvaluationFlags  evaluation_flags)

Evaluate the subcell values and/or gradients by projecting the finite element solution to the finite volume subcell solution space.

Parameters
evaluation_flagsWhich quantities to compute. Must be dealii::EvaluationFlags::values, dealii::EvaluationFlags::gradients, or a combination of both. Other flags are not supported.

◆ face_adjacent_subcell_index()

template<int dim, int n_components, typename number >
unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::face_adjacent_subcell_index ( const unsigned int  subcell_face_index,
const bool  interior_face 
) const
private

Return the index of the interior or exterior subcell adjacent to the intra cell subcell face with the given index.

Parameters
subcell_face_indexThe index of the intra cell subcell face.
interior_faceA boolean indicating whether the interior or exterior subcell index is to be returned. If true, the interior subcell index is returned, otherwise the exterior subcell index is returned.

◆ gather_evaluate()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::gather_evaluate ( const dealii::LinearAlgebra::distributed::Vector< number > &  input_vector,
const dealii::EvaluationFlags::EvaluationFlags  evaluation_flags,
const std::bitset< n_lanes > &  mask = std::bitset<n_lanes>().flip() 
)

Read the dof values from the given vector, and evaluate the subcell values and/or gradients by projecting the finite element solution to the subcells. After calling this function, the subcell values and/or gradients can be accessed using get_value() and get_gradient().

Parameters
input_vectorThe vector from which the DoF values are to be read.
evaluation_flagsWhich quantities to compute. Must be dealii::EvaluationFlags::values, dealii::EvaluationFlags::gradients, or a combination of both. Other flags are not supported.
maskA bitset indicating which vectorization lanes are active and therefore which DoF values are to be read. If a lane is inactive, the corresponding DoF values will not be read from the vector.
Note
This function is equivalent to calling read_dof_values() followed by evaluate().

◆ get_face_value()

template<int dim, int n_components, typename number >
auto MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::get_face_value ( const unsigned int  subcell_face_index,
const bool  interior_value 
) const

Return the value of an intra cell subcell face with the given face index subcell_face_index. The function can be either asked for the interior or exterior value of the face depending on the interior_value parameter. For the ordering of the subcell faces, and the definition of interior and exterior values, see the documentation of the class.

◆ get_gradient()

template<int dim, int n_components, typename number >
auto MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::get_gradient ( const unsigned int  subcell_index) const

Returns the gradient of the solution for the subcell with the given index subcell_index. A call to this function requires that evaluate() has been called with dealii::EvaluationFlags::gradients before, otherwise an exception is thrown.

◆ get_value()

template<int dim, int n_components, typename number >
auto MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::get_value ( const unsigned int  subcell_index) const

Returns the value of the solution for the subcell with the given index subcell_index. A call to this function requires that evaluate() has been called with dealii::EvaluationFlags::values before, otherwise an exception is thrown.

◆ integrate()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::integrate ( )

This function takes the submitted subcell values adds the submitted fluxes multiplied by the corresponding face size and divided by the corresponding subcell size to the interior subcell and subtracts it from the exterior subcell of each face. The resulting values are then transformed back to the finite element solution space and stored in the internally.

Note that this function does not update the subcell values or gradients. If you want to update the subcell values and gradients after calling this function, you need to call evaluate() again.

◆ integrate_scatter()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::integrate_scatter ( dealii::LinearAlgebra::distributed::Vector< number > &  dst_vector,
const std::bitset< n_lanes > &  mask = std::bitset<n_lanes>().flip() 
)

This function takes the submitted subcell values adds the submitted fluxes multiplied by the corresponding face size and divided by the corresponding subcell size to the interior subcell and subtracts it from the exterior subcell of each face. The resulting values are then transformed back to the finite element solution space and added to the given destination vector on the degrees of freedom belonging to the current cell.

A call to this function is hence equivalent to calling integrate() followed by distribute_local_to_global().

Parameters
dst_vectorThe vector to which the local DoF values are to be added.
maskA bitset indicating which vectorization lanes are active and therefore which DoF values are to be added. If a lane is inactive, the corresponding DoF values will not be added to the vector.

◆ n_subcells()

template<int dim, int n_components, typename number >
unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::n_subcells ( ) const

Retrun the number of subcells in which the current cell is partitioned.

◆ project_dof_values_to_subcell_values()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::project_dof_values_to_subcell_values ( const dealii::EvaluationFlags::EvaluationFlags  evaluation_flags)
private

Compute the subcell values and/or gradients from the DoF values currently stored in fe_cell_evaluator, following Sonntag and Munz (J. Sci. Comput. 70, 2017): the finite element solution is evaluated at the quadrature points, and the value at quadrature point q is interpreted as the mean value of subcell q.

The subcell gradients are the gradients of the finite element solution at the quadrature points. They are not reconstructed from the subcell values and hence inherit any oscillations of the high-order solution.

The results are stored in subcell_values and subcell_gradients, and the corresponding *_initialized flags are set.

Parameters
evaluation_flagsWhich quantities to compute. Must be dealii::EvaluationFlags::values, dealii::EvaluationFlags::gradients, or a combination of both. Other flags are not supported.

◆ project_subcell_values_to_dof_values()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::project_subcell_values_to_dof_values ( const std::vector< value_type > &  values_to_project)
private

Compute the DoF values from the subcell values currently stored in submitted_subcell_values, following Sonntag and Munz (J. Sci. Comput. 70, 2017): the finite element solution is reconstructed from the mean values of the subcells by applying the inverse mass matrix. The results are stored in fe_cell_evaluator.

Parameters
values_to_projectThe subcell values to project to DoF values.

◆ read_cell_data()

template<int dim, int n_components, typename number >
template<typename T >
T MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::read_cell_data ( const dealii::AlignedVector< T > &  data) const

Reads the cell data for the current cell from the given data vector. The call is forwarded to the underlying dealii::FEEvaluation object.

Parameters
dataThe data vector from which the cell data is to be read.
Returns
The cell data for the current cell.

◆ read_dof_values()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::read_dof_values ( const dealii::LinearAlgebra::distributed::Vector< number > &  src_vector,
const std::bitset< n_lanes > &  mask = std::bitset<n_lanes>().flip() 
)

Read the DoF values for the current cell from the given vector. The values are stored internally and can be projected to the finite volume subcell solution space using evaluate() or gather_evaluate().

Parameters
src_vectorThe vector from which the DoF values are to be read.
maskA bitset indicating which vectorization lanes are active and therefore which DoF values are to be read. If a lane is inactive, the corresponding DoF values will not be read from the vector.

◆ reinit()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::reinit ( const unsigned int  cell_batch_index)

Reinitialize the FESubcellEvaluation object for a specific cell batch. This function must be called before any other member functions are used, as it sets up any cell batch-specific data structures and prepares the object for evaluating subcell values on the specified cell batch.

Parameters
cell_batch_indexThe index of the cell batch for which the FESubcellEvaluation object is to be reinitialized.

◆ set_cell_data()

template<int dim, int n_components, typename number >
template<typename T >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::set_cell_data ( dealii::AlignedVector< T > &  data,
const T &  value 
) const

Sets the cell data for the current cell in the given data vector to the specified value. The call is forwarded to the underlying dealii::FEEvaluation object.

Parameters
dataThe data vector in which the cell data is to be set.
valueThe value to which the cell data is to be set.

◆ set_dof_values()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::set_dof_values ( dealii::LinearAlgebra::distributed::Vector< number > &  dst,
const std::bitset< n_lanes > &  mask = std::bitset<n_lanes>().flip() 
)

This function sets the DoF values for the current cell in the given vector to the DoF values currently stored in the FESubcellEvaluation object. Note that contrary to distribute_local_to_global() this function overrides the values in the destination vector, rather than adding to them.

Parameters
dstThe destination vector in which the DoF values are to be set.
maskA bitset indicating which vectorization lanes are active and therefore which DoF values are to be set.

◆ setup_internal_data_structures()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::setup_internal_data_structures ( )
private

This function sets up all internal data structures, i.e. allocating memory for internal data and initializing members for all class members which can be initialized at construction time. It is intended to be called from the constructor only.

◆ subcell_face_indices()

template<int dim, int n_components, typename number >
std::ranges::iota_view< unsigned int, unsigned int > MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_face_indices ( ) const

Returns a range of all intra cell subcell face indices for the current cell. For the ordering of the subcell faces, see the documentation of the class. The intention of this function is to provide a convenient way to iterate over all intra cell subcell faces of the current cell, e.g. in a range-based for loop.

◆ subcell_face_interior_exterior_indices()

template<int dim, int n_components, typename number >
std::pair< unsigned int, unsigned int > MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_face_interior_exterior_indices ( const unsigned int  subcell_face_index) const

Returns the indices of the interior and exterior subcells of the intra cell subcell face with the given index subcell_face_index.

Returns
A pair of unsigned integers, where the first element is the index of the interior subcell and the second element is the index of the exterior subcell.

◆ subcell_face_normal_vector()

template<int dim, int n_components, typename number >
dealii::Tensor< 1, dim, dealii::VectorizedArray< number > > MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_face_normal_vector ( const unsigned int  subcell_face_index) const

Returns the normal vector of the intra cell subcell face with the given index subcell_face_index. The normal vector points out of the interior subcell, i.e. into the exterior subcell in the direction of increasing reference coordinate d. For the ordering of the subcell faces, and the definition of interior and exterior values, see the documentation of the class.

◆ subcell_face_size()

template<int dim, int n_components, typename number >
auto MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_face_size ( const unsigned int  subcell_face_index) const

Returns the size, i.e. the area in 3D and the length in 2D, of the intra cell subcell face with the given index subcell_face_index.

◆ subcell_indices()

template<int dim, int n_components, typename number >
std::ranges::iota_view< unsigned int, unsigned int > MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_indices ( ) const

Returns a range of all subcell indices for the current cell. The indices are in lexicographic order, with the x-index varying fastest. The intention of this function is to provide a convenient way to iterate over all subcells of the current cell, e.g. in a range-based for loop.

◆ subcell_location()

template<int dim, int n_components, typename number >
auto MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_location ( const unsigned int  subcell_index) const

Returns the location of the subcell with the given index subcell_index in real space. Following Sonntag and Munz, this is the quadrature point the subcell is associated with. Note that the quadrature point is in general not the geometric center of the subcell.

◆ subcell_size()

template<int dim, int n_components, typename number >
auto MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_size ( const unsigned int  subcell_index) const

Returns the size (volume) of the subcell with the given index subcell_index.

◆ submit_flux()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::submit_flux ( const unsigned int  subcell_face_index,
const value_type &  flux 
)

Submit a flux value for a specific intra cell subcell face. The submitted value is stored internally and taken into account when integrating the subcell values back to the finite element solution using integrate() or integrate_scatter(). Note that calling this function twice with the same subcell index will overwrite the previously submitted value.

Parameters
subcell_face_indexThe index of the intra cell subcell face for which the flux is to be submitted.
fluxThe flux value to be submitted for the subcell face.

◆ submit_value()

template<int dim, int n_components, typename number >
void MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::submit_value ( const unsigned int  subcell_index,
const value_type &  value 
)

Submit a value for the subcell with the given index subcell_index. The submitted values are stored in an internal buffer and can be projected to the finite element solution using apply_subcell_values().

Parameters
subcell_indexThe index of the subcell for which the value is to be submitted.
valueThe value to be submitted for the subcell.

Member Data Documentation

◆ cell_batch_index

template<int dim, int n_components, typename number >
unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::cell_batch_index
private

The cell batch index of the cell on which this FESubcellEvaluation object is currently reinitialized.

◆ dof_values_initialized

template<int dim, int n_components, typename number >
bool MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::dof_values_initialized = false
private

A flag indicating whether the DoF values have been set. Used for debug information.

◆ fe_cell_evaluator

template<int dim, int n_components, typename number >
dealii::FEEvaluation<dim, -1, 0, n_components, number, VectorizedArrayType> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::fe_cell_evaluator
private

The dealii::FEEvaluation object used for evaluating the finite element solution on the cell and interacting with the matrix-free framework.

◆ integrated_values_buffer

template<int dim, int n_components, typename number >
std::vector<value_type> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::integrated_values_buffer
private

A buffer used to store the integrated subcell values before they are projected back to the finite element solution space.

◆ intra_cell_face_fluxes

template<int dim, int n_components, typename number >
std::vector<value_type> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::intra_cell_face_fluxes
private

This vector stores the fluxes submitted with submit_flux(), one per intra cell subcell face, i.e. per face shared by two subcells of the current cell. Subcell faces on the boundary of the DG cell are not included, they are handled by FESubcellFaceEvaluation. For details on the ordering of the intra cell subcell faces, see the class documentation.

◆ intra_cell_face_sizes

template<int dim, int n_components, typename number >
std::vector<VectorizedArrayType> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::intra_cell_face_sizes
private

The sizes of the intra cell subcell faces, i.e. the areas in 3D and the lengths in 2D. The sizes are stored in the same order as the intra cell subcell faces (see the class documentation for details on the ordering).

◆ is_reinitialized

template<int dim, int n_components, typename number >
bool MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::is_reinitialized = false
private

A flag indicating whether the FESubcellEvaluation object has been reinitialized for a cell. Used for debug information.

◆ n_intra_cell_faces

template<int dim, int n_components, typename number >
unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::n_intra_cell_faces
private

The number of intra cell subcell faces on the current cell. Intra cell subcell faces are the faces that are shared between two subcells on the same DG cell.

◆ n_lanes

template<int dim, int n_components, typename number >
constexpr unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::n_lanes = VectorizedArrayType::size()
staticconstexprprivate

◆ n_subcells_1d

template<int dim, int n_components, typename number >
unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::n_subcells_1d
private

The number of subcells in each spatial direction. The total number of subcells is n_subcells_1d^dim.

◆ n_subcells_total

template<int dim, int n_components, typename number >
unsigned int MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::n_subcells_total
private

The total number of subcells on the current cell.

◆ subcell_fluxes_submitted

template<int dim, int n_components, typename number >
bool MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_fluxes_submitted = false
private

A flag indicating whether the subcell fluxes have been submitted. Used for debug information.

◆ subcell_gradients

template<int dim, int n_components, typename number >
std::vector<gradient_type> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_gradients
private

The subcell gradients of the solution for all subcells on the current cell. The gradients are stored in lexicographic order, with the x-index varying fastest. This is the same order as the quadrature points of the dealii::FEEvaluation object as well as the order of the subcell indices returned by subcell_indices().

◆ subcell_gradients_initialized

template<int dim, int n_components, typename number >
bool MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_gradients_initialized = false
private

A flag indicating whether the subcell gradients have been set. Used for debug information.

◆ subcell_values

template<int dim, int n_components, typename number >
std::vector<value_type> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_values
private

The subcell values of the solution for all subcells on the current cell. The values are stored in lexicographic order, with the x-index varying fastest. This is the same order as the quadrature points of the dealii::FEEvaluation object as well as the order of the subcell indices returned by subcell_indices().

◆ subcell_values_initialized

template<int dim, int n_components, typename number >
bool MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_values_initialized = false
private

A flag indicating whether the subcell values have been set. Used for debug information.

◆ subcell_values_submitted

template<int dim, int n_components, typename number >
bool MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_values_submitted = false
private

A flag indicating whether the subcell values have been submitted. Used for debug information.

◆ subcell_values_to_project_buffer

template<int dim, int n_components, typename number >
std::vector<VectorizedArrayType> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::subcell_values_to_project_buffer
private

A buffer used for projecting the subcell values to the finite element solution space. The buffer is a class member to avoid repeated allocations memory.

◆ submitted_subcell_values

template<int dim, int n_components, typename number >
std::vector<value_type> MeltPoolDG::FESubcellEvaluation< dim, n_components, number >::submitted_subcell_values
private

The subcell values that have been submitted using submit_value(). These values are stored in lexicographic order, with the x-index varying fastest. This is the same order as the quadrature points of the dealii::FEEvaluation object as well as the order of the subcell indices returned by subcell_indices().


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