1 #include "numerical_flux_factory.hpp" 3 #include "convective_numerical_flux.hpp" 5 #include "physics/physics_model.h" 8 namespace NumericalFlux {
10 using AllParam = Parameters::AllParameters;
12 template <
int dim,
int nstate,
typename real>
13 std::unique_ptr< NumericalFluxConvective<dim,nstate,real> >
22 const bool is_euler_based = ((conv_num_flux_type == AllParam::ConvectiveNumericalFlux::roe) ||
23 (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::l2roe) ||
24 (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_roe_dissipation) ||
25 (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_l2roe_dissipation));
27 const bool is_two_point_conv = ((conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux) ||
28 (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_lax_friedrichs_dissipation) ||
29 (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_roe_dissipation) ||
30 (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_l2roe_dissipation));
31 if(is_two_point_conv && physics_input->all_parameters->use_split_form ==
false ) {
32 std::cout <<
"two point flux and not using split form are not compatible, please use another Convective Numerical Flux" << std::endl;
36 if (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::central_flux) {
37 if constexpr (nstate<=5) {
38 return std::make_unique< Central<dim, nstate, real> > (physics_input);
41 else if(conv_num_flux_type == AllParam::ConvectiveNumericalFlux::lax_friedrichs) {
42 return std::make_unique< LaxFriedrichs<dim, nstate, real> > (physics_input);
44 else if(is_euler_based) {
45 if constexpr (dim+2==nstate) {
46 return create_euler_based_convective_numerical_flux(conv_num_flux_type, pde_type, model_type, physics_input);
49 else if (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux) {
50 if constexpr (nstate<=5) {
51 return std::make_unique< EntropyConserving<dim, nstate, real> > (physics_input);
54 else if (conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_lax_friedrichs_dissipation) {
55 if constexpr (nstate<=5) {
56 return std::make_unique< EntropyConservingWithLaxFriedrichsDissipation<dim, nstate, real> > (physics_input);
64 std::cout <<
"Invalid convective numerical flux and/or invalid added Riemann solver dissipation type." << std::endl;
68 template <
int dim,
int nstate,
typename real>
69 std::unique_ptr< NumericalFluxConvective<dim,nstate,real> >
79 std::shared_ptr<Physics::PhysicsBase<dim, nstate, real>> euler_based_physics_to_be_passed = physics_input;
81 if(pde_type!=PDE_enum::euler &&
82 pde_type!=PDE_enum::navier_stokes &&
83 !(pde_type==PDE_enum::physics_model && model_type==Model_enum::large_eddy_simulation))
85 std::cout <<
"Invalid convective numerical flux for pde_type. Aborting..." << std::endl;
90 if((pde_type==PDE_enum::physics_model &&
91 model_type==Model_enum::large_eddy_simulation))
93 if constexpr (dim+2==nstate) {
95 std::shared_ptr<Physics::Euler<dim,dim+2,real>> physics_baseline = std::dynamic_pointer_cast<
Physics::Euler<dim,dim+2,real>>(physics_model->physics_baseline);
96 euler_based_physics_to_be_passed = physics_baseline;
99 else if((pde_type==PDE_enum::physics_model &&
100 model_type!=Model_enum::large_eddy_simulation))
102 std::cout <<
"Invalid convective numerical flux for physics_model and/or corresponding baseline_physics_type" << std::endl;
103 if(nstate!=(dim+2)) std::cout <<
"Error: Cannot create_euler_based_convective_numerical_flux() for nstate_baseline_physics != nstate." << std::endl;
107 if(conv_num_flux_type == AllParam::ConvectiveNumericalFlux::roe) {
108 if constexpr (dim+2==nstate)
return std::make_unique< RoePike<dim, nstate, real> > (euler_based_physics_to_be_passed);
110 else if(conv_num_flux_type == AllParam::ConvectiveNumericalFlux::l2roe) {
111 if constexpr (dim+2==nstate)
return std::make_unique< L2Roe<dim, nstate, real> > (euler_based_physics_to_be_passed);
113 else if(conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_roe_dissipation) {
114 if constexpr (dim+2==nstate)
return std::make_unique< EntropyConservingWithRoeDissipation<dim, nstate, real> > (euler_based_physics_to_be_passed);
116 else if(conv_num_flux_type == AllParam::ConvectiveNumericalFlux::two_point_flux_with_l2roe_dissipation) {
117 if constexpr (dim+2==nstate)
return std::make_unique< EntropyConservingWithL2RoeDissipation<dim, nstate, real> > (euler_based_physics_to_be_passed);
123 std::cout <<
"Invalid Euler based convective numerical flux" << std::endl;
127 template <
int dim,
int nstate,
typename real>
128 std::unique_ptr< NumericalFluxDissipative<dim,nstate,real> >
135 if(diss_num_flux_type == AllParam::symm_internal_penalty) {
136 return std::make_unique < SymmetricInternalPenalty<dim, nstate, real> > (physics_input,artificial_dissipation_input);
137 }
else if(diss_num_flux_type == AllParam::bassi_rebay_2) {
138 return std::make_unique < BassiRebay2<dim, nstate, real> > (physics_input,artificial_dissipation_input);
139 }
else if(diss_num_flux_type == AllParam::central_visc_flux) {
140 return std::make_unique < CentralViscousNumericalFlux<dim, nstate, real> > (physics_input,artificial_dissipation_input);
143 std::cout <<
"Invalid dissipative flux" << std::endl;
static std::unique_ptr< NumericalFluxConvective< dim, nstate, real > > create_euler_based_convective_numerical_flux(const AllParam::ConvectiveNumericalFlux conv_num_flux_type, const AllParam::PartialDifferentialEquation pde_type, const AllParam::ModelType model_type, std::shared_ptr< Physics::PhysicsBase< dim, nstate, real >> physics_input)
Creates euler-based convective numerical flux (upwind term)
Base class from which Advection, Diffusion, ConvectionDiffusion, and Euler is derived.
static std::unique_ptr< NumericalFluxConvective< dim, nstate, real > > create_convective_numerical_flux(const AllParam::ConvectiveNumericalFlux conv_num_flux_type, const AllParam::PartialDifferentialEquation pde_type, const AllParam::ModelType model_type, std::shared_ptr< Physics::PhysicsBase< dim, nstate, real >> physics_input)
Creates convective numerical flux (baseline flux + upwind term) based on input.
Physics Model equations. Derived from PhysicsBase, holds a baseline physics and model terms and equat...
PartialDifferentialEquation
Possible Partial Differential Equations to solve.
Files for the baseline physics.
static std::unique_ptr< NumericalFluxDissipative< dim, nstate, real > > create_dissipative_numerical_flux(const AllParam::DissipativeNumericalFlux diss_num_flux_type, std::shared_ptr< Physics::PhysicsBase< dim, nstate, real >> physics_input, std::shared_ptr< ArtificialDissipationBase< dim, nstate >> artificial_dissipation_input)
Creates dissipative numerical flux based on input.
Creates a NumericalFluxConvective or NumericalFluxDissipative based on input.
ModelType
Types of models available.
DissipativeNumericalFlux
Possible dissipative numerical flux types.
ConvectiveNumericalFlux
Possible convective numerical flux types.
Class to add artificial dissipation with an option to add one of the 3 dissipation types: 1...