[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
parameters_flow_solver.cpp
1 #include <deal.II/base/mpi.h>
2 #include <deal.II/base/utilities.h>
3 #include <deal.II/base/conditional_ostream.h>
4 
5 #include "parameters_flow_solver.h"
6 
7 #include <string>
8 
9 //for checking output directories
10 #include <sys/types.h>
11 #include <sys/stat.h>
12 
13 namespace PHiLiP {
14 
15 namespace Parameters {
16 
17 void FlowSolverParam::declare_parameters(dealii::ParameterHandler &prm)
18 {
19  prm.enter_subsection("flow_solver");
20  {
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 | "
26  " naca0012 | "
27  " burgers_rewienski_snapshot | "
28  " burgers_inviscid | "
29  " convection_diffusion | "
30  " advection | "
31  " periodic_1D_unsteady | "
32  " gaussian_bump | "
33  " channel_flow | "
34  " isentropic_vortex | "
35  " kelvin_helmholtz_instability | "
36  " dipole_wall_collision_normal | "
37  " dipole_wall_collision_oblique | "
38  " non_periodic_cube_flow | "
39  " sod_shock_tube | "
40  " low_density | "
41  " leblanc_shock_tube | "
42  " shu_osher_problem | "
43  " advection_limiter | "
44  " burgers_limiter | "
45  " double_mach_reflection | "
46  " shock_diffraction | "
47  " astrophysical_jet | "
48  " strong_vortex_shock_wave | "
49  " turbulent_airfoil_3D |"
50  " multi_species_vortex_advection |"
51  " multi_species_vortex_advection_high_temp | "
52  " multi_species_sod_shock_tube |"
53  " multi_species_isentropic_vortex |"
54  " multi_species_taylor_green_vortex_smooth |"
55  " multi_species_taylor_green_vortex_sharp |"),
56  "The type of flow we want to simulate. "
57  "Choices are "
58  " <taylor_green_vortex | "
59  " decaying_homogeneous_isotropic_turbulence | "
60  " burgers_viscous_snapshot | "
61  " naca0012 | "
62  " burgers_rewienski_snapshot | "
63  " burgers_inviscid | "
64  " convection_diffusion | "
65  " advection | "
66  " periodic_1D_unsteady | "
67  " gaussian_bump | "
68  " channel_flow | "
69  " isentropic_vortex | "
70  " kelvin_helmholtz_instability | "
71  " dipole_wall_collision_normal | "
72  " dipole_wall_collision_oblique | "
73  " non_periodic_cube_flow | "
74  " sod_shock_tube | "
75  " low_density | "
76  " leblanc_shock_tube | "
77  " shu_osher_problem | "
78  " advection_limiter | "
79  " burgers_limiter | "
80  " double_mach_reflection | "
81  " shock_diffraction | "
82  " astrophysical_jet | "
83  " strong_vortex_shock_wave | "
84  " turbulent_airfoil_3D | "
85  " multi_species_vortex_advection | "
86  " multi_species_vortex_advection_high_temp "
87  " multi_species_sod_shock_tube | "
88  " multi_species_isentropic_vortex | "
89  " multi_species_taylor_green_vortex_smooth | "
90  " multi_species_taylor_green_vortex_sharp>. ");
91 
92  prm.declare_entry("poly_degree", "1",
93  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
94  "Polynomial order (P) of the basis functions for DG.");
95 
96  prm.declare_entry("max_poly_degree_for_adaptation", "0",
97  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
98  "Maxiumum possible polynomial order (P) of the basis functions for DG "
99  "when doing adaptive simulations. Default is 0 which actually sets "
100  "the value to poly_degree in the code, indicating no adaptation.");
101 
102  prm.declare_entry("final_time", "1",
103  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
104  "Final solution time.");
105 
106  prm.declare_entry("constant_time_step", "0",
107  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
108  "Constant time step.");
109 
110  prm.declare_entry("courant_friedrichs_lewy_number", "1",
111  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
112  "Courant-Friedrich-Lewy (CFL) number for constant time step.");
113 
114  prm.declare_entry("unsteady_data_table_filename", "unsteady_data_table",
115  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
116  "Filename of the unsteady data table output file: unsteady_data_table_filename.txt.");
117 
118  prm.declare_entry("steady_state", "false",
119  dealii::Patterns::Bool(),
120  "Solve steady-state solution. False by default (i.e. unsteady by default).");
121 
122  prm.declare_entry("error_adaptive_time_step", "false",
123  dealii::Patterns::Bool(),
124  "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).");
125 
126  prm.declare_entry("adaptive_time_step", "false",
127  dealii::Patterns::Bool(),
128  "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).");
129 
130  prm.declare_entry("steady_state_polynomial_ramping", "false",
131  dealii::Patterns::Bool(),
132  "For steady-state cases, does polynomial ramping if set to true. False by default.");
133 
134  prm.declare_entry("sensitivity_table_filename", "sensitivity_table",
135  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
136  "Filename for the sensitivity data table output file: sensitivity_table_filename.txt.");
137 
138  prm.declare_entry("restart_computation_from_file", "false",
139  dealii::Patterns::Bool(),
140  "Restarts the computation from the restart file. False by default.");
141 
142  prm.declare_entry("output_restart_files", "false",
143  dealii::Patterns::Bool(),
144  "Output restart files for restarting the computation. False by default.");
145 
146  prm.declare_entry("restart_files_directory_name", ".",
147  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
148  "Name of directory for writing and reading restart files. Current directory by default.");
149 
150  prm.declare_entry("restart_file_index", "1",
151  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
152  "Index of restart file from which the computation will be restarted from. 1 by default.");
153 
154  prm.declare_entry("output_restart_files_every_x_steps", "1",
155  dealii::Patterns::Integer(1,dealii::Patterns::Integer::max_int_value),
156  "Outputs the restart files every x steps.");
157 
158  prm.declare_entry("output_restart_files_every_dt_time_intervals", "0.0",
159  dealii::Patterns::Double(0,dealii::Patterns::Double::max_double_value),
160  "Outputs the restart files at time intervals of dt.");
161 
162  prm.declare_entry("write_unsteady_data_table_file_every_dt_time_intervals", "0.0",
163  dealii::Patterns::Double(0,dealii::Patterns::Double::max_double_value),
164  "Writes the unsteady data table file at time intervals of dt. "
165  "If set to zero, it outputs at every time step.");
166 
167  prm.declare_entry("expected_order_at_final_time", "0.0",
168  dealii::Patterns::Double(0.0, 10.0),
169  "For convergence tests related to limiters, expected order of accuracy for final run.");
170 
171  prm.enter_subsection("grid");
172  {
173  prm.declare_entry("input_mesh_filename", "",
174  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
175  "Filename of the input mesh: input_mesh_filename.msh. For cases that import a mesh file.");
176 
177  prm.declare_entry("grid_degree", "1",
178  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
179  "Polynomial degree of the grid. Curvilinear grid if set greater than 1; default is 1.");
180 
181  prm.declare_entry("grid_left_bound", "0.0",
182  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
183  "Left bound of domain for hyper_cube mesh based cases.");
184 
185  prm.declare_entry("grid_right_bound", "1.0",
186  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
187  "Right bound of domain for hyper_cube mesh based cases.");
188 
189  prm.declare_entry("number_of_grid_elements_per_dimension", "4",
190  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
191  "Number of grid elements per dimension for hyper_cube mesh based cases.");
192 
193  prm.declare_entry("number_of_mesh_refinements", "0",
194  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
195  "Number of mesh refinements for Gaussian bump and naca0012 based cases.");
196 
197  prm.declare_entry("use_gmsh_mesh", "false",
198  dealii::Patterns::Bool(),
199  "Use the input .msh file which calls read_gmsh. False by default.");
200 
201  prm.declare_entry("mesh_reader_verbose_output", "false",
202  dealii::Patterns::Bool(),
203  "Flag for verbose (true) or quiet (false) mesh reader output.");
204 
205  prm.enter_subsection("gmsh_boundary_IDs");
206  {
207 
208  prm.declare_entry("use_periodic_BC_in_x", "false",
209  dealii::Patterns::Bool(),
210  "Use periodic boundary condition in the x-direction. False by default.");
211 
212  prm.declare_entry("use_periodic_BC_in_y", "false",
213  dealii::Patterns::Bool(),
214  "Use periodic boundary condition in the y-direction. False by default.");
215 
216  prm.declare_entry("use_periodic_BC_in_z", "false",
217  dealii::Patterns::Bool(),
218  "Use periodic boundary condition in the z-direction. False by default.");
219 
220  prm.declare_entry("x_periodic_id_face_1", "2001",
221  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
222  "Boundary ID for the first periodic boundary face in the x-direction.");
223 
224  prm.declare_entry("x_periodic_id_face_2", "2002",
225  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
226  "Boundary ID for the second periodic boundary face in the x-direction.");
227 
228  prm.declare_entry("y_periodic_id_face_1", "2003",
229  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
230  "Boundary ID for the first periodic boundary face in the y-direction.");
231 
232  prm.declare_entry("y_periodic_id_face_2", "2004",
233  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
234  "Boundary ID for the second periodic boundary face in the y-direction.");
235 
236  prm.declare_entry("z_periodic_id_face_1", "2005",
237  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
238  "Boundary ID for the first periodic boundary face in the z-direction.");
239 
240  prm.declare_entry("z_periodic_id_face_2", "2006",
241  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
242  "Boundary ID for the second periodic boundary face in the z-direction.");
243  }
244  prm.leave_subsection();
245 
246  prm.enter_subsection("gaussian_bump");
247  {
248  prm.declare_entry("channel_length", "3.0",
249  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
250  "Lenght of channel for gaussian bump meshes.");
251 
252  prm.declare_entry("channel_height", "0.8",
253  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
254  "Height of channel for gaussian bump meshes.");
255 
256  prm.declare_entry("bump_height", "0.0625",
257  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
258  "Height of the bump for gaussian bump meshes.");
259 
260  prm.declare_entry("number_of_subdivisions_in_x_direction", "0",
261  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
262  "Number of subdivisions in the x direction for gaussian bump meshes.");
263 
264  prm.declare_entry("number_of_subdivisions_in_y_direction", "0",
265  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
266  "Number of subdivisions in the y direction for gaussian bump meshes.");
267 
268  prm.declare_entry("number_of_subdivisions_in_z_direction", "0",
269  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
270  "Number of subdivisions in the z direction for gaussian bump meshes.");
271  }
272  prm.leave_subsection();
273 
274  prm.enter_subsection("grid_rectangle");
275  {
276  prm.declare_entry("grid_top_bound", "0.0",
277  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
278  "Left bound of domain for hyper_cube mesh based cases.");
279 
280  prm.declare_entry("grid_bottom_bound", "0.0",
281  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
282  "Right bound of domain for hyper_cube mesh based cases.");
283 
284  prm.declare_entry("grid_z_lower_bound", "0.0",
285  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
286  "Left bound of domain for hyper_cube mesh based cases.");
287 
288  prm.declare_entry("grid_z_upper_bound", "0.0",
289  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
290  "Right bound of domain for hyper_cube mesh based cases.");
291 
292  prm.declare_entry("number_of_grid_elements_x", "1",
293  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
294  "Number of grid elements in the x-direction.");
295 
296  prm.declare_entry("number_of_grid_elements_y", "1",
297  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
298  "Number of grid elements in the y-direction.");
299 
300  prm.declare_entry("number_of_grid_elements_z", "1",
301  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
302  "Number of grid elements in the z-direction.");
303  }
304  prm.leave_subsection();
305 
306  }
307  prm.leave_subsection();
308 
309  prm.enter_subsection("taylor_green_vortex");
310  {
311  prm.declare_entry("expected_kinetic_energy_at_final_time", "1",
312  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
313  "For integration test purposes, expected kinetic energy at final time.");
314 
315  prm.declare_entry("expected_theoretical_dissipation_rate_at_final_time", "1",
316  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
317  "For integration test purposes, expected theoretical kinetic energy dissipation rate at final time.");
318 
319  prm.declare_entry("density_initial_condition_type", "uniform",
320  dealii::Patterns::Selection(
321  " uniform | "
322  " isothermal "),
323  "The type of density initialization. "
324  "Choices are "
325  " <uniform | "
326  " isothermal>.");
327 
328  prm.declare_entry("do_calculate_numerical_entropy", "false",
329  dealii::Patterns::Bool(),
330  "Flag to calculate numerical entropy and write to file. By default, do not calculate.");
331 
332  prm.declare_entry("check_nonphysical_flow_case_behavior", "true",
333  dealii::Patterns::Bool(),
334  "Flag to check if non-physical case dependant behaviour is encounted. By default, false.");
335  }
336  prm.leave_subsection();
337 
338  prm.enter_subsection("channel_flow");
339  {
340  prm.declare_entry("channel_friction_velocity_reynolds_number", "590",
341  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
342  "Channel Reynolds number based on wall friction velocity. Default is 590.");
343 
344  prm.declare_entry("turbulent_channel_number_of_cells_x_direction","4",
345  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
346  "Number of cells in the x-direction for channel flow case.");
347 
348  prm.declare_entry("turbulent_channel_number_of_cells_y_direction","16",
349  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
350  "Number of cells in the y-direction for channel flow case.");
351 
352  prm.declare_entry("turbulent_channel_number_of_cells_z_direction","2",
353  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
354  "Number of cells in the z-direction for channel flow case.");
355 
356  prm.declare_entry("turbulent_channel_domain_length_x_direction", "6.283185307179586476",
357  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
358  "Channel domain length for x-direction. Default is 2*PI.");
359 
360  prm.declare_entry("turbulent_channel_domain_length_y_direction", "2.0",
361  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
362  "Channel domain length for y-direction. Default is 2.0.");
363 
364  prm.declare_entry("turbulent_channel_domain_length_z_direction", "3.141592653589793238",
365  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
366  "Channel domain length for x-direction. Default is PI.");
367 
368  prm.declare_entry("turbulent_channel_mesh_stretching_function_type", "gullbrand",
369  dealii::Patterns::Selection(
370  " gullbrand | "
371  " carton_de_wiart_et_al | "
372  " uniform_mesh_no_stretching | "
373  " hopw "),
374  "The type of mesh stretching function for channel flow case. "
375  "Choices are "
376  " <gullbrand | "
377  " carton_de_wiart_et_al | "
378  " uniform_mesh_no_stretching | "
379  " hopw>.");
380  prm.declare_entry("xvelocity_initial_condition_type", "laminar",
381  dealii::Patterns::Selection(
382  " laminar | "
383  " manufactured | "
384  " turbulent "),
385  "The type of x-velocity initialization. "
386  "Choices are "
387  " <laminar | "
388  " manufactured | "
389  " turbulent>.");
390  prm.declare_entry("relaxation_coefficient_for_turbulent_channel_flow_source_term", "0.0",
391  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
392  "Relaxation coefficient for the turbulent channel flow source term. Default is 0.");
393  prm.declare_entry("expected_average_wall_shear_stress_at_final_time", "1",
394  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
395  "For integration test purposes, expected average wall shear stress at final time.");
396  prm.declare_entry("expected_skin_friction_coefficient_at_final_time", "1",
397  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
398  "For integration test purposes, expected skin friction coefficient at final time.");
399  }
400  prm.leave_subsection();
401 
402  prm.enter_subsection("dipole_wall_collision");
403  {
404  prm.declare_entry("do_use_stretched_mesh", "false",
405  dealii::Patterns::Bool(),
406  "Flag to use stretched mesh. By default, false (i.e. use uniform mesh).");
407  prm.declare_entry("do_compute_angular_momentum", "false",
408  dealii::Patterns::Bool(),
409  "Flag to compute the angular momentum. By default, false.");
410  prm.declare_entry("expected_enstrophy_at_final_time", "1",
411  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
412  "For integration test purposes, expected enstrophy at final time.");
413  prm.declare_entry("expected_palinstrophy_at_final_time", "1",
414  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
415  "For integration test purposes, expected palinstrophy at final time.");
416  }
417  prm.leave_subsection();
418 
419  prm.enter_subsection("kelvin_helmholtz_instability");
420  {
421  prm.declare_entry("atwood_number", "0.5",
422  dealii::Patterns::Double(0.0, 1.0),
423  "Atwood number, which characterizes the density difference "
424  "between the layers of fluid.");
425  }
426  prm.leave_subsection();
427 
428  prm.enter_subsection("ESFR_parameter_tests");
429  {
430  prm.declare_entry("number_ESFR_parameter_values", "0",
431  dealii::Patterns::Integer(),
432  "Number of tested ESFR parameter values");
433  prm.declare_entry("ESFR_parameter_values_start", "1e-3",
434  dealii::Patterns::Double(0.0, dealii::Patterns::Double::max_double_value),
435  "Minimum ESFR parameter values >0 since logspace vector");
436 
437  prm.declare_entry("ESFR_parameter_values_end", "1e-3",
438  dealii::Patterns::Double(0.0, dealii::Patterns::Double::max_double_value),
439  "Maximum ESFR parameter values >0 since logspace vector");
440  }
441  prm.leave_subsection();
442 
443  prm.declare_entry("apply_initial_condition_method", "interpolate_initial_condition_function",
444  dealii::Patterns::Selection(
445  " interpolate_initial_condition_function | "
446  " project_initial_condition_function | "
447  " read_values_from_file_and_project "),
448  "The method used for applying the initial condition. "
449  "Choices are "
450  " <interpolate_initial_condition_function | "
451  " project_initial_condition_function | "
452  " read_values_from_file_and_project>.");
453 
454  prm.declare_entry("input_flow_setup_filename_prefix", "setup",
455  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
456  "Filename prefix of the input flow setup file. "
457  "Example: 'setup' for files named setup-0000i.dat, where i is the MPI rank. "
458  "For initializing the flow with values from a file. "
459  "To be set when apply_initial_condition_method is read_values_from_file_and_project.");
460 
461  prm.enter_subsection("output_velocity_field");
462  {
463  prm.declare_entry("output_velocity_field_at_fixed_times", "false",
464  dealii::Patterns::Bool(),
465  "Output velocity field (at equidistant nodes) at fixed times. False by default.");
466 
467  prm.declare_entry("output_velocity_field_times_string", " ",
468  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
469  "String of the times at which to output the velocity field. "
470  "Example: '0.0 1.0 2.0 3.0 ' or '0.0 1.0 2.0 3.0'");
471 
472  prm.declare_entry("output_vorticity_magnitude_field_in_addition_to_velocity", "false",
473  dealii::Patterns::Bool(),
474  "Output vorticity magnitude field in addition to velocity field. False by default.");
475 
476  prm.declare_entry("output_density_field_in_addition_to_velocity", "false",
477  dealii::Patterns::Bool(),
478  "Output density field in addition to velocity field. False by default.");
479  prm.declare_entry("output_viscosity_field_in_addition_to_velocity", "false",
480  dealii::Patterns::Bool(),
481  "Output viscosity field in addition to velocity field. False by default.");
482 
483  prm.declare_entry("do_compute_time_averaged_solution", "false",
484  dealii::Patterns::Bool(),
485  "Compute time-averaged solution for turbulent cases on the fly. False by default.");
486  prm.declare_entry("time_to_start_averaging", "0.0",
487  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
488  "Time to start time-averaged solution. 0.0 default.");
489  prm.declare_entry("do_compute_Reynolds_stress", "false",
490  dealii::Patterns::Bool(),
491  "Compute Reynolds stresses on the fly. False by default.");
492  prm.declare_entry("time_to_start_computing_Reynolds_stress", "0.0",
493  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
494  "Time to start computing Reynolds stresse. 0.0 default.");
495  prm.declare_entry("output_flow_field_files_directory_name", ".",
496  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
497  "Name of directory for writing flow field files. Current directory by default.");
498 
499  prm.declare_entry("output_velocity_number_of_subvisions","2",
500  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
501  "Number of subdivisions to apply when writting the velocity field at equidistant nodes.");
502  }
503  prm.leave_subsection();
504 
505  prm.declare_entry("end_exactly_at_final_time", "true",
506  dealii::Patterns::Bool(),
507  "Flag to adjust the last timestep such that the simulation "
508  "ends exactly at final_time. True by default.");
509 
510  prm.declare_entry("do_compute_unsteady_data_and_write_to_table", "true",
511  dealii::Patterns::Bool(),
512  "Flag for computing unsteady data and writting to table. True by default.");
513  }
514  prm.leave_subsection();
515 }
516 
517 void FlowSolverParam::parse_parameters(dealii::ParameterHandler &prm)
518 {
519  const int mpi_rank = dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
520  dealii::ConditionalOStream pcout(std::cout, mpi_rank==0);
521  prm.enter_subsection("flow_solver");
522  {
523  const std::string flow_case_type_string = prm.get("flow_case_type");
524  if (flow_case_type_string == "taylor_green_vortex") {flow_case_type = taylor_green_vortex;}
525  else if (flow_case_type_string == "decaying_homogeneous_isotropic_turbulence")
526  {flow_case_type = decaying_homogeneous_isotropic_turbulence;}
527  else if (flow_case_type_string == "burgers_viscous_snapshot") {flow_case_type = burgers_viscous_snapshot;}
528  else if (flow_case_type_string == "burgers_rewienski_snapshot") {flow_case_type = burgers_rewienski_snapshot;}
529  else if (flow_case_type_string == "naca0012") {flow_case_type = naca0012;}
530  else if (flow_case_type_string == "burgers_inviscid") {flow_case_type = burgers_inviscid;}
531  else if (flow_case_type_string == "convection_diffusion") {flow_case_type = convection_diffusion;}
532  else if (flow_case_type_string == "advection") {flow_case_type = advection;}
533  else if (flow_case_type_string == "periodic_1D_unsteady") {flow_case_type = periodic_1D_unsteady;}
534  else if (flow_case_type_string == "gaussian_bump") {flow_case_type = gaussian_bump;}
535  else if (flow_case_type_string == "channel_flow") {flow_case_type = channel_flow;}
536  else if (flow_case_type_string == "isentropic_vortex") {flow_case_type = isentropic_vortex;}
537  else if (flow_case_type_string == "kelvin_helmholtz_instability")
538  {flow_case_type = kelvin_helmholtz_instability;}
539  else if (flow_case_type_string == "non_periodic_cube_flow") {flow_case_type = non_periodic_cube_flow;}
540  else if (flow_case_type_string == "turbulent_airfoil_3D") {flow_case_type = turbulent_airfoil_3D;}
541  // Positivity Preserving Tests
542  else if (flow_case_type_string == "sod_shock_tube") {flow_case_type = sod_shock_tube;}
543  else if (flow_case_type_string == "low_density") {flow_case_type = low_density;}
544  else if (flow_case_type_string == "leblanc_shock_tube") {flow_case_type = leblanc_shock_tube;}
545  else if (flow_case_type_string == "shu_osher_problem") {flow_case_type = shu_osher_problem;}
546  else if (flow_case_type_string == "advection_limiter") {flow_case_type = advection_limiter;}
547  else if (flow_case_type_string == "burgers_limiter") {flow_case_type = burgers_limiter;}
548  else if (flow_case_type_string == "dipole_wall_collision_normal")
549  {flow_case_type = dipole_wall_collision_normal;}
550  else if (flow_case_type_string == "dipole_wall_collision_oblique")
551  {flow_case_type = dipole_wall_collision_oblique;}
552  else if (flow_case_type_string == "double_mach_reflection") {flow_case_type = double_mach_reflection;}
553  else if (flow_case_type_string == "shock_diffraction") {flow_case_type = shock_diffraction;}
554  else if (flow_case_type_string == "astrophysical_jet") {flow_case_type = astrophysical_jet;}
555  else if (flow_case_type_string == "strong_vortex_shock_wave") {flow_case_type = strong_vortex_shock_wave;}
556  // Multispecies Tests
557  else if (flow_case_type_string == "multi_species_vortex_advection") {flow_case_type = multi_species_vortex_advection;}
558  else if (flow_case_type_string == "multi_species_vortex_advection_high_temp") {flow_case_type = multi_species_vortex_advection_high_temp;}
559  else if (flow_case_type_string == "multi_species_sod_shock_tube") {flow_case_type = multi_species_sod_shock_tube;}
560  else if (flow_case_type_string == "multi_species_isentropic_vortex") {flow_case_type = multi_species_isentropic_vortex;}
561  else if (flow_case_type_string == "multi_species_taylor_green_vortex_smooth") {flow_case_type = multi_species_taylor_green_vortex_smooth;}
562  else if (flow_case_type_string == "multi_species_taylor_green_vortex_sharp") {flow_case_type = multi_species_taylor_green_vortex_sharp;}
563 
564  poly_degree = prm.get_integer("poly_degree");
565 
566  // get max poly degree for adaptation
567  max_poly_degree_for_adaptation = prm.get_integer("max_poly_degree_for_adaptation");
568  // -- set value to poly_degree if it is the default value
570  final_time = prm.get_double("final_time");
571  constant_time_step = prm.get_double("constant_time_step");
572  courant_friedrichs_lewy_number = prm.get_double("courant_friedrichs_lewy_number");
573  unsteady_data_table_filename = prm.get("unsteady_data_table_filename");
574  steady_state = prm.get_bool("steady_state");
575  steady_state_polynomial_ramping = prm.get_bool("steady_state_polynomial_ramping");
576  error_adaptive_time_step = prm.get_bool("error_adaptive_time_step");
577  adaptive_time_step = prm.get_bool("adaptive_time_step");
578  sensitivity_table_filename = prm.get("sensitivity_table_filename");
579  restart_computation_from_file = prm.get_bool("restart_computation_from_file");
580  output_restart_files = prm.get_bool("output_restart_files");
581  restart_files_directory_name = prm.get("restart_files_directory_name");
583  // Check if directory exists - see https://stackoverflow.com/a/18101042
584  struct stat info_restart;
585  if( stat( restart_files_directory_name.c_str(), &info_restart ) != 0 ){
586  pcout << "Error: No restart files directory named " << restart_files_directory_name << " exists." << std::endl
587  << "Please create the directory and restart. Aborting..." << std::endl;
588  std::abort();
589  }
590  }
591  restart_file_index = prm.get_integer("restart_file_index");
592  output_restart_files_every_x_steps = prm.get_integer("output_restart_files_every_x_steps");
593  output_restart_files_every_dt_time_intervals = prm.get_double("output_restart_files_every_dt_time_intervals");
594  write_unsteady_data_table_file_every_dt_time_intervals = prm.get_double("write_unsteady_data_table_file_every_dt_time_intervals");
595  expected_order_at_final_time = prm.get_double("expected_order_at_final_time");
596 
597  prm.enter_subsection("grid");
598  {
599  input_mesh_filename = prm.get("input_mesh_filename");
600  grid_degree = prm.get_integer("grid_degree");
601  grid_left_bound = prm.get_double("grid_left_bound");
602  grid_right_bound = prm.get_double("grid_right_bound");
603  number_of_grid_elements_per_dimension = prm.get_integer("number_of_grid_elements_per_dimension");
604  number_of_mesh_refinements = prm.get_integer("number_of_mesh_refinements");
605  use_gmsh_mesh = prm.get_bool("use_gmsh_mesh");
606  mesh_reader_verbose_output = prm.get_bool("mesh_reader_verbose_output");
607 
608  prm.enter_subsection("gmsh_boundary_IDs");
609  {
610  use_periodic_BC_in_x = prm.get_bool("use_periodic_BC_in_x");
611  use_periodic_BC_in_y = prm.get_bool("use_periodic_BC_in_y");
612  use_periodic_BC_in_z = prm.get_bool("use_periodic_BC_in_z");
613  x_periodic_id_face_1 = prm.get_integer("x_periodic_id_face_1");
614  x_periodic_id_face_2 = prm.get_integer("x_periodic_id_face_2");
615  y_periodic_id_face_1 = prm.get_integer("y_periodic_id_face_1");
616  y_periodic_id_face_2 = prm.get_integer("y_periodic_id_face_2");
617  z_periodic_id_face_1 = prm.get_integer("z_periodic_id_face_1");
618  z_periodic_id_face_2 = prm.get_integer("z_periodic_id_face_2");
619  }
620  prm.leave_subsection();
621 
622  prm.enter_subsection("gaussian_bump");
623  {
624  number_of_subdivisions_in_x_direction = prm.get_integer("number_of_subdivisions_in_x_direction");
625  number_of_subdivisions_in_y_direction = prm.get_integer("number_of_subdivisions_in_y_direction");
626  number_of_subdivisions_in_z_direction = prm.get_integer("number_of_subdivisions_in_z_direction");
627  channel_length = prm.get_double("channel_length");
628  channel_height = prm.get_double("channel_height");
629  bump_height = prm.get_double("bump_height");
630  }
631  prm.leave_subsection();
632 
633  prm.enter_subsection("grid_rectangle");
634  {
635  grid_top_bound = prm.get_double("grid_top_bound");
636  grid_bottom_bound = prm.get_double("grid_bottom_bound");
637  grid_z_upper_bound = prm.get_double("grid_z_upper_bound");
638  grid_z_lower_bound = prm.get_double("grid_z_lower_bound");
639 
640  number_of_grid_elements_x = prm.get_integer("number_of_grid_elements_x");
641  number_of_grid_elements_y = prm.get_integer("number_of_grid_elements_y");
642  number_of_grid_elements_z = prm.get_integer("number_of_grid_elements_z");
643  }
644  prm.leave_subsection();
645  }
646  prm.leave_subsection();
647 
648 
649  prm.enter_subsection("taylor_green_vortex");
650  {
651  expected_kinetic_energy_at_final_time = prm.get_double("expected_kinetic_energy_at_final_time");
652  expected_theoretical_dissipation_rate_at_final_time = prm.get_double("expected_theoretical_dissipation_rate_at_final_time");
653 
654  const std::string density_initial_condition_type_string = prm.get("density_initial_condition_type");
655  if (density_initial_condition_type_string == "uniform") {density_initial_condition_type = uniform;}
656  else if (density_initial_condition_type_string == "isothermal") {density_initial_condition_type = isothermal;}
657  do_calculate_numerical_entropy = prm.get_bool("do_calculate_numerical_entropy");
658  check_nonphysical_flow_case_behavior = prm.get_bool("check_nonphysical_flow_case_behavior");
659  }
660  prm.leave_subsection();
661 
662  prm.enter_subsection("channel_flow");
663  {
664  turbulent_channel_friction_velocity_reynolds_number = prm.get_double("channel_friction_velocity_reynolds_number");
665  turbulent_channel_number_of_cells_x_direction = prm.get_integer("turbulent_channel_number_of_cells_x_direction");
666  turbulent_channel_number_of_cells_y_direction = prm.get_integer("turbulent_channel_number_of_cells_y_direction");
667  turbulent_channel_number_of_cells_z_direction = prm.get_integer("turbulent_channel_number_of_cells_z_direction");
668  turbulent_channel_domain_length_x_direction = prm.get_double("turbulent_channel_domain_length_x_direction");
669  turbulent_channel_domain_length_y_direction = prm.get_double("turbulent_channel_domain_length_y_direction");
670  turbulent_channel_domain_length_z_direction = prm.get_double("turbulent_channel_domain_length_z_direction");
671  const std::string turbulent_channel_mesh_stretching_function_type_string = prm.get("turbulent_channel_mesh_stretching_function_type");
672  if (turbulent_channel_mesh_stretching_function_type_string == "gullbrand") {turbulent_channel_mesh_stretching_function_type = gullbrand;}
673  else if (turbulent_channel_mesh_stretching_function_type_string == "hopw") {turbulent_channel_mesh_stretching_function_type = hopw;}
674  else if (turbulent_channel_mesh_stretching_function_type_string == "carton_de_wiart_et_al") {turbulent_channel_mesh_stretching_function_type = carton_de_wiart_et_al;}
675  else if (turbulent_channel_mesh_stretching_function_type_string == "uniform_mesh_no_stretching")
676  {turbulent_channel_mesh_stretching_function_type = uniform_mesh_no_stretching;}
677  const std::string xvelocity_initial_condition_type_string = prm.get("xvelocity_initial_condition_type");
678  if (xvelocity_initial_condition_type_string == "laminar") {xvelocity_initial_condition_type = laminar;}
679  else if (xvelocity_initial_condition_type_string == "turbulent") {xvelocity_initial_condition_type = turbulent;}
680  else if (xvelocity_initial_condition_type_string == "manufactured") {xvelocity_initial_condition_type = manufactured;}
681  relaxation_coefficient_for_turbulent_channel_flow_source_term = prm.get_double("relaxation_coefficient_for_turbulent_channel_flow_source_term");
682  expected_average_wall_shear_stress_at_final_time = prm.get_double("expected_average_wall_shear_stress_at_final_time");
683  expected_skin_friction_coefficient_at_final_time = prm.get_double("expected_skin_friction_coefficient_at_final_time");
684  }
685  prm.leave_subsection();
686 
687  prm.enter_subsection("dipole_wall_collision");
688  {
689  do_use_stretched_mesh = prm.get_bool("do_use_stretched_mesh");
690  do_compute_angular_momentum = prm.get_bool("do_compute_angular_momentum");
691  expected_enstrophy_at_final_time = prm.get_double("expected_enstrophy_at_final_time");
692  expected_palinstrophy_at_final_time = prm.get_double("expected_palinstrophy_at_final_time");
693  }
694  prm.leave_subsection();
695 
696  prm.enter_subsection("kelvin_helmholtz_instability");
697  {
698  atwood_number = prm.get_double("atwood_number");
699  }
700  prm.leave_subsection();
701 
702  prm.enter_subsection("ESFR_parameter_tests");
703  {
704  number_ESFR_parameter_values = prm.get_integer("number_ESFR_parameter_values");
705  ESFR_parameter_values_start = prm.get_double("ESFR_parameter_values_start");
706  ESFR_parameter_values_end = prm.get_double("ESFR_parameter_values_end");
707  }
708  prm.leave_subsection();
709 
710  const std::string apply_initial_condition_method_string = prm.get("apply_initial_condition_method");
711  if (apply_initial_condition_method_string == "interpolate_initial_condition_function") {apply_initial_condition_method = interpolate_initial_condition_function;}
712  else if (apply_initial_condition_method_string == "project_initial_condition_function") {apply_initial_condition_method = project_initial_condition_function;}
713  else if (apply_initial_condition_method_string == "read_values_from_file_and_project") {apply_initial_condition_method = read_values_from_file_and_project;}
714 
715  input_flow_setup_filename_prefix = prm.get("input_flow_setup_filename_prefix");
716 
717  prm.enter_subsection("output_velocity_field");
718  {
719  output_velocity_field_at_fixed_times = prm.get_bool("output_velocity_field_at_fixed_times");
720  output_velocity_field_times_string = prm.get("output_velocity_field_times_string");
722  output_vorticity_magnitude_field_in_addition_to_velocity = prm.get_bool("output_vorticity_magnitude_field_in_addition_to_velocity");
723  output_density_field_in_addition_to_velocity = prm.get_bool("output_density_field_in_addition_to_velocity");
724  output_viscosity_field_in_addition_to_velocity = prm.get_bool("output_viscosity_field_in_addition_to_velocity");
725  do_compute_time_averaged_solution = prm.get_bool("do_compute_time_averaged_solution");
726  time_to_start_averaging = prm.get_double("time_to_start_averaging");
727  do_compute_Reynolds_stress = prm.get_bool("do_compute_Reynolds_stress");
728  time_to_start_computing_Reynolds_stress = prm.get_double("time_to_start_computing_Reynolds_stress");
729  output_flow_field_files_directory_name = prm.get("output_flow_field_files_directory_name");
731  // Check if directory exists - see https://stackoverflow.com/a/18101042
732  struct stat info_flow;
733  if( stat( output_flow_field_files_directory_name.c_str(), &info_flow ) != 0 ){
734  pcout << "Error: No flow field files directory named " << output_flow_field_files_directory_name << " exists." << std::endl
735  << "Please create the directory and restart. Aborting..." << std::endl;
736  std::abort();
737  }
738  }
739  output_velocity_number_of_subvisions = prm.get_integer("output_velocity_number_of_subvisions");
740  }
741  prm.leave_subsection();
742 
743  end_exactly_at_final_time = prm.get_bool("end_exactly_at_final_time");
744  do_compute_unsteady_data_and_write_to_table = prm.get_bool("do_compute_unsteady_data_and_write_to_table");
745  }
746  prm.leave_subsection();
747 }
748 
749 } // Parameters namespace
750 } // PHiLiP namespace
bool do_compute_Reynolds_stress
Flag for computing time-averaged Reynolds stresses.
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.
bool check_nonphysical_flow_case_behavior
For TGV, flag to check if non-physical case dependant behaviour is encounted.
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.
unsigned int number_of_grid_elements_z
Number of subdivisions in z direction for a rectangle grid.
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.
int turbulent_channel_number_of_cells_z_direction
For channel flow, number of cells in z-direction.
double courant_friedrichs_lewy_number
Courant-Friedrichs-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.
int turbulent_channel_number_of_cells_x_direction
For channel flow, number of cells in x-direction.
bool output_velocity_field_at_fixed_times
Flag for outputting velocity field at fixed times.
double turbulent_channel_domain_length_y_direction
For channel flow, domain length in y-direction.
int z_periodic_id_face_1
Custom Boundary IDs for the first periodic face in the z-direction.
double ESFR_parameter_values_start
For user defined FR parameter tests, value of starting FR param.
unsigned int grid_degree
Parameters related to mesh generation.
double constant_time_step
Constant time step.
double grid_bottom_bound
Minimum y bound of domain for a rectangle grid.
bool restart_computation_from_file
Restart computation from restart file.
double turbulent_channel_friction_velocity_reynolds_number
For channel flow, channel Reynolds number based on wall friction velocity.
XVelocityInitialConditionType xvelocity_initial_condition_type
Selected XVelocityInitialConditionType from the input file.
int number_ESFR_parameter_values
For user defined FR parameter tests, number of values to be tested.
double channel_height
Height of channel for gaussian bump case.
double ESFR_parameter_values_end
For user defined FR parameter tests, value of final FR param.
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.
Definition: ADTypes.hpp:10
void parse_parameters(dealii::ParameterHandler &prm)
Parses input file and sets the variables.
double time_to_start_averaging
Flag for starting time-averaged solution.
unsigned int output_velocity_number_of_subvisions
Number of subdivisions to apply when writting the velocity field at equidistant nodes.
double grid_z_lower_bound
Minimum z bound of domain for a rectangle grid.
double bump_height
Height of gaussian bump.
bool do_compute_angular_momentum
For dipole wall collision, flag to compute angular momentum.
bool mesh_reader_verbose_output
< Flag for verbose (true) or quiet (false) mesh reader output
bool output_viscosity_field_in_addition_to_velocity
Flag for outputting viscosity field in addition to velocity field.
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.
double grid_z_upper_bound
Maximum z bound of domain for a rectangle grid.
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.
double write_unsteady_data_table_file_every_dt_time_intervals
Writes the unsteady data table file at time intervals of dt.
double expected_order_at_final_time
For limiter convergence tests, specify expected order at final time.
unsigned int restart_file_index
Index of desired restart file for restarting the computation from.
bool do_compute_unsteady_data_and_write_to_table
Flag for computing unsteady data and writting to table.
int output_restart_files_every_x_steps
Outputs the restart files every x steps.
unsigned int number_of_grid_elements_x
Number of subdivisions in x direction for a rectangle grid.
double grid_top_bound
Maximum y bound of domain for a rectangle grid.
double turbulent_channel_domain_length_z_direction
For channel flow, domain length in z-direction.
bool do_compute_time_averaged_solution
Flag for computing time-averaged solution.
bool use_periodic_BC_in_y
Flag for using periodic boundary conditions in the y-direction.
bool do_use_stretched_mesh
For dipole wall collision, flag to use stretched mesh.
double turbulent_channel_domain_length_x_direction
For channel flow, domain length in x-direction.
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
int turbulent_channel_number_of_cells_y_direction
For channel flow, number of cells in y-direction.
unsigned int number_of_times_to_output_velocity_field
Number of fixed times to output the velocity field.
unsigned int number_of_grid_elements_y
Number of subdivisions in y direction for a rectangle grid.
double atwood_number
For KHI, the atwood number.
TurbulentChannelMeshStretchingFunctionType turbulent_channel_mesh_stretching_function_type
Selected DensityInitialConditionType from the input file.
double time_to_start_computing_Reynolds_stress
Flag for starting to compute Reynolds stresses. This needs to be after the time-averaging has started...
double relaxation_coefficient_for_turbulent_channel_flow_source_term
For channel flow, relaxation coefficient for the source term.
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.
bool output_density_field_in_addition_to_velocity
Flag for outputting density field in addition to velocity field.
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.
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.