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(
24  tt::assert_conforms_to<NumericalFluxType, protocols::NumericalFlux>);
25  using type = dg::SimpleBoundaryData<
26  tmpl::remove_duplicates<tmpl::append<
28  typename NumericalFluxType::variables_tags>,
29  typename NumericalFluxType::package_field_tags>>,
30  typename NumericalFluxType::package_extra_tags>;
31 };
32 } // namespace detail
33 
34 /*!
35  * \brief The data on element boundaries that's needed for the (strong)
36  * first-order boundary scheme
37  *
38  * The boundary data includes the `NumericalFluxType`'s packaged data plus all
39  * "normal-dot-fluxes" so the strong boundary scheme can compute the difference
40  * between the normal-dot-numerical-fluxes and the normal-dot-fluxes
41  * (see `dg::FirstOrder`). For the weak formulation the normal-dot-fluxes
42  * need not be included explicitly, but the `NumericalFluxType` may require
43  * a subset of them.
44  */
45 template <typename NumericalFluxType>
47 
48 /*!
49  * \brief Package the data on element boundaries that's needed for the (strong)
50  * first-order boundary scheme.
51  *
52  * This function currently packages the data required by the `NumericalFluxType`
53  * plus all "normal-dot-fluxes", which are needed for the strong first-order
54  * boundary scheme (see `dg::FirstOrderScheme::BoundaryData`). Note that for
55  * the weak formulation the normal-dot-fluxes need not be included explicitly,
56  * but the `NumericalFluxType` may require a subset of them.
57  */
58 template <
59  size_t FaceDim, typename NumericalFluxType, typename... NumericalFluxArgs,
61  nullptr>
63  const NumericalFluxType& numerical_flux_computer,
64  const Mesh<FaceDim>& face_mesh,
65  const Variables<db::wrap_tags_in<
66  ::Tags::NormalDotFlux, typename NumericalFluxType::variables_tags>>&
67  normal_dot_fluxes,
68  const NumericalFluxArgs&... args) noexcept {
69  BoundaryData<NumericalFluxType> boundary_data{
70  face_mesh.number_of_grid_points()};
71  boundary_data.field_data.assign_subset(normal_dot_fluxes);
72  dg::NumericalFluxes::package_data(make_not_null(&boundary_data),
73  numerical_flux_computer, args...);
74  return boundary_data;
75 }
76 
77 } // namespace FirstOrderScheme
78 } // namespace dg
DataBoxTag.hpp
Tags::NormalDotFlux
Prefix indicating a boundary unit normal vector dotted into the flux.
Definition: Prefixes.hpp:114
dg
Functionality related to discontinuous Galerkin schemes.
Definition: ComputeNonconservativeBoundaryFluxes.hpp:23
dg::FirstOrderScheme::package_boundary_data
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's needed for the (strong) first-order boundary scheme.
Definition: BoundaryData.hpp:62
dg::SimpleBoundaryData
Distinguishes between field data, which can be projected to a mortar, and extra data,...
Definition: SimpleBoundaryData.hpp:35
Variables.hpp
dg::FirstOrderScheme::BoundaryData
typename detail::BoundaryDataImpl< NumericalFluxType >::type BoundaryData
The data on element boundaries that's needed for the (strong) first-order boundary scheme.
Definition: BoundaryData.hpp:46
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:50
dg::FirstOrderScheme::FirstOrderScheme
Boundary contributions for a first-order DG scheme.
Definition: FirstOrderScheme.hpp:67
Requires.hpp
db::wrap_tags_in
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
make_not_null
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,...
Definition: Gsl.hpp:880
Requires
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
Mesh.hpp
Prefixes.hpp
TMPL.hpp