1 #include <deal.II/base/mpi.h> 2 #include <deal.II/base/utilities.h> 3 #include <deal.II/base/conditional_ostream.h> 5 #include "parameters_flow_solver.h" 10 #include <sys/types.h> 15 namespace Parameters {
19 prm.enter_subsection(
"flow_solver");
21 prm.declare_entry(
"flow_case_type",
"taylor_green_vortex",
22 dealii::Patterns::Selection(
23 " taylor_green_vortex | " 24 " decaying_homogeneous_isotropic_turbulence | " 25 " burgers_viscous_snapshot | " 27 " burgers_rewienski_snapshot | " 28 " burgers_inviscid | " 29 " convection_diffusion | " 31 " periodic_1D_unsteady | " 33 " isentropic_vortex | " 34 " kelvin_helmholtz_instability | " 35 " non_periodic_cube_flow | " 38 " leblanc_shock_tube | " 39 " shu_osher_problem | " 40 " advection_limiter | " 42 "The type of flow we want to simulate. " 44 " <taylor_green_vortex | " 45 " decaying_homogeneous_isotropic_turbulence | " 46 " burgers_viscous_snapshot | " 48 " burgers_rewienski_snapshot | " 49 " burgers_inviscid | " 50 " convection_diffusion | " 52 " periodic_1D_unsteady | " 54 " isentropic_vortex | " 55 " kelvin_helmholtz_instability | " 56 " non_periodic_cube_flow | " 59 " leblanc_shock_tube | " 60 " shu_osher_problem | " 61 " advection_limiter | " 62 " burgers_limiter >. ");
64 prm.declare_entry(
"poly_degree",
"1",
65 dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
66 "Polynomial order (P) of the basis functions for DG.");
68 prm.declare_entry(
"max_poly_degree_for_adaptation",
"0",
69 dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
70 "Maxiumum possible polynomial order (P) of the basis functions for DG " 71 "when doing adaptive simulations. Default is 0 which actually sets " 72 "the value to poly_degree in the code, indicating no adaptation.");
74 prm.declare_entry(
"final_time",
"1",
75 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
76 "Final solution time.");
78 prm.declare_entry(
"constant_time_step",
"0",
79 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
80 "Constant time step.");
82 prm.declare_entry(
"courant_friedrichs_lewy_number",
"1",
83 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
84 "Courant-Friedrich-Lewy (CFL) number for constant time step.");
86 prm.declare_entry(
"unsteady_data_table_filename",
"unsteady_data_table",
87 dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
88 "Filename of the unsteady data table output file: unsteady_data_table_filename.txt.");
90 prm.declare_entry(
"steady_state",
"false",
91 dealii::Patterns::Bool(),
92 "Solve steady-state solution. False by default (i.e. unsteady by default).");
94 prm.declare_entry(
"error_adaptive_time_step",
"false",
95 dealii::Patterns::Bool(),
96 "Adapt the time step on the fly for unsteady flow simulations according to an estimate of temporal error. False by default (i.e. constant time step by default).");
98 prm.declare_entry(
"adaptive_time_step",
"false",
99 dealii::Patterns::Bool(),
100 "Adapt the time step on the fly for unsteady flow simulations according to a CFL condition. False by default (i.e. constant time step by default).");
102 prm.declare_entry(
"steady_state_polynomial_ramping",
"false",
103 dealii::Patterns::Bool(),
104 "For steady-state cases, does polynomial ramping if set to true. False by default.");
106 prm.declare_entry(
"sensitivity_table_filename",
"sensitivity_table",
107 dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
108 "Filename for the sensitivity data table output file: sensitivity_table_filename.txt.");
110 prm.declare_entry(
"restart_computation_from_file",
"false",
111 dealii::Patterns::Bool(),
112 "Restarts the computation from the restart file. False by default.");
114 prm.declare_entry(
"output_restart_files",
"false",
115 dealii::Patterns::Bool(),
116 "Output restart files for restarting the computation. False by default.");
118 prm.declare_entry(
"restart_files_directory_name",
".",
119 dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
120 "Name of directory for writing and reading restart files. Current directory by default.");
122 prm.declare_entry(
"restart_file_index",
"1",
123 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
124 "Index of restart file from which the computation will be restarted from. 1 by default.");
126 prm.declare_entry(
"output_restart_files_every_x_steps",
"1",
127 dealii::Patterns::Integer(1,dealii::Patterns::Integer::max_int_value),
128 "Outputs the restart files every x steps.");
130 prm.declare_entry(
"output_restart_files_every_dt_time_intervals",
"0.0",
131 dealii::Patterns::Double(0,dealii::Patterns::Double::max_double_value),
132 "Outputs the restart files at time intervals of dt.");
134 prm.enter_subsection(
"grid");
136 prm.declare_entry(
"input_mesh_filename",
"",
137 dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
138 "Filename of the input mesh: input_mesh_filename.msh. For cases that import a mesh file.");
140 prm.declare_entry(
"grid_degree",
"1",
141 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
142 "Polynomial degree of the grid. Curvilinear grid if set greater than 1; default is 1.");
144 prm.declare_entry(
"grid_left_bound",
"0.0",
145 dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
146 "Left bound of domain for hyper_cube mesh based cases.");
148 prm.declare_entry(
"grid_right_bound",
"1.0",
149 dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
150 "Right bound of domain for hyper_cube mesh based cases.");
152 prm.declare_entry(
"number_of_grid_elements_per_dimension",
"4",
153 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
154 "Number of grid elements per dimension for hyper_cube mesh based cases.");
156 prm.declare_entry(
"number_of_mesh_refinements",
"0",
157 dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
158 "Number of mesh refinements for Gaussian bump and naca0012 based cases.");
160 prm.declare_entry(
"use_gmsh_mesh",
"false",
161 dealii::Patterns::Bool(),
162 "Use the input .msh file which calls read_gmsh. False by default.");
164 prm.declare_entry(
"mesh_reader_verbose_output",
"false",
165 dealii::Patterns::Bool(),
166 "Flag for verbose (true) or quiet (false) mesh reader output.");
168 prm.enter_subsection(
"gmsh_boundary_IDs");
171 prm.declare_entry(
"use_periodic_BC_in_x",
"false",
172 dealii::Patterns::Bool(),
173 "Use periodic boundary condition in the x-direction. False by default.");
175 prm.declare_entry(
"use_periodic_BC_in_y",
"false",
176 dealii::Patterns::Bool(),
177 "Use periodic boundary condition in the y-direction. False by default.");
179 prm.declare_entry(
"use_periodic_BC_in_z",
"false",
180 dealii::Patterns::Bool(),
181 "Use periodic boundary condition in the z-direction. False by default.");
183 prm.declare_entry(
"x_periodic_id_face_1",
"2001",
184 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
185 "Boundary ID for the first periodic boundary face in the x-direction.");
187 prm.declare_entry(
"x_periodic_id_face_2",
"2002",
188 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
189 "Boundary ID for the second periodic boundary face in the x-direction.");
191 prm.declare_entry(
"y_periodic_id_face_1",
"2003",
192 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
193 "Boundary ID for the first periodic boundary face in the y-direction.");
195 prm.declare_entry(
"y_periodic_id_face_2",
"2004",
196 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
197 "Boundary ID for the second periodic boundary face in the y-direction.");
199 prm.declare_entry(
"z_periodic_id_face_1",
"2005",
200 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
201 "Boundary ID for the first periodic boundary face in the z-direction.");
203 prm.declare_entry(
"z_periodic_id_face_2",
"2006",
204 dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
205 "Boundary ID for the second periodic boundary face in the z-direction.");
207 prm.leave_subsection();
209 prm.enter_subsection(
"gaussian_bump");
211 prm.declare_entry(
"channel_length",
"3.0",
212 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
213 "Lenght of channel for gaussian bump meshes.");
215 prm.declare_entry(
"channel_height",
"0.8",
216 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
217 "Height of channel for gaussian bump meshes.");
219 prm.declare_entry(
"bump_height",
"0.0625",
220 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
221 "Height of the bump for gaussian bump meshes.");
223 prm.declare_entry(
"number_of_subdivisions_in_x_direction",
"0",
224 dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
225 "Number of subdivisions in the x direction for gaussian bump meshes.");
227 prm.declare_entry(
"number_of_subdivisions_in_y_direction",
"0",
228 dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
229 "Number of subdivisions in the y direction for gaussian bump meshes.");
231 prm.declare_entry(
"number_of_subdivisions_in_z_direction",
"0",
232 dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
233 "Number of subdivisions in the z direction for gaussian bump meshes.");
235 prm.leave_subsection();
237 prm.leave_subsection();
239 prm.enter_subsection(
"taylor_green_vortex");
241 prm.declare_entry(
"expected_kinetic_energy_at_final_time",
"1",
242 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
243 "For integration test purposes, expected kinetic energy at final time.");
245 prm.declare_entry(
"expected_theoretical_dissipation_rate_at_final_time",
"1",
246 dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
247 "For integration test purposes, expected theoretical kinetic energy dissipation rate at final time.");
249 prm.declare_entry(
"density_initial_condition_type",
"uniform",
250 dealii::Patterns::Selection(
253 "The type of density initialization. " 258 prm.declare_entry(
"do_calculate_numerical_entropy",
"false",
259 dealii::Patterns::Bool(),
260 "Flag to calculate numerical entropy and write to file. By default, do not calculate.");
263 prm.leave_subsection();
265 prm.enter_subsection(
"kelvin_helmholtz_instability");
267 prm.declare_entry(
"atwood_number",
"0.5",
268 dealii::Patterns::Double(0.0, 1.0),
269 "Atwood number, which characterizes the density difference " 270 "between the layers of fluid.");
272 prm.leave_subsection();
274 prm.declare_entry(
"apply_initial_condition_method",
"interpolate_initial_condition_function",
275 dealii::Patterns::Selection(
276 " interpolate_initial_condition_function | " 277 " project_initial_condition_function | " 278 " read_values_from_file_and_project "),
279 "The method used for applying the initial condition. " 281 " <interpolate_initial_condition_function | " 282 " project_initial_condition_function | " 283 " read_values_from_file_and_project>.");
285 prm.declare_entry(
"input_flow_setup_filename_prefix",
"setup",
286 dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
287 "Filename prefix of the input flow setup file. " 288 "Example: 'setup' for files named setup-0000i.dat, where i is the MPI rank. " 289 "For initializing the flow with values from a file. " 290 "To be set when apply_initial_condition_method is read_values_from_file_and_project.");
292 prm.enter_subsection(
"output_velocity_field");
294 prm.declare_entry(
"output_velocity_field_at_fixed_times",
"false",
295 dealii::Patterns::Bool(),
296 "Output velocity field (at equidistant nodes) at fixed times. False by default.");
298 prm.declare_entry(
"output_velocity_field_times_string",
" ",
299 dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
300 "String of the times at which to output the velocity field. " 301 "Example: '0.0 1.0 2.0 3.0 ' or '0.0 1.0 2.0 3.0'");
303 prm.declare_entry(
"output_vorticity_magnitude_field_in_addition_to_velocity",
"false",
304 dealii::Patterns::Bool(),
305 "Output vorticity magnitude field in addition to velocity field. False by default.");
307 prm.declare_entry(
"output_flow_field_files_directory_name",
".",
308 dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
309 "Name of directory for writing flow field files. Current directory by default.");
311 prm.leave_subsection();
313 prm.declare_entry(
"end_exactly_at_final_time",
"true",
314 dealii::Patterns::Bool(),
315 "Flag to adjust the last timestep such that the simulation " 316 "ends exactly at final_time. True by default.");
318 prm.leave_subsection();
323 const int mpi_rank = dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
324 dealii::ConditionalOStream pcout(std::cout, mpi_rank==0);
325 prm.enter_subsection(
"flow_solver");
327 const std::string flow_case_type_string = prm.get(
"flow_case_type");
328 if (flow_case_type_string ==
"taylor_green_vortex") {
flow_case_type = taylor_green_vortex;}
329 else if (flow_case_type_string ==
"decaying_homogeneous_isotropic_turbulence")
331 else if (flow_case_type_string ==
"burgers_viscous_snapshot") {
flow_case_type = burgers_viscous_snapshot;}
332 else if (flow_case_type_string ==
"burgers_rewienski_snapshot") {
flow_case_type = burgers_rewienski_snapshot;}
333 else if (flow_case_type_string ==
"naca0012") {
flow_case_type = naca0012;}
334 else if (flow_case_type_string ==
"burgers_inviscid") {
flow_case_type = burgers_inviscid;}
335 else if (flow_case_type_string ==
"convection_diffusion") {
flow_case_type = convection_diffusion;}
336 else if (flow_case_type_string ==
"advection") {
flow_case_type = advection;}
337 else if (flow_case_type_string ==
"periodic_1D_unsteady") {
flow_case_type = periodic_1D_unsteady;}
338 else if (flow_case_type_string ==
"gaussian_bump") {
flow_case_type = gaussian_bump;}
339 else if (flow_case_type_string ==
"isentropic_vortex") {
flow_case_type = isentropic_vortex;}
340 else if (flow_case_type_string ==
"kelvin_helmholtz_instability")
342 else if (flow_case_type_string ==
"non_periodic_cube_flow") {
flow_case_type = non_periodic_cube_flow;}
343 else if (flow_case_type_string ==
"sod_shock_tube") {
flow_case_type = sod_shock_tube;}
344 else if (flow_case_type_string ==
"low_density_2d") {
flow_case_type = low_density_2d;}
345 else if (flow_case_type_string ==
"leblanc_shock_tube") {
flow_case_type = leblanc_shock_tube;}
346 else if (flow_case_type_string ==
"shu_osher_problem") {
flow_case_type = shu_osher_problem;}
347 else if (flow_case_type_string ==
"advection_limiter") {
flow_case_type = advection_limiter;}
348 else if (flow_case_type_string ==
"burgers_limiter") {
flow_case_type = burgers_limiter;}
369 struct stat info_restart;
372 <<
"Please create the directory and restart. Aborting..." << std::endl;
379 prm.enter_subsection(
"grid");
390 prm.enter_subsection(
"gmsh_boundary_IDs");
402 prm.leave_subsection();
404 prm.enter_subsection(
"gaussian_bump");
413 prm.leave_subsection();
415 prm.leave_subsection();
417 prm.enter_subsection(
"taylor_green_vortex");
422 const std::string density_initial_condition_type_string = prm.get(
"density_initial_condition_type");
427 prm.leave_subsection();
429 prm.enter_subsection(
"kelvin_helmholtz_instability");
433 prm.leave_subsection();
435 const std::string apply_initial_condition_method_string = prm.get(
"apply_initial_condition_method");
436 if (apply_initial_condition_method_string ==
"interpolate_initial_condition_function") {
apply_initial_condition_method = interpolate_initial_condition_function;}
437 else if (apply_initial_condition_method_string ==
"project_initial_condition_function") {
apply_initial_condition_method = project_initial_condition_function;}
438 else if (apply_initial_condition_method_string ==
"read_values_from_file_and_project") {
apply_initial_condition_method = read_values_from_file_and_project;}
442 prm.enter_subsection(
"output_velocity_field");
450 struct stat info_flow;
453 <<
"Please create the directory and restart. Aborting..." << std::endl;
457 prm.leave_subsection();
461 prm.leave_subsection();
int number_of_subdivisions_in_y_direction
Number of subdivisions in y direction for gaussian bump case.
int y_periodic_id_face_2
Custom Boundary IDs for the second periodic face in the y-direction.
double channel_length
Width of channel for gaussian bump case.
double final_time
Final solution time.
int y_periodic_id_face_1
Custom Boundary IDs for the first periodic face in the y-direction.
double output_restart_files_every_dt_time_intervals
Outputs the restart files at time intervals of dt.
bool error_adaptive_time_step
Computes time step based on error.
int x_periodic_id_face_1
Custom Boundary IDs for the first periodic face in the x-direction.
int number_of_subdivisions_in_z_direction
Number of subdivisions in z direction for gaussian bump case.
FlowCaseType flow_case_type
Selected FlowCaseType from the input file.
unsigned int number_of_grid_elements_per_dimension
Number of grid elements per dimension for hyper_cube mesh based cases.
bool steady_state
Flag for solving steady state solution.
int z_periodic_id_face_2
Custom Boundary IDs for the first periodic face in the z-direction.
double courant_friedrichs_lewy_number
Courant-Friedrich-Lewy (CFL) number for constant time step.
bool adaptive_time_step
Flag for computing the time step on the fly.
bool output_vorticity_magnitude_field_in_addition_to_velocity
Flag for outputting vorticity magnitude field in addition to velocity field.
bool output_velocity_field_at_fixed_times
Flag for outputting velocity field at fixed times.
int z_periodic_id_face_1
Custom Boundary IDs for the first periodic face in the z-direction.
unsigned int grid_degree
Parameters related to mesh generation.
double constant_time_step
Constant time step.
bool restart_computation_from_file
Restart computation from restart file.
double channel_height
Height of channel for gaussian bump case.
bool use_periodic_BC_in_z
Flag for using periodic boundary conditions in the z-direction.
bool output_restart_files
Output the restart files.
Files for the baseline physics.
void parse_parameters(dealii::ParameterHandler &prm)
Parses input file and sets the variables.
double bump_height
Height of gaussian bump.
bool mesh_reader_verbose_output
< Flag for verbose (true) or quiet (false) mesh reader output
unsigned int poly_degree
Polynomial order (P) of the basis functions for DG.
bool do_calculate_numerical_entropy
For TGV, flag to calculate and write numerical entropy.
bool steady_state_polynomial_ramping
Flag for steady state polynomial ramping.
std::string output_velocity_field_times_string
String of velocity field output times.
double grid_left_bound
Left bound of domain for hyper_cube mesh based cases.
std::string input_flow_setup_filename_prefix
double expected_kinetic_energy_at_final_time
unsigned int restart_file_index
Index of desired restart file for restarting the computation from.
int output_restart_files_every_x_steps
Outputs the restart files every x steps.
bool use_periodic_BC_in_y
Flag for using periodic boundary conditions in the y-direction.
double expected_theoretical_dissipation_rate_at_final_time
std::string input_mesh_filename
bool end_exactly_at_final_time
Flag to adjust the last timestep such that the simulation ends exactly at final_time.
int number_of_mesh_refinements
Number of refinements for naca0012 and Gaussian bump based cases.
bool use_gmsh_mesh
< Flag for using input mesh file
unsigned int number_of_times_to_output_velocity_field
Number of fixed times to output the velocity field.
std::string unsteady_data_table_filename
double atwood_number
For KHI, the atwood number.
int x_periodic_id_face_2
Custom Boundary IDs for the second periodic face in the x-direction.
static void declare_parameters(dealii::ParameterHandler &prm)
Declares the possible variables and sets the defaults.
double grid_right_bound
Right bound of domain for hyper_cube mesh based cases.
int number_of_subdivisions_in_x_direction
Number of subdivisions in x direction for gaussian bump case.
std::string restart_files_directory_name
Name of directory for writing and reading restart files.
std::string sensitivity_table_filename
ApplyInitialConditionMethod apply_initial_condition_method
Selected ApplyInitialConditionMethod from the input file.
unsigned int max_poly_degree_for_adaptation
Maximum polynomial order of the DG basis functions for adaptation.
bool use_periodic_BC_in_x
Flag for using periodic boundary conditions in the x-direction.
DensityInitialConditionType density_initial_condition_type
Selected DensityInitialConditionType from the input file.
std::string output_flow_field_files_directory_name
Name of directory for writing flow field files.