SpECTRE  v2021.12.06
dg::protocols::NumericalFlux Struct Reference

Defines the interface for DG numerical fluxes. More...

#include <Protocols.hpp>

Classes

struct  test
 

Detailed Description

Defines the interface for DG numerical fluxes.

This protocol defines the interface that a class must conform to so that it can be used as a numerical flux in DG boundary schemes. Essentially, the class must be able to compute the quantity \(G\) that appears, for example, in the strong first-order DG boundary scheme \(G_\alpha(n_i^\mathrm{int}, u_\alpha^\mathrm{int}, n_i^\mathrm{ext}, u_\alpha^\mathrm{ext}) - n_i^\mathrm{int} F^{i,\mathrm{int}}_\alpha\) where \(u_\alpha\) are the system variables and \(F^i_\alpha\) their corresponding fluxes. See also Eq. (2.20) in [110] where the quantity \(G\) is denoted \(n_i F^{i*}\), which is why we occasionally refer to it as the "normal-dot-numerical-fluxes".

Requires the ConformingType has these type aliases:

  • variables_tags: A typelist of DataBox tags that the class computes numerical fluxes for.
  • argument_tags: A typelist of DataBox tags that will be retrieved on interfaces and passed to the package_data function (see below). The ConformingType may also have a volume_tags typelist that specifies the subset of argument_tags that should be retrieved from the volume instead of the interface.
  • package_field_tags: A typelist of DataBox tags with Tensor types that the package_data function will compute from the argument_tags. These quantities will be made available on both sides of a mortar and passed to the call operator to compute the numerical flux.
  • package_extra_tags: Additional non-tensor tags that will be made available on both sides of a mortar, e.g. geometric quantities.

Requires the ConformingType has these member functions:

  • package_data: Takes the types of the package_field_tags and the package_extra_tags by gsl::not_null pointer, followed by the types of the argument_tags.
  • operator(): Takes the types of the variables_tags by gsl::not_null pointer, followed by the types of the package_field_tags and the package_extra_tags from the interior side of the mortar and from the exterior side. Note that the data from the exterior side was computed entirely with data from the neighboring element, including its interface normal which is (at least when it's independent of the system variables) opposite to the interior element's interface normal. Therefore, make sure to take into account the sign flip for quantities that include the interface normal.

Here's an example for a simple "central" numerical flux \(G_\alpha(n_i^\mathrm{int}, u_\alpha^\mathrm{int}, n_i^\mathrm{ext}, u_\alpha^\mathrm{ext}) = \frac{1}{2}\left(n_i^\mathrm{int} F^{i,\mathrm{int}}_\alpha - n_i^\mathrm{ext} F^{i,\mathrm{ext}}_\alpha \right)\):

struct CentralFlux : tt::ConformsTo<dg::protocols::NumericalFlux> {
using variables_tags = tmpl::list<FieldTag>;
using argument_tags = tmpl::list<::Tags::NormalDotFlux<FieldTag>>;
using package_field_tags = tmpl::list<::Tags::NormalDotFlux<FieldTag>>;
using package_extra_tags = tmpl::list<>;
static void package_data(
const gsl::not_null<Scalar<DataVector>*> packaged_normal_dot_flux,
const Scalar<DataVector>& normal_dot_flux) {
*packaged_normal_dot_flux = normal_dot_flux;
}
void operator()(const gsl::not_null<Scalar<DataVector>*> numerical_flux,
const Scalar<DataVector>& normal_dot_flux_interior,
const Scalar<DataVector>& normal_dot_flux_exterior) const {
// The minus sign appears because the `normal_dot_flux_exterior` was
// computed with the interface normal from the neighboring element
get(*numerical_flux) =
0.5 * (get(normal_dot_flux_interior) - get(normal_dot_flux_exterior));
}
};
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183
const auto & get(const DataBox< TagList > &box)
Retrieve the item with tag Tag from the DataBox.
Definition: DataBox.hpp:840
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Indicate a class conforms to the Protocol.
Definition: ProtocolHelpers.hpp:22

Note that this numerical flux reduces to the interface average \(G_\alpha=\frac{n^\mathrm{int}_i}{2}\left(F^{i,\mathrm{int}}_\alpha + F^{i,\mathrm{ext}}_\alpha\right)\) for the case where the interface normal is independent of the system variables and therefore \(n_i^\mathrm{ext} = -n_i^\mathrm{int}\).


The documentation for this struct was generated from the following file: