TciOptions.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <limits>
8 
9 #include "DataStructures/DataBox/Tag.hpp"
10 #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags/OptionsGroup.hpp"
11 #include "Options/Options.hpp"
12 #include "Utilities/TMPL.hpp"
13 
14 /// \cond
15 namespace PUP {
16 class er;
17 } // namespace PUP
18 /// \endcond
19 
21 /*!
22  * \brief Class holding options using by the GRMHD-specific parts of the
23  * troubled-cell indicator.
24  */
25 struct TciOptions {
26  /// \brief Minimum value of rest-mass density times Lorentz factor before we
27  /// switch to subcell. Used to identify places where the density has suddenly
28  /// become negative
29  struct MinimumValueOfD {
30  using type = double;
31  static type lower_bound() noexcept { return 0.0; }
32  static constexpr Options::String help = {
33  "Minimum value of rest-mass density times Lorentz factor before we "
34  "switch to subcell."};
35  };
36  /// \brief The density cutoff where if the maximum value of the density in the
37  /// DG element is below this value we skip primitive recovery and treat the
38  /// cell as atmosphere.
40  using type = double;
41  static type lower_bound() noexcept { return 0.0; }
42  static constexpr Options::String help = {
43  "The density cutoff where if the maximum value of the density in the "
44  "DG element is below this value we skip primitive recovery and treat "
45  "the cell as atmosphere."};
46  };
47  /// \brief Safety factor \f$\epsilon_B\f$.
48  ///
49  /// See the documentation for TciOnDgGrid for details on what this parameter
50  /// controls.
52  using type = double;
53  static type lower_bound() noexcept { return 0.0; }
54  static constexpr Options::String help = {
55  "Safety factor for magnetic field bound."};
56  };
57 
58  using options =
59  tmpl::list<MinimumValueOfD, AtmosphereDensity, SafetyFactorForB>;
60  static constexpr Options::String help = {
61  "Options for the troubled-cell indicator."};
62 
63  // NOLINTNEXTLINE(google-runtime-references)
64  void pup(PUP::er& p) noexcept;
65 
66  double minimum_rest_mass_density_times_lorentz_factor{
68  double atmosphere_density{std::numeric_limits<double>::signaling_NaN()};
69  double safety_factor_for_magnetic_field{
71 };
72 
73 namespace OptionTags {
74 struct TciOptions {
75  using type = subcell::TciOptions;
76  static constexpr Options::String help = "GRMHD-specific options for the TCI.";
78 };
79 } // namespace OptionTags
80 
81 namespace Tags {
83  using type = subcell::TciOptions;
84 
85  using option_tags = tmpl::list<OptionTags::TciOptions>;
86  static constexpr bool pass_metavariables = false;
87  static type create_from_options(const type& tci_options) noexcept {
88  return tci_options;
89  }
90 };
91 } // namespace Tags
92 } // namespace grmhd::ValenciaDivClean::subcell
grmhd::ValenciaDivClean::subcell
Code required by the DG-subcell/FD hybrid solver.
Definition: InitialDataTci.hpp:23
Options.hpp
grmhd::ValenciaDivClean::subcell::OptionTags::TciOptions
Definition: TciOptions.hpp:74
grmhd::ValenciaDivClean::subcell::TciOptions::MinimumValueOfD
Minimum value of rest-mass density times Lorentz factor before we switch to subcell....
Definition: TciOptions.hpp:29
db::SimpleTag
Mark a struct as a simple tag by inheriting from this.
Definition: Tag.hpp:36
cstddef
grmhd::ValenciaDivClean::subcell::TciOptions
Class holding options using by the GRMHD-specific parts of the troubled-cell indicator.
Definition: TciOptions.hpp:25
std::numeric_limits::signaling_NaN
T signaling_NaN(T... args)
grmhd::ValenciaDivClean::subcell::Tags::TciOptions
Definition: TciOptions.hpp:82
limits
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
dg::OptionTags::DiscontinuousGalerkinGroup
Group holding options for controlling the DG discretization.
Definition: OptionsGroup.hpp:19
grmhd::ValenciaDivClean::subcell::TciOptions::AtmosphereDensity
The density cutoff where if the maximum value of the density in the DG element is below this value we...
Definition: TciOptions.hpp:39
grmhd::ValenciaDivClean::subcell::TciOptions::SafetyFactorForB
Safety factor .
Definition: TciOptions.hpp:51
TMPL.hpp