SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/GhValenciaDivClean/BoundaryConditions - DirichletFreeOutflow.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 6.5 % 31 2
Test Date: 2026-10-22 17:29:42
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              : #include <unordered_map>
      12              : 
      13              : #include "DataStructures/DataBox/Prefixes.hpp"
      14              : #include "DataStructures/DataVector.hpp"
      15              : #include "DataStructures/Tensor/Tensor.hpp"
      16              : #include "Domain/CoordinateMaps/CoordinateMap.hpp"
      17              : #include "Domain/CoordinateMaps/Tags.hpp"
      18              : #include "Domain/ElementMap.hpp"
      19              : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
      20              : #include "Domain/FunctionsOfTime/Tags.hpp"
      21              : #include "Domain/Structure/Direction.hpp"
      22              : #include "Domain/Tags.hpp"
      23              : #include "Evolution/BoundaryConditions/Type.hpp"
      24              : #include "Evolution/DgSubcell/GhostZoneLogicalCoordinates.hpp"
      25              : #include "Evolution/DgSubcell/Tags/Coordinates.hpp"
      26              : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
      27              : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
      28              : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/BoundaryConditions/BoundaryCondition.hpp"
      29              : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/Factory.hpp"
      30              : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/Reconstructor.hpp"
      31              : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/Tag.hpp"
      32              : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/Tags.hpp"
      33              : #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/HydroFreeOutflow.hpp"
      34              : #include "Evolution/Systems/GrMhd/ValenciaDivClean/ConservativeFromPrimitive.hpp"
      35              : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Fluxes.hpp"
      36              : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
      37              : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
      38              : #include "Options/String.hpp"
      39              : #include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/ConstraintDampingTags.hpp"
      40              : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      41              : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
      42              : #include "Utilities/ErrorHandling/Assert.hpp"
      43              : #include "Utilities/Gsl.hpp"
      44              : #include "Utilities/Serialization/CharmPupable.hpp"
      45              : #include "Utilities/TMPL.hpp"
      46              : 
      47              : /// \cond
      48              : namespace Tags {
      49              : struct Time;
      50              : }  // namespace Tags
      51              : /// \endcond
      52              : 
      53              : namespace grmhd::GhValenciaDivClean::BoundaryConditions {
      54              : /*!
      55              :  * \brief Sets Dirichlet boundary conditions using the analytic solution or
      56              :  * analytic data on the spacetime variables and hydro free outflow on the GRMHD
      57              :  * variables.
      58              :  */
      59              : template <typename System>
      60            1 : class DirichletFreeOutflow final : public BoundaryCondition {
      61              :  private:
      62              :   template <typename T>
      63            0 :   using Flux = ::Tags::Flux<T, tmpl::size_t<3>, Frame::Inertial>;
      64            0 :   std::unique_ptr<evolution::initial_data::InitialData> analytic_prescription_;
      65              : 
      66              :  public:
      67              :   /// \brief What analytic solution/data to prescribe.
      68            1 :   struct AnalyticPrescription {
      69            0 :     static constexpr Options::String help =
      70              :         "What analytic solution/data to prescribe.";
      71            0 :     using type = std::unique_ptr<evolution::initial_data::InitialData>;
      72              :   };
      73            0 :   using options = tmpl::list<AnalyticPrescription>;
      74            0 :   static constexpr Options::String help{
      75              :       "DirichletFreeOutflow boundary conditions using either analytic solution "
      76              :       "or analytic data for GH variables and hydro free outflow for GRMHD"};
      77              : 
      78            0 :   DirichletFreeOutflow() = default;
      79            0 :   DirichletFreeOutflow(DirichletFreeOutflow&&) = default;
      80            0 :   DirichletFreeOutflow& operator=(DirichletFreeOutflow&&) = default;
      81            0 :   DirichletFreeOutflow(const DirichletFreeOutflow&);
      82            0 :   DirichletFreeOutflow& operator=(const DirichletFreeOutflow&);
      83            0 :   ~DirichletFreeOutflow() override = default;
      84              : 
      85            0 :   explicit DirichletFreeOutflow(CkMigrateMessage* msg);
      86              : 
      87            0 :   explicit DirichletFreeOutflow(
      88              :       std::unique_ptr<evolution::initial_data::InitialData>
      89              :           analytic_prescription);
      90              : 
      91            0 :   WRAPPED_PUPable_decl_base_template(
      92              :       domain::BoundaryConditions::BoundaryCondition, DirichletFreeOutflow);
      93              : 
      94            0 :   auto get_clone() const -> std::unique_ptr<
      95              :       domain::BoundaryConditions::BoundaryCondition> override;
      96              : 
      97            0 :   static constexpr evolution::BoundaryConditions::Type bc_type =
      98              :       evolution::BoundaryConditions::Type::Ghost;
      99              : 
     100            0 :   void pup(PUP::er& p) override;
     101              : 
     102            0 :   using dg_interior_evolved_variables_tags = tmpl::list<>;
     103            0 :   using dg_interior_temporary_tags =
     104              :       tmpl::list<domain::Tags::Coordinates<3, Frame::Inertial>,
     105              :                  ::gh::Tags::ConstraintGamma1, ::gh::Tags::ConstraintGamma2>;
     106            0 :   using dg_interior_primitive_variables_tags =
     107              :       tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
     108              :                  hydro::Tags::ElectronFraction<DataVector>,
     109              :                  hydro::Tags::SpecificInternalEnergy<DataVector>,
     110              :                  hydro::Tags::SpatialVelocity<DataVector, 3>,
     111              :                  hydro::Tags::MagneticField<DataVector, 3>,
     112              :                  hydro::Tags::LorentzFactor<DataVector>,
     113              :                  hydro::Tags::Pressure<DataVector>,
     114              :                  hydro::Tags::Temperature<DataVector>>;
     115            0 :   using dg_gridless_tags = tmpl::list<::Tags::Time>;
     116            0 :   std::optional<std::string> dg_ghost(
     117              :       gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> spacetime_metric,
     118              :       gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> pi,
     119              :       gsl::not_null<tnsr::iaa<DataVector, 3, Frame::Inertial>*> phi,
     120              :       gsl::not_null<Scalar<DataVector>*> tilde_d,
     121              :       gsl::not_null<Scalar<DataVector>*> tilde_ye,
     122              :       gsl::not_null<Scalar<DataVector>*> tilde_tau,
     123              :       gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*> tilde_s,
     124              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_b,
     125              :       gsl::not_null<Scalar<DataVector>*> tilde_phi,
     126              : 
     127              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_d_flux,
     128              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_ye_flux,
     129              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_tau_flux,
     130              :       gsl::not_null<tnsr::Ij<DataVector, 3, Frame::Inertial>*> tilde_s_flux,
     131              :       gsl::not_null<tnsr::IJ<DataVector, 3, Frame::Inertial>*> tilde_b_flux,
     132              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_phi_flux,
     133              : 
     134              :       gsl::not_null<Scalar<DataVector>*> gamma1,
     135              :       gsl::not_null<Scalar<DataVector>*> gamma2,
     136              :       gsl::not_null<Scalar<DataVector>*> lapse,
     137              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
     138              :       gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
     139              :           spatial_velocity_one_form,
     140              :       gsl::not_null<Scalar<DataVector>*> rest_mass_density,
     141              :       gsl::not_null<Scalar<DataVector>*> electron_fraction,
     142              :       gsl::not_null<Scalar<DataVector>*> temperature,
     143              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> spatial_velocity,
     144              :       gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
     145              :           inv_spatial_metric,
     146              : 
     147              :       const std::optional<tnsr::I<DataVector, 3, Frame::Inertial>>&
     148              :           face_mesh_velocity,
     149              :       const tnsr::i<DataVector, 3, Frame::Inertial>& normal_covector,
     150              :       const tnsr::I<DataVector, 3, Frame::Inertial>& normal_vector,
     151              : 
     152              :       const Scalar<DataVector>& interior_rest_mass_density,
     153              :       const Scalar<DataVector>& interior_electron_fraction,
     154              :       const Scalar<DataVector>& interior_specific_internal_energy,
     155              :       const tnsr::I<DataVector, 3, Frame::Inertial>& interior_spatial_velocity,
     156              :       const tnsr::I<DataVector, 3, Frame::Inertial>& interior_magnetic_field,
     157              :       const Scalar<DataVector>& interior_lorentz_factor,
     158              :       const Scalar<DataVector>& interior_pressure,
     159              :       const Scalar<DataVector>& interior_temperature,
     160              : 
     161              :       const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
     162              :       const Scalar<DataVector>& interior_gamma1,
     163              :       const Scalar<DataVector>& interior_gamma2, double time) const;
     164              : 
     165            0 :   using fd_interior_evolved_variables_tags = tmpl::list<>;
     166            0 :   using fd_interior_temporary_tags =
     167              :       tmpl::list<evolution::dg::subcell::Tags::Mesh<3>>;
     168            0 :   using fd_interior_primitive_variables_tags =
     169              :       tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
     170              :                  hydro::Tags::ElectronFraction<DataVector>,
     171              :                  hydro::Tags::Temperature<DataVector>,
     172              :                  hydro::Tags::Pressure<DataVector>,
     173              :                  hydro::Tags::SpecificInternalEnergy<DataVector>,
     174              :                  hydro::Tags::LorentzFactor<DataVector>,
     175              :                  hydro::Tags::SpatialVelocity<DataVector, 3>,
     176              :                  hydro::Tags::MagneticField<DataVector, 3>>;
     177            0 :   using fd_gridless_tags =
     178              :       tmpl::list<::Tags::Time, ::domain::Tags::FunctionsOfTime,
     179              :                  domain::Tags::ElementMap<3, Frame::Grid>,
     180              :                  domain::CoordinateMaps::Tags::CoordinateMap<3, Frame::Grid,
     181              :                                                              Frame::Inertial>,
     182              :                  fd::Tags::Reconstructor<System>>;
     183            0 :   void fd_ghost(
     184              : 
     185              :       gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> spacetime_metric,
     186              :       gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> pi,
     187              :       gsl::not_null<tnsr::iaa<DataVector, 3, Frame::Inertial>*> phi,
     188              :       gsl::not_null<Scalar<DataVector>*> rest_mass_density,
     189              :       gsl::not_null<Scalar<DataVector>*> electron_fraction,
     190              :       gsl::not_null<Scalar<DataVector>*> temperature,
     191              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
     192              :           lorentz_factor_times_spatial_velocity,
     193              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> magnetic_field,
     194              :       gsl::not_null<Scalar<DataVector>*> divergence_cleaning_field,
     195              :       const Direction<3>& direction,
     196              : 
     197              :       // fd_interior_temporary_tags
     198              :       const Mesh<3>& subcell_mesh,
     199              : 
     200              :       // interior prim vars tags
     201              :       const Scalar<DataVector>& interior_rest_mass_density,
     202              :       const Scalar<DataVector>& interior_electron_fraction,
     203              :       const Scalar<DataVector>& interior_temperature,
     204              :       const Scalar<DataVector>& interior_pressure,
     205              :       const Scalar<DataVector>& interior_specific_internal_energy,
     206              :       const Scalar<DataVector>& interior_lorentz_factor,
     207              :       const tnsr::I<DataVector, 3, Frame::Inertial>& interior_spatial_velocity,
     208              :       const tnsr::I<DataVector, 3, Frame::Inertial>& interior_magnetic_field,
     209              : 
     210              :       // fd_gridless_tags
     211              :       double time,
     212              :       const std::unordered_map<
     213              :           std::string,
     214              :           std::unique_ptr<::domain::FunctionsOfTime::FunctionOfTime>>&
     215              :           functions_of_time,
     216              :       const ElementMap<3, Frame::Grid>& logical_to_grid_map,
     217              :       const domain::CoordinateMapBase<Frame::Grid, Frame::Inertial, 3>&
     218              :           grid_to_inertial_map,
     219              :       const fd::Reconstructor<System>& reconstructor) const;
     220              : };
     221              : }  // namespace grmhd::GhValenciaDivClean::BoundaryConditions
        

Generated by: LCOV version 2.0-1