ZeroNonSmooth.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 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  */
39  using type = double;
40  static std::string name() noexcept { return "AngularCoordTolerance"; }
41  static constexpr Options::String help = {
42  "Tolerance of initial angular coordinates for CCE"};
43  static type lower_bound() noexcept { return 1.0e-14; }
44  static type upper_bound() noexcept { return 1.0e-3; }
45  static type default_value() noexcept { return 1.0e-10; }
46  };
47 
48  struct MaxIterations {
49  using type = size_t;
50  static constexpr Options::String help = {
51  "Number of linearized inversion iterations."};
52  static type lower_bound() noexcept { return 10; }
53  static type upper_bound() noexcept { return 1000; }
54  static type default_value() noexcept { return 300; }
55  };
56 
58  using type = bool;
59  static constexpr Options::String help = {
60  "If true, initialization will error if it hits MaxIterations"};
61  static type default_value() noexcept { return false; }
62  };
63  using options =
64  tmpl::list<AngularCoordinateTolerance, MaxIterations, RequireConvergence>;
65 
66  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  WRAPPED_PUPable_decl_template(ZeroNonSmooth); // NOLINT
71  explicit ZeroNonSmooth(CkMigrateMessage* /*unused*/) noexcept {}
72 
73  ZeroNonSmooth(double angular_coordinate_tolerance, size_t max_iterations,
74  bool require_convergence = false) noexcept;
75 
76  ZeroNonSmooth() = default;
77 
78  std::unique_ptr<InitializeJ> get_clone() const noexcept override;
79 
80  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, size_t l_max,
89  size_t number_of_radial_points) const noexcept override;
90 
91  void pup(PUP::er& p) noexcept override;
92 
93  private:
94  double angular_coordinate_tolerance_ = 1.0e-10;
95  size_t max_iterations_ = 300;
96  bool require_convergence_ = false;
97 };
98 } // namespace InitializeJ
99 } // namespace Cce
std::string
CharmPupable.hpp
Cce::InitializeJ::ZeroNonSmooth::RequireConvergence
Definition: ZeroNonSmooth.hpp:57
SpinWeighted
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition,...
Definition: SpinWeighted.hpp:24
Cce::InitializeJ::ZeroNonSmooth::AngularCoordinateTolerance
Definition: ZeroNonSmooth.hpp:38
cstddef
Cce::InitializeJ::ZeroNonSmooth::MaxIterations
Definition: ZeroNonSmooth.hpp:48
Cce::InitializeJ::ZeroNonSmooth
Initialize on the first hypersurface to be vanishing, finding the appropriate angular coordinates to...
Definition: ZeroNonSmooth.hpp:37
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
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
Frame
Definition: IndexType.hpp:36
ComplexDataVector
Stores a collection of complex function values.
Definition: ComplexDataVector.hpp:47
gsl
Implementations from the Guideline Support Library.
Definition: Gsl.hpp:80
TMPL.hpp
string