https://mooseframework.inl.gov
SIMPLESolveBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "SIMPLESolveBase.h"
11 #include "FEProblem.h"
12 #include "SegregatedSolverUtils.h"
13 
16 {
18  params.addRequiredParam<UserObjectName>("rhie_chow_user_object", "The rhie-chow user-object");
19 
20  /*
21  * The names of the different systems in the segregated solver
22  */
23  params.addRequiredParam<std::vector<SolverSystemName>>(
24  "momentum_systems", "The solver system(s) for the momentum equation(s).");
25  params.addRequiredParam<SolverSystemName>("pressure_system",
26  "The solver system for the pressure equation.");
27  params.addParam<SolverSystemName>("energy_system", "The solver system for the energy equation.");
28  params.addParam<SolverSystemName>("solid_energy_system",
29  "The solver system for the solid energy equation.");
30  params.addParam<std::vector<SolverSystemName>>(
31  "passive_scalar_systems", {}, "The solver system for each scalar advection equation.");
32  params.addParam<std::vector<SolverSystemName>>(
33  "turbulence_systems", {}, "The solver system for each surrogate turbulence equation.");
34 
35  /*
36  * Parameters to control the solution of the momentum equation
37  */
38 
39  params.addRangeCheckedParam<Real>(
40  "momentum_equation_relaxation",
41  1.0,
42  "0.0<momentum_equation_relaxation<=1.0",
43  "The relaxation which should be used for the momentum equation. (=1 for no relaxation, "
44  "diagonal dominance will still be enforced)");
45 
46  params.addParam<MultiMooseEnum>("momentum_petsc_options",
48  "Singleton PETSc options for the momentum equation");
49  params.addParam<MultiMooseEnum>("momentum_petsc_options_iname",
51  "Names of PETSc name/value pairs for the momentum equation");
52  params.addParam<std::vector<std::string>>(
53  "momentum_petsc_options_value",
54  "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
55  "momentum equation");
56 
57  params.addRangeCheckedParam<Real>(
58  "momentum_absolute_tolerance",
59  1e-5,
60  "0.0<momentum_absolute_tolerance",
61  "The absolute tolerance on the normalized residual of the momentum equation.");
62 
63  params.addRangeCheckedParam<Real>("momentum_l_tol",
64  1e-5,
65  "0.0<=momentum_l_tol & momentum_l_tol<1.0",
66  "The relative tolerance on the normalized residual in the "
67  "linear solver of the momentum equation.");
68  params.addRangeCheckedParam<Real>("momentum_l_abs_tol",
69  1e-50,
70  "0.0<momentum_l_abs_tol",
71  "The absolute tolerance on the normalized residual in the "
72  "linear solver of the momentum equation.");
73  params.addParam<unsigned int>(
74  "momentum_l_max_its",
75  10000,
76  "The maximum allowed iterations in the linear solver of the momentum equation.");
77 
78  params.addParamNamesToGroup(
79  "momentum_equation_relaxation momentum_petsc_options momentum_petsc_options_iname "
80  "momentum_petsc_options_value momentum_petsc_options_value momentum_absolute_tolerance "
81  "momentum_l_tol momentum_l_abs_tol momentum_l_max_its momentum_systems",
82  "Momentum Equation");
83 
84  /*
85  * Parameters to control the solution of the pressure equation
86  */
87  params.addRangeCheckedParam<Real>(
88  "pressure_variable_relaxation",
89  1.0,
90  "0.0<pressure_variable_relaxation<=1.0",
91  "The relaxation which should be used for the pressure variable (=1 for no relaxation).");
92 
93  params.addParam<MultiMooseEnum>("pressure_petsc_options",
95  "Singleton PETSc options for the pressure equation");
96  params.addParam<MultiMooseEnum>("pressure_petsc_options_iname",
98  "Names of PETSc name/value pairs for the pressure equation");
99  params.addParam<std::vector<std::string>>(
100  "pressure_petsc_options_value",
101  "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
102  "pressure equation");
103 
104  params.addRangeCheckedParam<Real>(
105  "pressure_absolute_tolerance",
106  1e-5,
107  "0.0<pressure_absolute_tolerance",
108  "The absolute tolerance on the normalized residual of the pressure equation.");
109 
110  params.addRangeCheckedParam<Real>("pressure_l_tol",
111  1e-5,
112  "0.0<=pressure_l_tol & pressure_l_tol<1.0",
113  "The relative tolerance on the normalized residual in the "
114  "linear solver of the pressure equation.");
115  params.addRangeCheckedParam<Real>("pressure_l_abs_tol",
116  1e-10,
117  "0.0<pressure_l_abs_tol",
118  "The absolute tolerance on the normalized residual in the "
119  "linear solver of the pressure equation.");
120  params.addParam<unsigned int>(
121  "pressure_l_max_its",
122  10000,
123  "The maximum allowed iterations in the linear solver of the pressure equation.");
124 
125  params.addParamNamesToGroup(
126  "pressure_variable_relaxation pressure_petsc_options pressure_petsc_options_iname "
127  "pressure_petsc_options_value pressure_petsc_options_value pressure_absolute_tolerance "
128  "pressure_l_tol pressure_l_abs_tol pressure_l_max_its pressure_system",
129  "Pressure Equation");
130 
131  /*
132  * Pressure pin parameters for enclosed flows
133  */
134 
135  params.addParam<bool>(
136  "pin_pressure", false, "If the pressure field needs to be pinned at a point.");
137  params.addParam<Real>(
138  "pressure_pin_value", 0.0, "The value which needs to be enforced for the pressure.");
139  params.addParam<Point>("pressure_pin_point", "The point where the pressure needs to be pinned.");
140 
141  params.addParamNamesToGroup("pin_pressure pressure_pin_value pressure_pin_point", "Pressure Pin");
142 
143  params.addParam<bool>(
144  "print_fields",
145  false,
146  "Use this to print the coupling and solution fields and matrices throughout the iteration.");
147 
148  /*
149  * Parameters to control the solution of the energy equation
150  */
151 
152  params.addRangeCheckedParam<Real>(
153  "energy_equation_relaxation",
154  1.0,
155  "0.0<energy_equation_relaxation<=1.0",
156  "The relaxation which should be used for the energy equation. (=1 for no relaxation, "
157  "diagonal dominance will still be enforced)");
158 
159  params.addParam<MultiMooseEnum>("energy_petsc_options",
161  "Singleton PETSc options for the energy equation");
162  params.addParam<MultiMooseEnum>("energy_petsc_options_iname",
164  "Names of PETSc name/value pairs for the energy equation");
165  params.addParam<std::vector<std::string>>(
166  "energy_petsc_options_value",
167  "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
168  "energy equation");
169 
170  params.addRangeCheckedParam<Real>(
171  "energy_absolute_tolerance",
172  1e-5,
173  "0.0<energy_absolute_tolerance",
174  "The absolute tolerance on the normalized residual of the energy equation.");
175 
176  params.addRangeCheckedParam<Real>("energy_l_tol",
177  1e-5,
178  "0.0<=energy_l_tol & energy_l_tol<1.0",
179  "The relative tolerance on the normalized residual in the "
180  "linear solver of the energy equation.");
181  params.addRangeCheckedParam<Real>("energy_l_abs_tol",
182  1e-10,
183  "0.0<energy_l_abs_tol",
184  "The absolute tolerance on the normalized residual in the "
185  "linear solver of the energy equation.");
186  params.addRangeCheckedParam<unsigned int>(
187  "energy_l_max_its",
188  10000,
189  "0<energy_l_max_its",
190  "The maximum allowed iterations in the linear solver of the energy equation.");
191 
192  params.addParamNamesToGroup(
193  "energy_equation_relaxation energy_petsc_options energy_petsc_options_iname "
194  "energy_petsc_options_value energy_petsc_options_value energy_absolute_tolerance "
195  "energy_l_tol energy_l_abs_tol energy_l_max_its",
196  "Energy Equation");
197 
198  /*
199  * Parameters to control the solution of the solid energy equation
200  */
201 
202  params.addParam<MultiMooseEnum>("solid_energy_petsc_options",
204  "Singleton PETSc options for the solid energy equation");
205  params.addParam<MultiMooseEnum>("solid_energy_petsc_options_iname",
207  "Names of PETSc name/value pairs for the solid energy equation");
208  params.addParam<std::vector<std::string>>(
209  "solid_energy_petsc_options_value",
210  "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
211  "solid energy equation");
212 
213  params.addRangeCheckedParam<Real>(
214  "solid_energy_absolute_tolerance",
215  1e-5,
216  "0.0<solid_energy_absolute_tolerance",
217  "The absolute tolerance on the normalized residual of the solid energy equation.");
218 
219  params.addRangeCheckedParam<Real>("solid_energy_l_tol",
220  1e-5,
221  "0.0<=solid_energy_l_tol & solid_energy_l_tol<1.0",
222  "The relative tolerance on the normalized residual in the "
223  "linear solver of the solid energy equation.");
224 
225  params.addRangeCheckedParam<Real>("solid_energy_l_abs_tol",
226  1e-10,
227  "0.0<solid_energy_l_abs_tol",
228  "The absolute tolerance on the normalized residual in the "
229  "linear solver of the solid energy equation.");
230  params.addRangeCheckedParam<unsigned int>(
231  "solid_energy_l_max_its",
232  10000,
233  "0<solid_energy_l_max_its",
234  "The maximum allowed iterations in the linear solver of the solid energy equation.");
235 
236  params.addParamNamesToGroup("solid_energy_petsc_options solid_energy_petsc_options_iname "
237  "solid_energy_petsc_options_value solid_energy_absolute_tolerance "
238  "solid_energy_l_tol solid_energy_l_abs_tol solid_energy_l_max_its",
239  "Solid Energy Equation");
240 
241  /*
242  * Parameters to control the solution of each scalar advection system
243  */
244  params.addParam<std::vector<Real>>("passive_scalar_equation_relaxation",
245  std::vector<Real>(),
246  "The relaxation which should be used for the passive scalar "
247  "equations. (=1 for no relaxation, "
248  "diagonal dominance will still be enforced)");
249 
250  params.addParam<MultiMooseEnum>("passive_scalar_petsc_options",
252  "Singleton PETSc options for the passive scalar equation(s)");
253  params.addParam<MultiMooseEnum>(
254  "passive_scalar_petsc_options_iname",
256  "Names of PETSc name/value pairs for the passive scalar equation(s)");
257  params.addParam<std::vector<std::string>>(
258  "passive_scalar_petsc_options_value",
259  "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
260  "passive scalar equation(s)");
261  params.addParam<std::vector<Real>>(
262  "passive_scalar_absolute_tolerance",
263  std::vector<Real>(),
264  "The absolute tolerance(s) on the normalized residual(s) of the passive scalar equation(s).");
265  params.addRangeCheckedParam<Real>("passive_scalar_l_tol",
266  1e-5,
267  "0.0<=passive_scalar_l_tol & passive_scalar_l_tol<1.0",
268  "The relative tolerance on the normalized residual in the "
269  "linear solver of the passive scalar equation(s).");
270  params.addRangeCheckedParam<Real>("passive_scalar_l_abs_tol",
271  1e-10,
272  "0.0<passive_scalar_l_abs_tol",
273  "The absolute tolerance on the normalized residual in the "
274  "linear solver of the passive scalar equation(s).");
275  params.addParam<unsigned int>(
276  "passive_scalar_l_max_its",
277  10000,
278  "The maximum allowed iterations in the linear solver of the turbulence equation.");
279 
280  params.addParamNamesToGroup(
281  "passive_scalar_systems passive_scalar_equation_relaxation passive_scalar_petsc_options "
282  "passive_scalar_petsc_options_iname "
283  "passive_scalar_petsc_options_value passive_scalar_petsc_options_value "
284  "passive_scalar_absolute_tolerance "
285  "passive_scalar_l_tol passive_scalar_l_abs_tol passive_scalar_l_max_its",
286  "passive_scalar Equation");
287 
288  /*
289  * Parameters to control the solution of each turbulence system
290  */
291  params.addParam<std::vector<Real>>("turbulence_equation_relaxation",
292  std::vector<Real>(),
293  "The relaxation which should be used for the turbulence "
294  "equations. (=1 for no relaxation, "
295  "diagonal dominance will still be enforced)");
296 
297  params.addParam<std::vector<Real>>("turbulence_field_relaxation",
298  std::vector<Real>(),
299  "The relaxation which should be used for the turbulence "
300  "fields.");
301 
302  params.addParam<std::vector<Real>>(
303  "turbulence_field_min_limit",
304  std::vector<Real>(),
305  "The lower limit imposed on turbulent quantities. The recommended value for robustness "
306  "is 1e-8. This is the imposed default if not set.");
307 
308  params.addParam<MultiMooseEnum>("turbulence_petsc_options",
310  "Singleton PETSc options for the turbulence equation(s)");
311  params.addParam<MultiMooseEnum>("turbulence_petsc_options_iname",
313  "Names of PETSc name/value pairs for the turbulence equation(s)");
314  params.addParam<std::vector<std::string>>(
315  "turbulence_petsc_options_value",
316  "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
317  "turbulence equation(s)");
318  params.addParam<std::vector<Real>>(
319  "turbulence_absolute_tolerance",
320  std::vector<Real>(),
321  "The absolute tolerance(s) on the normalized residual(s) of the turbulence equation(s).");
322  params.addRangeCheckedParam<Real>("turbulence_l_tol",
323  1e-5,
324  "0.0<=turbulence_l_tol & turbulence_l_tol<1.0",
325  "The relative tolerance on the normalized residual in the "
326  "linear solver of the turbulence equation(s).");
327  params.addRangeCheckedParam<Real>("turbulence_l_abs_tol",
328  1e-10,
329  "0.0<turbulence_l_abs_tol",
330  "The absolute tolerance on the normalized residual in the "
331  "linear solver of the turbulence equation(s).");
332  params.addParam<unsigned int>(
333  "turbulence_l_max_its",
334  10000,
335  "The maximum allowed iterations in the linear solver of the turbulence equation.");
336 
337  params.addParamNamesToGroup("turbulence_systems "
338  "turbulence_equation_relaxation "
339  "turbulence_field_relaxation "
340  "turbulence_field_min_limit "
341  "turbulence_petsc_options "
342  "turbulence_petsc_options_iname "
343  "turbulence_petsc_options_value turbulence_petsc_options_value "
344  "turbulence_absolute_tolerance "
345  "turbulence_l_tol turbulence_l_abs_tol turbulence_l_max_its",
346  "Turbulence Equations");
347 
348  /*
349  * SIMPLE iteration control
350  */
351 
352  params.addRangeCheckedParam<unsigned int>(
353  "num_iterations",
354  1000,
355  "0<num_iterations",
356  "The number of momentum-pressure-(other fields) iterations needed.");
357 
358  params.addParam<bool>("continue_on_max_its",
359  false,
360  "If solve should continue if maximum number of iterations is hit.");
361 
362  return params;
363 }
364 
366  : SolveObject(ex),
367  UserObjectInterface(this),
368  _momentum_system_names(getParam<std::vector<SolverSystemName>>("momentum_systems")),
369  _momentum_l_abs_tol(getParam<Real>("momentum_l_abs_tol")),
370  _momentum_equation_relaxation(getParam<Real>("momentum_equation_relaxation")),
371  _pressure_system_name(getParam<SolverSystemName>("pressure_system")),
372  _pressure_l_abs_tol(getParam<Real>("pressure_l_abs_tol")),
373  _pressure_variable_relaxation(getParam<Real>("pressure_variable_relaxation")),
374  _pin_pressure(getParam<bool>("pin_pressure")),
375  _pressure_pin_value(getParam<Real>("pressure_pin_value")),
376  _pressure_pin_dof(libMesh::invalid_uint),
377  _has_energy_system(isParamValid("energy_system")),
378  _energy_equation_relaxation(getParam<Real>("energy_equation_relaxation")),
379  _energy_l_abs_tol(getParam<Real>("energy_l_abs_tol")),
380  _has_solid_energy_system(_has_energy_system && isParamValid("solid_energy_system")),
381  _solid_energy_l_abs_tol(getParam<Real>("solid_energy_l_abs_tol")),
382  _passive_scalar_system_names(getParam<std::vector<SolverSystemName>>("passive_scalar_systems")),
383  _has_passive_scalar_systems(!_passive_scalar_system_names.empty()),
384  _passive_scalar_equation_relaxation(
385  getParam<std::vector<Real>>("passive_scalar_equation_relaxation")),
386  _passive_scalar_l_abs_tol(getParam<Real>("passive_scalar_l_abs_tol")),
387  _turbulence_system_names(getParam<std::vector<SolverSystemName>>("turbulence_systems")),
388  _has_turbulence_systems(!_turbulence_system_names.empty()),
389  _turbulence_equation_relaxation(getParam<std::vector<Real>>("turbulence_equation_relaxation")),
390  _turbulence_field_relaxation(getParam<std::vector<Real>>("turbulence_field_relaxation")),
391  _turbulence_field_min_limit(getParam<std::vector<Real>>("turbulence_field_min_limit")),
392  _turbulence_l_abs_tol(getParam<Real>("turbulence_l_abs_tol")),
393  _momentum_absolute_tolerance(getParam<Real>("momentum_absolute_tolerance")),
394  _pressure_absolute_tolerance(getParam<Real>("pressure_absolute_tolerance")),
395  _energy_absolute_tolerance(getParam<Real>("energy_absolute_tolerance")),
396  _solid_energy_absolute_tolerance(getParam<Real>("solid_energy_absolute_tolerance")),
397  _passive_scalar_absolute_tolerance(
398  getParam<std::vector<Real>>("passive_scalar_absolute_tolerance")),
399  _turbulence_absolute_tolerance(getParam<std::vector<Real>>("turbulence_absolute_tolerance")),
400  _num_iterations(getParam<unsigned int>("num_iterations")),
401  _continue_on_max_its(getParam<bool>("continue_on_max_its")),
402  _print_fields(getParam<bool>("print_fields"))
403 {
404  if (_momentum_system_names.size() != _problem.mesh().dimension())
405  paramError("momentum_systems",
406  "The number of momentum components should be equal to the number of "
407  "spatial dimensions on the mesh.");
408 
409  const auto & momentum_petsc_options = getParam<MultiMooseEnum>("momentum_petsc_options");
410  const auto & momentum_petsc_pair_options = getParam<MooseEnumItem, std::string>(
411  "momentum_petsc_options_iname", "momentum_petsc_options_value");
413  momentum_petsc_options, "-", *this, _momentum_petsc_options);
414  Moose::PetscSupport::addPetscPairsToPetscOptions(momentum_petsc_pair_options,
415  _problem.mesh().dimension(),
416  "-",
417  *this,
419 
420  _momentum_linear_control.real_valued_data["rel_tol"] = getParam<Real>("momentum_l_tol");
421  _momentum_linear_control.real_valued_data["abs_tol"] = getParam<Real>("momentum_l_abs_tol");
423  getParam<unsigned int>("momentum_l_max_its");
424 
425  const auto & pressure_petsc_options = getParam<MultiMooseEnum>("pressure_petsc_options");
426  const auto & pressure_petsc_pair_options = getParam<MooseEnumItem, std::string>(
427  "pressure_petsc_options_iname", "pressure_petsc_options_value");
429  pressure_petsc_options, "-", *this, _pressure_petsc_options);
430  Moose::PetscSupport::addPetscPairsToPetscOptions(pressure_petsc_pair_options,
431  _problem.mesh().dimension(),
432  "-",
433  *this,
435 
436  _pressure_linear_control.real_valued_data["rel_tol"] = getParam<Real>("pressure_l_tol");
437  _pressure_linear_control.real_valued_data["abs_tol"] = getParam<Real>("pressure_l_abs_tol");
439  getParam<unsigned int>("pressure_l_max_its");
440 
441  if (_has_energy_system)
442  {
443  const auto & energy_petsc_options = getParam<MultiMooseEnum>("energy_petsc_options");
444  const auto & energy_petsc_pair_options = getParam<MooseEnumItem, std::string>(
445  "energy_petsc_options_iname", "energy_petsc_options_value");
447  energy_petsc_options, "-", *this, _energy_petsc_options);
449  energy_petsc_pair_options, _problem.mesh().dimension(), "-", *this, _energy_petsc_options);
450 
451  _energy_linear_control.real_valued_data["rel_tol"] = getParam<Real>("energy_l_tol");
452  _energy_linear_control.real_valued_data["abs_tol"] = getParam<Real>("energy_l_abs_tol");
453  _energy_linear_control.int_valued_data["max_its"] = getParam<unsigned int>("energy_l_max_its");
454  }
455  else
456  checkDependentParameterError("energy_system",
457  {"energy_petsc_options",
458  "energy_petsc_options_iname",
459  "energy_petsc_options_value",
460  "energy_l_tol",
461  "energy_l_abs_tol",
462  "energy_l_max_its",
463  "energy_absolute_tolerance",
464  "energy_equation_relaxation"},
465  false);
466 
468  {
469  const auto & solid_energy_petsc_options =
470  getParam<MultiMooseEnum>("solid_energy_petsc_options");
471  const auto & solid_energy_petsc_pair_options = getParam<MooseEnumItem, std::string>(
472  "solid_energy_petsc_options_iname", "solid_energy_petsc_options_value");
474  solid_energy_petsc_options, "-", *this, _solid_energy_petsc_options);
475  Moose::PetscSupport::addPetscPairsToPetscOptions(solid_energy_petsc_pair_options,
476  _problem.mesh().dimension(),
477  "-",
478  *this,
480 
481  _solid_energy_linear_control.real_valued_data["rel_tol"] = getParam<Real>("solid_energy_l_tol");
483  getParam<Real>("solid_energy_l_abs_tol");
485  getParam<unsigned int>("solid_energy_l_max_its");
486  }
487  else
488  checkDependentParameterError("solid_energy_system",
489  {"solid_energy_petsc_options",
490  "solid_energy_petsc_options_iname",
491  "solid_energy_petsc_options_value",
492  "solid_energy_l_tol",
493  "solid_energy_l_abs_tol",
494  "solid_energy_l_max_its",
495  "solid_energy_absolute_tolerance",
496  "solid_energy_equation_relaxation"},
497  false);
498 
499  // We check for input errors with regards to the passive scalar equations. At the same time, we
500  // set up the corresponding system numbers
502  {
504  paramError("passive_scalar_equation_relaxation",
505  "The number of equation relaxation parameters does not match the number of "
506  "passive scalar equations!");
508  paramError("passive_scalar_absolute_tolerance",
509  "The number of absolute tolerances does not match the number of "
510  "passive scalar equations!");
511  }
513  {
514  const auto & passive_scalar_petsc_options =
515  getParam<MultiMooseEnum>("passive_scalar_petsc_options");
516  const auto & passive_scalar_petsc_pair_options = getParam<MooseEnumItem, std::string>(
517  "passive_scalar_petsc_options_iname", "passive_scalar_petsc_options_value");
519  passive_scalar_petsc_options, "-", *this, _passive_scalar_petsc_options);
520  Moose::PetscSupport::addPetscPairsToPetscOptions(passive_scalar_petsc_pair_options,
521  _problem.mesh().dimension(),
522  "-",
523  *this,
525 
527  getParam<Real>("passive_scalar_l_tol");
529  getParam<Real>("passive_scalar_l_abs_tol");
531  getParam<unsigned int>("passive_scalar_l_max_its");
532  }
533  else
534  checkDependentParameterError("passive_scalar_systems",
535  {"passive_scalar_petsc_options",
536  "passive_scalar_petsc_options_iname",
537  "passive_scalar_petsc_options_value",
538  "passive_scalar_l_tol",
539  "passive_scalar_l_abs_tol",
540  "passive_scalar_l_max_its",
541  "passive_scalar_equation_relaxation",
542  "passive_scalar_absolute_tolerance"},
543  false);
544 
545  // We check for input errors with regards to the surrogate turbulence equations. At the same time,
546  // we set up the corresponding system numbers
548  {
550  paramError("turbulence_equation_relaxation",
551  "The number of equation relaxation parameters does not match the number of "
552  "turbulence equations!");
554  paramError("turbulence_absolute_tolerance",
555  "The number of absolute tolerances does not match the number of "
556  "turbulence equations!");
557  if (_turbulence_field_min_limit.empty())
558  // If no minimum bounds are given, initialize to default value 1e-8
560 
561  // Assign turbulence field relaxation as 1.0 if not defined
562  if (_turbulence_field_relaxation.empty())
564 
565  const auto & turbulence_petsc_options = getParam<MultiMooseEnum>("turbulence_petsc_options");
566  const auto & turbulence_petsc_pair_options = getParam<MooseEnumItem, std::string>(
567  "turbulence_petsc_options_iname", "turbulence_petsc_options_value");
569  turbulence_petsc_options, "-", *this, _turbulence_petsc_options);
570  Moose::PetscSupport::addPetscPairsToPetscOptions(turbulence_petsc_pair_options,
571  _problem.mesh().dimension(),
572  "-",
573  *this,
575 
576  _turbulence_linear_control.real_valued_data["rel_tol"] = getParam<Real>("turbulence_l_tol");
577  _turbulence_linear_control.real_valued_data["abs_tol"] = getParam<Real>("turbulence_l_abs_tol");
579  getParam<unsigned int>("turbulence_l_max_its");
580  }
581  else
582  checkDependentParameterError("turbulence_systems",
583  {"turbulence_petsc_options",
584  "turbulence_petsc_options_iname",
585  "turbulence_petsc_options_value",
586  "turbulence_l_tol",
587  "turbulence_l_abs_tol",
588  "turbulence_l_max_its",
589  "turbulence_equation_relaxation",
590  "turbulence_field_relaxation",
591  "turbulence_field_min_limit",
592  "turbulence_absolute_tolerance"},
593  false);
594 }
595 
596 void
598 {
599  if (_pin_pressure)
601  _problem.mesh(),
602  getParam<Point>("pressure_pin_point"));
603 }
604 
605 void
606 SIMPLESolveBase::checkDependentParameterError(const std::string & main_parameter,
607  const std::vector<std::string> & dependent_parameters,
608  const bool should_be_defined)
609 {
610  for (const auto & param : dependent_parameters)
611  if (parameters().isParamSetByUser(param) == !should_be_defined)
612  paramError(param,
613  "This parameter should " + std::string(should_be_defined ? "" : "not") +
614  " be given by the user with the corresponding " + main_parameter +
615  " setting!");
616 }
MultiMooseEnum getCommonPetscKeys()
FEProblemBase & _problem
SIMPLESolverConfiguration _momentum_linear_control
Options for the linear solver of the momentum equation.
SIMPLESolverConfiguration _turbulence_linear_control
Options for the linear solver of the turbulence equation(s)
SIMPLESolverConfiguration _energy_linear_control
Options for the linear solver of the energy equation.
const unsigned int invalid_uint
Moose::PetscSupport::PetscOptions _turbulence_petsc_options
Options which hold the petsc settings for the turbulence equation(s)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const bool _has_energy_system
Boolean for easy check if a fluid energy system shall be solved or not.
std::vector< Real > _turbulence_field_relaxation
The user-defined relaxation parameter(s) for the turbulence field(s)
Moose::PetscSupport::PetscOptions _solid_energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
const bool _has_turbulence_systems
Boolean for easy check if a turbulence scalar systems shall be solved or not.
void checkDependentParameterError(const std::string &main_parameter, const std::vector< std::string > &dependent_parameters, const bool should_be_defined)
static InputParameters validParams()
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
std::map< std::string, Real > real_valued_data
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
InputParameters emptyInputParameters()
const std::vector< SolverSystemName > & _passive_scalar_system_names
The names of the passive scalar systems.
SIMPLESolverConfiguration _passive_scalar_linear_control
Options for the linear solver of the passive scalar equation(s)
Moose::PetscSupport::PetscOptions _energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
SIMPLESolverConfiguration _pressure_linear_control
Options for the linear solver of the pressure equation.
MultiMooseEnum getCommonPetscFlags()
Moose::PetscSupport::PetscOptions _passive_scalar_petsc_options
Options which hold the petsc settings for the passive scalar equation(s)
virtual unsigned int dimension() const
std::map< std::string, int > int_valued_data
Moose::PetscSupport::PetscOptions _momentum_petsc_options
Options which hold the petsc settings for the momentum equation.
const std::vector< Real > _passive_scalar_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in passive scalars.
dof_id_type _pressure_pin_dof
The dof ID where the pressure needs to be pinned.
const std::vector< SolverSystemName > & _turbulence_system_names
The names of the turbulence systems.
const bool _pin_pressure
If the pressure needs to be pinned.
void paramError(const std::string &param, Args... args) const
dof_id_type findPointDoFID(const MooseVariableFieldBase &variable, const MooseMesh &mesh, const Point &point)
Find the ID of the degree of freedom which corresponds to the variable and a given point on the mesh...
const std::vector< Real > _turbulence_equation_relaxation
The user-defined relaxation parameter(s) for the turbulence equation(s)
const std::vector< SolverSystemName > & _momentum_system_names
The names of the momentum systems.
bool isParamSetByUser(const std::string &nm) const
const std::vector< Real > _passive_scalar_equation_relaxation
The user-defined relaxation parameter(s) for the passive scalar equation(s)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
SIMPLESolveBase(Executioner &ex)
void addPetscPairsToPetscOptions(const std::vector< std::pair< MooseEnumItem, std::string >> &petsc_pair_options, const unsigned int mesh_dimension, const std::string &prefix, const ParallelParamObject &param_object, PetscOptions &petsc_options)
virtual MooseMesh & mesh() override
const InputParameters & parameters() const
const bool _has_passive_scalar_systems
Boolean for easy check if a passive scalar systems shall be solved or not.
void addPetscFlagsToPetscOptions(const MultiMooseEnum &petsc_flags, const std::string &prefix, const ParallelParamObject &param_object, PetscOptions &petsc_options)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
SIMPLESolverConfiguration _solid_energy_linear_control
Options for the linear solver of the energy equation.
std::vector< Real > _turbulence_field_min_limit
The user-defined lower limit for turbulent quantities e.g. k, eps/omega, etc..
const std::vector< Real > _turbulence_absolute_tolerance
The user-defined absolute tolerance for determining the convergence turbulence variables.
void setupPressurePin()
Setup pressure pin if there is need for one.
void ErrorVector unsigned int
Moose::PetscSupport::PetscOptions _pressure_petsc_options
Options which hold the petsc settings for the pressure equation.
const bool _has_solid_energy_system
Boolean for easy check if a solid energy system shall be solved or not.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)