[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  " isentropic_vortex | "
34  " kelvin_helmholtz_instability | "
35  " non_periodic_cube_flow | "
36  " sod_shock_tube | "
37  " low_density | "
38  " leblanc_shock_tube | "
39  " shu_osher_problem | "
40  " advection_limiter | "
41  " burgers_limiter | "
42  " double_mach_reflection | "
43  " shock_diffraction | "
44  " astrophysical_jet | "
45  " strong_vortex_shock_wave |"),
46  "The type of flow we want to simulate. "
47  "Choices are "
48  " <taylor_green_vortex | "
49  " decaying_homogeneous_isotropic_turbulence | "
50  " burgers_viscous_snapshot | "
51  " naca0012 | "
52  " burgers_rewienski_snapshot | "
53  " burgers_inviscid | "
54  " convection_diffusion | "
55  " advection | "
56  " periodic_1D_unsteady | "
57  " gaussian_bump | "
58  " isentropic_vortex | "
59  " kelvin_helmholtz_instability | "
60  " non_periodic_cube_flow | "
61  " sod_shock_tube | "
62  " low_density | "
63  " leblanc_shock_tube | "
64  " shu_osher_problem | "
65  " advection_limiter | "
66  " burgers_limiter | "
67  " double_mach_reflection | "
68  " shock_diffraction | "
69  " astrophysical_jet | "
70  " strong_vortex_shock_wave >. ");
71 
72  prm.declare_entry("poly_degree", "1",
73  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
74  "Polynomial order (P) of the basis functions for DG.");
75 
76  prm.declare_entry("max_poly_degree_for_adaptation", "0",
77  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
78  "Maxiumum possible polynomial order (P) of the basis functions for DG "
79  "when doing adaptive simulations. Default is 0 which actually sets "
80  "the value to poly_degree in the code, indicating no adaptation.");
81 
82  prm.declare_entry("final_time", "1",
83  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
84  "Final solution time.");
85 
86  prm.declare_entry("constant_time_step", "0",
87  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
88  "Constant time step.");
89 
90  prm.declare_entry("courant_friedrichs_lewy_number", "1",
91  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
92  "Courant-Friedrich-Lewy (CFL) number for constant time step.");
93 
94  prm.declare_entry("unsteady_data_table_filename", "unsteady_data_table",
95  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
96  "Filename of the unsteady data table output file: unsteady_data_table_filename.txt.");
97 
98  prm.declare_entry("steady_state", "false",
99  dealii::Patterns::Bool(),
100  "Solve steady-state solution. False by default (i.e. unsteady by default).");
101 
102  prm.declare_entry("error_adaptive_time_step", "false",
103  dealii::Patterns::Bool(),
104  "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).");
105 
106  prm.declare_entry("adaptive_time_step", "false",
107  dealii::Patterns::Bool(),
108  "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).");
109 
110  prm.declare_entry("steady_state_polynomial_ramping", "false",
111  dealii::Patterns::Bool(),
112  "For steady-state cases, does polynomial ramping if set to true. False by default.");
113 
114  prm.declare_entry("sensitivity_table_filename", "sensitivity_table",
115  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
116  "Filename for the sensitivity data table output file: sensitivity_table_filename.txt.");
117 
118  prm.declare_entry("restart_computation_from_file", "false",
119  dealii::Patterns::Bool(),
120  "Restarts the computation from the restart file. False by default.");
121 
122  prm.declare_entry("output_restart_files", "false",
123  dealii::Patterns::Bool(),
124  "Output restart files for restarting the computation. False by default.");
125 
126  prm.declare_entry("restart_files_directory_name", ".",
127  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
128  "Name of directory for writing and reading restart files. Current directory by default.");
129 
130  prm.declare_entry("restart_file_index", "1",
131  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
132  "Index of restart file from which the computation will be restarted from. 1 by default.");
133 
134  prm.declare_entry("output_restart_files_every_x_steps", "1",
135  dealii::Patterns::Integer(1,dealii::Patterns::Integer::max_int_value),
136  "Outputs the restart files every x steps.");
137 
138  prm.declare_entry("output_restart_files_every_dt_time_intervals", "0.0",
139  dealii::Patterns::Double(0,dealii::Patterns::Double::max_double_value),
140  "Outputs the restart files at time intervals of dt.");
141 
142  prm.declare_entry("expected_order_at_final_time", "0.0",
143  dealii::Patterns::Double(0.0, 10.0),
144  "For convergence tests related to limiters, expected order of accuracy for final run.");
145 
146  prm.enter_subsection("grid");
147  {
148  prm.declare_entry("input_mesh_filename", "",
149  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
150  "Filename of the input mesh: input_mesh_filename.msh. For cases that import a mesh file.");
151 
152  prm.declare_entry("grid_degree", "1",
153  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
154  "Polynomial degree of the grid. Curvilinear grid if set greater than 1; default is 1.");
155 
156  prm.declare_entry("grid_left_bound", "0.0",
157  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
158  "Left bound of domain for hyper_cube mesh based cases.");
159 
160  prm.declare_entry("grid_right_bound", "1.0",
161  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
162  "Right bound of domain for hyper_cube mesh based cases.");
163 
164  prm.declare_entry("number_of_grid_elements_per_dimension", "4",
165  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
166  "Number of grid elements per dimension for hyper_cube mesh based cases.");
167 
168  prm.declare_entry("number_of_mesh_refinements", "0",
169  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
170  "Number of mesh refinements for Gaussian bump and naca0012 based cases.");
171 
172  prm.declare_entry("use_gmsh_mesh", "false",
173  dealii::Patterns::Bool(),
174  "Use the input .msh file which calls read_gmsh. False by default.");
175 
176  prm.declare_entry("mesh_reader_verbose_output", "false",
177  dealii::Patterns::Bool(),
178  "Flag for verbose (true) or quiet (false) mesh reader output.");
179 
180  prm.enter_subsection("gmsh_boundary_IDs");
181  {
182 
183  prm.declare_entry("use_periodic_BC_in_x", "false",
184  dealii::Patterns::Bool(),
185  "Use periodic boundary condition in the x-direction. False by default.");
186 
187  prm.declare_entry("use_periodic_BC_in_y", "false",
188  dealii::Patterns::Bool(),
189  "Use periodic boundary condition in the y-direction. False by default.");
190 
191  prm.declare_entry("use_periodic_BC_in_z", "false",
192  dealii::Patterns::Bool(),
193  "Use periodic boundary condition in the z-direction. False by default.");
194 
195  prm.declare_entry("x_periodic_id_face_1", "2001",
196  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
197  "Boundary ID for the first periodic boundary face in the x-direction.");
198 
199  prm.declare_entry("x_periodic_id_face_2", "2002",
200  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
201  "Boundary ID for the second periodic boundary face in the x-direction.");
202 
203  prm.declare_entry("y_periodic_id_face_1", "2003",
204  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
205  "Boundary ID for the first periodic boundary face in the y-direction.");
206 
207  prm.declare_entry("y_periodic_id_face_2", "2004",
208  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
209  "Boundary ID for the second periodic boundary face in the y-direction.");
210 
211  prm.declare_entry("z_periodic_id_face_1", "2005",
212  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
213  "Boundary ID for the first periodic boundary face in the z-direction.");
214 
215  prm.declare_entry("z_periodic_id_face_2", "2006",
216  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
217  "Boundary ID for the second periodic boundary face in the z-direction.");
218  }
219  prm.leave_subsection();
220 
221  prm.enter_subsection("gaussian_bump");
222  {
223  prm.declare_entry("channel_length", "3.0",
224  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
225  "Lenght of channel for gaussian bump meshes.");
226 
227  prm.declare_entry("channel_height", "0.8",
228  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
229  "Height of channel for gaussian bump meshes.");
230 
231  prm.declare_entry("bump_height", "0.0625",
232  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
233  "Height of the bump for gaussian bump meshes.");
234 
235  prm.declare_entry("number_of_subdivisions_in_x_direction", "0",
236  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
237  "Number of subdivisions in the x direction for gaussian bump meshes.");
238 
239  prm.declare_entry("number_of_subdivisions_in_y_direction", "0",
240  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
241  "Number of subdivisions in the y direction for gaussian bump meshes.");
242 
243  prm.declare_entry("number_of_subdivisions_in_z_direction", "0",
244  dealii::Patterns::Integer(0, dealii::Patterns::Integer::max_int_value),
245  "Number of subdivisions in the z direction for gaussian bump meshes.");
246  }
247  prm.leave_subsection();
248 
249  prm.enter_subsection("grid_rectangle");
250  {
251  prm.declare_entry("grid_top_bound", "0.0",
252  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
253  "Left bound of domain for hyper_cube mesh based cases.");
254 
255  prm.declare_entry("grid_bottom_bound", "0.0",
256  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
257  "Right bound of domain for hyper_cube mesh based cases.");
258 
259  prm.declare_entry("grid_z_lower_bound", "0.0",
260  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
261  "Left bound of domain for hyper_cube mesh based cases.");
262 
263  prm.declare_entry("grid_z_upper_bound", "0.0",
264  dealii::Patterns::Double(-dealii::Patterns::Double::max_double_value, dealii::Patterns::Double::max_double_value),
265  "Right bound of domain for hyper_cube mesh based cases.");
266 
267  prm.declare_entry("number_of_grid_elements_x", "1",
268  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
269  "Number of grid elements in the x-direction.");
270 
271  prm.declare_entry("number_of_grid_elements_y", "1",
272  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
273  "Number of grid elements in the y-direction.");
274 
275  prm.declare_entry("number_of_grid_elements_z", "1",
276  dealii::Patterns::Integer(1, dealii::Patterns::Integer::max_int_value),
277  "Number of grid elements in the z-direction.");
278  }
279  prm.leave_subsection();
280 
281  }
282  prm.leave_subsection();
283 
284  prm.enter_subsection("taylor_green_vortex");
285  {
286  prm.declare_entry("expected_kinetic_energy_at_final_time", "1",
287  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
288  "For integration test purposes, expected kinetic energy at final time.");
289 
290  prm.declare_entry("expected_theoretical_dissipation_rate_at_final_time", "1",
291  dealii::Patterns::Double(0, dealii::Patterns::Double::max_double_value),
292  "For integration test purposes, expected theoretical kinetic energy dissipation rate at final time.");
293 
294  prm.declare_entry("density_initial_condition_type", "uniform",
295  dealii::Patterns::Selection(
296  " uniform | "
297  " isothermal "),
298  "The type of density initialization. "
299  "Choices are "
300  " <uniform | "
301  " isothermal>.");
302 
303  prm.declare_entry("do_calculate_numerical_entropy", "false",
304  dealii::Patterns::Bool(),
305  "Flag to calculate numerical entropy and write to file. By default, do not calculate.");
306 
307  }
308  prm.leave_subsection();
309 
310  prm.enter_subsection("kelvin_helmholtz_instability");
311  {
312  prm.declare_entry("atwood_number", "0.5",
313  dealii::Patterns::Double(0.0, 1.0),
314  "Atwood number, which characterizes the density difference "
315  "between the layers of fluid.");
316  }
317  prm.leave_subsection();
318 
319  prm.enter_subsection("ESFR_parameter_tests");
320  {
321  prm.declare_entry("number_ESFR_parameter_values", "0",
322  dealii::Patterns::Integer(),
323  "Number of tested ESFR parameter values");
324  prm.declare_entry("ESFR_parameter_values_start", "1e-3",
325  dealii::Patterns::Double(0.0, dealii::Patterns::Double::max_double_value),
326  "Minimum ESFR parameter values >0 since logspace vector");
327 
328  prm.declare_entry("ESFR_parameter_values_end", "1e-3",
329  dealii::Patterns::Double(0.0, dealii::Patterns::Double::max_double_value),
330  "Maximum ESFR parameter values >0 since logspace vector");
331  }
332  prm.leave_subsection();
333 
334  prm.declare_entry("apply_initial_condition_method", "interpolate_initial_condition_function",
335  dealii::Patterns::Selection(
336  " interpolate_initial_condition_function | "
337  " project_initial_condition_function | "
338  " read_values_from_file_and_project "),
339  "The method used for applying the initial condition. "
340  "Choices are "
341  " <interpolate_initial_condition_function | "
342  " project_initial_condition_function | "
343  " read_values_from_file_and_project>.");
344 
345  prm.declare_entry("input_flow_setup_filename_prefix", "setup",
346  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
347  "Filename prefix of the input flow setup file. "
348  "Example: 'setup' for files named setup-0000i.dat, where i is the MPI rank. "
349  "For initializing the flow with values from a file. "
350  "To be set when apply_initial_condition_method is read_values_from_file_and_project.");
351 
352  prm.enter_subsection("output_velocity_field");
353  {
354  prm.declare_entry("output_velocity_field_at_fixed_times", "false",
355  dealii::Patterns::Bool(),
356  "Output velocity field (at equidistant nodes) at fixed times. False by default.");
357 
358  prm.declare_entry("output_velocity_field_times_string", " ",
359  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
360  "String of the times at which to output the velocity field. "
361  "Example: '0.0 1.0 2.0 3.0 ' or '0.0 1.0 2.0 3.0'");
362 
363  prm.declare_entry("output_vorticity_magnitude_field_in_addition_to_velocity", "false",
364  dealii::Patterns::Bool(),
365  "Output vorticity magnitude field in addition to velocity field. False by default.");
366 
367  prm.declare_entry("output_flow_field_files_directory_name", ".",
368  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
369  "Name of directory for writing flow field files. Current directory by default.");
370  }
371  prm.leave_subsection();
372 
373  prm.declare_entry("end_exactly_at_final_time", "true",
374  dealii::Patterns::Bool(),
375  "Flag to adjust the last timestep such that the simulation "
376  "ends exactly at final_time. True by default.");
377  }
378  prm.leave_subsection();
379 }
380 
381 void FlowSolverParam::parse_parameters(dealii::ParameterHandler &prm)
382 {
383  const int mpi_rank = dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
384  dealii::ConditionalOStream pcout(std::cout, mpi_rank==0);
385  prm.enter_subsection("flow_solver");
386  {
387  const std::string flow_case_type_string = prm.get("flow_case_type");
388  if (flow_case_type_string == "taylor_green_vortex") {flow_case_type = taylor_green_vortex;}
389  else if (flow_case_type_string == "decaying_homogeneous_isotropic_turbulence")
390  {flow_case_type = decaying_homogeneous_isotropic_turbulence;}
391  else if (flow_case_type_string == "burgers_viscous_snapshot") {flow_case_type = burgers_viscous_snapshot;}
392  else if (flow_case_type_string == "burgers_rewienski_snapshot") {flow_case_type = burgers_rewienski_snapshot;}
393  else if (flow_case_type_string == "naca0012") {flow_case_type = naca0012;}
394  else if (flow_case_type_string == "burgers_inviscid") {flow_case_type = burgers_inviscid;}
395  else if (flow_case_type_string == "convection_diffusion") {flow_case_type = convection_diffusion;}
396  else if (flow_case_type_string == "advection") {flow_case_type = advection;}
397  else if (flow_case_type_string == "periodic_1D_unsteady") {flow_case_type = periodic_1D_unsteady;}
398  else if (flow_case_type_string == "gaussian_bump") {flow_case_type = gaussian_bump;}
399  else if (flow_case_type_string == "isentropic_vortex") {flow_case_type = isentropic_vortex;}
400  else if (flow_case_type_string == "kelvin_helmholtz_instability")
401  {flow_case_type = kelvin_helmholtz_instability;}
402  else if (flow_case_type_string == "non_periodic_cube_flow") {flow_case_type = non_periodic_cube_flow;}
403  // Positivity Preserving Tests
404  else if (flow_case_type_string == "sod_shock_tube") {flow_case_type = sod_shock_tube;}
405  else if (flow_case_type_string == "low_density") {flow_case_type = low_density;}
406  else if (flow_case_type_string == "leblanc_shock_tube") {flow_case_type = leblanc_shock_tube;}
407  else if (flow_case_type_string == "shu_osher_problem") {flow_case_type = shu_osher_problem;}
408  else if (flow_case_type_string == "advection_limiter") {flow_case_type = advection_limiter;}
409  else if (flow_case_type_string == "burgers_limiter") {flow_case_type = burgers_limiter;}
410  else if (flow_case_type_string == "double_mach_reflection") {flow_case_type = double_mach_reflection;}
411  else if (flow_case_type_string == "shock_diffraction") {flow_case_type = shock_diffraction;}
412  else if (flow_case_type_string == "astrophysical_jet") {flow_case_type = astrophysical_jet;}
413  else if (flow_case_type_string == "strong_vortex_shock_wave") {flow_case_type = strong_vortex_shock_wave;}
414 
415  poly_degree = prm.get_integer("poly_degree");
416 
417  // get max poly degree for adaptation
418  max_poly_degree_for_adaptation = prm.get_integer("max_poly_degree_for_adaptation");
419  // -- set value to poly_degree if it is the default value
421  final_time = prm.get_double("final_time");
422  constant_time_step = prm.get_double("constant_time_step");
423  courant_friedrichs_lewy_number = prm.get_double("courant_friedrichs_lewy_number");
424  unsteady_data_table_filename = prm.get("unsteady_data_table_filename");
425  steady_state = prm.get_bool("steady_state");
426  steady_state_polynomial_ramping = prm.get_bool("steady_state_polynomial_ramping");
427  error_adaptive_time_step = prm.get_bool("error_adaptive_time_step");
428  adaptive_time_step = prm.get_bool("adaptive_time_step");
429  sensitivity_table_filename = prm.get("sensitivity_table_filename");
430  restart_computation_from_file = prm.get_bool("restart_computation_from_file");
431  output_restart_files = prm.get_bool("output_restart_files");
432  restart_files_directory_name = prm.get("restart_files_directory_name");
433  // Check if directory exists - see https://stackoverflow.com/a/18101042
434  struct stat info_restart;
435  if( stat( restart_files_directory_name.c_str(), &info_restart ) != 0 ){
436  pcout << "Error: No restart files directory named " << restart_files_directory_name << " exists." << std::endl
437  << "Please create the directory and restart. Aborting..." << std::endl;
438  std::abort();
439  }
440  restart_file_index = prm.get_integer("restart_file_index");
441  output_restart_files_every_x_steps = prm.get_integer("output_restart_files_every_x_steps");
442  output_restart_files_every_dt_time_intervals = prm.get_double("output_restart_files_every_dt_time_intervals");
443  expected_order_at_final_time = prm.get_double("expected_order_at_final_time");
444 
445  prm.enter_subsection("grid");
446  {
447  input_mesh_filename = prm.get("input_mesh_filename");
448  grid_degree = prm.get_integer("grid_degree");
449  grid_left_bound = prm.get_double("grid_left_bound");
450  grid_right_bound = prm.get_double("grid_right_bound");
451  number_of_grid_elements_per_dimension = prm.get_integer("number_of_grid_elements_per_dimension");
452  number_of_mesh_refinements = prm.get_integer("number_of_mesh_refinements");
453  use_gmsh_mesh = prm.get_bool("use_gmsh_mesh");
454  mesh_reader_verbose_output = prm.get_bool("mesh_reader_verbose_output");
455 
456  prm.enter_subsection("gmsh_boundary_IDs");
457  {
458  use_periodic_BC_in_x = prm.get_bool("use_periodic_BC_in_x");
459  use_periodic_BC_in_y = prm.get_bool("use_periodic_BC_in_y");
460  use_periodic_BC_in_z = prm.get_bool("use_periodic_BC_in_z");
461  x_periodic_id_face_1 = prm.get_integer("x_periodic_id_face_1");
462  x_periodic_id_face_2 = prm.get_integer("x_periodic_id_face_2");
463  y_periodic_id_face_1 = prm.get_integer("y_periodic_id_face_1");
464  y_periodic_id_face_2 = prm.get_integer("y_periodic_id_face_2");
465  z_periodic_id_face_1 = prm.get_integer("z_periodic_id_face_1");
466  z_periodic_id_face_2 = prm.get_integer("z_periodic_id_face_2");
467  }
468  prm.leave_subsection();
469 
470  prm.enter_subsection("gaussian_bump");
471  {
472  number_of_subdivisions_in_x_direction = prm.get_integer("number_of_subdivisions_in_x_direction");
473  number_of_subdivisions_in_y_direction = prm.get_integer("number_of_subdivisions_in_y_direction");
474  number_of_subdivisions_in_z_direction = prm.get_integer("number_of_subdivisions_in_z_direction");
475  channel_length = prm.get_double("channel_length");
476  channel_height = prm.get_double("channel_height");
477  bump_height = prm.get_double("bump_height");
478  }
479  prm.leave_subsection();
480 
481  prm.enter_subsection("grid_rectangle");
482  {
483  grid_top_bound = prm.get_double("grid_top_bound");
484  grid_bottom_bound = prm.get_double("grid_bottom_bound");
485  grid_z_upper_bound = prm.get_double("grid_z_upper_bound");
486  grid_z_lower_bound = prm.get_double("grid_z_lower_bound");
487 
488  number_of_grid_elements_x = prm.get_integer("number_of_grid_elements_x");
489  number_of_grid_elements_y = prm.get_integer("number_of_grid_elements_y");
490  number_of_grid_elements_z = prm.get_integer("number_of_grid_elements_z");
491  }
492  prm.leave_subsection();
493  }
494  prm.leave_subsection();
495 
496 
497  prm.enter_subsection("taylor_green_vortex");
498  {
499  expected_kinetic_energy_at_final_time = prm.get_double("expected_kinetic_energy_at_final_time");
500  expected_theoretical_dissipation_rate_at_final_time = prm.get_double("expected_theoretical_dissipation_rate_at_final_time");
501 
502  const std::string density_initial_condition_type_string = prm.get("density_initial_condition_type");
503  if (density_initial_condition_type_string == "uniform") {density_initial_condition_type = uniform;}
504  else if (density_initial_condition_type_string == "isothermal") {density_initial_condition_type = isothermal;}
505  do_calculate_numerical_entropy = prm.get_bool("do_calculate_numerical_entropy");
506  }
507  prm.leave_subsection();
508 
509  prm.enter_subsection("kelvin_helmholtz_instability");
510  {
511  atwood_number = prm.get_double("atwood_number");
512  }
513  prm.leave_subsection();
514 
515  prm.enter_subsection("ESFR_parameter_tests");
516  {
517  number_ESFR_parameter_values = prm.get_integer("number_ESFR_parameter_values");
518  ESFR_parameter_values_start = prm.get_double("ESFR_parameter_values_start");
519  ESFR_parameter_values_end = prm.get_double("ESFR_parameter_values_end");
520  }
521  prm.leave_subsection();
522 
523  const std::string apply_initial_condition_method_string = prm.get("apply_initial_condition_method");
524  if (apply_initial_condition_method_string == "interpolate_initial_condition_function") {apply_initial_condition_method = interpolate_initial_condition_function;}
525  else if (apply_initial_condition_method_string == "project_initial_condition_function") {apply_initial_condition_method = project_initial_condition_function;}
526  else if (apply_initial_condition_method_string == "read_values_from_file_and_project") {apply_initial_condition_method = read_values_from_file_and_project;}
527 
528  input_flow_setup_filename_prefix = prm.get("input_flow_setup_filename_prefix");
529 
530  prm.enter_subsection("output_velocity_field");
531  {
532  output_velocity_field_at_fixed_times = prm.get_bool("output_velocity_field_at_fixed_times");
533  output_velocity_field_times_string = prm.get("output_velocity_field_times_string");
535  output_vorticity_magnitude_field_in_addition_to_velocity = prm.get_bool("output_vorticity_magnitude_field_in_addition_to_velocity");
536  output_flow_field_files_directory_name = prm.get("output_flow_field_files_directory_name");
537  // Check if directory exists - see https://stackoverflow.com/a/18101042
538  struct stat info_flow;
539  if( stat( output_flow_field_files_directory_name.c_str(), &info_flow ) != 0 ){
540  pcout << "Error: No flow field files directory named " << output_flow_field_files_directory_name << " exists." << std::endl
541  << "Please create the directory and restart. Aborting..." << std::endl;
542  std::abort();
543  }
544  }
545  prm.leave_subsection();
546 
547  end_exactly_at_final_time = prm.get_bool("end_exactly_at_final_time");
548  }
549  prm.leave_subsection();
550 }
551 
552 } // Parameters namespace
553 } // PHiLiP namespace
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.
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.
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.
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.
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 grid_z_lower_bound
Minimum z bound of domain for a rectangle grid.
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.
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 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.
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.
bool use_periodic_BC_in_y
Flag for using periodic boundary conditions in the y-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
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.
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.
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.