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