SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions - DirichletAnalytic.hpp Hit Total Coverage
Commit: 3c072f0ce967e2e56649d3fa12aa2a0e4fe2a42e Lines: 2 31 6.5 %
Date: 2024-04-23 20:50:18
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/PrefixHelpers.hpp"
      14             : #include "DataStructures/DataBox/Prefixes.hpp"
      15             : #include "DataStructures/DataVector.hpp"
      16             : #include "DataStructures/Tensor/EagerMath/DeterminantAndInverse.hpp"
      17             : #include "DataStructures/Tensor/Tensor.hpp"
      18             : #include "DataStructures/Variables.hpp"
      19             : #include "Domain/CoordinateMaps/CoordinateMap.hpp"
      20             : #include "Domain/CoordinateMaps/Tags.hpp"
      21             : #include "Domain/ElementMap.hpp"
      22             : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
      23             : #include "Domain/FunctionsOfTime/Tags.hpp"
      24             : #include "Domain/Structure/Direction.hpp"
      25             : #include "Domain/Tags.hpp"
      26             : #include "Evolution/BoundaryConditions/Type.hpp"
      27             : #include "Evolution/DgSubcell/GhostZoneLogicalCoordinates.hpp"
      28             : #include "Evolution/DgSubcell/SliceTensor.hpp"
      29             : #include "Evolution/DgSubcell/Tags/Coordinates.hpp"
      30             : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
      31             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/BoundaryCondition.hpp"
      32             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/ConservativeFromPrimitive.hpp"
      33             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Factory.hpp"
      34             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Reconstructor.hpp"
      35             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Tag.hpp"
      36             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Fluxes.hpp"
      37             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/System.hpp"
      38             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
      39             : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
      40             : #include "Options/String.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::ValenciaDivClean::BoundaryConditions {
      54             : /*!
      55             :  * \brief Sets Dirichlet boundary conditions using the analytic solution or
      56             :  * analytic data.
      57             :  */
      58           1 : class DirichletAnalytic final : public BoundaryCondition {
      59             :  private:
      60             :   template <typename T>
      61           0 :   using Flux = ::Tags::Flux<T, tmpl::size_t<3>, Frame::Inertial>;
      62             : 
      63             :  public:
      64             :   /// \brief What analytic solution/data to prescribe.
      65           1 :   struct AnalyticPrescription {
      66           0 :     static constexpr Options::String help =
      67             :         "What analytic solution/data to prescribe.";
      68           0 :     using type = std::unique_ptr<evolution::initial_data::InitialData>;
      69             :   };
      70           0 :   using options = tmpl::list<AnalyticPrescription>;
      71           0 :   static constexpr Options::String help{
      72             :       "DirichletAnalytic boundary conditions using either analytic solution or "
      73             :       "analytic data."};
      74             : 
      75           0 :   DirichletAnalytic() = default;
      76           0 :   DirichletAnalytic(DirichletAnalytic&&) = default;
      77           0 :   DirichletAnalytic& operator=(DirichletAnalytic&&) = default;
      78           0 :   DirichletAnalytic(const DirichletAnalytic&);
      79           0 :   DirichletAnalytic& operator=(const DirichletAnalytic&);
      80           0 :   ~DirichletAnalytic() override = default;
      81             : 
      82           0 :   explicit DirichletAnalytic(CkMigrateMessage* msg);
      83             : 
      84           0 :   explicit DirichletAnalytic(
      85             :       std::unique_ptr<evolution::initial_data::InitialData>
      86             :           analytic_prescription);
      87             : 
      88           0 :   WRAPPED_PUPable_decl_base_template(
      89             :       domain::BoundaryConditions::BoundaryCondition, DirichletAnalytic);
      90             : 
      91           0 :   auto get_clone() const -> std::unique_ptr<
      92             :       domain::BoundaryConditions::BoundaryCondition> override;
      93             : 
      94           0 :   static constexpr evolution::BoundaryConditions::Type bc_type =
      95             :       evolution::BoundaryConditions::Type::Ghost;
      96             : 
      97           0 :   void pup(PUP::er& p) override;
      98             : 
      99           0 :   using dg_interior_evolved_variables_tags = tmpl::list<>;
     100           0 :   using dg_interior_temporary_tags =
     101             :       tmpl::list<domain::Tags::Coordinates<3, Frame::Inertial>>;
     102           0 :   using dg_interior_primitive_variables_tags = tmpl::list<>;
     103           0 :   using dg_gridless_tags = tmpl::list<::Tags::Time>;
     104             : 
     105           0 :   std::optional<std::string> dg_ghost(
     106             :       gsl::not_null<Scalar<DataVector>*> tilde_d,
     107             :       gsl::not_null<Scalar<DataVector>*> tilde_ye,
     108             :       gsl::not_null<Scalar<DataVector>*> tilde_tau,
     109             :       gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*> tilde_s,
     110             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_b,
     111             :       gsl::not_null<Scalar<DataVector>*> tilde_phi,
     112             : 
     113             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_d_flux,
     114             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_ye_flux,
     115             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_tau_flux,
     116             :       gsl::not_null<tnsr::Ij<DataVector, 3, Frame::Inertial>*> tilde_s_flux,
     117             :       gsl::not_null<tnsr::IJ<DataVector, 3, Frame::Inertial>*> tilde_b_flux,
     118             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_phi_flux,
     119             : 
     120             :       gsl::not_null<Scalar<DataVector>*> lapse,
     121             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
     122             :       gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
     123             :           inv_spatial_metric,
     124             : 
     125             :       const std::optional<
     126             :           tnsr::I<DataVector, 3, Frame::Inertial>>& /*face_mesh_velocity*/,
     127             :       const tnsr::i<DataVector, 3, Frame::Inertial>& /*normal_covector*/,
     128             :       const tnsr::I<DataVector, 3, Frame::Inertial>& /*normal_vector*/,
     129             :       const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
     130             :       [[maybe_unused]] double time) const;
     131             : 
     132           0 :   using fd_interior_evolved_variables_tags = tmpl::list<>;
     133           0 :   using fd_interior_temporary_tags =
     134             :       tmpl::list<evolution::dg::subcell::Tags::Mesh<3>>;
     135           0 :   using fd_interior_primitive_variables_tags = tmpl::list<>;
     136           0 :   using fd_gridless_tags =
     137             :       tmpl::list<::Tags::Time, ::domain::Tags::FunctionsOfTime,
     138             :                  domain::Tags::ElementMap<3, Frame::Grid>,
     139             :                  domain::CoordinateMaps::Tags::CoordinateMap<3, Frame::Grid,
     140             :                                                              Frame::Inertial>,
     141             :                  fd::Tags::Reconstructor>;
     142           0 :   void fd_ghost(
     143             :       gsl::not_null<Scalar<DataVector>*> rest_mass_density,
     144             :       gsl::not_null<Scalar<DataVector>*> electron_fraction,
     145             :       gsl::not_null<Scalar<DataVector>*> temperature,
     146             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
     147             :           lorentz_factor_times_spatial_velocity,
     148             :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> magnetic_field,
     149             :       gsl::not_null<Scalar<DataVector>*> divergence_cleaning_field,
     150             : 
     151             :       gsl::not_null<std::optional<Variables<db::wrap_tags_in<
     152             :           Flux, typename grmhd::ValenciaDivClean::System::flux_variables>>>*>
     153             :           cell_centered_ghost_fluxes,
     154             : 
     155             :       const Direction<3>& direction,
     156             : 
     157             :       // fd_interior_temporary_tags
     158             :       const Mesh<3>& subcell_mesh,
     159             : 
     160             :       // fd_gridless_tags
     161             :       [[maybe_unused]] double time,
     162             :       const std::unordered_map<
     163             :           std::string,
     164             :           std::unique_ptr<::domain::FunctionsOfTime::FunctionOfTime>>&
     165             :           functions_of_time,
     166             :       const ElementMap<3, Frame::Grid>& logical_to_grid_map,
     167             :       const domain::CoordinateMapBase<Frame::Grid, Frame::Inertial, 3>&
     168             :           grid_to_inertial_map,
     169             :       const fd::Reconstructor& reconstructor) const;
     170             : 
     171             :  private:
     172           0 :   std::unique_ptr<evolution::initial_data::InitialData> analytic_prescription_;
     173             : };
     174             : }  // namespace grmhd::ValenciaDivClean::BoundaryConditions

Generated by: LCOV version 1.14