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 <string>
8 :
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "Options/String.hpp"
11 : #include "Utilities/Gsl.hpp"
12 : #include "Utilities/TMPL.hpp"
13 :
14 : namespace gh::bbh {
15 0 : namespace OptionTags {
16 : /// BBH inspiral-completion controls that are read from input options.
17 1 : struct CompletionCriteria {
18 0 : static std::string name() { return "BbhCompletionCriteria"; }
19 0 : static constexpr Options::String help =
20 : "Options controlling inspiral termination based on global BBH criteria.";
21 : };
22 :
23 0 : struct MinCommonHorizonSuccessesBeforeChecks {
24 0 : using type = size_t;
25 0 : using group = CompletionCriteria;
26 0 : static constexpr Options::String help =
27 : "Do not evaluate binary-black-hole completion checks before this many "
28 : "successful common-horizon finds.";
29 : };
30 :
31 0 : struct MaxCommonHorizonSuccesses {
32 0 : using type = size_t;
33 0 : using group = CompletionCriteria;
34 0 : static constexpr Options::String help =
35 : "When successful common-horizon finds reach this count in a "
36 : "binary-black-hole simulation, request completion.";
37 : };
38 :
39 0 : struct GaugeConstraintLinfThreshold {
40 0 : using type = double;
41 0 : using group = CompletionCriteria;
42 0 : static constexpr Options::String help =
43 : "When the reduced Linf norm of the gauge constraint is greater than or "
44 : "equal to this threshold in a binary-black-hole simulation, request "
45 : "completion.";
46 : };
47 :
48 0 : struct ThreeIndexConstraintLinfThreshold {
49 0 : using type = double;
50 0 : using group = CompletionCriteria;
51 0 : static constexpr Options::String help =
52 : "When the reduced Linf norm of the three-index constraint is greater "
53 : "than or equal to this threshold in a binary-black-hole simulation, "
54 : "request completion.";
55 : };
56 :
57 0 : struct CommonHorizonLMaxThreshold {
58 0 : using type = size_t;
59 0 : using group = CompletionCriteria;
60 0 : static constexpr Options::String help =
61 : "When the common-horizon LMax is less than or equal to this value in a "
62 : "binary-black-hole simulation, request completion (after the minimum "
63 : "common-horizon success count is reached).";
64 : };
65 :
66 0 : struct ConstraintCheckVerbose {
67 0 : using type = bool;
68 0 : using group = CompletionCriteria;
69 0 : static constexpr Options::String help =
70 : "Whether to print reduced binary-black-hole constraint norms at each "
71 : "constraint-threshold check.";
72 : };
73 : } // namespace OptionTags
74 :
75 0 : namespace Tags {
76 : /// Minimum number of successful common-horizon finds required before
77 : /// completion checks are evaluated.
78 1 : struct MinCommonHorizonSuccessesBeforeChecks : db::SimpleTag {
79 0 : using type = size_t;
80 0 : using option_tags =
81 : tmpl::list<OptionTags::MinCommonHorizonSuccessesBeforeChecks>;
82 :
83 0 : static constexpr bool pass_metavariables = false;
84 0 : static type create_from_options(const type value) { return value; }
85 : };
86 :
87 : /// Number of successful common-horizon finds that triggers completion.
88 : /// Controlled by `gh::bbh::OptionTags::MaxCommonHorizonSuccesses`.
89 1 : struct MaxCommonHorizonSuccesses : db::SimpleTag {
90 0 : using type = size_t;
91 0 : using option_tags = tmpl::list<OptionTags::MaxCommonHorizonSuccesses>;
92 :
93 0 : static constexpr bool pass_metavariables = false;
94 0 : static type create_from_options(const type value) { return value; }
95 : };
96 :
97 : /// Threshold for requesting completion from the reduced gauge-constraint Linf
98 : /// criterion:
99 : /// when Linf(gauge constraint) >= this threshold in a binary-black-hole
100 : /// simulation, request completion.
101 : /// Controlled by `gh::bbh::OptionTags::GaugeConstraintLinfThreshold`.
102 1 : struct GaugeConstraintLinfThreshold : db::SimpleTag {
103 0 : using type = double;
104 0 : using option_tags = tmpl::list<OptionTags::GaugeConstraintLinfThreshold>;
105 :
106 0 : static constexpr bool pass_metavariables = false;
107 0 : static type create_from_options(const type value) { return value; }
108 : };
109 :
110 : /// Threshold for requesting completion from the reduced three-index-constraint
111 : /// Linf criterion:
112 : /// when Linf(three-index constraint) >= this threshold in a binary-black-hole
113 : /// simulation, request completion.
114 : /// Controlled by `gh::bbh::OptionTags::ThreeIndexConstraintLinfThreshold`.
115 1 : struct ThreeIndexConstraintLinfThreshold : db::SimpleTag {
116 0 : using type = double;
117 0 : using option_tags = tmpl::list<OptionTags::ThreeIndexConstraintLinfThreshold>;
118 :
119 0 : static constexpr bool pass_metavariables = false;
120 0 : static type create_from_options(const type value) { return value; }
121 : };
122 :
123 : /// Common-horizon `LMax` threshold criterion for requesting completion
124 : /// (after the minimum common-horizon success count is reached):
125 : /// when common-horizon `LMax` <= this threshold in a binary-black-hole
126 : /// simulation, request completion.
127 : /// Controlled by `gh::bbh::OptionTags::CommonHorizonLMaxThreshold`.
128 1 : struct CommonHorizonLMaxThreshold : db::SimpleTag {
129 0 : using type = size_t;
130 0 : using option_tags = tmpl::list<OptionTags::CommonHorizonLMaxThreshold>;
131 :
132 0 : static constexpr bool pass_metavariables = false;
133 0 : static type create_from_options(const type value) { return value; }
134 : };
135 :
136 : /// Verbosity control for reduced constraint checks.
137 : /// Controlled by `gh::bbh::OptionTags::ConstraintCheckVerbose`.
138 1 : struct ConstraintCheckVerbose : db::SimpleTag {
139 0 : using type = bool;
140 0 : using option_tags = tmpl::list<OptionTags::ConstraintCheckVerbose>;
141 :
142 0 : static constexpr bool pass_metavariables = false;
143 0 : static type create_from_options(const type value) { return value; }
144 : };
145 :
146 : /// Latch indicating that the reduced gauge-constraint criterion was met.
147 1 : struct GaugeConstraintExceeded : db::SimpleTag {
148 0 : using type = bool;
149 0 : using option_tags = tmpl::list<>;
150 :
151 0 : static constexpr bool pass_metavariables = false;
152 0 : static type create_from_options() { return false; }
153 : };
154 :
155 : /// Latch indicating that the reduced three-index-constraint criterion was met.
156 1 : struct ThreeIndexConstraintExceeded : db::SimpleTag {
157 0 : using type = bool;
158 0 : using option_tags = tmpl::list<>;
159 :
160 0 : static constexpr bool pass_metavariables = false;
161 0 : static type create_from_options() { return false; }
162 : };
163 :
164 : /// Latch indicating that a successful common-horizon find satisfied the `LMax`
165 : /// criterion.
166 1 : struct CommonHorizonLMaxBelowOrEqualThreshold : db::SimpleTag {
167 0 : using type = bool;
168 0 : using option_tags = tmpl::list<>;
169 :
170 0 : static constexpr bool pass_metavariables = false;
171 0 : static type create_from_options() { return false; }
172 : };
173 :
174 : /// Count of successful common-horizon finds.
175 1 : struct CommonHorizonSuccessCount : db::SimpleTag {
176 0 : using type = size_t;
177 0 : using option_tags = tmpl::list<>;
178 :
179 0 : static constexpr bool pass_metavariables = false;
180 0 : static type create_from_options() { return 0; }
181 : };
182 :
183 : /// Latch used by phase control to checkpoint-and-exit the binary-black-hole
184 : /// simulation when completion is requested by any criterion.
185 1 : struct CompletionRequested : db::SimpleTag {
186 0 : using type = bool;
187 0 : using option_tags = tmpl::list<>;
188 :
189 0 : static constexpr bool pass_metavariables = false;
190 0 : static type create_from_options() { return false; }
191 : };
192 :
193 : /// Element-local latch mirrored from the BBH completion singleton and used by
194 : /// phase control to request checkpoint-and-exit.
195 1 : struct ElementCompletionRequested : db::SimpleTag {
196 0 : using type = bool;
197 0 : using option_tags = tmpl::list<>;
198 :
199 0 : static constexpr bool pass_metavariables = false;
200 0 : static type create_from_options() { return false; }
201 : };
202 : } // namespace Tags
203 : } // namespace gh::bbh
|