1 #include "flow_solver_case_base.h" 6 template<
int dim,
int nspecies,
int nstate>
8 : initial_condition_function(
InitialConditionFactory<dim, nspecies, nstate, double>::create_InitialConditionFunction(parameters_input))
9 , all_param(*parameters_input)
10 , mpi_communicator(MPI_COMM_WORLD)
11 , mpi_rank(dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD))
12 , n_mpi(dealii::Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD))
13 , pcout(
std::cout, mpi_rank==0)
16 template<
int dim,
int nspecies,
int nstate>
25 std::string pde_string;
26 if (pde_type == PDE_enum::advection) {pde_string =
"advection";}
27 if (pde_type == PDE_enum::advection_vector) {pde_string =
"advection_vector";}
28 if (pde_type == PDE_enum::diffusion) {pde_string =
"diffusion";}
29 if (pde_type == PDE_enum::convection_diffusion) {pde_string =
"convection_diffusion";}
30 if (pde_type == PDE_enum::burgers_inviscid) {pde_string =
"burgers_inviscid";}
31 if (pde_type == PDE_enum::burgers_viscous) {pde_string =
"burgers_viscous";}
32 if (pde_type == PDE_enum::burgers_rewienski) {pde_string =
"burgers_rewienski";}
33 if (pde_type == PDE_enum::mhd) {pde_string =
"mhd";}
34 if (pde_type == PDE_enum::euler) {pde_string =
"euler";}
35 if (pde_type == PDE_enum::navier_stokes) {pde_string =
"navier_stokes";}
36 if (pde_type == PDE_enum::navier_stokes_channel_flow_constant_source_term)
37 {pde_string =
"navier_stokes_channel_flow_constant_source_term";}
38 if (pde_type == PDE_enum::navier_stokes_channel_flow_constant_source_term_wall_model)
39 {pde_string =
"navier_stokes_channel_flow_constant_source_term_wall_model";}
41 if (pde_type == PDE_enum::physics_model || pde_type == PDE_enum::physics_model_filtered) {
42 if(pde_type == PDE_enum::physics_model) pde_string =
"physics_model";
43 else if(pde_type == PDE_enum::physics_model_filtered) pde_string =
"physics_model_filtered";
46 std::string model_string =
"WARNING: invalid model";
47 if(model == Model_enum::large_eddy_simulation) {
49 model_string =
"large_eddy_simulation";
52 std::string sgs_model_string =
"WARNING: invalid SGS model";
54 if (sgs_model==SGSModel_enum::smagorinsky) sgs_model_string =
"smagorinsky";
55 else if(sgs_model==SGSModel_enum::wall_adaptive_local_eddy_viscosity) sgs_model_string =
"wall_adaptive_local_eddy_viscosity";
56 else if(sgs_model==SGSModel_enum::vreman) sgs_model_string =
"vreman";
57 else if(sgs_model==SGSModel_enum::shear_improved_smagorinsky) sgs_model_string =
"shear_improved_smagorinsky";
58 else if(sgs_model==SGSModel_enum::small_small_variational_multiscale) sgs_model_string =
"small_small_variational_multiscale";
59 else if(sgs_model==SGSModel_enum::all_all_variational_multiscale) sgs_model_string =
"all_all_variational_multiscale";
60 if(pde_string ==
"physics_model_filtered"){
63 pde_string += std::string(
" (Model: ") + model_string + std::string(
", SGS Model: ") + sgs_model_string + std::string(
")");
64 }
else if(model == Model_enum::navier_stokes_model) {
65 model_string =
"navier_stokes_model";
67 else if(model == Model_enum::reynolds_averaged_navier_stokes) {
69 model_string =
"reynolds_averaged_navier_stokes";
72 std::string rans_model_string =
"WARNING: invalid RANS model";
74 if (rans_model==RANSModel_enum::SA_negative) rans_model_string =
"SA_negative";
75 pde_string += std::string(
" (Model: ") + model_string + std::string(
", RANS Model: ") + rans_model_string + std::string(
")");
77 if(pde_string ==
"physics_model") pde_string += std::string(
" (Model: ") + model_string + std::string(
")");
84 template<
int dim,
int nspecies,
int nstate>
91 std::string flow_case_string;
92 if (flow_case_type == FlowCaseEnum::taylor_green_vortex) {flow_case_string =
"taylor_green_vortex";}
93 if (flow_case_type == FlowCaseEnum::decaying_homogeneous_isotropic_turbulence)
94 {flow_case_string =
"decaying_homogeneous_isotropic_turbulence";}
95 if (flow_case_type == FlowCaseEnum::burgers_viscous_snapshot) {flow_case_string =
"burgers_viscous_snapshot";}
96 if (flow_case_type == FlowCaseEnum::burgers_rewienski_snapshot) {flow_case_string =
"burgers_rewienski_snapshot";}
97 if (flow_case_type == FlowCaseEnum::naca0012) {flow_case_string =
"naca0012";}
98 if (flow_case_type == FlowCaseEnum::periodic_1D_unsteady) {flow_case_string =
"periodic_1D_unsteady";}
99 if (flow_case_type == FlowCaseEnum::gaussian_bump) {flow_case_string =
"gaussian_bump";}
100 if (flow_case_type == FlowCaseEnum::advection_limiter) {flow_case_string =
"advection_limiter";}
101 if (flow_case_type == FlowCaseEnum::dipole_wall_collision_normal)
102 {flow_case_string =
"dipole_wall_collision_normal";}
103 if (flow_case_type == FlowCaseEnum::dipole_wall_collision_oblique)
104 {flow_case_string =
"dipole_wall_collision_oblique";}
105 if (flow_case_type == FlowCaseEnum::channel_flow) {flow_case_string =
"channel_flow";}
108 return flow_case_string;
111 template <
int dim,
int nspecies,
int nstate>
115 pcout <<
"- PDE Type: " << pde_string <<
" " <<
"(dim=" << dim <<
", nstate=" << nstate <<
")" << std::endl;
120 const unsigned int number_of_degrees_of_freedom_per_state = dg->dof_handler.n_dofs()/nstate;
121 const double number_of_degrees_of_freedom_per_dim = pow(number_of_degrees_of_freedom_per_state,(1.0/dim));
122 pcout <<
"- Degrees of freedom (per state): " << number_of_degrees_of_freedom_per_state <<
" " <<
"(" << number_of_degrees_of_freedom_per_dim <<
" per state per dim)" << std::endl;
123 pcout <<
"- Number of active cells: " << dg->triangulation->n_global_active_cells() << std::endl;
127 if (use_weak_form ==
false){
128 this->
pcout <<
"- Using strong DG" << std::endl;
131 std::string c_parameter_string;
134 if (fr_type == FREnum::cDG) c_parameter_string =
"cDG";
135 else if (fr_type == FREnum::cSD) c_parameter_string =
"cSD";
136 else if (fr_type == FREnum::cHU) c_parameter_string =
"cHU";
137 else if (fr_type == FREnum::cNegative) c_parameter_string =
"cNegative";
138 else if (fr_type == FREnum::cNegative2) c_parameter_string =
"cNegative2";
139 else if (fr_type == FREnum::cPlus) c_parameter_string =
"cPlus";
140 else if (fr_type == FREnum::c10Thousand) c_parameter_string =
"c10Thousand";
141 else if (fr_type == FREnum::cHULumped) c_parameter_string =
"cHULumped";
143 if (c_parameter_string ==
"cDG" ) {
146 if(fr_type == FREnum::user_specified_value) {
147 this->
pcout <<
"- - Using user specified flux reconstruction c parameter: " 152 this->
pcout <<
"- - Using flux reconstruction c parameter: " << c_parameter_string << std::endl;
158 this->
pcout <<
"- - Using split form " << std::endl;
162 this->
pcout <<
"- Using weak DG" << std::endl;
167 pcout <<
"- Flow case: " << flow_case_string <<
" " << std::flush;
169 pcout <<
"(Steady state)" << std::endl;
171 pcout <<
"(Unsteady)" << std::endl;
178 template <
int dim,
int nspecies,
int nstate>
184 template <
int dim,
int nspecies,
int nstate>
196 template <
int dim,
int nspecies,
int nstate>
199 pcout <<
"ERROR: Base definition for get_adaptive_time_step() has not yet been implemented. " <<std::flush;
204 template <
int dim,
int nspecies,
int nstate>
207 pcout <<
"ERROR: Base definition for get_adaptive_time_step_initial() has not yet been implemented. " <<std::flush;
212 template <
int dim,
int nspecies,
int nstate>
218 template <
int dim,
int nspecies,
int nstate>
222 const std::shared_ptr <dealii::TableHandler> ,
228 template <
int dim,
int nspecies,
int nstate>
231 const std::string value_string,
232 const std::shared_ptr <dealii::TableHandler> data_table)
const 234 data_table->add_value(value_string, value);
235 data_table->set_precision(value_string, 16);
236 data_table->set_scientific(value_string,
true);
239 template <
int dim,
int nspecies,
int nstate>
245 template <
int dim,
int nspecies,
int nstate>
247 const double time_step_input)
252 template <
int dim,
int nspecies,
int nstate>
258 template <
int dim,
int nspecies,
int nstate>
267 template <
int dim,
int nspecies,
int nstate>
276 #if PHILIP_SPECIES==1 278 #define POSSIBLE_NSTATE (1)(2)(3)(4)(5)(6) 281 #define INSTANTIATE_FLOWSOLVER(r, data, nstate) \ 282 template class FlowSolverCaseBase<PHILIP_DIM, PHILIP_SPECIES,nstate>; 283 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_FLOWSOLVER, _, POSSIBLE_NSTATE)
FlowCaseType
Selects the flow case to be simulated.
double final_time
Final solution time.
virtual double get_constant_time_step(std::shared_ptr< DGBase< dim, nspecies, double >> dg) const
Virtual function to compute the constant time step.
PartialDifferentialEquation pde_type
Store the PDE type to be solved.
virtual void set_higher_order_grid(std::shared_ptr< DGBase< dim, nspecies, double >> dg) const
Set higher order grid.
std::string get_pde_string() const
Returns the pde type string from the all_param class member.
FlowCaseType flow_case_type
Selected FlowCaseType from the input file.
const Parameters::AllParameters all_param
All parameters.
bool steady_state
Flag for solving steady state solution.
virtual void compute_Reynolds_stress(const std::shared_ptr< ODE::ODESolverBase< dim, nspecies, double >> ode_solver, const std::shared_ptr< DGBase< dim, nspecies, double >> dg, const double time_step)
Virtual function for computing time-averaged Reynolds Stresses for turbulent cases.
FlowSolverParam flow_solver_param
Contains the parameters for simulation cases (flow solver test)
double constant_time_step
Constant time step.
PartialDifferentialEquation
Possible Partial Differential Equations to solve.
virtual void compute_time_averaged_solution(const std::shared_ptr< ODE::ODESolverBase< dim, nspecies, double >> ode_solver, const std::shared_ptr< DGBase< dim, nspecies, double >> dg, const double time_step)
Virtual function for computing time-averaged solution for turbulent cases.
Files for the baseline physics.
bool use_weak_form
Flag to use weak or strong form of DG.
virtual double get_adaptive_time_step(std::shared_ptr< DGBase< dim, nspecies, double >> dg) const
Virtual function to compute the adaptive time step.
Flux_Reconstruction
Type of correction in Flux Reconstruction.
ModelType
Types of models available.
unsigned int poly_degree
Polynomial order (P) of the basis functions for DG.
virtual void steady_state_postprocessing(std::shared_ptr< DGBase< dim, nspecies, double >> dg) const
Virtual function for postprocessing when solving for steady state.
Main parameter class that contains the various other sub-parameter classes.
void display_flow_solver_setup(std::shared_ptr< DGBase< dim, nspecies, double >> dg) const
Displays the flow setup parameters.
virtual double get_adaptive_time_step_initial(std::shared_ptr< DGBase< dim, nspecies, double >> dg)
Virtual function to compute the initial adaptive time step.
SubGridScaleModel SGS_model_type
Store the SubGridScale (SGS) model type.
Flux_Reconstruction flux_reconstruction_type
Store flux reconstruction type.
ODESolverParam ode_solver_param
Contains parameters for ODE solver.
double initial_time_step
Time step used in ODE solver.
unsigned int poly_degree_max_large_scales
Max poly degree representing the large scales for LES VMS filtering.
virtual void display_additional_flow_case_specific_parameters() const =0
Display additional more specific flow case parameters.
Initial condition function factory.
double FR_user_specified_correction_parameter_value
User specified flux recontruction correction parameter value.
bool use_split_form
Flag to use split form.
ReynoldsAveragedNavierStokesModel
Types of Reynolds-averaged Navier-Stokes (RANS) models that can be used.
FlowSolverCaseBase(const Parameters::AllParameters *const parameters_input)
Constructor.
double time_step
Current time step.
ReynoldsAveragedNavierStokesModel RANS_model_type
Store the Reynolds-averaged Navier-Stokes (RANS) model type.
std::string get_flow_case_string() const
Returns the flow case type string from the all_param class member.
dealii::ConditionalOStream pcout
ConditionalOStream.
void add_value_to_data_table(const double value, const std::string value_string, const std::shared_ptr< dealii::TableHandler > data_table) const
Add a value to a given data table with scientific format.
SubGridScaleModel
Types of sub-grid scale (SGS) models that can be used.
double get_time_step() const
Getter for time step.
ModelType model_type
Store the model type.
DGBase is independent of the number of state variables.
virtual void modify_dg_object(std::shared_ptr< DGBase< dim, nspecies, double >> dg) const
Allows user to modify DG object during flow solver routines.
virtual void compute_unsteady_data_and_write_to_table(const std::shared_ptr< ODE::ODESolverBase< dim, nspecies, double >> ode_solver, const std::shared_ptr< DGBase< dim, nspecies, double >> dg, const std::shared_ptr< dealii::TableHandler > unsteady_data_table, const bool do_write_unsteady_data_table_file)
Virtual function to write unsteady snapshot data to table.
PhysicsModelParam physics_model_param
Contains parameters for Physics Model.
unsigned int max_poly_degree_for_adaptation
Maximum polynomial order of the DG basis functions for adaptation.
void set_time_step(const double time_step_input)
Setter for time step.