SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/NewtonianEuler/Sources - VortexPerturbation.hpp Hit Total Coverage
Commit: 2db722c93a8e9b106e406b439b79c8e05c2057fb Lines: 1 13 7.7 %
Date: 2021-03-03 22:01:00
Legend: Lines: hit not hit

          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             : #include <limits>
       8             : 
       9             : #include "DataStructures/Tensor/TypeAliases.hpp"
      10             : #include "Domain/Tags.hpp"
      11             : #include "Evolution/Systems/NewtonianEuler/TagsDeclarations.hpp"
      12             : #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
      13             : #include "Time/Tags.hpp"
      14             : #include "Utilities/MakeArray.hpp"
      15             : #include "Utilities/TMPL.hpp"
      16             : 
      17             : // IWYU pragma: no_forward_declare Tensor
      18             : 
      19             : /// \cond
      20             : class DataVector;
      21             : 
      22             : namespace NewtonianEuler {
      23             : namespace Solutions {
      24             : template <size_t Dim>
      25             : struct IsentropicVortex;
      26             : }  // namespace Solutions
      27             : }  // namespace NewtonianEuler
      28             : 
      29             : namespace gsl {
      30             : template <typename T>
      31             : class not_null;
      32             : }  // namespace gsl
      33             : /// \endcond
      34             : 
      35             : namespace NewtonianEuler {
      36             : namespace Sources {
      37             : 
      38             : /*!
      39             :  * \brief Source generating a modified isentropic vortex.
      40             :  *
      41             :  * If Solutions::IsentropicVortex is modifed so that the flow velocity along
      42             :  * the \f$z-\f$axis is not a constant but a function of \f$z\f$, the new vortex
      43             :  * will be a solution to the 3-D Newtonian Euler equations with a source term,
      44             :  *
      45             :  * \f{align*}
      46             :  * \partial_t\rho + \partial_i F^i(\rho) &= S(\rho)\\
      47             :  * \partial_t S^i + \partial_j F^{j}(S^i) &= S(S^i)\\
      48             :  * \partial_t e + \partial_i F^i(e) &= S(e),
      49             :  * \f}
      50             :  *
      51             :  * where \f$F^i(u)\f$ is the volume flux of the conserved quantity \f$u\f$
      52             :  * (see ComputeFluxes), and
      53             :  *
      54             :  * \f{align*}
      55             :  * S(\rho) &= \rho \dfrac{dv_z}{dz}\\
      56             :  * S(S_x) &= S_x \dfrac{dv_z}{dz}\\
      57             :  * S(S_y) &= S_y \dfrac{dv_z}{dz}\\
      58             :  * S(S_z) &= 2S_z \dfrac{dv_z}{dz}\\
      59             :  * S(e) &= \left(e + p + v_z S_z\right)\dfrac{dv_z}{dz},
      60             :  * \f}
      61             :  *
      62             :  * where \f$\rho\f$ is the mass density of the vortex, \f$S_i\f$ is
      63             :  * its momentum density, \f$e\f$ is its energy density,
      64             :  * \f$v_z = v_z(z)\f$ is the \f$z-\f$component of its velocity,
      65             :  * and \f$p\f$ is its pressure. These quantities are readily obtained
      66             :  * from the primitive variables, whose expressions are those in
      67             :  * Solutions::IsentropicVortex
      68             :  */
      69             : template <size_t Dim>
      70           1 : struct VortexPerturbation {
      71           0 :   VortexPerturbation() noexcept = default;
      72           0 :   VortexPerturbation(const VortexPerturbation& /*rhs*/) = default;
      73           0 :   VortexPerturbation& operator=(const VortexPerturbation& /*rhs*/) = default;
      74           0 :   VortexPerturbation(VortexPerturbation&& /*rhs*/) noexcept = default;
      75           0 :   VortexPerturbation& operator=(VortexPerturbation&& /*rhs*/) noexcept =
      76             :       default;
      77           0 :   ~VortexPerturbation() = default;
      78             : 
      79             :   // clang-tidy: google-runtime-references
      80           0 :   void pup(PUP::er& /*p*/) noexcept {}  // NOLINT
      81             : 
      82           0 :   using sourced_variables = tmpl::conditional_t<
      83             :       Dim == 3,
      84             :       tmpl::list<Tags::MassDensityCons, Tags::MomentumDensity<Dim>,
      85             :                  Tags::EnergyDensity>,
      86             :       tmpl::list<>>;
      87             : 
      88           0 :   using argument_tags = tmpl::conditional_t<
      89             :       Dim == 3,
      90             :       tmpl::list<::Tags::AnalyticSolution<
      91             :                      NewtonianEuler::Solutions::IsentropicVortex<Dim>>,
      92             :                  domain::Tags::Coordinates<3, Frame::Inertial>, ::Tags::Time>,
      93             :       tmpl::list<>>;
      94             : 
      95             :   // Overload required for 2d simulations, where no variable is sourced.
      96           0 :   void apply() const noexcept;
      97             : 
      98             :   // Function to be used in 3d.
      99           0 :   void apply(gsl::not_null<Scalar<DataVector>*> source_mass_density_cons,
     100             :              gsl::not_null<tnsr::I<DataVector, Dim>*> source_momentum_density,
     101             :              gsl::not_null<Scalar<DataVector>*> source_energy_density,
     102             :              const NewtonianEuler::Solutions::IsentropicVortex<Dim>& vortex,
     103             :              const tnsr::I<DataVector, Dim>& x, double time) const noexcept;
     104             : };
     105             : }  // namespace Sources
     106             : }  // namespace NewtonianEuler

Generated by: LCOV version 1.14