SpECTRE Documentation Coverage Report
Current view: top level - Domain/Creators - NonconformingSphericalShells.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 5 61 8.2 %
Date: 2025-12-05 05:03:31
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 <array>
       7             : #include <cstddef>
       8             : #include <memory>
       9             : #include <string>
      10             : #include <unordered_map>
      11             : #include <vector>
      12             : 
      13             : #include "Domain/BoundaryConditions/BoundaryCondition.hpp"
      14             : #include "Domain/BoundaryConditions/GetBoundaryConditionsBase.hpp"
      15             : #include "Domain/Creators/DomainCreator.hpp"
      16             : #include "Options/Context.hpp"
      17             : #include "Options/String.hpp"
      18             : #include "Utilities/TMPL.hpp"
      19             : 
      20             : /// \cond
      21             : template <size_t Dim, typename T>
      22             : class DirectionMap;
      23             : template <size_t Dim>
      24             : class Domain;
      25             : namespace domain {
      26             : namespace CoordinateMaps {
      27             : class Affine;
      28             : template <size_t Dim>
      29             : class Identity;
      30             : class Interval;
      31             : template <typename Map1, typename Map2>
      32             : class ProductOf2Maps;
      33             : class SphericalToCartesianPfaffian;
      34             : template <size_t Dim>
      35             : class Wedge;
      36             : }  // namespace CoordinateMaps
      37             : 
      38             : template <typename SourceFrame, typename TargetFrame, typename... Maps>
      39             : class CoordinateMap;
      40             : }  // namespace domain
      41             : /// \endcond
      42             : 
      43             : namespace domain::creators {
      44             : /*!
      45             :  * \brief A set of non-conforming concentric spherical shells
      46             :  *
      47             :  * \details The inner spherical shells are decomposed into six wedges
      48             :  * surrounding an excised interior region.  The outer spherical shells will use
      49             :  * a spherical harmonic basis which cannot be used with subcell.
      50             :  *
      51             :  * This domain creator offers one grid anchor "Center" at the origin.
      52             :  *
      53             :  */
      54           1 : class NonconformingSphericalShells : public DomainCreator<3> {
      55             :  public:
      56           0 :   using maps_list =
      57             :       tmpl::list<domain::CoordinateMap<
      58             :                      Frame::BlockLogical, Frame::Inertial,
      59             :                      domain::CoordinateMaps::ProductOf2Maps<
      60             :                          domain::CoordinateMaps::Affine,
      61             :                          domain::CoordinateMaps::Identity<2>>,
      62             :                      domain::CoordinateMaps::SphericalToCartesianPfaffian>,
      63             :                  domain::CoordinateMap<Frame::BlockLogical, Frame::Inertial,
      64             :                                        CoordinateMaps::Wedge<3>>>;
      65             : 
      66           0 :   struct InnerRadius {
      67           0 :     using type = double;
      68           0 :     static constexpr Options::String help = {
      69             :         "Inner radius of the inner wedges."};
      70             :   };
      71             : 
      72           0 :   struct InterfaceRadius {
      73           0 :     using type = double;
      74           0 :     static constexpr Options::String help = {
      75             :         "Radius of interface between the inner wedges and the outer spherical "
      76             :         "shells."};
      77             :   };
      78             : 
      79           0 :   struct OuterRadius {
      80           0 :     using type = double;
      81           0 :     static constexpr Options::String help = {
      82             :         "Outer radius of the outer spherical shell."};
      83             :   };
      84             : 
      85           0 :   struct InitialRadialRefinement {
      86           0 :     using type = size_t;
      87           0 :     static constexpr Options::String help = {
      88             :         "Initial radial refinement level for both the inner wedges and the "
      89             :         "outer spherical shells."};
      90             :   };
      91             : 
      92           0 :   struct InitialAngularRefinementOfWedges {
      93           0 :     using type = size_t;
      94           0 :     static constexpr Options::String help = {
      95             :         "Initial angular refinement levels of inner wedges."};
      96             :   };
      97             : 
      98           0 :   struct InitialNumberOfRadialGridPoints {
      99           0 :     using type = size_t;
     100           0 :     static constexpr Options::String help = {
     101             :         "Initial number of radial grid points for both the inner wedges and "
     102             :         "the outer spherical shells."};
     103             :   };
     104             : 
     105           0 :   struct InitialSphericalHarmonicL {
     106           0 :     using type = size_t;
     107           0 :     static constexpr Options::String help = {
     108             :         "Initial spherical harmonic resolution specified as the highest "
     109             :         "spherical harmonic represented on the grid."};
     110             :   };
     111             : 
     112           0 :   struct InitialNumberOfAngularGridPointsOfWedges {
     113           0 :     using type = size_t;
     114           0 :     static constexpr Options::String help = {
     115             :         "Initial angular refinement levels of inner wedges."};
     116             :   };
     117             : 
     118             :   template <typename BoundaryConditionsBase>
     119           0 :   struct InnerBoundaryCondition {
     120           0 :     static constexpr Options::String help =
     121             :         "Options for the boundary conditions at the inner radius.";
     122           0 :     using type = std::unique_ptr<BoundaryConditionsBase>;
     123             :   };
     124             : 
     125             :   template <typename BoundaryConditionsBase>
     126           0 :   struct OuterBoundaryCondition {
     127           0 :     static constexpr Options::String help =
     128             :         "Options for the boundary conditions at the outer radius.";
     129           0 :     using type = std::unique_ptr<BoundaryConditionsBase>;
     130             :   };
     131             : 
     132           0 :   using basic_options =
     133             :       tmpl::list<InnerRadius, InterfaceRadius, OuterRadius,
     134             :                  InitialRadialRefinement, InitialAngularRefinementOfWedges,
     135             :                  InitialNumberOfRadialGridPoints, InitialSphericalHarmonicL,
     136             :                  InitialNumberOfAngularGridPointsOfWedges>;
     137             : 
     138             :   template <typename Metavariables>
     139           0 :   using options = tmpl::conditional_t<
     140             :       domain::BoundaryConditions::has_boundary_conditions_base_v<
     141             :           typename Metavariables::system>,
     142             :       tmpl::push_back<
     143             :           basic_options,
     144             :           InnerBoundaryCondition<
     145             :               domain::BoundaryConditions::get_boundary_conditions_base<
     146             :                   typename Metavariables::system>>,
     147             :           OuterBoundaryCondition<
     148             :               domain::BoundaryConditions::get_boundary_conditions_base<
     149             :                   typename Metavariables::system>>>,
     150             :       basic_options>;
     151             : 
     152           0 :   static constexpr Options::String help{
     153             :       "A set of concentric spherical shells centered at the origin."};
     154             : 
     155           0 :   NonconformingSphericalShells(
     156             :       double inner_radius, double interface_radius, double outer_radius,
     157             :       size_t initial_radial_refinement,
     158             :       size_t initial_angular_refinement,
     159             :       size_t initial_number_of_radial_grid_points,
     160             :       size_t initial_spherical_harmonic_l,
     161             :       size_t initial_number_of_angular_grid_points_of_wedges,
     162             :       std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
     163             :           inner_boundary_condition = nullptr,
     164             :       std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
     165             :           outer_boundary_condition = nullptr,
     166             :       const Options::Context& context = {});
     167             : 
     168           0 :   NonconformingSphericalShells() = default;
     169           0 :   NonconformingSphericalShells(const NonconformingSphericalShells&) = delete;
     170           0 :   NonconformingSphericalShells(NonconformingSphericalShells&&) = default;
     171           0 :   NonconformingSphericalShells& operator=(const NonconformingSphericalShells&) =
     172             :       delete;
     173           0 :   NonconformingSphericalShells& operator=(NonconformingSphericalShells&&) =
     174             :       default;
     175           0 :   ~NonconformingSphericalShells() override = default;
     176             : 
     177           0 :   Domain<3> create_domain() const override;
     178             : 
     179             :   std::unordered_map<std::string, tnsr::I<double, 3, Frame::Grid>>
     180           1 :   grid_anchors() const override;
     181             : 
     182             :   std::vector<DirectionMap<
     183             :       3, std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>>>
     184           1 :   external_boundary_conditions() const override;
     185             : 
     186           1 :   std::vector<std::array<size_t, 3>> initial_extents() const override;
     187             : 
     188           1 :   std::vector<std::array<size_t, 3>> initial_refinement_levels() const override;
     189             :  private:
     190           0 :   double inner_radius_{};
     191           0 :   double interface_radius_{};
     192           0 :   double outer_radius_{};
     193           0 :   size_t initial_radial_refinement_{};
     194           0 :   size_t initial_angular_refinement_{};
     195           0 :   size_t initial_number_of_radial_grid_points_{};
     196           0 :   size_t initial_spherical_harmonic_l_{};
     197           0 :   size_t initial_number_of_angular_grid_points_of_wedges_{};
     198           0 :   std::vector<std::array<size_t, 3>> initial_refinement_levels_{};
     199           0 :   std::vector<std::array<size_t, 3>> initial_number_of_grid_points_{};
     200             :   std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
     201           0 :       inner_boundary_condition_{};
     202             :   std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
     203           0 :       outer_boundary_condition_{};
     204             :   std::unordered_map<std::string, tnsr::I<double, 3, Frame::Grid>>
     205           0 :       grid_anchors_{};
     206             : };
     207             : }  // namespace domain::creators

Generated by: LCOV version 1.14