Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/VariablesTag.hpp"
9 : #include "Evolution/Systems/NewtonianMhd/BoundaryConditions/BoundaryCondition.hpp"
10 : #include "Evolution/Systems/NewtonianMhd/Characteristics.hpp"
11 : #include "Evolution/Systems/NewtonianMhd/ConservativeFromPrimitive.hpp"
12 : #include "Evolution/Systems/NewtonianMhd/PrimitiveFromConservative.hpp"
13 : #include "Evolution/Systems/NewtonianMhd/Tags.hpp"
14 : #include "Evolution/Systems/NewtonianMhd/TimeDerivativeTerms.hpp"
15 : #include "PointwiseFunctions/Hydro/Tags.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : /// \ingroup EvolutionSystemsGroup
19 : /// \brief Items related to evolving the Newtonian Euler system
20 : namespace NewtonianMhd {
21 :
22 : namespace detail {
23 : /// Asserts on use rather than on instantiation of `System`.
24 : template <bool EvolveMagneticField>
25 : struct MagneticFieldNotSupportedYet {
26 : static_assert(not EvolveMagneticField,
27 : "Evolving the magnetic field is not supported yet. "
28 : "Instantiate the system with EvolveMagneticField = false.");
29 : };
30 : } // namespace detail
31 :
32 : template <size_t Dim, bool EvolveMagneticField = true>
33 0 : struct System {
34 : static_assert(
35 : Dim == 3 or not EvolveMagneticField,
36 : "Magnetic field evolution is only supported at Dim == 3 since the vector "
37 : "dimensionality is tied to that of the system. "
38 : "Currently, lower-dimensional MHD problems still need to be run in a 3D "
39 : "domain. Users may set ignored directions to be thin and periodic.");
40 :
41 0 : static constexpr bool evolve_magnetic_field = EvolveMagneticField;
42 :
43 0 : static std::string name() {
44 : return EvolveMagneticField ? "NewtonianMhd" : "NewtonianEuler";
45 : }
46 :
47 0 : static constexpr bool is_in_flux_conservative_form = true;
48 0 : static constexpr bool has_primitive_and_conservative_vars = true;
49 0 : static constexpr size_t volume_dim = Dim;
50 :
51 0 : using boundary_conditions_base = BoundaryConditions::BoundaryCondition<Dim>;
52 :
53 0 : using flux_variables = tmpl::append<
54 : tmpl::list<Tags::MassDensityCons, Tags::MomentumDensity<Dim>,
55 : Tags::EnergyDensity>,
56 : tmpl::conditional_t<EvolveMagneticField,
57 : tmpl::list<Tags::MagneticFieldCons<>,
58 : Tags::DivergenceCleaningFieldCons>,
59 : tmpl::list<>>>;
60 0 : using variables_tag = ::Tags::Variables<flux_variables>;
61 0 : using non_conservative_variables = tmpl::list<>;
62 0 : using gradient_variables = tmpl::list<>;
63 : // Compute item for pressure not currently implemented in SpECTRE,
64 : // so its simple tag is passed along with the primitive variables.
65 0 : using primitive_variables_tag = ::Tags::Variables<tmpl::append<
66 : tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
67 : hydro::Tags::SpatialVelocity<DataVector, Dim>,
68 : hydro::Tags::SpecificInternalEnergy<DataVector>,
69 : hydro::Tags::Pressure<DataVector>>,
70 : tmpl::conditional_t<
71 : EvolveMagneticField,
72 : tmpl::list<hydro::Tags::MagneticField<DataVector, 3>,
73 : hydro::Tags::DivergenceCleaningField<DataVector>>,
74 : tmpl::list<>>>>;
75 :
76 0 : using compute_volume_time_derivative_terms = tmpl::conditional_t<
77 : EvolveMagneticField,
78 : detail::MagneticFieldNotSupportedYet<EvolveMagneticField>,
79 : TimeDerivativeTerms<Dim>>;
80 :
81 0 : using conservative_from_primitive = ConservativeFromPrimitive<Dim>;
82 0 : using primitive_from_conservative = PrimitiveFromConservative<Dim>;
83 :
84 0 : using compute_largest_characteristic_speed =
85 : Tags::ComputeLargestCharacteristicSpeed<Dim>;
86 : };
87 :
88 : } // namespace NewtonianMhd
|