IsentropicVortexSource.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <string>
8 
10 #include "Utilities/TMPL.hpp"
11 
12 // IWYU pragma: no_forward_declare Tensor
13 
14 /// \cond
15 namespace gsl {
16 template <typename T>
17 class not_null;
18 } // namespace gsl
19 
20 namespace NewtonianEuler {
21 namespace Tags {
22 template <typename DataType>
23 struct MassDensity;
24 template <typename DataType, size_t Dim, typename VolumeFrame>
25 struct MomentumDensity;
26 template <typename DataType>
27 struct EnergyDensity;
28 template <typename DataType>
29 struct Pressure;
30 } // namespace Tags
31 } // namespace NewtonianEuler
32 
33 class DataVector;
34 /// \endcond
35 
36 namespace NewtonianEuler {
37 namespace Sources {
38 
39 /*!
40  * \brief Source generating a modified isentropic vortex.
41  *
42  * If Solutions::IsentropicVortex is modifed so that the flow velocity along
43  * the \f$z-\f$axis is not a constant but a function of \f$z\f$, the new vortex
44  * will be a solution to the 3-D Newtonian Euler equations with a source term,
45  *
46  * \f{align*}
47  * \partial_t\rho + \partial_i F^i(\rho) &= S(\rho)\\
48  * \partial_t S^i + \partial_j F^{j}(S^i) &= S(S^i)\\
49  * \partial_t e + \partial_i F^i(e) &= S(e),
50  * \f}
51  *
52  * where \f$F^i(u)\f$ is the volume flux of the conserved quantity \f$u\f$
53  * (see ComputeFluxes), and
54  *
55  * \f{align*}
56  * S(\rho) &= \rho \dfrac{dv_z}{dz}\\
57  * S(S_x) &= S_x \dfrac{dv_z}{dz}\\
58  * S(S_y) &= S_y \dfrac{dv_z}{dz}\\
59  * S(S_z) &= 2S_z \dfrac{dv_z}{dz}\\
60  * S(e) &= \left(e + p + v_z S_z\right)\dfrac{dv_z}{dz},
61  * \f}
62  *
63  * where \f$v_z = v_z(z)\f$ is the \f$z-\f$component of the flow velocity,
64  * and \f$p\f$ is the pressure.
65  */
67  /// The \f$z-\f$component of the vortex flow velocity.
68  struct VelocityAlongZ {
69  using type = Scalar<DataVector>;
70  static std::string name() noexcept { return "VelocityAlongZ"; }
71  };
72 
73  /// The derivative w.r.t. \f$z\f$ of the \f$z-\f$component of the velocity.
75  using type = Scalar<DataVector>;
76  static std::string name() noexcept { return "DzVelocityAlongZ"; }
77  };
78 
79  using argument_tags =
80  tmpl::list<Tags::MassDensity<DataVector>,
84 
85  static void apply(
86  gsl::not_null<Scalar<DataVector>*> mass_density_source,
87  gsl::not_null<tnsr::I<DataVector, 3>*> momentum_density_source,
88  gsl::not_null<Scalar<DataVector>*> energy_density_source,
89  const Scalar<DataVector>& vortex_mass_density,
90  const tnsr::I<DataVector, 3>& vortex_momentum_density,
91  const Scalar<DataVector>& vortex_energy_density,
92  const Scalar<DataVector>& vortex_pressure,
93  const Scalar<DataVector>& vortex_velocity_z,
94  const Scalar<DataVector>& dz_vortex_velocity_z) noexcept;
95 };
96 
97 } // namespace Sources
98 } // namespace NewtonianEuler
The momentum density of the fluid.
Definition: Tags.hpp:24
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
Source generating a modified isentropic vortex.
Definition: IsentropicVortexSource.hpp:66
The derivative w.r.t. of the component of the velocity.
Definition: IsentropicVortexSource.hpp:74
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args)
Apply the function f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1595
The component of the vortex flow velocity.
Definition: IsentropicVortexSource.hpp:68
The energy density of the fluid.
Definition: Tags.hpp:31
Definition: DataBoxTag.hpp:29
The fluid pressure.
Definition: Tags.hpp:52
Defines a list of useful type aliases for tensors.
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12
Items related to evolving the Newtonian Euler system.
Definition: Characteristics.hpp:17