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 <optional> 9 : 10 : #include "DataStructures/DataBox/Tag.hpp" 11 : #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags/OptionsGroup.hpp" 12 : #include "Options/Auto.hpp" 13 : #include "Options/String.hpp" 14 : #include "Utilities/TMPL.hpp" 15 : 16 : /// \cond 17 : namespace PUP { 18 : class er; 19 : } // namespace PUP 20 : /// \endcond 21 : 22 : namespace ForceFree::subcell { 23 : 24 0 : struct TciOptions { 25 : private: 26 0 : struct DoNotCheckTildeQ {}; 27 : 28 : public: 29 : /*! 30 : * \brief The cutoff of the absolute value of the generalized charge density 31 : * \f$\tilde{Q}\f$ in an element to apply the Persson TCI. 32 : * 33 : * If maximum absolute value of \f$\tilde{Q}\f$ is below this option value, 34 : * the Persson TCI is not triggered for it. 35 : */ 36 1 : struct TildeQCutoff { 37 0 : using type = Options::Auto<double, DoNotCheckTildeQ>; 38 0 : static constexpr Options::String help = { 39 : "If maximum absolute value of TildeQ in an element is below this value " 40 : "we do not apply the Persson TCI to TildeQ. To disable the check, set " 41 : "this option to 'DoNotCheckTildeQ'."}; 42 : }; 43 : 44 0 : using options = tmpl::list<TildeQCutoff>; 45 : 46 0 : static constexpr Options::String help = { 47 : "Options for the troubled-cell indicator"}; 48 : 49 0 : TciOptions(); 50 0 : explicit TciOptions(std::optional<double> tilde_q_cutoff_in); 51 : 52 : // NOLINTNEXTLINE(google-runtime-references) 53 0 : void pup(PUP::er& /*p*/); 54 : 55 0 : std::optional<double> tilde_q_cutoff{ 56 : std::numeric_limits<double>::signaling_NaN()}; 57 : }; 58 : 59 0 : namespace OptionTags { 60 0 : struct TciOptions { 61 0 : using type = subcell::TciOptions; 62 0 : static constexpr Options::String help = "TCI options for ForceFree system"; 63 0 : using group = ::dg::OptionTags::DiscontinuousGalerkinGroup; 64 : }; 65 : } // namespace OptionTags 66 : 67 0 : namespace Tags { 68 0 : struct TciOptions : db::SimpleTag { 69 0 : using type = subcell::TciOptions; 70 0 : using option_tags = tmpl::list<typename OptionTags::TciOptions>; 71 : 72 0 : static constexpr bool pass_metavariables = false; 73 0 : static type create_from_options(const type& tci_options) { 74 : return tci_options; 75 : } 76 : }; 77 : } // namespace Tags 78 : } // namespace ForceFree::subcell