[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.declare_entry("apply_initial_condition_method", "interpolate_initial_condition_function",
320  dealii::Patterns::Selection(
321  " interpolate_initial_condition_function | "
322  " project_initial_condition_function | "
323  " read_values_from_file_and_project "),
324  "The method used for applying the initial condition. "
325  "Choices are "
326  " <interpolate_initial_condition_function | "
327  " project_initial_condition_function | "
328  " read_values_from_file_and_project>.");
329 
330  prm.declare_entry("input_flow_setup_filename_prefix", "setup",
331  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
332  "Filename prefix of the input flow setup file. "
333  "Example: 'setup' for files named setup-0000i.dat, where i is the MPI rank. "
334  "For initializing the flow with values from a file. "
335  "To be set when apply_initial_condition_method is read_values_from_file_and_project.");
336 
337  prm.enter_subsection("output_velocity_field");
338  {
339  prm.declare_entry("output_velocity_field_at_fixed_times", "false",
340  dealii::Patterns::Bool(),
341  "Output velocity field (at equidistant nodes) at fixed times. False by default.");
342 
343  prm.declare_entry("output_velocity_field_times_string", " ",
344  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
345  "String of the times at which to output the velocity field. "
346  "Example: '0.0 1.0 2.0 3.0 ' or '0.0 1.0 2.0 3.0'");
347 
348  prm.declare_entry("output_vorticity_magnitude_field_in_addition_to_velocity", "false",
349  dealii::Patterns::Bool(),
350  "Output vorticity magnitude field in addition to velocity field. False by default.");
351 
352  prm.declare_entry("output_flow_field_files_directory_name", ".",
353  dealii::Patterns::FileName(dealii::Patterns::FileName::FileType::input),
354  "Name of directory for writing flow field files. Current directory by default.");
355  }
356  prm.leave_subsection();
357 
358  prm.declare_entry("end_exactly_at_final_time", "true",
359  dealii::Patterns::Bool(),
360  "Flag to adjust the last timestep such that the simulation "
361  "ends exactly at final_time. True by default.");
362  }
363  prm.leave_subsection();
364 }
365 
366 void FlowSolverParam::parse_parameters(dealii::ParameterHandler &prm)
367 {
368  const int mpi_rank = dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
369  dealii::ConditionalOStream pcout(std::cout, mpi_rank==0);
370  prm.enter_subsection("flow_solver");
371  {
372  const std::string flow_case_type_string = prm.get("flow_case_type");
373  if (flow_case_type_string == "taylor_green_vortex") {flow_case_type = taylor_green_vortex;}
374  else if (flow_case_type_string == "decaying_homogeneous_isotropic_turbulence")
375  {flow_case_type = decaying_homogeneous_isotropic_turbulence;}
376  else if (flow_case_type_string == "burgers_viscous_snapshot") {flow_case_type = burgers_viscous_snapshot;}
377  else if (flow_case_type_string == "burgers_rewienski_snapshot") {flow_case_type = burgers_rewienski_snapshot;}
378  else if (flow_case_type_string == "naca0012") {flow_case_type = naca0012;}
379  else if (flow_case_type_string == "burgers_inviscid") {flow_case_type = burgers_inviscid;}
380  else if (flow_case_type_string == "convection_diffusion") {flow_case_type = convection_diffusion;}
381  else if (flow_case_type_string == "advection") {flow_case_type = advection;}
382  else if (flow_case_type_string == "periodic_1D_unsteady") {flow_case_type = periodic_1D_unsteady;}
383  else if (flow_case_type_string == "gaussian_bump") {flow_case_type = gaussian_bump;}
384  else if (flow_case_type_string == "isentropic_vortex") {flow_case_type = isentropic_vortex;}
385  else if (flow_case_type_string == "kelvin_helmholtz_instability")
386  {flow_case_type = kelvin_helmholtz_instability;}
387  else if (flow_case_type_string == "non_periodic_cube_flow") {flow_case_type = non_periodic_cube_flow;}
388  // Positivity Preserving Tests
389  else if (flow_case_type_string == "sod_shock_tube") {flow_case_type = sod_shock_tube;}
390  else if (flow_case_type_string == "low_density") {flow_case_type = low_density;}
391  else if (flow_case_type_string == "leblanc_shock_tube") {flow_case_type = leblanc_shock_tube;}
392  else if (flow_case_type_string == "shu_osher_problem") {flow_case_type = shu_osher_problem;}
393  else if (flow_case_type_string == "advection_limiter") {flow_case_type = advection_limiter;}
394  else if (flow_case_type_string == "burgers_limiter") {flow_case_type = burgers_limiter;}
395  else if (flow_case_type_string == "double_mach_reflection") {flow_case_type = double_mach_reflection;}
396  else if (flow_case_type_string == "shock_diffraction") {flow_case_type = shock_diffraction;}
397  else if (flow_case_type_string == "astrophysical_jet") {flow_case_type = astrophysical_jet;}
398  else if (flow_case_type_string == "strong_vortex_shock_wave") {flow_case_type = strong_vortex_shock_wave;}
399 
400  poly_degree = prm.get_integer("poly_degree");
401 
402  // get max poly degree for adaptation
403  max_poly_degree_for_adaptation = prm.get_integer("max_poly_degree_for_adaptation");
404  // -- set value to poly_degree if it is the default value
406  final_time = prm.get_double("final_time");
407  constant_time_step = prm.get_double("constant_time_step");
408  courant_friedrichs_lewy_number = prm.get_double("courant_friedrichs_lewy_number");
409  unsteady_data_table_filename = prm.get("unsteady_data_table_filename");
410  steady_state = prm.get_bool("steady_state");
411  steady_state_polynomial_ramping = prm.get_bool("steady_state_polynomial_ramping");
412  error_adaptive_time_step = prm.get_bool("error_adaptive_time_step");
413  adaptive_time_step = prm.get_bool("adaptive_time_step");
414  sensitivity_table_filename = prm.get("sensitivity_table_filename");
415  restart_computation_from_file = prm.get_bool("restart_computation_from_file");
416  output_restart_files = prm.get_bool("output_restart_files");
417  restart_files_directory_name = prm.get("restart_files_directory_name");
418  // Check if directory exists - see https://stackoverflow.com/a/18101042
419  struct stat info_restart;
420  if( stat( restart_files_directory_name.c_str(), &info_restart ) != 0 ){
421  pcout << "Error: No restart files directory named " << restart_files_directory_name << " exists." << std::endl
422  << "Please create the directory and restart. Aborting..." << std::endl;
423  std::abort();
424  }
425  restart_file_index = prm.get_integer("restart_file_index");
426  output_restart_files_every_x_steps = prm.get_integer("output_restart_files_every_x_steps");
427  output_restart_files_every_dt_time_intervals = prm.get_double("output_restart_files_every_dt_time_intervals");
428  expected_order_at_final_time = prm.get_double("expected_order_at_final_time");
429 
430  prm.enter_subsection("grid");
431  {
432  input_mesh_filename = prm.get("input_mesh_filename");
433  grid_degree = prm.get_integer("grid_degree");
434  grid_left_bound = prm.get_double("grid_left_bound");
435  grid_right_bound = prm.get_double("grid_right_bound");
436  number_of_grid_elements_per_dimension = prm.get_integer("number_of_grid_elements_per_dimension");
437  number_of_mesh_refinements = prm.get_integer("number_of_mesh_refinements");
438  use_gmsh_mesh = prm.get_bool("use_gmsh_mesh");
439  mesh_reader_verbose_output = prm.get_bool("mesh_reader_verbose_output");
440 
441  prm.enter_subsection("gmsh_boundary_IDs");
442  {
443  use_periodic_BC_in_x = prm.get_bool("use_periodic_BC_in_x");
444  use_periodic_BC_in_y = prm.get_bool("use_periodic_BC_in_y");
445  use_periodic_BC_in_z = prm.get_bool("use_periodic_BC_in_z");
446  x_periodic_id_face_1 = prm.get_integer("x_periodic_id_face_1");
447  x_periodic_id_face_2 = prm.get_integer("x_periodic_id_face_2");
448  y_periodic_id_face_1 = prm.get_integer("y_periodic_id_face_1");
449  y_periodic_id_face_2 = prm.get_integer("y_periodic_id_face_2");
450  z_periodic_id_face_1 = prm.get_integer("z_periodic_id_face_1");
451  z_periodic_id_face_2 = prm.get_integer("z_periodic_id_face_2");
452  }
453  prm.leave_subsection();
454 
455  prm.enter_subsection("gaussian_bump");
456  {
457  number_of_subdivisions_in_x_direction = prm.get_integer("number_of_subdivisions_in_x_direction");
458  number_of_subdivisions_in_y_direction = prm.get_integer("number_of_subdivisions_in_y_direction");
459  number_of_subdivisions_in_z_direction = prm.get_integer("number_of_subdivisions_in_z_direction");
460  channel_length = prm.get_double("channel_length");
461  channel_height = prm.get_double("channel_height");
462  bump_height = prm.get_double("bump_height");
463  }
464  prm.leave_subsection();
465 
466  prm.enter_subsection("grid_rectangle");
467  {
468  grid_top_bound = prm.get_double("grid_top_bound");
469  grid_bottom_bound = prm.get_double("grid_bottom_bound");
470  grid_z_upper_bound = prm.get_double("grid_z_upper_bound");
471  grid_z_lower_bound = prm.get_double("grid_z_lower_bound");
472 
473  number_of_grid_elements_x = prm.get_integer("number_of_grid_elements_x");
474  number_of_grid_elements_y = prm.get_integer("number_of_grid_elements_y");
475  number_of_grid_elements_z = prm.get_integer("number_of_grid_elements_z");
476  }
477  prm.leave_subsection();
478  }
479  prm.leave_subsection();
480 
481 
482  prm.enter_subsection("taylor_green_vortex");
483  {
484  expected_kinetic_energy_at_final_time = prm.get_double("expected_kinetic_energy_at_final_time");
485  expected_theoretical_dissipation_rate_at_final_time = prm.get_double("expected_theoretical_dissipation_rate_at_final_time");
486 
487  const std::string density_initial_condition_type_string = prm.get("density_initial_condition_type");
488  if (density_initial_condition_type_string == "uniform") {density_initial_condition_type = uniform;}
489  else if (density_initial_condition_type_string == "isothermal") {density_initial_condition_type = isothermal;}
490  do_calculate_numerical_entropy = prm.get_bool("do_calculate_numerical_entropy");
491  }
492  prm.leave_subsection();
493 
494  prm.enter_subsection("kelvin_helmholtz_instability");
495  {
496  atwood_number = prm.get_double("atwood_number");
497  }
498  prm.leave_subsection();
499 
500  const std::string apply_initial_condition_method_string = prm.get("apply_initial_condition_method");
501  if (apply_initial_condition_method_string == "interpolate_initial_condition_function") {apply_initial_condition_method = interpolate_initial_condition_function;}
502  else if (apply_initial_condition_method_string == "project_initial_condition_function") {apply_initial_condition_method = project_initial_condition_function;}
503  else if (apply_initial_condition_method_string == "read_values_from_file_and_project") {apply_initial_condition_method = read_values_from_file_and_project;}
504 
505  input_flow_setup_filename_prefix = prm.get("input_flow_setup_filename_prefix");
506 
507  prm.enter_subsection("output_velocity_field");
508  {
509  output_velocity_field_at_fixed_times = prm.get_bool("output_velocity_field_at_fixed_times");
510  output_velocity_field_times_string = prm.get("output_velocity_field_times_string");
512  output_vorticity_magnitude_field_in_addition_to_velocity = prm.get_bool("output_vorticity_magnitude_field_in_addition_to_velocity");
513  output_flow_field_files_directory_name = prm.get("output_flow_field_files_directory_name");
514  // Check if directory exists - see https://stackoverflow.com/a/18101042
515  struct stat info_flow;
516  if( stat( output_flow_field_files_directory_name.c_str(), &info_flow ) != 0 ){
517  pcout << "Error: No flow field files directory named " << output_flow_field_files_directory_name << " exists." << std::endl
518  << "Please create the directory and restart. Aborting..." << std::endl;
519  std::abort();
520  }
521  }
522  prm.leave_subsection();
523 
524  end_exactly_at_final_time = prm.get_bool("end_exactly_at_final_time");
525  }
526  prm.leave_subsection();
527 }
528 
529 } // Parameters namespace
530 } // 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.
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 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.
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.