NoIncomingRadiation.hpp
1 // 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"
12 #include "Evolution/Systems/Cce/Initialize/InitializeJ.hpp"
14 #include "Utilities/Gsl.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 by constraining
26  * \f$\Psi_0 = 0\f$.
27  *
28  * \details This algorithm first radially evolves the \f$\Psi_0 = 0\f$
29  * condition, which can be converted to a second-order radial ODE for J. Then,
30  * the initial data generator performs an iterative solve for the angular
31  * coordinates necessary to ensure asymptotic flatness. The parameters for the
32  * iterative procedure are determined by options
33  * `AngularCoordinateTolerance` and `MaxIterations`.
34  */
37  using type = double;
38  static std::string name() noexcept { return "AngularCoordTolerance"; }
39  static constexpr OptionString help = {
40  "Tolerance of initial angular coordinates for CCE"};
41  static type lower_bound() noexcept { return 1.0e-14; }
42  static type upper_bound() noexcept { return 1.0e-3; }
43  static type default_value() noexcept { return 1.0e-10; }
44  };
45 
46  struct MaxIterations {
47  using type = size_t;
48  static constexpr OptionString help = {
49  "Number of linearized inversion iterations."};
50  static type lower_bound() noexcept { return 10; }
51  static type upper_bound() noexcept { return 1000; }
52  static type default_value() noexcept { return 300; }
53  };
54 
56  using type = bool;
57  static constexpr OptionString help = {
58  "If true, initialization will error if it hits MaxIterations"};
59  static type default_value() noexcept { return false; }
60  };
61 
62  using options =
63  tmpl::list<AngularCoordinateTolerance, MaxIterations, RequireConvergence>;
64  static constexpr OptionString help = {
65  "Initialization process where J is set so Psi0 is vanishing\n"
66  "(roughly a no incoming radiation condition)"};
67 
68  WRAPPED_PUPable_decl_template(NoIncomingRadiation); // NOLINT
69  explicit NoIncomingRadiation(CkMigrateMessage* /*unused*/) noexcept {}
70 
71  NoIncomingRadiation(double angular_coordinate_tolerance,
72  size_t max_iterations,
73  bool require_convergence = false) noexcept;
74 
75  NoIncomingRadiation() = default;
76 
77  std::unique_ptr<InitializeJ> get_clone() const noexcept override;
78 
79  void operator()(
80  gsl::not_null<Scalar<SpinWeighted<ComplexDataVector, 2>>*> j,
81  gsl::not_null<tnsr::i<DataVector, 3>*> cartesian_cauchy_coordinates,
82  gsl::not_null<
83  tnsr::i<DataVector, 2, ::Frame::Spherical<::Frame::Inertial>>*>
84  angular_cauchy_coordinates,
85  const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_j,
86  const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_dr_j,
87  const Scalar<SpinWeighted<ComplexDataVector, 0>>& r, size_t l_max,
88  size_t number_of_radial_points) const noexcept override;
89 
90  void pup(PUP::er& p) noexcept override;
91 
92  private:
93  bool require_convergence_ = false;
94  double angular_coordinate_tolerance_ = 1.0e-10;
95  size_t max_iterations_ = 300;
96 };
97 } // namespace InitializeJ
98 } // namespace Cce
Cce::InitializeJ::NoIncomingRadiation::AngularCoordinateTolerance
Definition: NoIncomingRadiation.hpp:36
std::string
CharmPupable.hpp
SpinWeighted
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition,...
Definition: SpinWeighted.hpp:24
cstddef
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
memory
tnsr
Type aliases to construct common Tensors.
Definition: TypeAliases.hpp:31
Cce::InitializeJ::InitializeJ
Abstract base class for an initial hypersurface data generator for Cce.
Definition: InitializeJ.hpp:104
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Gsl.hpp
TypeAliases.hpp
Frame
Definition: IndexType.hpp:36
ComplexDataVector
Stores a collection of complex function values.
Definition: ComplexDataVector.hpp:47
Cce::InitializeJ::NoIncomingRadiation::RequireConvergence
Definition: NoIncomingRadiation.hpp:55
OptionString
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:30
gsl
Implementations from the Guideline Support Library.
Definition: Gsl.hpp:79
Cce::InitializeJ::NoIncomingRadiation::MaxIterations
Definition: NoIncomingRadiation.hpp:46
TMPL.hpp
Cce::InitializeJ::NoIncomingRadiation
Initialize on the first hypersurface by constraining .
Definition: NoIncomingRadiation.hpp:35
string