SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Initialize - ZeroNonSmooth.hpp Hit Total Coverage
Commit: 3c072f0ce967e2e56649d3fa12aa2a0e4fe2a42e Lines: 1 31 3.2 %
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 <cstddef>
       7             : #include <memory>
       8             : #include <string>
       9             : 
      10             : #include "DataStructures/SpinWeighted.hpp"
      11             : #include "DataStructures/Tensor/TypeAliases.hpp"
      12             : #include "Evolution/Systems/Cce/Initialize/InitializeJ.hpp"
      13             : #include "Utilities/Gsl.hpp"
      14             : #include "Utilities/Serialization/CharmPupable.hpp"
      15             : #include "Utilities/TMPL.hpp"
      16             : 
      17             : /// \cond
      18             : class ComplexDataVector;
      19             : /// \endcond
      20             : 
      21             : namespace Cce {
      22             : namespace InitializeJ {
      23             : 
      24             : /*!
      25             :  * \brief Initialize \f$J\f$ on the first hypersurface to be vanishing, finding
      26             :  * the appropriate angular coordinates to be continuous with the provided
      27             :  * worldtube boundary data.
      28             :  *
      29             :  * \details Internally, this performs an iterative solve for the angular
      30             :  * coordinates necessary to give rise to a vanishing gauge-transformed J on the
      31             :  * worldtube boundary. The parameters for the iterative procedure are determined
      32             :  * by options `ZeroNonSmooth::AngularCoordinateTolerance` and
      33             :  * `ZeroNonSmooth::MaxIterations`. The resulting `J` will necessarily
      34             :  * have vanishing first radial derivative, and so will typically not be smooth
      35             :  * (only continuous) with the provided Cauchy data at the worldtube boundary.
      36             :  */
      37           1 : struct ZeroNonSmooth : InitializeJ<false> {
      38           0 :   struct AngularCoordinateTolerance {
      39           0 :     using type = double;
      40           0 :     static std::string name() { return "AngularCoordTolerance"; }
      41           0 :     static constexpr Options::String help = {
      42             :         "Tolerance of initial angular coordinates for CCE"};
      43           0 :     static type lower_bound() { return 1.0e-14; }
      44           0 :     static type upper_bound() { return 1.0e-3; }
      45           0 :     static type suggested_value() { return 1.0e-10; }
      46             :   };
      47             : 
      48           0 :   struct MaxIterations {
      49           0 :     using type = size_t;
      50           0 :     static constexpr Options::String help = {
      51             :         "Number of linearized inversion iterations."};
      52           0 :     static type lower_bound() { return 10; }
      53           0 :     static type upper_bound() { return 1000; }
      54           0 :     static type suggested_value() { return 300; }
      55             :   };
      56             : 
      57           0 :   struct RequireConvergence {
      58           0 :     using type = bool;
      59           0 :     static constexpr Options::String help = {
      60             :         "If true, initialization will error if it hits MaxIterations"};
      61           0 :     static type suggested_value() { return true; }
      62             :   };
      63           0 :   using options =
      64             :       tmpl::list<AngularCoordinateTolerance, MaxIterations, RequireConvergence>;
      65             : 
      66           0 :   static constexpr Options::String help = {
      67             :       "Initialization process where J is set so Psi0 is vanishing\n"
      68             :       "(roughly a no incoming radiation condition)"};
      69             : 
      70           0 :   WRAPPED_PUPable_decl_template(ZeroNonSmooth);  // NOLINT
      71           0 :   explicit ZeroNonSmooth(CkMigrateMessage* /*unused*/) {}
      72             : 
      73           0 :   ZeroNonSmooth(double angular_coordinate_tolerance, size_t max_iterations,
      74             :                 bool require_convergence = false);
      75             : 
      76           0 :   ZeroNonSmooth() = default;
      77             : 
      78           0 :   std::unique_ptr<InitializeJ> get_clone() const override;
      79             : 
      80           0 :   void operator()(
      81             :       gsl::not_null<Scalar<SpinWeighted<ComplexDataVector, 2>>*> j,
      82             :       gsl::not_null<tnsr::i<DataVector, 3>*> cartesian_cauchy_coordinates,
      83             :       gsl::not_null<
      84             :           tnsr::i<DataVector, 2, ::Frame::Spherical<::Frame::Inertial>>*>
      85             :           angular_cauchy_coordinates,
      86             :       const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_j,
      87             :       const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_dr_j,
      88             :       const Scalar<SpinWeighted<ComplexDataVector, 0>>& r,
      89             :       const Scalar<SpinWeighted<ComplexDataVector, 0>>& beta, size_t l_max,
      90             :       size_t number_of_radial_points,
      91             :       gsl::not_null<Parallel::NodeLock*> hdf5_lock) const override;
      92             : 
      93           0 :   void pup(PUP::er& p) override;
      94             : 
      95             :  private:
      96           0 :   double angular_coordinate_tolerance_ = 1.0e-10;
      97           0 :   size_t max_iterations_ = 300;
      98           0 :   bool require_convergence_ = false;
      99             : };
     100             : }  // namespace InitializeJ
     101             : }  // namespace Cce

Generated by: LCOV version 1.14