SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/RelativisticEuler/Valencia/BoundaryConditions - DirichletAnalytic.hpp Hit Total Coverage
Commit: cd74d65bdc718fd7e344eaec61dc6334dd4d366b Lines: 1 20 5.0 %
Date: 2022-08-12 23:56:47
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             : 
      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<>, gr::Tags::Lapse<>,
     119             :                        gr::Tags::Shift<Dim>, gr::Tags::SpatialMetric<Dim>,
     120             :                        gr::Tags::InverseSpatialMetric<Dim>>{});
     121             :       } else {
     122             :         (void)time;
     123             :         return analytic_solution_or_data.variables(
     124             :             coords,
     125             :             tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
     126             :                        hydro::Tags::SpecificInternalEnergy<DataVector>,
     127             :                        hydro::Tags::SpecificEnthalpy<DataVector>,
     128             :                        hydro::Tags::Pressure<DataVector>,
     129             :                        hydro::Tags::SpatialVelocity<DataVector, Dim>,
     130             :                        hydro::Tags::LorentzFactor<DataVector>,
     131             :                        gr::Tags::SqrtDetSpatialMetric<>, gr::Tags::Lapse<>,
     132             :                        gr::Tags::Shift<Dim>, gr::Tags::SpatialMetric<Dim>,
     133             :                        gr::Tags::InverseSpatialMetric<Dim>>{});
     134             :       }
     135             :     }();
     136             : 
     137             :     *lapse = get<gr::Tags::Lapse<>>(boundary_values);
     138             :     *shift = get<gr::Tags::Shift<Dim>>(boundary_values);
     139             :     *spatial_metric = get<gr::Tags::SpatialMetric<Dim>>(boundary_values);
     140             :     *inv_spatial_metric =
     141             :         get<gr::Tags::InverseSpatialMetric<Dim>>(boundary_values);
     142             :     *rest_mass_density =
     143             :         get<hydro::Tags::RestMassDensity<DataVector>>(boundary_values);
     144             :     *specific_internal_energy =
     145             :         get<hydro::Tags::SpecificInternalEnergy<DataVector>>(boundary_values);
     146             :     *specific_enthalpy =
     147             :         get<hydro::Tags::SpecificEnthalpy<DataVector>>(boundary_values);
     148             :     *spatial_velocity =
     149             :         get<hydro::Tags::SpatialVelocity<DataVector, Dim>>(boundary_values);
     150             : 
     151             :     const auto& pressure =
     152             :         get<hydro::Tags::Pressure<DataVector>>(boundary_values);
     153             :     const auto& lorentz_factor =
     154             :         get<hydro::Tags::LorentzFactor<DataVector>>(boundary_values);
     155             :     const auto& sqrt_det_spatial_metric =
     156             :         get<gr::Tags::SqrtDetSpatialMetric<>>(boundary_values);
     157             : 
     158             :     ConservativeFromPrimitive<Dim>::apply(
     159             :         tilde_d, tilde_tau, tilde_s, *rest_mass_density,
     160             :         *specific_internal_energy, *specific_enthalpy, pressure,
     161             :         *spatial_velocity, lorentz_factor, sqrt_det_spatial_metric,
     162             :         *spatial_metric);
     163             :     ComputeFluxes<Dim>::apply(flux_tilde_d, flux_tilde_tau, flux_tilde_s,
     164             :                               *tilde_d, *tilde_tau, *tilde_s, *lapse, *shift,
     165             :                               sqrt_det_spatial_metric, pressure,
     166             :                               *spatial_velocity);
     167             : 
     168             :     return {};
     169             :   }
     170             : };
     171             : }  // namespace RelativisticEuler::Valencia::BoundaryConditions

Generated by: LCOV version 1.14