BoundaryData.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
9 #include "Domain/Mesh.hpp"
10 #include "NumericalAlgorithms/DiscontinuousGalerkin/NumericalFluxes/NumericalFluxHelpers.hpp"
11 #include "NumericalAlgorithms/DiscontinuousGalerkin/Protocols.hpp"
12 #include "NumericalAlgorithms/DiscontinuousGalerkin/SimpleBoundaryData.hpp"
13 #include "Utilities/ProtocolHelpers.hpp"
14 #include "Utilities/Requires.hpp"
15 #include "Utilities/TMPL.hpp"
16 
17 namespace dg {
18 namespace FirstOrderScheme {
19 
20 namespace detail {
21 template <typename NumericalFluxType>
22 struct BoundaryDataImpl {
23  static_assert(tt::conforms_to_v<NumericalFluxType, protocols::NumericalFlux>,
24  "The 'NumericalFluxType' must conform to the "
25  "'dg::protocols::NumericalFlux'.");
26  using type = dg::SimpleBoundaryData<
27  tmpl::remove_duplicates<tmpl::append<
29  typename NumericalFluxType::variables_tags>,
30  typename NumericalFluxType::package_field_tags>>,
31  typename NumericalFluxType::package_extra_tags>;
32 };
33 } // namespace detail
34 
35 /*!
36  * \brief The data on element boundaries that's needed for the (strong)
37  * first-order boundary scheme
38  *
39  * The boundary data includes the `NumericalFluxType`'s packaged data plus all
40  * "normal-dot-fluxes" so the strong boundary scheme can compute the difference
41  * between the normal-dot-numerical-fluxes and the normal-dot-fluxes
42  * (see `dg::FirstOrder`). For the weak formulation the normal-dot-fluxes
43  * need not be included explicitly, but the `NumericalFluxType` may require
44  * a subset of them.
45  */
46 template <typename NumericalFluxType>
48 
49 /*!
50  * \brief Package the data on element boundaries that's needed for the (strong)
51  * first-order boundary scheme.
52  *
53  * This function currently packages the data required by the `NumericalFluxType`
54  * plus all "normal-dot-fluxes", which are needed for the strong first-order
55  * boundary scheme (see `dg::FirstOrderScheme::BoundaryData`). Note that for
56  * the weak formulation the normal-dot-fluxes need not be included explicitly,
57  * but the `NumericalFluxType` may require a subset of them.
58  */
59 template <
60  size_t FaceDim, typename NumericalFluxType, typename... NumericalFluxArgs,
62  nullptr>
64  const NumericalFluxType& numerical_flux_computer,
65  const Mesh<FaceDim>& face_mesh,
66  const Variables<db::wrap_tags_in<
67  ::Tags::NormalDotFlux, typename NumericalFluxType::variables_tags>>&
68  normal_dot_fluxes,
69  const NumericalFluxArgs&... args) noexcept {
70  BoundaryData<NumericalFluxType> boundary_data{
71  face_mesh.number_of_grid_points()};
72  boundary_data.field_data.assign_subset(normal_dot_fluxes);
73  dg::NumericalFluxes::package_data(make_not_null(&boundary_data),
74  numerical_flux_computer, args...);
75  return boundary_data;
76 }
77 
78 } // namespace FirstOrderScheme
79 } // namespace dg
Prefix indicating a boundary unit normal vector dotted into the flux.
Definition: Prefixes.hpp:124
typename detail::BoundaryDataImpl< NumericalFluxType >::type BoundaryData
The data on element boundaries that&#39;s needed for the (strong) first-order boundary scheme...
Definition: BoundaryData.hpp:47
Functionality related to discontinuous Galerkin schemes.
Definition: ApplyBoundaryFluxesLocalTimeStepping.hpp:33
Holds the number of grid points, basis, and quadrature in each direction of the computational grid...
Definition: Mesh.hpp:50
Define prefixes for DataBox tags.
tmpl::transform< TagList, tmpl::bind< Wrapper, tmpl::_1, tmpl::pin< Args >... > > wrap_tags_in
Create a new list of Tags by wrapping each tag in TagList using the Wrapper.
Definition: PrefixHelpers.hpp:30
Defines the type alias Requires.
Distinguishes between field data, which can be projected to a mortar, and extra data, which will not be projected.
Definition: SimpleBoundaryData.hpp:35
Definition: Determinant.hpp:11
Boundary contributions for a first-order DG scheme.
Definition: FirstOrderScheme.hpp:72
Defines class Variables.
Defines the class template Mesh.
auto package_boundary_data(const NumericalFluxType &numerical_flux_computer, const Mesh< FaceDim > &face_mesh, const Variables< db::wrap_tags_in< ::Tags::NormalDotFlux, typename NumericalFluxType::variables_tags >> &normal_dot_fluxes, const NumericalFluxArgs &... args) noexcept
Package the data on element boundaries that&#39;s needed for the (strong) first-order boundary scheme...
Definition: BoundaryData.hpp:63
Wraps the template metaprogramming library used (brigand)
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion, but it may be necessary to perform the conversion explicitly when type deduction is desired.
Definition: Gsl.hpp:879
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t ...
Definition: Requires.hpp:67
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...