Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/Tag.hpp" 7 : #include "DataStructures/DataVector.hpp" 8 : #include "DataStructures/Tensor/Tensor.hpp" 9 : #include "NumericalAlgorithms/DiscontinuousGalerkin/Formulation.hpp" 10 : #include "NumericalAlgorithms/Spectral/Quadrature.hpp" 11 : #include "Options/String.hpp" 12 : #include "Utilities/ErrorHandling/Error.hpp" 13 : #include "Utilities/TMPL.hpp" 14 : 15 : namespace elliptic::dg { 16 : /// Option tags related to elliptic discontinuous Galerkin schemes 17 1 : namespace OptionTags { 18 : 19 0 : struct Discretization { 20 0 : static constexpr Options::String help = 21 : "Options for the discretization of the elliptic equations"; 22 : }; 23 : 24 0 : struct DiscontinuousGalerkin { 25 0 : using group = Discretization; 26 0 : static constexpr Options::String help = 27 : "Options for the discontinuous Galerkin discretization"; 28 : }; 29 : 30 0 : struct PenaltyParameter { 31 0 : using type = double; 32 0 : static constexpr Options::String help = 33 : "The prefactor to the penalty term of the numerical flux. Values closer " 34 : "to one lead to better-conditioned problems, but on curved meshes the " 35 : "penalty parameter may need to be increased to keep the problem " 36 : "well-defined."; 37 0 : using group = DiscontinuousGalerkin; 38 : }; 39 : 40 0 : struct Massive { 41 0 : using type = bool; 42 0 : static constexpr Options::String help = 43 : "Whether or not to multiply the DG operator with the mass matrix. " 44 : "Massive DG operators can be easier to solve because they are symmetric, " 45 : "or at least closer to symmetry"; 46 0 : using group = DiscontinuousGalerkin; 47 : }; 48 : 49 0 : struct Quadrature { 50 0 : using type = Spectral::Quadrature; 51 0 : static constexpr Options::String help = 52 : "The quadrature method used, which determines the distribution of points " 53 : "on the grid. Gauss-Lobatto points have a point at the boundary and " 54 : "Gauss points do not. Other quadratures are not currently supported."; 55 0 : using group = DiscontinuousGalerkin; 56 : }; 57 : 58 0 : struct Formulation { 59 0 : using type = ::dg::Formulation; 60 0 : static constexpr Options::String help = 61 : "The DG formulation to use (strong or weak)."; 62 0 : using group = DiscontinuousGalerkin; 63 : }; 64 : 65 : } // namespace OptionTags 66 : 67 : /// DataBox tags related to elliptic discontinuous Galerkin schemes 68 : namespace Tags { 69 : 70 : /*! 71 : * \brief The prefactor to the penalty term of the numerical flux 72 : * 73 : * \see elliptic::dg::penalty 74 : */ 75 1 : struct PenaltyParameter : db::SimpleTag { 76 0 : using type = double; 77 0 : static constexpr bool pass_metavariables = false; 78 0 : using option_tags = tmpl::list<OptionTags::PenaltyParameter>; 79 0 : static double create_from_options(const double value) { return value; } 80 : }; 81 : 82 : /*! 83 : * \brief The penalty factor in internal penalty fluxes 84 : * 85 : * \see elliptic::dg::penalty 86 : */ 87 1 : struct PenaltyFactor : db::SimpleTag { 88 0 : using type = Scalar<DataVector>; 89 : }; 90 : 91 : /// Whether or not to multiply the DG operator with the mass matrix. Massive DG 92 : /// operators can be easier to solve because they are symmetric, or at least 93 : /// closer to symmetry. 94 1 : struct Massive : db::SimpleTag { 95 0 : using type = bool; 96 0 : static constexpr bool pass_metavariables = false; 97 0 : using option_tags = tmpl::list<OptionTags::Massive>; 98 0 : static bool create_from_options(const bool value) { return value; } 99 : }; 100 : 101 : /// The quadrature method used for the elliptic DG discretization 102 1 : struct Quadrature : db::SimpleTag { 103 0 : using type = Spectral::Quadrature; 104 0 : static constexpr bool pass_metavariables = false; 105 0 : using option_tags = tmpl::list<OptionTags::Quadrature>; 106 0 : static type create_from_options(const type value) { 107 : if (not(value == Spectral::Quadrature::Gauss or 108 : value == Spectral::Quadrature::GaussLobatto)) { 109 : ERROR_NO_TRACE( 110 : "Choose Gauss or Gauss-Lobatto quadrature for elliptic DG " 111 : "discretizations."); 112 : } 113 : return value; 114 : } 115 : }; 116 : 117 : /// The DG formulation to use (strong or weak) 118 1 : struct Formulation : db::SimpleTag { 119 0 : using type = ::dg::Formulation; 120 0 : static constexpr bool pass_metavariables = false; 121 0 : using option_tags = tmpl::list<OptionTags::Formulation>; 122 0 : static type create_from_options(const type value) { return value; } 123 : }; 124 : 125 : } // namespace Tags 126 : } // namespace elliptic::dg