Classes | Typedefs
Protocols

Classes that define metaprogramming interfaces. More...

Classes

struct  tt::ConformsTo< Protocol >
 Indicate a class conforms to the Protocol. More...
 

Typedefs

template<typename ConformingType >
using evolution::protocols::NumericInitialData = detail::has_import_fields< ConformingType >
 Indicates the ConformingType provides compile-time information for importing numeric initial data for an evolution. More...
 
template<typename ConformingType >
using dg::protocols::NumericalFlux = std::conditional_t< tmpl2::flat_all_v< detail::has_variables_tags_v< ConformingType >, detail::has_argument_tags_v< ConformingType >, detail::has_package_field_tags_v< ConformingType >, detail::has_package_extra_tags_v< ConformingType > >, detail::IsNumericalFluxCallable< ConformingType >, std::false_type >
 Defines the interface for DG numerical fluxes. More...
 
template<typename ConformingType , template< class > class Protocol>
using tt::conforms_to = typename std::is_convertible< ConformingType *, ConformsTo< Protocol > * >
 Checks if the ConformingType conforms to the Protocol. More...
 

Detailed Description

Classes that define metaprogramming interfaces.

See the Protocols section of the dev guide for details.

Typedef Documentation

◆ conforms_to

template<typename ConformingType , template< class > class Protocol>
using tt::conforms_to = typedef typename std::is_convertible<ConformingType*, ConformsTo<Protocol>*>

Checks if the ConformingType conforms to the Protocol.

By default, only checks if the class derives off the protocol to reduce compile time. Protocol conformance is tested rigorously in the unit tests instead. Set the SPECTRE_ALWAYS_CHECK_PROTOCOL_CONFORMANCE CMake option to always enable rigorous protocol conformance checks.

See also
Documentation on Protocols

◆ NumericalFlux

template<typename ConformingType >
using dg::protocols::NumericalFlux = typedef std::conditional_t< tmpl2::flat_all_v<detail::has_variables_tags_v<ConformingType>, detail::has_argument_tags_v<ConformingType>, detail::has_package_field_tags_v<ConformingType>, detail::has_package_extra_tags_v<ConformingType> >, detail::IsNumericalFluxCallable<ConformingType>, std::false_type>

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 [60] 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<>;
void package_data(
const gsl::not_null<Scalar<DataVector>*> packaged_normal_dot_flux,
const Scalar<DataVector>& normal_dot_flux) const noexcept {
*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
noexcept {
// 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));
}
};

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}\).

◆ NumericInitialData

template<typename ConformingType >
using evolution::protocols::NumericInitialData = typedef detail::has_import_fields<ConformingType>

Indicates the ConformingType provides compile-time information for importing numeric initial data for an evolution.

Requires the ConformingType has these type aliases:

  • import_fields: The list of tags that should be imported from a volume data file

Here's an example of a class that conforms to this protocol:

struct ValidNumericInitialData
: tt::ConformsTo<evolution::protocols::NumericInitialData> {
using import_fields = tmpl::list<FieldTag>;
};
get
constexpr Tag::type & get(Variables< TagList > &v) noexcept
Return Tag::type pointing into the contiguous array.
Definition: Variables.hpp:689
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
tt::ConformsTo
Indicate a class conforms to the Protocol.
Definition: ProtocolHelpers.hpp:22
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182