1 #include "parameters/all_parameters.h" 2 #include "parameters/parameters_manufactured_solution.h" 4 #include <deal.II/base/tensor.h> 8 #include "physics_factory.h" 9 #include "manufactured_solution.h" 11 #include "convection_diffusion.h" 13 #include "burgers_rewienski.h" 16 #include "navier_stokes.h" 17 #include "physics_model.h" 22 template <
int dim,
int nstate,
typename real>
23 std::shared_ptr < PhysicsBase<dim,nstate,real> >
29 PDE_enum pde_type = parameters_input->
pde_type;
31 return create_Physics(parameters_input, pde_type, model_input);
34 template <
int dim,
int nstate,
typename real>
35 std::shared_ptr < PhysicsBase<dim,nstate,real> >
44 std::shared_ptr< ManufacturedSolutionFunction<dim,real> > manufactured_solution_function
52 if (pde_type == PDE_enum::advection || pde_type == PDE_enum::advection_vector) {
53 if constexpr (nstate<=2)
54 return std::make_shared < ConvectionDiffusion<dim,nstate,real> >(
57 diffusion_tensor, advection_vector, diffusion_coefficient,
58 manufactured_solution_function);
59 }
else if (pde_type == PDE_enum::diffusion) {
60 if constexpr (nstate==1)
61 return std::make_shared < ConvectionDiffusion<dim,nstate,real> >(
64 diffusion_tensor, advection_vector, diffusion_coefficient,
65 manufactured_solution_function,
67 }
else if (pde_type == PDE_enum::convection_diffusion) {
68 if constexpr (nstate==1)
69 return std::make_shared < ConvectionDiffusion<dim,nstate,real> >(
72 diffusion_tensor, advection_vector, diffusion_coefficient,
73 manufactured_solution_function,
75 }
else if (pde_type == PDE_enum::burgers_inviscid) {
76 if constexpr (nstate==dim)
77 return std::make_shared < Burgers<dim,nstate,real> >(
82 manufactured_solution_function,
83 parameters_input->test_type);
84 }
else if (pde_type == PDE_enum::burgers_viscous) {
85 if constexpr (nstate==dim)
86 return std::make_shared < Burgers<dim,nstate,real> >(
91 manufactured_solution_function);
92 }
else if (pde_type == PDE_enum::burgers_rewienski) {
93 if constexpr (nstate==dim)
94 return std::make_shared < BurgersRewienski<dim,nstate,real> >(
97 parameters_input->burgers_param.rewienski_b,
98 parameters_input->burgers_param.rewienski_manufactured_solution,
102 manufactured_solution_function);
103 }
else if (pde_type == PDE_enum::euler) {
104 if constexpr (nstate==dim+2) {
105 return std::make_shared < Euler<dim,nstate,real> > (
108 parameters_input->euler_param.gamma_gas,
109 parameters_input->euler_param.mach_inf,
110 parameters_input->euler_param.angle_of_attack,
111 parameters_input->euler_param.side_slip_angle,
112 manufactured_solution_function,
113 parameters_input->two_point_num_flux_type);
115 }
else if (pde_type == PDE_enum::mhd) {
116 if constexpr (nstate == 8)
117 return std::make_shared < MHD<dim,nstate,real> > (
121 manufactured_solution_function);
122 }
else if (pde_type == PDE_enum::navier_stokes) {
123 if constexpr (nstate==dim+2) {
124 return std::make_shared < NavierStokes<dim,nstate,real> > (
127 parameters_input->euler_param.gamma_gas,
128 parameters_input->euler_param.mach_inf,
129 parameters_input->euler_param.angle_of_attack,
130 parameters_input->euler_param.side_slip_angle,
131 parameters_input->navier_stokes_param.prandtl_number,
132 parameters_input->navier_stokes_param.reynolds_number_inf,
133 parameters_input->navier_stokes_param.use_constant_viscosity,
134 parameters_input->navier_stokes_param.nondimensionalized_constant_viscosity,
135 parameters_input->navier_stokes_param.temperature_inf,
136 parameters_input->navier_stokes_param.nondimensionalized_isothermal_wall_temperature,
137 parameters_input->navier_stokes_param.thermal_boundary_condition_type,
138 manufactured_solution_function,
139 parameters_input->two_point_num_flux_type);
141 }
else if (pde_type == PDE_enum::physics_model) {
142 if constexpr (nstate>=dim+2) {
143 return create_Physics_Model(parameters_input,
144 manufactured_solution_function,
149 (void) diffusion_tensor;
150 (void) advection_vector;
151 (void) diffusion_coefficient;
153 std::cout <<
"Can't create PhysicsBase, invalid PDE type: " << pde_type << std::endl;
154 assert(0==1 &&
"Can't create PhysicsBase, invalid PDE type");
158 template <
int dim,
int nstate,
typename real>
159 std::shared_ptr < PhysicsBase<dim,nstate,real> >
168 Model_enum model_type = parameters_input->
model_type;
178 PDE_enum baseline_physics_type;
181 bool has_nonzero_diffusion;
184 bool has_nonzero_physical_source;
189 if (model_type == Model_enum::large_eddy_simulation) {
190 has_nonzero_diffusion =
true;
191 has_nonzero_physical_source =
false;
192 if constexpr ((nstate==dim+2) && (dim==3)) {
195 constexpr
int nstate_baseline_physics = dim+2;
198 baseline_physics_type = PDE_enum::euler;
201 baseline_physics_type = PDE_enum::navier_stokes;
205 return std::make_shared < PhysicsModel<dim,nstate,real,nstate_baseline_physics> > (
207 baseline_physics_type,
209 manufactured_solution_function,
210 has_nonzero_diffusion,
211 has_nonzero_physical_source);
215 (void) baseline_physics_type;
216 (void) has_nonzero_diffusion;
217 (void) has_nonzero_physical_source;
224 else if (model_type == Model_enum::reynolds_averaged_navier_stokes) {
225 has_nonzero_diffusion =
true;
226 has_nonzero_physical_source =
true;
227 if (rans_model_type == RANSModel_enum::SA_negative)
229 if constexpr (nstate==dim+3) {
232 constexpr
int nstate_baseline_physics = dim+2;
235 baseline_physics_type = PDE_enum::euler;
238 baseline_physics_type = PDE_enum::navier_stokes;
242 return std::make_shared < PhysicsModel<dim,nstate,real,nstate_baseline_physics> > (
244 baseline_physics_type,
246 manufactured_solution_function,
247 has_nonzero_diffusion,
248 has_nonzero_physical_source);
252 (void) baseline_physics_type;
253 (void) has_nonzero_physical_source;
254 std::cout <<
"Can't create RANS + negative SA model for nstate!=(dim+3). " << std::endl;
261 (void) baseline_physics_type;
262 (void) has_nonzero_diffusion;
263 (void) has_nonzero_physical_source;
265 std::cout <<
"Can't create PhysicsModel, invalid ModelType type: " << model_type << std::endl;
266 assert(0==1 &&
"Can't create PhysicsModel, invalid ModelType type");
double diffusion_coefficient
Parameter for diffusion coefficient.
PartialDifferentialEquation pde_type
Store the PDE type to be solved.
double diffusion_coefficient
Diffusion coefficient.
Manufactured solution used for grid studies to check convergence orders.
static std::shared_ptr< ManufacturedSolutionFunction< dim, real > > create_ManufacturedSolution(Parameters::AllParameters const *const param, int nstate)
Construct Manufactured solution object from global parameter file.
PartialDifferentialEquation
Possible Partial Differential Equations to solve.
Files for the baseline physics.
ManufacturedSolutionParam manufactured_solution_param
Associated manufactured solution parameters.
Physics model additional terms and equations to the baseline physics.
EulerParam euler_param
Contains parameters for the Euler equations non-dimensionalization.
ModelType
Types of models available.
Main parameter class that contains the various other sub-parameter classes.
ManufacturedConvergenceStudyParam manufactured_convergence_study_param
Contains parameters for manufactured convergence study.
double ref_length
Reference length.
TestType test_type
Store selected TestType from the input file.
ReynoldsAveragedNavierStokesModel
Types of Reynolds-averaged Navier-Stokes (RANS) models that can be used.
dealii::Tensor< 1, 3, double > advection_vector
Advection velocity.
Create specified physics as PhysicsBase object.
static std::shared_ptr< PhysicsBase< dim, nstate, real > > create_Physics(const Parameters::AllParameters *const parameters_input, std::shared_ptr< ModelBase< dim, nstate, real > > model_input=nullptr)
Factory to return the correct physics given input file.
ReynoldsAveragedNavierStokesModel RANS_model_type
Store the Reynolds-averaged Navier-Stokes (RANS) model type.
static std::shared_ptr< PhysicsBase< dim, nstate, real > > create_Physics_Model(const Parameters::AllParameters *const parameters_input, std::shared_ptr< ManufacturedSolutionFunction< dim, real > > manufactured_solution_function=nullptr, std::shared_ptr< ModelBase< dim, nstate, real > > model_input=nullptr)
Factory to return the correct physics model, i.e. when PDE_type==physics_model, given input file...
dealii::Tensor< 2, 3, double > diffusion_tensor
Diffusion tensor.
ModelType model_type
Store the model type.
PhysicsModelParam physics_model_param
Contains parameters for Physics Model.
BurgersParam burgers_param
Contains parameters for Burgers equation.