1 #include "parameters/all_parameters.h" 2 #include "bound_preserving_limiter_factory.hpp" 3 #include "bound_preserving_limiter.h" 4 #include "tvb_limiter.h" 5 #include "maximum_principle_limiter.h" 6 #include "positivity_preserving_limiter.h" 9 template <
int dim,
int nspecies,
int nstate,
typename real>
10 std::unique_ptr< BoundPreservingLimiter<dim, nspecies, real> >
17 else if (nstate == parameters_input->
nstate && nspecies == 1)
19 else if constexpr (nstate > 1 && nspecies == 1)
25 template <
int dim,
int nspecies,
int nstate,
typename real>
26 std::unique_ptr< BoundPreservingLimiter<dim, nspecies, real> >
40 if (limiter_type == limiter_enum::none) {
41 if (apply_tvb ==
true) {
42 if(curvilinear_grid) {
43 std::cout <<
"Error: Cannot create limiter for curvilinear grid" << std::endl;
45 }
else if (flux_nodes_type != flux_nodes_enum::GLL) {
46 std::cout <<
"Error: Can only use limiter with GLL flux nodes" << std::endl;
48 }
else if (dim == 1) {
49 return std::make_unique < TVBLimiter<dim, nspecies, nstate, real> >(parameters_input);
52 std::cout <<
"Error: Cannot create TVB limiter for dim > 1" << std::endl;
58 }
else if(curvilinear_grid) {
59 std::cout <<
"Error: Cannot create limiter for curvilinear grid" << std::endl;
61 }
else if (flux_nodes_type != flux_nodes_enum::GLL) {
62 std::cout <<
"Error: Can only use limiter with GLL flux nodes" << std::endl;
64 }
else if (limiter_type == limiter_enum::maximum_principle && nspecies==1) {
65 return std::make_unique< MaximumPrincipleLimiter<dim, nspecies, nstate, real> >(parameters_input);
66 }
else if ((limiter_type == limiter_enum::positivity_preservingZhang2010 && nspecies==1)
67 || limiter_type == limiter_enum::positivity_preservingWang2012) {
68 if (nstate == dim + nspecies + 1)
69 return std::make_unique< PositivityPreservingLimiter<dim, nspecies, nstate, real> >(parameters_input);
71 if(nstate != dim + nspecies + 1) {
72 std::cout <<
"Error: Cannot create Positivity-Preserving limiter for nstate_input != dim + nspecies + 1" << std::endl;
73 std::cout <<
"Positivity-Preserving Limiter can only be created for Euler, Navier-Stokes and Real Gas PDEs." << std::endl;
79 std::cout <<
"Error: Cannot create limiter pointer due to an invalid limiter type specified" << std::endl;
84 #if PHILIP_SPECIES == 1 86 #define POSSIBLE_NSTATE (1)(2)(3)(4)(5)(6) 89 #define INSTANTIATE_LIMITER(r, data, nstate) \ 90 template class BoundPreservingLimiterFactory <PHILIP_DIM, PHILIP_SPECIES, nstate, double>; 91 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_LIMITER, _, POSSIBLE_NSTATE)
bool use_curvilinear_grid
Flag to use curvilinear grid.
LimiterType
Limiter type to be applied on the solution.
LimiterParam limiter_param
Contains parameters for limiter.
LimiterType bound_preserving_limiter
Variable to store specified limiter type.
Files for the baseline physics.
This class creates a new BoundPreservingLimiter object based on input parameters. ...
static std::unique_ptr< BoundPreservingLimiter< dim, nspecies, real > > create_limiter(const Parameters::AllParameters *const parameters_input)
Recursively templated function that calls select_limiter when nstate is equal to one specified in prm...
Main parameter class that contains the various other sub-parameter classes.
int nstate
Number of state variables. Will depend on PDE.
FluxNodes flux_nodes_type
Store selected FluxNodes from the input file.
static std::unique_ptr< BoundPreservingLimiter< dim, nspecies, real > > select_limiter(const Parameters::AllParameters *const parameters_input)
Create a pointer to the limiter specified in prms.
bool use_tvb_limiter
Flag for applying TVB Limiter.
FluxNodes
Flux nodes type.