17 #include "DataStructures/DataBox/Tag.hpp"
18 #include "DataStructures/DataVector.hpp"
24 #include "NumericalAlgorithms/DiscontinuousGalerkin/NumericalFluxes/NumericalFluxHelpers.hpp"
25 #include "NumericalAlgorithms/DiscontinuousGalerkin/SimpleBoundaryData.hpp"
29 namespace TestHelpers {
30 namespace NumericalFluxes {
39 using type = tnsr::I<DataVector, Dim>;
44 using type = tnsr::i<DataVector, Dim>;
49 using type = tnsr::Ij<DataVector, Dim>;
62 const tnsr::i<DataVector, Dim>& var_3) noexcept {
65 for (
size_t i = 0; i < result.size(); ++i) {
67 cos(
static_cast<double>(i)) *
get(var_1) -
68 (1.0 - sin(
static_cast<double>(i))) *
get(
dot_product(var_2, var_3));
75 static constexpr
size_t volume_dim = Dim;
82 template <
typename Var>
90 template <
typename FluxType,
typename... Args>
91 auto get_packaged_data(
const FluxType& flux_computer,
93 const Args&... args) noexcept {
95 typename FluxType::package_extra_tags>
96 packaged_data{used_for_size.size()};
97 dg::NumericalFluxes::package_data(
make_not_null(&packaged_data),
98 flux_computer, args...);
103 template <
size_t Dim,
typename FluxType,
typename... VariablesTags>
104 void test_conservation(
const FluxType& flux_computer,
106 const tmpl::list<VariablesTags...> ) noexcept {
109 const size_t num_points = used_for_size.size();
111 const auto variables_interior =
114 const auto variables_exterior =
117 const auto n_dot_f_interior =
120 const auto n_dot_f_exterior =
124 auto packaged_data_interior = get_packaged_data(
125 flux_computer, used_for_size, get<VariablesTags>(n_dot_f_interior)...,
126 get<VariablesTags>(variables_interior)...,
127 TestHelpers::NumericalFluxes::characteristic_speeds(
128 get<Tags::Variable1>(variables_interior),
129 get<Tags::Variable2<Dim>>(variables_interior),
130 get<Tags::Variable3<Dim>>(variables_interior)));
131 auto packaged_data_exterior = get_packaged_data(
132 flux_computer, used_for_size, get<VariablesTags>(n_dot_f_exterior)...,
133 get<VariablesTags>(variables_exterior)...,
134 TestHelpers::NumericalFluxes::characteristic_speeds(
135 get<Tags::Variable1>(variables_exterior),
136 get<Tags::Variable2<Dim>>(variables_exterior),
137 get<Tags::Variable3<Dim>>(variables_exterior)));
139 Variables<tmpl::list<VariablesTags...>> n_dot_num_flux_interior(
141 dg::NumericalFluxes::normal_dot_numerical_fluxes(
143 packaged_data_interior, packaged_data_exterior);
145 Variables<tmpl::list<VariablesTags...>> n_dot_num_flux_exterior(
147 dg::NumericalFluxes::normal_dot_numerical_fluxes(
149 packaged_data_exterior, packaged_data_interior);
155 template <
size_t Dim,
typename FluxType>
156 void test_conservation(
const FluxType& flux_computer,
158 detail::test_conservation<Dim>(
159 flux_computer, used_for_size,
160 typename System<Dim>::variables_tag::tags_list{});