SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/RelativisticEuler/Valencia/BoundaryConditions - DirichletAnalytic.hpp Hit Total Coverage
Commit: 990bc653376fc4a4068db06123ec02659d814816 Lines: 1 21 4.8 %
Date: 2021-05-16 17:17:32
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 <memory>
       7             : #include <optional>
       8             : #include <pup.h>
       9             : #include <string>
      10             : #include <type_traits>
      11             : 
      12             : #include "DataStructures/DataBox/Prefixes.hpp"
      13             : #include "DataStructures/DataVector.hpp"
      14             : #include "DataStructures/Tensor/Tensor.hpp"
      15             : #include "DataStructures/Variables.hpp"
      16             : #include "Evolution/BoundaryConditions/Type.hpp"
      17             : #include "Evolution/Systems/RelativisticEuler/Valencia/BoundaryConditions/BoundaryCondition.hpp"
      18             : #include "Evolution/Systems/RelativisticEuler/Valencia/ConservativeFromPrimitive.hpp"
      19             : #include "Evolution/Systems/RelativisticEuler/Valencia/Fluxes.hpp"
      20             : #include "Evolution/Systems/RelativisticEuler/Valencia/Tags.hpp"
      21             : #include "Options/Options.hpp"
      22             : #include "Parallel/CharmPupable.hpp"
      23             : #include "PointwiseFunctions/AnalyticData/Tags.hpp"
      24             : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
      25             : #include "Time/Tags.hpp"
      26             : #include "Utilities/Gsl.hpp"
      27             : #include "Utilities/TMPL.hpp"
      28             : 
      29             : /// \cond
      30             : namespace domain::Tags {
      31             : template <size_t Dim, typename Frame>
      32             : struct Coordinates;
      33             : }  // namespace domain::Tags
      34             : /// \endcond
      35             : 
      36             : namespace RelativisticEuler::Valencia::BoundaryConditions {
      37             : /*!
      38             :  * \brief Sets Dirichlet boundary conditions using the analytic solution or
      39             :  * analytic data.
      40             :  */
      41             : template <size_t Dim>
      42           1 : class DirichletAnalytic final : public BoundaryCondition<Dim> {
      43             :  public:
      44           0 :   using options = tmpl::list<>;
      45           0 :   static constexpr Options::String help{
      46             :       "DirichletAnalytic boundary conditions using either analytic solution or "
      47             :       "analytic data."};
      48           0 :   static std::string name() noexcept { return "DirichletAnalytic"; }
      49             : 
      50           0 :   DirichletAnalytic() = default;
      51           0 :   DirichletAnalytic(DirichletAnalytic&&) noexcept = default;
      52           0 :   DirichletAnalytic& operator=(DirichletAnalytic&&) noexcept = default;
      53           0 :   DirichletAnalytic(const DirichletAnalytic&) = default;
      54           0 :   DirichletAnalytic& operator=(const DirichletAnalytic&) = default;
      55           0 :   ~DirichletAnalytic() override = default;
      56             : 
      57           0 :   explicit DirichletAnalytic(CkMigrateMessage* msg) noexcept;
      58             : 
      59           0 :   WRAPPED_PUPable_decl_base_template(
      60             :       domain::BoundaryConditions::BoundaryCondition, DirichletAnalytic);
      61             : 
      62           0 :   auto get_clone() const noexcept -> std::unique_ptr<
      63             :       domain::BoundaryConditions::BoundaryCondition> override;
      64             : 
      65           0 :   static constexpr evolution::BoundaryConditions::Type bc_type =
      66             :       evolution::BoundaryConditions::Type::Ghost;
      67             : 
      68           0 :   void pup(PUP::er& p) override;
      69             : 
      70           0 :   using dg_interior_evolved_variables_tags = tmpl::list<>;
      71           0 :   using dg_interior_temporary_tags =
      72             :       tmpl::list<domain::Tags::Coordinates<Dim, Frame::Inertial>>;
      73           0 :   using dg_interior_primitive_variables_tags = tmpl::list<>;
      74           0 :   using dg_gridless_tags =
      75             :       tmpl::list<::Tags::Time, ::Tags::AnalyticSolutionOrData>;
      76             : 
      77             :   template <typename AnalyticSolutionOrData>
      78           0 :   std::optional<std::string> dg_ghost(
      79             :       const gsl::not_null<Scalar<DataVector>*> tilde_d,
      80             :       const gsl::not_null<Scalar<DataVector>*> tilde_tau,
      81             :       const gsl::not_null<tnsr::i<DataVector, Dim, Frame::Inertial>*> tilde_s,
      82             : 
      83             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
      84             :           flux_tilde_d,
      85             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
      86             :           flux_tilde_tau,
      87             :       const gsl::not_null<tnsr::Ij<DataVector, Dim, Frame::Inertial>*>
      88             :           flux_tilde_s,
      89             : 
      90             :       const gsl::not_null<Scalar<DataVector>*> lapse,
      91             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*> shift,
      92             :       const gsl::not_null<tnsr::ii<DataVector, Dim, Frame::Inertial>*>
      93             :           spatial_metric,
      94             :       const gsl::not_null<Scalar<DataVector>*> rest_mass_density,
      95             :       const gsl::not_null<Scalar<DataVector>*> specific_internal_energy,
      96             :       const gsl::not_null<Scalar<DataVector>*> specific_enthalpy,
      97             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
      98             :           spatial_velocity,
      99             :       const gsl::not_null<tnsr::II<DataVector, Dim, Frame::Inertial>*>
     100             :           inv_spatial_metric,
     101             : 
     102             :       const std::optional<
     103             :           tnsr::I<DataVector, Dim, Frame::Inertial>>& /*face_mesh_velocity*/,
     104             :       const tnsr::i<DataVector, Dim, Frame::Inertial>& /*normal_covector*/,
     105             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& /*normal_vector*/,
     106             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& coords,
     107             :       const double time,
     108             :       const AnalyticSolutionOrData& analytic_solution_or_data) const noexcept {
     109             :     auto boundary_values = [&analytic_solution_or_data, &coords,
     110             :                             &time]() noexcept {
     111             :       if constexpr (std::is_base_of_v<MarkAsAnalyticSolution,
     112             :                                       AnalyticSolutionOrData>) {
     113             :         return analytic_solution_or_data.variables(
     114             :             coords, time,
     115             :             tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
     116             :                        hydro::Tags::SpecificInternalEnergy<DataVector>,
     117             :                        hydro::Tags::SpecificEnthalpy<DataVector>,
     118             :                        hydro::Tags::Pressure<DataVector>,
     119             :                        hydro::Tags::SpatialVelocity<DataVector, Dim>,
     120             :                        hydro::Tags::LorentzFactor<DataVector>,
     121             :                        gr::Tags::SqrtDetSpatialMetric<>, gr::Tags::Lapse<>,
     122             :                        gr::Tags::Shift<Dim>, gr::Tags::SpatialMetric<Dim>,
     123             :                        gr::Tags::InverseSpatialMetric<Dim>>{});
     124             :       } else {
     125             :         (void)time;
     126             :         return analytic_solution_or_data.variables(
     127             :             coords,
     128             :             tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
     129             :                        hydro::Tags::SpecificInternalEnergy<DataVector>,
     130             :                        hydro::Tags::SpecificEnthalpy<DataVector>,
     131             :                        hydro::Tags::Pressure<DataVector>,
     132             :                        hydro::Tags::SpatialVelocity<DataVector, Dim>,
     133             :                        hydro::Tags::LorentzFactor<DataVector>,
     134             :                        gr::Tags::SqrtDetSpatialMetric<>, gr::Tags::Lapse<>,
     135             :                        gr::Tags::Shift<Dim>, gr::Tags::SpatialMetric<Dim>,
     136             :                        gr::Tags::InverseSpatialMetric<Dim>>{});
     137             :       }
     138             :     }();
     139             : 
     140             :     *lapse = get<gr::Tags::Lapse<>>(boundary_values);
     141             :     *shift = get<gr::Tags::Shift<Dim>>(boundary_values);
     142             :     *spatial_metric = get<gr::Tags::SpatialMetric<Dim>>(boundary_values);
     143             :     *inv_spatial_metric =
     144             :         get<gr::Tags::InverseSpatialMetric<Dim>>(boundary_values);
     145             :     *rest_mass_density =
     146             :         get<hydro::Tags::RestMassDensity<DataVector>>(boundary_values);
     147             :     *specific_internal_energy =
     148             :         get<hydro::Tags::SpecificInternalEnergy<DataVector>>(boundary_values);
     149             :     *specific_enthalpy =
     150             :         get<hydro::Tags::SpecificEnthalpy<DataVector>>(boundary_values);
     151             :     *spatial_velocity =
     152             :         get<hydro::Tags::SpatialVelocity<DataVector, Dim>>(boundary_values);
     153             : 
     154             :     const auto& pressure =
     155             :         get<hydro::Tags::Pressure<DataVector>>(boundary_values);
     156             :     const auto& lorentz_factor =
     157             :         get<hydro::Tags::LorentzFactor<DataVector>>(boundary_values);
     158             :     const auto& sqrt_det_spatial_metric =
     159             :         get<gr::Tags::SqrtDetSpatialMetric<>>(boundary_values);
     160             : 
     161             :     ConservativeFromPrimitive<Dim>::apply(
     162             :         tilde_d, tilde_tau, tilde_s, *rest_mass_density,
     163             :         *specific_internal_energy, *specific_enthalpy, pressure,
     164             :         *spatial_velocity, lorentz_factor, sqrt_det_spatial_metric,
     165             :         *spatial_metric);
     166             :     ComputeFluxes<Dim>::apply(flux_tilde_d, flux_tilde_tau, flux_tilde_s,
     167             :                               *tilde_d, *tilde_tau, *tilde_s, *lapse, *shift,
     168             :                               sqrt_det_spatial_metric, pressure,
     169             :                               *spatial_velocity);
     170             : 
     171             :     return {};
     172             :   }
     173             : };
     174             : }  // namespace RelativisticEuler::Valencia::BoundaryConditions

Generated by: LCOV version 1.14