libMesh
femparameters.C
Go to the documentation of this file.
1 
2 #include "femparameters.h"
3 
4 #include "libmesh/parsed_function.h"
5 #include "libmesh/zero_function.h"
6 
7 #include <memory>
8 #include <unordered_set>
9 
10 using namespace libMesh;
11 
12 #define GETPOT_INPUT(A) { A = input(#A, A); \
13  variable_names.insert(#A); \
14  const std::string stringval = input(#A, std::string()); \
15  variable_assignments.push_back(std::string(#A "=") + stringval); }
16 #define GETPOT_INT_INPUT(A) { A = input(#A, (int)A); \
17  variable_names.insert(#A); \
18  const std::string stringval = input(#A, std::string()); \
19  variable_assignments.push_back(std::string(#A "=") + stringval); }
20 
21 #define GETPOT_REGISTER(A) { \
22  variable_names.insert(#A); \
23  std::string stringval = input(#A, std::string()); \
24  variable_assignments.push_back(std::string(#A "=") + stringval); }
25 
27  ParallelObject(comm_in),
28  initial_timestep(0), n_timesteps(100),
29  transient(true),
30  deltat_reductions(0),
31  timesolver_core("euler"),
32  solution_history_type("memory"),
33  end_time(std::numeric_limits<Real>::max()),
34  deltat(0.0001), timesolver_theta(0.5),
35  timesolver_maxgrowth(0.), timesolver_tolerance(0.),
36  timesolver_upper_tolerance(0.),
37  steadystate_tolerance(0.),
38  timesolver_norm(0, L2),
39 
40  dimension(2),
41  domaintype("square"), domainfile("mesh.xda"), elementtype("quad"),
42  elementorder(2),
43  domain_xmin(0.0), domain_ymin(0.0), domain_zmin(0.0),
44  domain_edge_width(1.0), domain_edge_length(1.0), domain_edge_height(1.0),
45  coarsegridx(1), coarsegridy(1), coarsegridz(1),
46  coarserefinements(0), extrarefinements(0),
47  mesh_redistribute_func("0"),
48 
49  mesh_partitioner_type("Default"),
50 
51  nelem_target(8000), global_tolerance(0.0),
52  refine_fraction(0.3), coarsen_fraction(0.3), coarsen_threshold(10),
53  max_adaptivesteps(1),
54  initial_adaptivesteps(0),
55 
56  write_interval(10),
57  write_gmv_error(false), write_tecplot_error(false),
58  write_exodus_error(false),
59  output_xda(false), output_xdr(false),
60  output_bz2(true), output_gz(true),
61  output_gmv(false), output_tecplot(false),
62  output_exodus(false), output_nemesis(false),
63 
64  system_types(0),
65 
66 #ifdef LIBMESH_ENABLE_PERIODIC
67  periodic_boundaries(0),
68 #endif
69 
70  run_simulation(true), run_postprocess(false),
71 
72  fe_family(1, "LAGRANGE"), fe_order(1, 1),
73  extra_quadrature_order(0),
74 
75  analytic_jacobians(true), verify_analytic_jacobians(0.0),
76  numerical_jacobian_h(TOLERANCE),
77  print_solution_norms(false), print_solutions(false),
78  print_residual_norms(false), print_residuals(false),
79  print_jacobian_norms(false), print_jacobians(false),
80  print_element_solutions(false),
81  print_element_residuals(false),
82  print_element_jacobians(false),
83 
84  constrain_in_solver(true),
85  use_petsc_snes(false),
86  time_solver_quiet(true), solver_quiet(true), solver_verbose(false),
87  reuse_preconditioner(true),
88  require_residual_reduction(true),
89  min_step_length(1e-5),
90  max_linear_iterations(200000), max_nonlinear_iterations(20),
91  relative_step_tolerance(1.e-7), relative_residual_tolerance(1.e-10),
92  absolute_residual_tolerance(1.e-10),
93  initial_linear_tolerance(1.e-3), minimum_linear_tolerance(TOLERANCE*TOLERANCE),
94  linear_tolerance_multiplier(1.e-3),
95 
96  initial_sobolev_order(1),
97  initial_extra_quadrature(0),
98  refine_uniformly(false),
99  indicator_type("kelly"), patch_reuse(true), sobolev_order(1)
100 {
101 }
102 
104 {
105  for (std::map<subdomain_id_type, FunctionBase<Number> *>::iterator
106  i = initial_conditions.begin(); i != initial_conditions.end();
107  ++i)
108  delete i->second;
109 
110  for (std::map<boundary_id_type, FunctionBase<Number> *>::iterator
111  i = dirichlet_conditions.begin(); i != dirichlet_conditions.end();
112  ++i)
113  delete i->second;
114 
115  for (std::map<boundary_id_type, FunctionBase<Number> *>::iterator
116  i = neumann_conditions.begin(); i != neumann_conditions.end();
117  ++i)
118  delete i->second;
119 
120  for (std::map<int,
122  >::iterator
123  i = other_boundary_functions.begin(); i != other_boundary_functions.end();
124  ++i)
125  for (std::map<boundary_id_type, FunctionBase<Number> *>::iterator
126  j = i->second.begin(); j != i->second.end();
127  ++j)
128  delete j->second;
129 
130  for (std::map<int,
132  >::iterator
133  i = other_interior_functions.begin(); i != other_interior_functions.end();
134  ++i)
135  for (std::map<subdomain_id_type, FunctionBase<Number> *>::iterator
136  j = i->second.begin(); j != i->second.end();
137  ++j)
138  delete j->second;
139 }
140 
141 
142 std::unique_ptr<FunctionBase<Number>> new_function_base(const std::string & func_type,
143  const std::string & func_value)
144 {
145  if (func_type == "parsed")
146  return std::make_unique<ParsedFunction<Number>>(func_value);
147  else if (func_type == "zero")
148  return std::make_unique<ZeroFunction<Number>>();
149  else
150  libmesh_not_implemented();
151 
152  return std::unique_ptr<FunctionBase<Number>>();
153 }
154 
155 
156 void FEMParameters::read(GetPot & input,
157  const std::vector<std::string> * other_variable_names)
158 {
159  std::vector<std::string> variable_assignments;
160  std::unordered_set<std::string> variable_names;
161  if (other_variable_names)
162  for (std::size_t i=0; i != other_variable_names->size(); ++i)
163  {
164  const std::string & name = (*other_variable_names)[i];
165  const std::string stringval = input(name, std::string());
166  variable_assignments.push_back(name + "=" + stringval);
167  }
168 
169  GETPOT_INT_INPUT(initial_timestep);
170  GETPOT_INT_INPUT(n_timesteps);
171  GETPOT_INPUT(transient);
172  GETPOT_INT_INPUT(deltat_reductions);
173  GETPOT_INPUT(timesolver_core);
174  GETPOT_INPUT(solution_history_type);
175  GETPOT_INPUT(end_time);
176  GETPOT_INPUT(deltat);
177  GETPOT_INPUT(timesolver_theta);
178  GETPOT_INPUT(timesolver_maxgrowth);
179  GETPOT_INPUT(timesolver_tolerance);
180  GETPOT_INPUT(timesolver_upper_tolerance);
181  GETPOT_INPUT(steadystate_tolerance);
182 
183  GETPOT_REGISTER(timesolver_norm);
184  const unsigned int n_timesolver_norm = input.vector_variable_size("timesolver_norm");
185  timesolver_norm.resize(n_timesolver_norm, L2);
186  for (unsigned int i=0; i != n_timesolver_norm; ++i)
187  {
188  int current_norm = 0; // L2
189  if (timesolver_norm[i] == H1)
190  current_norm = 1;
191  if (timesolver_norm[i] == H2)
192  current_norm = 2;
193  current_norm = input("timesolver_norm", current_norm, i);
194  if (current_norm == 0)
195  timesolver_norm[i] = L2;
196  else if (current_norm == 1)
197  timesolver_norm[i] = H1;
198  else if (current_norm == 2)
199  timesolver_norm[i] = H2;
200  else
202  }
203 
204 
205  GETPOT_INT_INPUT(dimension);
206  GETPOT_INPUT(domaintype);
207  GETPOT_INPUT(domainfile);
208  GETPOT_INPUT(elementtype);
209  GETPOT_INPUT(elementorder);
210  GETPOT_INPUT(domain_xmin);
211  GETPOT_INPUT(domain_ymin);
212  GETPOT_INPUT(domain_zmin);
213  GETPOT_INPUT(domain_edge_width);
214  GETPOT_INPUT(domain_edge_length);
215  GETPOT_INPUT(domain_edge_height);
216  GETPOT_INT_INPUT(coarsegridx);
217  GETPOT_INT_INPUT(coarsegridy);
218  GETPOT_INT_INPUT(coarsegridz);
219  GETPOT_INT_INPUT(coarserefinements);
220  GETPOT_INT_INPUT(extrarefinements);
221  GETPOT_INPUT(mesh_redistribute_func);
222 
223 
224  GETPOT_INPUT(mesh_partitioner_type);
225 
226 
227  GETPOT_INT_INPUT(nelem_target);
228  GETPOT_INPUT(global_tolerance);
229  GETPOT_INPUT(refine_fraction);
230  GETPOT_INPUT(coarsen_fraction);
231  GETPOT_INPUT(coarsen_threshold);
232  GETPOT_INT_INPUT(max_adaptivesteps);
233  GETPOT_INT_INPUT(initial_adaptivesteps);
234 
235 
236  GETPOT_INT_INPUT(write_interval);
237  GETPOT_INPUT(output_xda);
238  GETPOT_INPUT(output_xdr);
239  GETPOT_INPUT(output_gz);
240 #ifndef LIBMESH_HAVE_GZSTREAM
241  output_gz = false;
242 #endif
243  GETPOT_INPUT(output_bz2);
244 #ifndef LIBMESH_HAVE_BZ2
245  output_bz2 = false;
246 #endif
247  GETPOT_INPUT(output_gmv);
248  GETPOT_INPUT(write_gmv_error);
249 #ifndef LIBMESH_HAVE_GMV
250  output_gmv = false;
251  write_gmv_error = false;
252 #endif
253  GETPOT_INPUT(output_tecplot);
254  GETPOT_INPUT(write_tecplot_error);
255 #ifndef LIBMESH_HAVE_TECPLOT_API
256  output_tecplot = false;
257  write_tecplot_error = false;
258 #endif
259  GETPOT_INPUT(output_exodus);
260  GETPOT_INPUT(write_exodus_error);
261 #ifndef LIBMESH_HAVE_EXODUS_API
262  output_exodus = false;
263  write_exodus_error = false;
264 #endif
265  GETPOT_INPUT(output_nemesis);
266 #ifndef LIBMESH_HAVE_NEMESIS_API
267  output_nemesis = false;
268 #endif
269 
270 
271  GETPOT_REGISTER(system_types);
272  const unsigned int n_system_types =
273  input.vector_variable_size("system_types");
274  if (n_system_types)
275  {
276  system_types.resize(n_system_types, "");
277  for (unsigned int i=0; i != n_system_types; ++i)
278  {
279  system_types[i] = input("system_types", system_types[i], i);
280  }
281  }
282 
283 
284 #ifdef LIBMESH_ENABLE_PERIODIC
285  GETPOT_REGISTER(periodic_boundaries);
286  const unsigned int n_periodic_bcs =
287  input.vector_variable_size("periodic_boundaries");
288 
289  if (n_periodic_bcs)
290  {
291  if (domaintype != "square" &&
292  domaintype != "cylinder" &&
293  domaintype != "file" &&
294  domaintype != "od2")
295  {
296  libMesh::out << "Periodic boundaries need rectilinear domains" << std::endl;;
297  libmesh_error();
298  }
299  for (unsigned int i=0; i != n_periodic_bcs; ++i)
300  {
301  const unsigned int myboundary =
302  input("periodic_boundaries", -1, i);
303  boundary_id_type pairedboundary = 0;
304  RealVectorValue translation_vector;
305  if (dimension == 2)
306  switch (myboundary)
307  {
308  case 0:
309  pairedboundary = 2;
310  translation_vector = RealVectorValue(0., domain_edge_length);
311  break;
312  case 1:
313  pairedboundary = 3;
314  translation_vector = RealVectorValue(-domain_edge_width, 0);
315  break;
316  default:
317  libMesh::out << "Unrecognized periodic boundary id " <<
318  myboundary << std::endl;;
319  libmesh_error();
320  }
321  else if (dimension == 3)
322  switch (myboundary)
323  {
324  case 0:
325  pairedboundary = 5;
326  translation_vector = RealVectorValue(Real(0), Real(0), domain_edge_height);
327  break;
328  case 1:
329  pairedboundary = 3;
330  translation_vector = RealVectorValue(Real(0), domain_edge_length, Real(0));
331  break;
332  case 2:
333  pairedboundary = 4;
334  translation_vector = RealVectorValue(-domain_edge_width, Real(0), Real(0));
335  break;
336  default:
337  libMesh::out << "Unrecognized periodic boundary id " <<
338  myboundary << std::endl;;
339  libmesh_error();
340  }
341  periodic_boundaries.push_back(PeriodicBoundary(translation_vector));
342  periodic_boundaries[i].myboundary = cast_int<boundary_id_type>(myboundary);
343  periodic_boundaries[i].pairedboundary = pairedboundary;
344  }
345  }
346 #endif // LIBMESH_ENABLE_PERIODIC
347 
348  // Use std::string inputs so GetPot doesn't have to make a bunch
349  // of internal C string copies
350  std::string zero_string = "zero";
351  std::string empty_string = "";
352 
353  GETPOT_REGISTER(dirichlet_condition_types);
354  GETPOT_REGISTER(dirichlet_condition_values);
355  GETPOT_REGISTER(dirichlet_condition_boundaries);
356  GETPOT_REGISTER(dirichlet_condition_variables);
357 
358  const unsigned int n_dirichlet_conditions=
359  input.vector_variable_size("dirichlet_condition_types");
360 
361  if (n_dirichlet_conditions !=
362  input.vector_variable_size("dirichlet_condition_values"))
363  {
364  libMesh::out << "Error: " << n_dirichlet_conditions
365  << " Dirichlet condition types does not match "
366  << input.vector_variable_size("dirichlet_condition_values")
367  << " Dirichlet condition values." << std::endl;
368 
369  libmesh_error();
370  }
371 
372  if (n_dirichlet_conditions !=
373  input.vector_variable_size("dirichlet_condition_boundaries"))
374  {
375  libMesh::out << "Error: " << n_dirichlet_conditions
376  << " Dirichlet condition types does not match "
377  << input.vector_variable_size("dirichlet_condition_boundaries")
378  << " Dirichlet condition boundaries." << std::endl;
379 
380  libmesh_error();
381  }
382 
383  if (n_dirichlet_conditions !=
384  input.vector_variable_size("dirichlet_condition_variables"))
385  {
386  libMesh::out << "Error: " << n_dirichlet_conditions
387  << " Dirichlet condition types does not match "
388  << input.vector_variable_size("dirichlet_condition_variables")
389  << " Dirichlet condition variables sets." << std::endl;
390 
391  libmesh_error();
392  }
393 
394  for (unsigned int dc=0; dc != n_dirichlet_conditions; ++dc)
395  {
396  const std::string func_type =
397  input("dirichlet_condition_types", zero_string, dc);
398 
399  const std::string func_value =
400  input("dirichlet_condition_values", empty_string, dc);
401 
402  const boundary_id_type func_boundary =
403  input("dirichlet_condition_boundaries", boundary_id_type(0), dc);
404 
405  dirichlet_conditions[func_boundary] =
406  (new_function_base(func_type, func_value).release());
407 
408  const std::string variable_set =
409  input("dirichlet_condition_variables", empty_string, dc);
410 
411  for (unsigned int i=0; i != variable_set.size(); ++i)
412  {
413  if (variable_set[i] == '1')
414  dirichlet_condition_variables[func_boundary].push_back(i);
415  else if (variable_set[i] != '0')
416  {
417  libMesh::out << "Unable to understand Dirichlet variable set"
418  << variable_set << std::endl;
419  libmesh_error();
420  }
421  }
422  }
423 
424  GETPOT_REGISTER(neumann_condition_types);
425  GETPOT_REGISTER(neumann_condition_values);
426  GETPOT_REGISTER(neumann_condition_boundaries);
427  GETPOT_REGISTER(neumann_condition_variables);
428 
429  const unsigned int n_neumann_conditions=
430  input.vector_variable_size("neumann_condition_types");
431 
432  if (n_neumann_conditions !=
433  input.vector_variable_size("neumann_condition_values"))
434  {
435  libMesh::out << "Error: " << n_neumann_conditions
436  << " Neumann condition types does not match "
437  << input.vector_variable_size("neumann_condition_values")
438  << " Neumann condition values." << std::endl;
439 
440  libmesh_error();
441  }
442 
443  if (n_neumann_conditions !=
444  input.vector_variable_size("neumann_condition_boundaries"))
445  {
446  libMesh::out << "Error: " << n_neumann_conditions
447  << " Neumann condition types does not match "
448  << input.vector_variable_size("neumann_condition_boundaries")
449  << " Neumann condition boundaries." << std::endl;
450 
451  libmesh_error();
452  }
453 
454  if (n_neumann_conditions !=
455  input.vector_variable_size("neumann_condition_variables"))
456  {
457  libMesh::out << "Error: " << n_neumann_conditions
458  << " Neumann condition types does not match "
459  << input.vector_variable_size("neumann_condition_variables")
460  << " Neumann condition variables sets." << std::endl;
461 
462  libmesh_error();
463  }
464 
465  for (unsigned int nc=0; nc != n_neumann_conditions; ++nc)
466  {
467  const std::string func_type =
468  input("neumann_condition_types", zero_string, nc);
469 
470  const std::string func_value =
471  input("neumann_condition_values", empty_string, nc);
472 
473  const boundary_id_type func_boundary =
474  input("neumann_condition_boundaries", boundary_id_type(0), nc);
475 
476  neumann_conditions[func_boundary] =
477  (new_function_base(func_type, func_value).release());
478 
479  const std::string variable_set =
480  input("neumann_condition_variables", empty_string, nc);
481 
482  for (unsigned int i=0; i != variable_set.size(); ++i)
483  {
484  if (variable_set[i] == '1')
485  neumann_condition_variables[func_boundary].push_back(i);
486  else if (variable_set[i] != '0')
487  {
488  libMesh::out << "Unable to understand Neumann variable set"
489  << variable_set << std::endl;
490  libmesh_error();
491  }
492  }
493  }
494 
495  GETPOT_REGISTER(initial_condition_types);
496  GETPOT_REGISTER(initial_condition_values);
497  GETPOT_REGISTER(initial_condition_subdomains);
498 
499  const unsigned int n_initial_conditions=
500  input.vector_variable_size("initial_condition_types");
501 
502  if (n_initial_conditions !=
503  input.vector_variable_size("initial_condition_values"))
504  {
505  libMesh::out << "Error: " << n_initial_conditions
506  << " initial condition types does not match "
507  << input.vector_variable_size("initial_condition_values")
508  << " initial condition values." << std::endl;
509 
510  libmesh_error();
511  }
512 
513  if (n_initial_conditions !=
514  input.vector_variable_size("initial_condition_subdomains"))
515  {
516  libMesh::out << "Error: " << n_initial_conditions
517  << " initial condition types does not match "
518  << input.vector_variable_size("initial_condition_subdomains")
519  << " initial condition subdomains." << std::endl;
520 
521  libmesh_error();
522  }
523 
524  for (unsigned int i=0; i != n_initial_conditions; ++i)
525  {
526  const std::string func_type =
527  input("initial_condition_types", zero_string, i);
528 
529  const std::string func_value =
530  input("initial_condition_values", empty_string, i);
531 
532  const subdomain_id_type func_subdomain =
533  input("initial_condition_subdomains", subdomain_id_type(0), i);
534 
535  initial_conditions[func_subdomain] =
536  (new_function_base(func_type, func_value).release());
537  }
538 
539  GETPOT_REGISTER(other_interior_function_types);
540  GETPOT_REGISTER(other_interior_function_values);
541  GETPOT_REGISTER(other_interior_function_subdomains);
542  GETPOT_REGISTER(other_interior_function_ids);
543 
544  const unsigned int n_other_interior_functions =
545  input.vector_variable_size("other_interior_function_types");
546 
547  if (n_other_interior_functions !=
548  input.vector_variable_size("other_interior_function_values"))
549  {
550  libMesh::out << "Error: " << n_other_interior_functions
551  << " other interior function types does not match "
552  << input.vector_variable_size("other_interior_function_values")
553  << " other interior function values." << std::endl;
554 
555  libmesh_error();
556  }
557 
558  if (n_other_interior_functions !=
559  input.vector_variable_size("other_interior_function_subdomains"))
560  {
561  libMesh::out << "Error: " << n_other_interior_functions
562  << " other interior function types does not match "
563  << input.vector_variable_size("other_interior_function_subdomains")
564  << " other interior function subdomains." << std::endl;
565 
566  libmesh_error();
567  }
568 
569  if (n_other_interior_functions !=
570  input.vector_variable_size("other_interior_function_ids"))
571  {
572  libMesh::out << "Error: " << n_other_interior_functions
573  << " other interior function types does not match "
574  << input.vector_variable_size("other_interior_function_ids")
575  << " other interior function ids." << std::endl;
576 
577  libmesh_error();
578  }
579 
580  for (unsigned int i=0; i != n_other_interior_functions; ++i)
581  {
582  const std::string func_type =
583  input("other_interior_function_types", zero_string, i);
584 
585  const std::string func_value =
586  input("other_interior_function_values", empty_string, i);
587 
588  const subdomain_id_type func_subdomain =
589  input("other_interior_condition_subdomains", subdomain_id_type(0), i);
590 
591  const int func_id =
592  input("other_interior_condition_ids", int(0), i);
593 
594  other_interior_functions[func_id][func_subdomain] =
595  (new_function_base(func_type, func_value).release());
596  }
597 
598  GETPOT_REGISTER(other_boundary_function_types);
599  GETPOT_REGISTER(other_boundary_function_values);
600  GETPOT_REGISTER(other_boundary_function_boundaries);
601  GETPOT_REGISTER(other_boundary_function_ids);
602 
603  const unsigned int n_other_boundary_functions =
604  input.vector_variable_size("other_boundary_function_types");
605 
606  if (n_other_boundary_functions !=
607  input.vector_variable_size("other_boundary_function_values"))
608  {
609  libMesh::out << "Error: " << n_other_boundary_functions
610  << " other boundary function types does not match "
611  << input.vector_variable_size("other_boundary_function_values")
612  << " other boundary function values." << std::endl;
613 
614  libmesh_error();
615  }
616 
617  if (n_other_boundary_functions !=
618  input.vector_variable_size("other_boundary_function_boundaries"))
619  {
620  libMesh::out << "Error: " << n_other_boundary_functions
621  << " other boundary function types does not match "
622  << input.vector_variable_size("other_boundary_function_boundaries")
623  << " other boundary function boundaries." << std::endl;
624 
625  libmesh_error();
626  }
627 
628  if (n_other_boundary_functions !=
629  input.vector_variable_size("other_boundary_function_ids"))
630  {
631  libMesh::out << "Error: " << n_other_boundary_functions
632  << " other boundary function types does not match "
633  << input.vector_variable_size("other_boundary_function_ids")
634  << " other boundary function ids." << std::endl;
635 
636  libmesh_error();
637  }
638 
639  for (unsigned int i=0; i != n_other_boundary_functions; ++i)
640  {
641  const std::string func_type =
642  input("other_boundary_function_types", zero_string, i);
643 
644  const std::string func_value =
645  input("other_boundary_function_values", empty_string, i);
646 
647  const boundary_id_type func_boundary =
648  input("other_boundary_function_boundaries", boundary_id_type(0), i);
649 
650  const int func_id =
651  input("other_boundary_function_ids", int(0), i);
652 
653  other_boundary_functions[func_id][func_boundary] =
654  (new_function_base(func_type, func_value).release());
655  }
656 
657  GETPOT_INPUT(run_simulation);
658  GETPOT_INPUT(run_postprocess);
659 
660 
661  GETPOT_REGISTER(fe_family);
662  const unsigned int n_fe_family =
663  std::max(1u, input.vector_variable_size("fe_family"));
664  fe_family.resize(n_fe_family, "LAGRANGE");
665  for (unsigned int i=0; i != n_fe_family; ++i)
666  fe_family[i] = input("fe_family", fe_family[i].c_str(), i);
667  GETPOT_REGISTER(fe_order);
668  const unsigned int n_fe_order =
669  input.vector_variable_size("fe_order");
670  fe_order.resize(n_fe_order, 1);
671  for (unsigned int i=0; i != n_fe_order; ++i)
672  fe_order[i] = input("fe_order", (int)fe_order[i], i);
673  GETPOT_INPUT(extra_quadrature_order);
674 
675 
676  GETPOT_INPUT(analytic_jacobians);
677  GETPOT_INPUT(verify_analytic_jacobians);
678  GETPOT_INPUT(numerical_jacobian_h);
679  GETPOT_INPUT(print_solution_norms);
680  GETPOT_INPUT(print_solutions);
681  GETPOT_INPUT(print_residual_norms);
682  GETPOT_INPUT(print_residuals);
683  GETPOT_INPUT(print_jacobian_norms);
684  GETPOT_INPUT(print_jacobians);
685  GETPOT_INPUT(print_element_solutions);
686  GETPOT_INPUT(print_element_residuals);
687  GETPOT_INPUT(print_element_jacobians);
688 
689 
690  GETPOT_INPUT(constrain_in_solver);
691  GETPOT_INPUT(use_petsc_snes);
692  GETPOT_INPUT(time_solver_quiet);
693  GETPOT_INPUT(solver_quiet);
694  GETPOT_INPUT(solver_verbose);
695  GETPOT_INPUT(reuse_preconditioner);
696  GETPOT_INPUT(require_residual_reduction);
697  GETPOT_INPUT(min_step_length);
698  GETPOT_INT_INPUT(max_linear_iterations);
699  GETPOT_INT_INPUT(max_nonlinear_iterations);
700  GETPOT_INPUT(relative_step_tolerance);
701  GETPOT_INPUT(relative_residual_tolerance);
702  GETPOT_INPUT(absolute_residual_tolerance);
703  GETPOT_INPUT(initial_linear_tolerance);
704  GETPOT_INPUT(minimum_linear_tolerance);
705  GETPOT_INPUT(linear_tolerance_multiplier);
706 
707 
708  GETPOT_INT_INPUT(initial_sobolev_order);
709  GETPOT_INT_INPUT(initial_extra_quadrature);
710  GETPOT_INPUT(refine_uniformly);
711  GETPOT_INPUT(indicator_type);
712  GETPOT_INPUT(patch_reuse);
713  GETPOT_INT_INPUT(sobolev_order);
714 
715  GETPOT_INPUT(system_config_file);
716 
717  std::vector<std::string> bad_variables =
718  input.unidentified_arguments(variable_assignments);
719 
720  // The way unidentified_arguments() works can give us false
721  // positives from repeated (overridden) variable assignments or from
722  // other (e.g. PETSc) command line arguments.
723  std::vector<std::string> actually_bad_variables;
724  for (std::size_t i = 0; i < bad_variables.size(); ++i)
725  {
726  // If any of our ufo arguments start with a -, that's a false
727  // positive from an unrelated command line argument.
728  if (bad_variables[i].empty() || bad_variables[i][0] != '-')
729  {
730  std::string bad_variable_name =
731  bad_variables[i].substr(0, bad_variables[i].find('='));
732  if (!variable_names.count(bad_variable_name))
733  actually_bad_variables.push_back(bad_variables[i]);
734  }
735  // Skip any option variable and (to be safe from false
736  // positives, though it can create false negatives) any
737  // subsequent potential argument
738  else
739  if (bad_variables.size() > (i+1) &&
740  !bad_variables[i+1].empty() &&
741  bad_variables[i+1][0] != '-')
742  ++i;
743  }
744 
745  if (this->comm().rank() == 0 && !actually_bad_variables.empty())
746  {
747  libMesh::err << "ERROR: Unrecognized variables:" << std::endl;
748  for (auto var : actually_bad_variables)
749  libMesh::err << var << std::endl;
750  libMesh::err << "Not found among recognized variables:" << std::endl;
751  for (std::size_t i = 0; i != variable_names.size(); ++i)
752  libMesh::err << variable_assignments[i] << std::endl;
753  libmesh_error();
754  }
755 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
unsigned int nelem_target
Definition: femparameters.h:60
OStreamProxy err
libMesh::Real timesolver_upper_tolerance
Definition: femparameters.h:39
libMesh::Real domain_ymin
Definition: femparameters.h:49
bool print_solution_norms
libMesh::Real deltat
Definition: femparameters.h:39
unsigned int initial_timestep
Definition: femparameters.h:34
bool print_element_residuals
unsigned int dimension
Definition: femparameters.h:46
unsigned int coarserefinements
Definition: femparameters.h:52
std::string solution_history_type
Definition: femparameters.h:38
bool reuse_preconditioner
libMesh::Real timesolver_tolerance
Definition: femparameters.h:39
std::string domaintype
Definition: femparameters.h:47
libMesh::Real elementorder
Definition: femparameters.h:48
bool analytic_jacobians
std::string mesh_partitioner_type
Definition: femparameters.h:56
VectorValue< Real > RealVectorValue
Useful typedefs to allow transparent switching between Real and Complex data types.
static constexpr Real TOLERANCE
TestClass subdomain_id_type
Based on the 4-byte comment warning above, this probably doesn&#39;t work with exodusII at all...
Definition: id_types.h:43
libMesh::Real domain_edge_length
Definition: femparameters.h:50
std::string timesolver_core
Definition: femparameters.h:37
std::string system_config_file
bool require_residual_reduction
unsigned int coarsegridy
Definition: femparameters.h:51
libMesh::Real domain_zmin
Definition: femparameters.h:49
bool print_residual_norms
libMesh::Real timesolver_maxgrowth
Definition: femparameters.h:39
processor_id_type rank() const
std::map< libMesh::boundary_id_type, libMesh::FunctionBase< libMesh::Number > * > neumann_conditions
Definition: femparameters.h:91
const Parallel::Communicator & comm() const
libMesh::Real relative_step_tolerance
std::string indicator_type
The libMesh namespace provides an interface to certain functionality in the library.
The definition of a periodic boundary.
libMesh::Real refine_fraction
Definition: femparameters.h:62
libMesh::Real domain_edge_height
Definition: femparameters.h:50
unsigned int initial_extra_quadrature
std::unique_ptr< FunctionBase< Number > > new_function_base(const std::string &func_type, const std::string &func_value)
std::vector< unsigned int > fe_order
std::string mesh_redistribute_func
Definition: femparameters.h:53
libMesh::Real coarsen_threshold
Definition: femparameters.h:62
bool write_gmv_error
Definition: femparameters.h:69
libMesh::Real end_time
Definition: femparameters.h:39
unsigned int max_linear_iterations
int8_t boundary_id_type
Definition: id_types.h:51
bool constrain_in_solver
double minimum_linear_tolerance
std::map< int, std::map< libMesh::subdomain_id_type, libMesh::FunctionBase< libMesh::Number > * > > other_interior_functions
Definition: femparameters.h:98
std::map< libMesh::subdomain_id_type, libMesh::FunctionBase< libMesh::Number > * > initial_conditions
Definition: femparameters.h:89
std::string domainfile
Definition: femparameters.h:47
std::vector< libMesh::PeriodicBoundary > periodic_boundaries
Definition: femparameters.h:85
std::vector< std::string > fe_family
std::map< int, std::map< libMesh::boundary_id_type, libMesh::FunctionBase< libMesh::Number > * > > other_boundary_functions
unsigned int coarsegridx
Definition: femparameters.h:51
libMesh::Real verify_analytic_jacobians
unsigned int write_interval
Definition: femparameters.h:68
unsigned int max_adaptivesteps
Definition: femparameters.h:63
double initial_linear_tolerance
std::map< libMesh::boundary_id_type, std::vector< unsigned int > > neumann_condition_variables
Definition: femparameters.h:94
int extra_quadrature_order
libMesh::Real global_tolerance
Definition: femparameters.h:61
std::string elementtype
Definition: femparameters.h:47
void read(GetPot &input, const std::vector< std::string > *other_variable_names=nullptr)
libMesh::Real absolute_residual_tolerance
An object whose state is distributed along a set of processors.
bool write_exodus_error
Definition: femparameters.h:69
libMesh::Real relative_residual_tolerance
bool print_element_solutions
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool print_jacobian_norms
unsigned int extrarefinements
Definition: femparameters.h:52
OStreamProxy out
libMesh::Real min_step_length
unsigned int n_timesteps
Definition: femparameters.h:34
libMesh::Real timesolver_theta
Definition: femparameters.h:39
unsigned int coarsegridz
Definition: femparameters.h:51
bool print_element_jacobians
unsigned int max_nonlinear_iterations
double linear_tolerance_multiplier
std::map< libMesh::boundary_id_type, std::vector< unsigned int > > dirichlet_condition_variables
Definition: femparameters.h:94
unsigned int initial_adaptivesteps
Definition: femparameters.h:64
bool time_solver_quiet
unsigned int initial_sobolev_order
libMesh::Real numerical_jacobian_h
std::map< libMesh::boundary_id_type, libMesh::FunctionBase< libMesh::Number > * > dirichlet_conditions
Definition: femparameters.h:91
std::vector< libMesh::FEMNormType > timesolver_norm
Definition: femparameters.h:42
unsigned int sobolev_order
std::vector< std::string > system_types
Definition: femparameters.h:78
FEMParameters(const libMesh::Parallel::Communicator &comm_in)
bool write_tecplot_error
Definition: femparameters.h:69
libMesh::Real domain_edge_width
Definition: femparameters.h:50
libMesh::Real coarsen_fraction
Definition: femparameters.h:62
libMesh::Real steadystate_tolerance
Definition: femparameters.h:39
libMesh::Real domain_xmin
Definition: femparameters.h:49
unsigned int deltat_reductions
Definition: femparameters.h:36