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 <limits>
8 : #include <string>
9 : #include <vector>
10 :
11 : #include "Options/Context.hpp"
12 : #include "Options/String.hpp"
13 : #include "Utilities/TMPL.hpp"
14 :
15 : /// \cond
16 : namespace PUP {
17 : class er;
18 : } // namespace PUP
19 : /// \endcond
20 :
21 : namespace grmhd::ValenciaDivClean {
22 :
23 : /// Options to be passed to the Con2Prim algorithm.
24 : /// Currently, we simply set a threshold for tildeD
25 : /// below which the inversion is not performed and
26 : /// the density is set to atmosphere values.
27 1 : class PrimitiveFromConservativeOptions {
28 : public:
29 0 : struct CutoffDForInversion {
30 0 : static std::string name() { return "CutoffDForInversion"; }
31 0 : static constexpr Options::String help{
32 : "Value of density times Lorentz factor below which we skip "
33 : "conservative to primitive inversion."};
34 0 : using type = double;
35 0 : static type lower_bound() { return 0.0; }
36 : };
37 :
38 0 : struct DensityWhenSkippingInversion {
39 0 : static std::string name() { return "DensityWhenSkippingInversion"; }
40 0 : static constexpr Options::String help{
41 : "Value of density when we skip conservative to primitive inversion."};
42 0 : using type = double;
43 0 : static type lower_bound() { return 0.0; }
44 : };
45 :
46 0 : struct KastaunMaxLorentzFactor {
47 0 : static constexpr Options::String help{
48 : "The maximum Lorentz allowed during primitive recovery when using the "
49 : "Kastaun schemes."};
50 0 : using type = double;
51 0 : static type lower_bound() { return 1.0; }
52 : };
53 :
54 0 : using options = tmpl::list<CutoffDForInversion, DensityWhenSkippingInversion,
55 : KastaunMaxLorentzFactor>;
56 :
57 0 : static constexpr Options::String help{
58 : "Options given to conservative to primitive inversion."};
59 :
60 0 : PrimitiveFromConservativeOptions() = default;
61 :
62 0 : PrimitiveFromConservativeOptions(double cutoff_d_for_inversion,
63 : double density_when_skipping_inversion,
64 : double kastaun_max_lorentz_factor,
65 : const Options::Context& context = {});
66 :
67 0 : void pup(PUP::er& p);
68 :
69 0 : double cutoff_d_for_inversion() const { return cutoff_d_for_inversion_; }
70 0 : double density_when_skipping_inversion() const {
71 : return density_when_skipping_inversion_;
72 : }
73 0 : double kastaun_max_lorentz_factor() const {
74 : return kastaun_max_lorentz_factor_;
75 : }
76 :
77 : private:
78 0 : friend bool operator==(const PrimitiveFromConservativeOptions& lhs,
79 : const PrimitiveFromConservativeOptions& rhs);
80 :
81 0 : double cutoff_d_for_inversion_ = std::numeric_limits<double>::signaling_NaN();
82 0 : double density_when_skipping_inversion_ =
83 : std::numeric_limits<double>::signaling_NaN();
84 0 : double kastaun_max_lorentz_factor_ =
85 : std::numeric_limits<double>::signaling_NaN();
86 : };
87 :
88 0 : bool operator!=(const PrimitiveFromConservativeOptions& lhs,
89 : const PrimitiveFromConservativeOptions& rhs);
90 :
91 : } // namespace grmhd::ValenciaDivClean
|