SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/RelativisticEuler/Valencia/BoundaryConditions - DirichletAnalytic.hpp Hit Total Coverage
Commit: fb144cfca92c3773ae2a942619781e0e583aa113 Lines: 1 20 5.0 %
Date: 2023-06-02 00:56:01
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 "PointwiseFunctions/AnalyticData/Tags.hpp"
      23             : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
      24             : #include "Time/Tags.hpp"
      25             : #include "Utilities/Gsl.hpp"
      26             : #include "Utilities/Serialization/CharmPupable.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             : 
      49           0 :   DirichletAnalytic() = default;
      50           0 :   DirichletAnalytic(DirichletAnalytic&&) = default;
      51           0 :   DirichletAnalytic& operator=(DirichletAnalytic&&) = default;
      52           0 :   DirichletAnalytic(const DirichletAnalytic&) = default;
      53           0 :   DirichletAnalytic& operator=(const DirichletAnalytic&) = default;
      54           0 :   ~DirichletAnalytic() override = default;
      55             : 
      56           0 :   explicit DirichletAnalytic(CkMigrateMessage* msg);
      57             : 
      58           0 :   WRAPPED_PUPable_decl_base_template(
      59             :       domain::BoundaryConditions::BoundaryCondition, DirichletAnalytic);
      60             : 
      61           0 :   auto get_clone() const -> std::unique_ptr<
      62             :       domain::BoundaryConditions::BoundaryCondition> override;
      63             : 
      64           0 :   static constexpr evolution::BoundaryConditions::Type bc_type =
      65             :       evolution::BoundaryConditions::Type::Ghost;
      66             : 
      67           0 :   void pup(PUP::er& p) override;
      68             : 
      69           0 :   using dg_interior_evolved_variables_tags = tmpl::list<>;
      70           0 :   using dg_interior_temporary_tags =
      71             :       tmpl::list<domain::Tags::Coordinates<Dim, Frame::Inertial>>;
      72           0 :   using dg_interior_primitive_variables_tags = tmpl::list<>;
      73           0 :   using dg_gridless_tags =
      74             :       tmpl::list<::Tags::Time, ::Tags::AnalyticSolutionOrData>;
      75             : 
      76             :   template <typename AnalyticSolutionOrData>
      77           0 :   std::optional<std::string> dg_ghost(
      78             :       const gsl::not_null<Scalar<DataVector>*> tilde_d,
      79             :       const gsl::not_null<Scalar<DataVector>*> tilde_tau,
      80             :       const gsl::not_null<tnsr::i<DataVector, Dim, Frame::Inertial>*> tilde_s,
      81             : 
      82             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
      83             :           flux_tilde_d,
      84             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
      85             :           flux_tilde_tau,
      86             :       const gsl::not_null<tnsr::Ij<DataVector, Dim, Frame::Inertial>*>
      87             :           flux_tilde_s,
      88             : 
      89             :       const gsl::not_null<Scalar<DataVector>*> lapse,
      90             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*> shift,
      91             :       const gsl::not_null<tnsr::ii<DataVector, Dim, Frame::Inertial>*>
      92             :           spatial_metric,
      93             :       const gsl::not_null<Scalar<DataVector>*> rest_mass_density,
      94             :       const gsl::not_null<Scalar<DataVector>*> specific_internal_energy,
      95             :       const gsl::not_null<Scalar<DataVector>*> specific_enthalpy,
      96             :       const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
      97             :           spatial_velocity,
      98             :       const gsl::not_null<tnsr::II<DataVector, Dim, Frame::Inertial>*>
      99             :           inv_spatial_metric,
     100             : 
     101             :       const std::optional<
     102             :           tnsr::I<DataVector, Dim, Frame::Inertial>>& /*face_mesh_velocity*/,
     103             :       const tnsr::i<DataVector, Dim, Frame::Inertial>& /*normal_covector*/,
     104             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& /*normal_vector*/,
     105             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& coords,
     106             :       const double time,
     107             :       const AnalyticSolutionOrData& analytic_solution_or_data) const {
     108             :     auto boundary_values = [&analytic_solution_or_data, &coords, &time]() {
     109             :       if constexpr (is_analytic_solution_v<AnalyticSolutionOrData>) {
     110             :         return analytic_solution_or_data.variables(
     111             :             coords, time,
     112             :             tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
     113             :                        hydro::Tags::SpecificInternalEnergy<DataVector>,
     114             :                        hydro::Tags::SpecificEnthalpy<DataVector>,
     115             :                        hydro::Tags::Pressure<DataVector>,
     116             :                        hydro::Tags::SpatialVelocity<DataVector, Dim>,
     117             :                        hydro::Tags::LorentzFactor<DataVector>,
     118             :                        gr::Tags::SqrtDetSpatialMetric<DataVector>,
     119             :                        gr::Tags::Lapse<DataVector>,
     120             :                        gr::Tags::Shift<DataVector, Dim>,
     121             :                        gr::Tags::SpatialMetric<DataVector, Dim>,
     122             :                        gr::Tags::InverseSpatialMetric<DataVector, Dim>>{});
     123             :       } else {
     124             :         (void)time;
     125             :         return analytic_solution_or_data.variables(
     126             :             coords,
     127             :             tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
     128             :                        hydro::Tags::SpecificInternalEnergy<DataVector>,
     129             :                        hydro::Tags::SpecificEnthalpy<DataVector>,
     130             :                        hydro::Tags::Pressure<DataVector>,
     131             :                        hydro::Tags::SpatialVelocity<DataVector, Dim>,
     132             :                        hydro::Tags::LorentzFactor<DataVector>,
     133             :                        gr::Tags::SqrtDetSpatialMetric<DataVector>,
     134             :                        gr::Tags::Lapse<DataVector>,
     135             :                        gr::Tags::Shift<DataVector, Dim>,
     136             :                        gr::Tags::SpatialMetric<DataVector, Dim>,
     137             :                        gr::Tags::InverseSpatialMetric<DataVector, Dim>>{});
     138             :       }
     139             :     }();
     140             : 
     141             :     *lapse = get<gr::Tags::Lapse<DataVector>>(boundary_values);
     142             :     *shift = get<gr::Tags::Shift<DataVector, Dim>>(boundary_values);
     143             :     *spatial_metric =
     144             :         get<gr::Tags::SpatialMetric<DataVector, Dim>>(boundary_values);
     145             :     *inv_spatial_metric =
     146             :         get<gr::Tags::InverseSpatialMetric<DataVector, Dim>>(boundary_values);
     147             :     *rest_mass_density =
     148             :         get<hydro::Tags::RestMassDensity<DataVector>>(boundary_values);
     149             :     *specific_internal_energy =
     150             :         get<hydro::Tags::SpecificInternalEnergy<DataVector>>(boundary_values);
     151             :     *specific_enthalpy =
     152             :         get<hydro::Tags::SpecificEnthalpy<DataVector>>(boundary_values);
     153             :     *spatial_velocity =
     154             :         get<hydro::Tags::SpatialVelocity<DataVector, Dim>>(boundary_values);
     155             : 
     156             :     const auto& pressure =
     157             :         get<hydro::Tags::Pressure<DataVector>>(boundary_values);
     158             :     const auto& lorentz_factor =
     159             :         get<hydro::Tags::LorentzFactor<DataVector>>(boundary_values);
     160             :     const auto& sqrt_det_spatial_metric =
     161             :         get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(boundary_values);
     162             : 
     163             :     ConservativeFromPrimitive<Dim>::apply(
     164             :         tilde_d, tilde_tau, tilde_s, *rest_mass_density,
     165             :         *specific_internal_energy, *specific_enthalpy, pressure,
     166             :         *spatial_velocity, lorentz_factor, sqrt_det_spatial_metric,
     167             :         *spatial_metric);
     168             :     ComputeFluxes<Dim>::apply(flux_tilde_d, flux_tilde_tau, flux_tilde_s,
     169             :                               *tilde_d, *tilde_tau, *tilde_s, *lapse, *shift,
     170             :                               sqrt_det_spatial_metric, pressure,
     171             :                               *spatial_velocity);
     172             : 
     173             :     return {};
     174             :   }
     175             : };
     176             : }  // namespace RelativisticEuler::Valencia::BoundaryConditions

Generated by: LCOV version 1.14