https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
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 "pm_radiation_systems",
34 {},
35 "The solver system for each participating media radiation equation.");
36 params.addParam<std::vector<SolverSystemName>>(
37 "turbulence_systems", {}, "The solver system for each surrogate turbulence equation.");
38
39 /*
40 * Parameters to control the solution of the momentum equation
41 */
42
43 params.addRangeCheckedParam<Real>(
44 "momentum_equation_relaxation",
45 1.0,
46 "0.0<momentum_equation_relaxation<=1.0",
47 "The relaxation which should be used for the momentum equation. (=1 for no relaxation, "
48 "diagonal dominance will still be enforced)");
49
50 params.addParam<MultiMooseEnum>("momentum_petsc_options",
52 "Singleton PETSc options for the momentum equation");
53 params.addParam<MultiMooseEnum>("momentum_petsc_options_iname",
55 "Names of PETSc name/value pairs for the momentum equation");
56 params.addParam<std::vector<std::string>>(
57 "momentum_petsc_options_value",
58 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
59 "momentum equation");
60
61 params.addRangeCheckedParam<std::vector<Real>>(
62 "momentum_absolute_tolerance",
63 {1e-5},
64 "0.0<momentum_absolute_tolerance",
65 "The absolute tolerance(s) on the normalized residual(s) of the momentum equation(s). "
66 "If a single value is provided it is applied to all momentum components.");
67
68 params.addRangeCheckedParam<Real>("momentum_l_tol",
69 1e-5,
70 "0.0<=momentum_l_tol & momentum_l_tol<1.0",
71 "The relative tolerance on the normalized residual in the "
72 "linear solver of the momentum equation.");
73 params.addRangeCheckedParam<Real>("momentum_l_abs_tol",
74 1e-50,
75 "0.0<momentum_l_abs_tol",
76 "The absolute tolerance on the normalized residual in the "
77 "linear solver of the momentum equation.");
78 params.addParam<unsigned int>(
79 "momentum_l_max_its",
80 10000,
81 "The maximum allowed iterations in the linear solver of the momentum equation.");
82
84 "momentum_equation_relaxation momentum_petsc_options momentum_petsc_options_iname "
85 "momentum_petsc_options_value momentum_petsc_options_value momentum_absolute_tolerance "
86 "momentum_l_tol momentum_l_abs_tol momentum_l_max_its momentum_systems",
87 "Momentum Equation");
88
89 /*
90 * Parameters to control the solution of the pressure equation
91 */
92 params.addRangeCheckedParam<Real>(
93 "pressure_variable_relaxation",
94 1.0,
95 "0.0<pressure_variable_relaxation<=1.0",
96 "The relaxation which should be used for the pressure variable (=1 for no relaxation).");
97
98 params.addParam<MultiMooseEnum>("pressure_petsc_options",
100 "Singleton PETSc options for the pressure equation");
101 params.addParam<MultiMooseEnum>("pressure_petsc_options_iname",
103 "Names of PETSc name/value pairs for the pressure equation");
104 params.addParam<std::vector<std::string>>(
105 "pressure_petsc_options_value",
106 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
107 "pressure equation");
108
109 params.addRangeCheckedParam<Real>(
110 "pressure_absolute_tolerance",
111 1e-5,
112 "0.0<pressure_absolute_tolerance",
113 "The absolute tolerance on the normalized residual of the pressure equation.");
114
115 params.addRangeCheckedParam<Real>("pressure_l_tol",
116 1e-5,
117 "0.0<=pressure_l_tol & pressure_l_tol<1.0",
118 "The relative tolerance on the normalized residual in the "
119 "linear solver of the pressure equation.");
120 params.addRangeCheckedParam<Real>("pressure_l_abs_tol",
121 1e-10,
122 "0.0<pressure_l_abs_tol",
123 "The absolute tolerance on the normalized residual in the "
124 "linear solver of the pressure equation.");
125 params.addParam<unsigned int>(
126 "pressure_l_max_its",
127 10000,
128 "The maximum allowed iterations in the linear solver of the pressure equation.");
129
131 "pressure_variable_relaxation pressure_petsc_options pressure_petsc_options_iname "
132 "pressure_petsc_options_value pressure_petsc_options_value pressure_absolute_tolerance "
133 "pressure_l_tol pressure_l_abs_tol pressure_l_max_its pressure_system",
134 "Pressure Equation");
135
136 /*
137 * Pressure pin parameters for enclosed flows
138 */
139
140 params.addParam<bool>(
141 "pin_pressure", false, "If the pressure field needs to be pinned at a point.");
142 params.addParam<Real>(
143 "pressure_pin_value", 0.0, "The value which needs to be enforced for the pressure.");
144 params.addParam<Point>("pressure_pin_point", "The point where the pressure needs to be pinned.");
145
146 params.addParamNamesToGroup("pin_pressure pressure_pin_value pressure_pin_point", "Pressure Pin");
147
148 params.addParam<bool>(
149 "print_fields",
150 false,
151 "Use this to print the coupling and solution fields and matrices throughout the iteration.");
152
153 /*
154 * Parameters to control the solution of the energy equation
155 */
156
157 params.addRangeCheckedParam<Real>(
158 "energy_equation_relaxation",
159 1.0,
160 "0.0<energy_equation_relaxation<=1.0",
161 "The relaxation which should be used for the energy equation. (=1 for no relaxation, "
162 "diagonal dominance will still be enforced)");
163
164 params.addParam<MultiMooseEnum>("energy_petsc_options",
166 "Singleton PETSc options for the energy equation");
167 params.addParam<MultiMooseEnum>("energy_petsc_options_iname",
169 "Names of PETSc name/value pairs for the energy equation");
170 params.addParam<std::vector<std::string>>(
171 "energy_petsc_options_value",
172 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
173 "energy equation");
174
175 params.addRangeCheckedParam<Real>(
176 "energy_absolute_tolerance",
177 1e-5,
178 "0.0<energy_absolute_tolerance",
179 "The absolute tolerance on the normalized residual of the energy equation.");
180
181 params.addRangeCheckedParam<Real>("energy_l_tol",
182 1e-5,
183 "0.0<=energy_l_tol & energy_l_tol<1.0",
184 "The relative tolerance on the normalized residual in the "
185 "linear solver of the energy equation.");
186 params.addRangeCheckedParam<Real>("energy_l_abs_tol",
187 1e-10,
188 "0.0<energy_l_abs_tol",
189 "The absolute tolerance on the normalized residual in the "
190 "linear solver of the energy equation.");
191 params.addRangeCheckedParam<unsigned int>(
192 "energy_l_max_its",
193 10000,
194 "0<energy_l_max_its",
195 "The maximum allowed iterations in the linear solver of the energy equation.");
196
198 "energy_equation_relaxation energy_petsc_options energy_petsc_options_iname "
199 "energy_petsc_options_value energy_petsc_options_value energy_absolute_tolerance "
200 "energy_l_tol energy_l_abs_tol energy_l_max_its",
201 "Energy Equation");
202
203 /*
204 * Parameters to control the solution of the solid energy equation
205 */
206
207 params.addParam<MultiMooseEnum>("solid_energy_petsc_options",
209 "Singleton PETSc options for the solid energy equation");
210 params.addParam<MultiMooseEnum>("solid_energy_petsc_options_iname",
212 "Names of PETSc name/value pairs for the solid energy equation");
213 params.addParam<std::vector<std::string>>(
214 "solid_energy_petsc_options_value",
215 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
216 "solid energy equation");
217
218 params.addRangeCheckedParam<Real>(
219 "solid_energy_absolute_tolerance",
220 1e-5,
221 "0.0<solid_energy_absolute_tolerance",
222 "The absolute tolerance on the normalized residual of the solid energy equation.");
223
224 params.addRangeCheckedParam<Real>("solid_energy_l_tol",
225 1e-5,
226 "0.0<=solid_energy_l_tol & solid_energy_l_tol<1.0",
227 "The relative tolerance on the normalized residual in the "
228 "linear solver of the solid energy equation.");
229
230 params.addRangeCheckedParam<Real>("solid_energy_l_abs_tol",
231 1e-10,
232 "0.0<solid_energy_l_abs_tol",
233 "The absolute tolerance on the normalized residual in the "
234 "linear solver of the solid energy equation.");
235 params.addRangeCheckedParam<unsigned int>(
236 "solid_energy_l_max_its",
237 10000,
238 "0<solid_energy_l_max_its",
239 "The maximum allowed iterations in the linear solver of the solid energy equation.");
240
241 params.addParamNamesToGroup("solid_energy_petsc_options solid_energy_petsc_options_iname "
242 "solid_energy_petsc_options_value solid_energy_absolute_tolerance "
243 "solid_energy_l_tol solid_energy_l_abs_tol solid_energy_l_max_its",
244 "Solid Energy Equation");
245
246 /*
247 * Parameters to control the solution of each scalar advection system
248 */
249 params.addParam<std::vector<Real>>("passive_scalar_equation_relaxation",
250 std::vector<Real>(),
251 "The relaxation which should be used for the passive scalar "
252 "equations. (=1 for no relaxation, "
253 "diagonal dominance will still be enforced)");
254
255 params.addParam<MultiMooseEnum>("passive_scalar_petsc_options",
257 "Singleton PETSc options for the passive scalar equation(s)");
258 params.addParam<MultiMooseEnum>(
259 "passive_scalar_petsc_options_iname",
261 "Names of PETSc name/value pairs for the passive scalar equation(s)");
262 params.addParam<std::vector<std::string>>(
263 "passive_scalar_petsc_options_value",
264 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
265 "passive scalar equation(s)");
266 params.addParam<std::vector<Real>>(
267 "passive_scalar_absolute_tolerance",
268 std::vector<Real>(),
269 "The absolute tolerance(s) on the normalized residual(s) of the passive scalar equation(s).");
270 params.addRangeCheckedParam<Real>("passive_scalar_l_tol",
271 1e-5,
272 "0.0<=passive_scalar_l_tol & passive_scalar_l_tol<1.0",
273 "The relative tolerance on the normalized residual in the "
274 "linear solver of the passive scalar equation(s).");
275 params.addRangeCheckedParam<Real>("passive_scalar_l_abs_tol",
276 1e-10,
277 "0.0<passive_scalar_l_abs_tol",
278 "The absolute tolerance on the normalized residual in the "
279 "linear solver of the passive scalar equation(s).");
280 params.addParam<unsigned int>(
281 "passive_scalar_l_max_its",
282 10000,
283 "The maximum allowed iterations in the linear solver of the turbulence equation.");
284
286 "passive_scalar_systems passive_scalar_equation_relaxation passive_scalar_petsc_options "
287 "passive_scalar_petsc_options_iname "
288 "passive_scalar_petsc_options_value passive_scalar_petsc_options_value "
289 "passive_scalar_absolute_tolerance "
290 "passive_scalar_l_tol passive_scalar_l_abs_tol passive_scalar_l_max_its",
291 "Passive Scalars Advection Equation");
292
293 /*
294 * Parameters to control the solution of each participating media radiation equation
295 */
296 params.addParam<std::vector<Real>>(
297 "pm_radiation_equation_relaxation",
298 std::vector<Real>(),
299 "The relaxation which should be used for the participating media radiation "
300 "equations. (=1 for no relaxation, "
301 "diagonal dominance will still be enforced)");
302
303 params.addParam<MultiMooseEnum>(
304 "pm_radiation_petsc_options",
306 "Singleton PETSc options for the participating media radiation equation(s)");
307 params.addParam<MultiMooseEnum>(
308 "pm_radiation_petsc_options_iname",
310 "Names of PETSc name/value pairs for the participating media radiation equation(s)");
311 params.addParam<std::vector<std::string>>(
312 "pm_radiation_petsc_options_value",
313 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
314 "participating media radiation equation(s)");
315 params.addParam<std::vector<Real>>("pm_radiation_absolute_tolerance",
316 std::vector<Real>(),
317 "The absolute tolerance(s) on the normalized residual(s) of "
318 "the participating media radiation equation(s).");
319 params.addRangeCheckedParam<Real>(
320 "pm_radiation_l_tol",
321 1e-5,
322 "0.0<=pm_radiation_l_tol & pm_radiation_l_tol<1.0",
323 "The relative tolerance on the normalized residual in the "
324 "linear solver of the participating media radiation equation(s).");
325 params.addRangeCheckedParam<Real>(
326 "pm_radiation_l_abs_tol",
327 1e-10,
328 "0.0<pm_radiation_l_abs_tol",
329 "The absolute tolerance on the normalized residual in the "
330 "linear solver of the participating media radiation equation(s).");
331 params.addParam<unsigned int>("pm_radiation_l_max_its",
332 10000,
333 "The maximum allowed iterations in the linear solver of the "
334 "participating media radiation equation.");
335
337 "pm_radiation_systems pm_radiation_equation_relaxation pm_radiation_petsc_options "
338 "pm_radiation_petsc_options_iname "
339 "pm_radiation_petsc_options_value pm_radiation_petsc_options_value "
340 "pm_radiation_absolute_tolerance "
341 "pm_radiation_l_tol pm_radiation_l_abs_tol pm_radiation_l_max_its",
342 "Participating Medium Radiation Equation");
343
344 /*
345 * Parameters to control the solution of each turbulence system
346 */
347 params.addParam<std::vector<Real>>("turbulence_equation_relaxation",
348 std::vector<Real>(),
349 "The relaxation which should be used for the turbulence "
350 "equations. (=1 for no relaxation, "
351 "diagonal dominance will still be enforced)");
352
353 params.addParam<std::vector<Real>>("turbulence_field_relaxation",
354 std::vector<Real>(),
355 "The relaxation which should be used for the turbulence "
356 "fields.");
357
358 params.addParam<std::vector<Real>>(
359 "turbulence_field_min_limit",
360 std::vector<Real>(),
361 "The lower limit imposed on turbulent quantities. The recommended value for robustness "
362 "is 1e-8. This is the imposed default if not set.");
363
364 params.addParam<MultiMooseEnum>("turbulence_petsc_options",
366 "Singleton PETSc options for the turbulence equation(s)");
367 params.addParam<MultiMooseEnum>("turbulence_petsc_options_iname",
369 "Names of PETSc name/value pairs for the turbulence equation(s)");
370 params.addParam<std::vector<std::string>>(
371 "turbulence_petsc_options_value",
372 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
373 "turbulence equation(s)");
374 params.addParam<std::vector<Real>>(
375 "turbulence_absolute_tolerance",
376 std::vector<Real>(),
377 "The absolute tolerance(s) on the normalized residual(s) of the turbulence equation(s).");
378 params.addRangeCheckedParam<Real>("turbulence_l_tol",
379 1e-5,
380 "0.0<=turbulence_l_tol & turbulence_l_tol<1.0",
381 "The relative tolerance on the normalized residual in the "
382 "linear solver of the turbulence equation(s).");
383 params.addRangeCheckedParam<Real>("turbulence_l_abs_tol",
384 1e-10,
385 "0.0<turbulence_l_abs_tol",
386 "The absolute tolerance on the normalized residual in the "
387 "linear solver of the turbulence equation(s).");
388 params.addParam<unsigned int>(
389 "turbulence_l_max_its",
390 10000,
391 "The maximum allowed iterations in the linear solver of the turbulence equation.");
392
393 params.addParamNamesToGroup("turbulence_systems "
394 "turbulence_equation_relaxation "
395 "turbulence_field_relaxation "
396 "turbulence_field_min_limit "
397 "turbulence_petsc_options "
398 "turbulence_petsc_options_iname "
399 "turbulence_petsc_options_value turbulence_petsc_options_value "
400 "turbulence_absolute_tolerance "
401 "turbulence_l_tol turbulence_l_abs_tol turbulence_l_max_its",
402 "Turbulence Equations");
403
404 /*
405 * SIMPLE iteration control
406 */
407
408 params.addRangeCheckedParam<unsigned int>(
409 "num_iterations",
410 1000,
411 "0<num_iterations",
412 "The number of momentum-pressure-(other fields) iterations needed.");
413
414 params.addParam<bool>("continue_on_max_its",
415 false,
416 "If solve should continue if maximum number of iterations is hit.");
417
418 return params;
419}
420
422 : SolveObject(ex),
424 _momentum_system_names(getParam<std::vector<SolverSystemName>>("momentum_systems")),
425 _momentum_l_abs_tol(getParam<Real>("momentum_l_abs_tol")),
426 _momentum_equation_relaxation(getParam<Real>("momentum_equation_relaxation")),
427 _pressure_system_name(getParam<SolverSystemName>("pressure_system")),
428 _pressure_l_abs_tol(getParam<Real>("pressure_l_abs_tol")),
429 _pressure_variable_relaxation(getParam<Real>("pressure_variable_relaxation")),
430 _pin_pressure(getParam<bool>("pin_pressure")),
431 _pressure_pin_value(getParam<Real>("pressure_pin_value")),
432 _pressure_pin_dof(libMesh::invalid_uint),
433 _has_energy_system(isParamValid("energy_system")),
434 _energy_equation_relaxation(getParam<Real>("energy_equation_relaxation")),
435 _energy_l_abs_tol(getParam<Real>("energy_l_abs_tol")),
436 _has_solid_energy_system(_has_energy_system && isParamValid("solid_energy_system")),
437 _solid_energy_l_abs_tol(getParam<Real>("solid_energy_l_abs_tol")),
438 _passive_scalar_system_names(getParam<std::vector<SolverSystemName>>("passive_scalar_systems")),
439 _has_passive_scalar_systems(!_passive_scalar_system_names.empty()),
440 _passive_scalar_equation_relaxation(
441 getParam<std::vector<Real>>("passive_scalar_equation_relaxation")),
442 _passive_scalar_l_abs_tol(getParam<Real>("passive_scalar_l_abs_tol")),
443 _pm_radiation_system_names(getParam<std::vector<SolverSystemName>>("pm_radiation_systems")),
444 _has_pm_radiation_systems(!_pm_radiation_system_names.empty()),
445 _pm_radiation_equation_relaxation(
446 getParam<std::vector<Real>>("pm_radiation_equation_relaxation")),
447 _pm_radiation_l_abs_tol(getParam<Real>("pm_radiation_l_abs_tol")),
448 _turbulence_system_names(getParam<std::vector<SolverSystemName>>("turbulence_systems")),
449 _has_turbulence_systems(!_turbulence_system_names.empty()),
450 _turbulence_equation_relaxation(getParam<std::vector<Real>>("turbulence_equation_relaxation")),
451 _turbulence_field_relaxation(getParam<std::vector<Real>>("turbulence_field_relaxation")),
452 _turbulence_field_min_limit(getParam<std::vector<Real>>("turbulence_field_min_limit")),
453 _turbulence_l_abs_tol(getParam<Real>("turbulence_l_abs_tol")),
454 _momentum_absolute_tolerance(getParam<std::vector<Real>>("momentum_absolute_tolerance")),
455 _pressure_absolute_tolerance(getParam<Real>("pressure_absolute_tolerance")),
456 _energy_absolute_tolerance(getParam<Real>("energy_absolute_tolerance")),
457 _solid_energy_absolute_tolerance(getParam<Real>("solid_energy_absolute_tolerance")),
458 _passive_scalar_absolute_tolerance(
459 getParam<std::vector<Real>>("passive_scalar_absolute_tolerance")),
460 _pm_radiation_absolute_tolerance(
461 getParam<std::vector<Real>>("pm_radiation_absolute_tolerance")),
462 _turbulence_absolute_tolerance(getParam<std::vector<Real>>("turbulence_absolute_tolerance")),
463 _num_iterations(getParam<unsigned int>("num_iterations")),
464 _continue_on_max_its(getParam<bool>("continue_on_max_its")),
465 _print_fields(getParam<bool>("print_fields"))
466{
467 // The momentum absolute tolerances must either be given as a single value
468 // (applied to all components) or one value per momentum component.
471 paramError("momentum_absolute_tolerance",
472 "The number of momentum absolute tolerances must be one or match the number of "
473 "momentum systems.");
474
475 const auto & momentum_petsc_options = getParam<MultiMooseEnum>("momentum_petsc_options");
476 const auto & momentum_petsc_pair_options = getParam<MooseEnumItem, std::string>(
477 "momentum_petsc_options_iname", "momentum_petsc_options_value");
479 momentum_petsc_options, "", *this, _momentum_petsc_options);
481 momentum_petsc_pair_options, _problem.mesh().dimension(), "", *this, _momentum_petsc_options);
482
483 _momentum_linear_control.real_valued_data["rel_tol"] = getParam<Real>("momentum_l_tol");
484 _momentum_linear_control.real_valued_data["abs_tol"] = getParam<Real>("momentum_l_abs_tol");
486 getParam<unsigned int>("momentum_l_max_its");
487
488 const auto & pressure_petsc_options = getParam<MultiMooseEnum>("pressure_petsc_options");
489 const auto & pressure_petsc_pair_options = getParam<MooseEnumItem, std::string>(
490 "pressure_petsc_options_iname", "pressure_petsc_options_value");
492 pressure_petsc_options, "", *this, _pressure_petsc_options);
494 pressure_petsc_pair_options, _problem.mesh().dimension(), "", *this, _pressure_petsc_options);
495
496 _pressure_linear_control.real_valued_data["rel_tol"] = getParam<Real>("pressure_l_tol");
497 _pressure_linear_control.real_valued_data["abs_tol"] = getParam<Real>("pressure_l_abs_tol");
499 getParam<unsigned int>("pressure_l_max_its");
500
502 {
503 const auto & energy_petsc_options = getParam<MultiMooseEnum>("energy_petsc_options");
504 const auto & energy_petsc_pair_options = getParam<MooseEnumItem, std::string>(
505 "energy_petsc_options_iname", "energy_petsc_options_value");
507 energy_petsc_options, "", *this, _energy_petsc_options);
509 energy_petsc_pair_options, _problem.mesh().dimension(), "", *this, _energy_petsc_options);
510
511 _energy_linear_control.real_valued_data["rel_tol"] = getParam<Real>("energy_l_tol");
512 _energy_linear_control.real_valued_data["abs_tol"] = getParam<Real>("energy_l_abs_tol");
513 _energy_linear_control.int_valued_data["max_its"] = getParam<unsigned int>("energy_l_max_its");
514 }
515 else
516 checkDependentParameterError("energy_system",
517 {"energy_petsc_options",
518 "energy_petsc_options_iname",
519 "energy_petsc_options_value",
520 "energy_l_tol",
521 "energy_l_abs_tol",
522 "energy_l_max_its",
523 "energy_absolute_tolerance",
524 "energy_equation_relaxation"},
525 false);
526
528 {
529 const auto & solid_energy_petsc_options =
530 getParam<MultiMooseEnum>("solid_energy_petsc_options");
531 const auto & solid_energy_petsc_pair_options = getParam<MooseEnumItem, std::string>(
532 "solid_energy_petsc_options_iname", "solid_energy_petsc_options_value");
534 solid_energy_petsc_options, "", *this, _solid_energy_petsc_options);
535 Moose::PetscSupport::addPetscPairsToPetscOptions(solid_energy_petsc_pair_options,
537 "",
538 *this,
540
541 _solid_energy_linear_control.real_valued_data["rel_tol"] = getParam<Real>("solid_energy_l_tol");
543 getParam<Real>("solid_energy_l_abs_tol");
545 getParam<unsigned int>("solid_energy_l_max_its");
546 }
547 else
548 checkDependentParameterError("solid_energy_system",
549 {"solid_energy_petsc_options",
550 "solid_energy_petsc_options_iname",
551 "solid_energy_petsc_options_value",
552 "solid_energy_l_tol",
553 "solid_energy_l_abs_tol",
554 "solid_energy_l_max_its",
555 "solid_energy_absolute_tolerance",
556 "solid_energy_equation_relaxation"},
557 false);
558
559 // We check for input errors with regards to the participating media radiation equations. At the
560 // same time, we set up the corresponding system numbers
562 {
564 paramError("pm_radiation_equation_relaxation",
565 "The number of equation relaxation parameters does not match the number of "
566 "participating media radiation equations!");
568 paramError("pm_radiation_absolute_tolerance",
569 "The number of absolute tolerances does not match the number of "
570 "participating media radiation equations!");
571 }
573 {
574 const auto & pm_radiation_petsc_options =
575 getParam<MultiMooseEnum>("pm_radiation_petsc_options");
576 const auto & pm_radiation_petsc_pair_options = getParam<MooseEnumItem, std::string>(
577 "pm_radiation_petsc_options_iname", "pm_radiation_petsc_options_value");
579 pm_radiation_petsc_options, "", *this, _pm_radiation_petsc_options);
580 Moose::PetscSupport::addPetscPairsToPetscOptions(pm_radiation_petsc_pair_options,
582 "",
583 *this,
585
586 _pm_radiation_linear_control.real_valued_data["rel_tol"] = getParam<Real>("pm_radiation_l_tol");
588 getParam<Real>("pm_radiation_l_abs_tol");
590 getParam<unsigned int>("pm_radiation_l_max_its");
591 }
592 else
593 checkDependentParameterError("pm_radiation_systems",
594 {"pm_radiation_petsc_options",
595 "pm_radiation_petsc_options_iname",
596 "pm_radiation_petsc_options_value",
597 "pm_radiation_l_tol",
598 "pm_radiation_l_abs_tol",
599 "pm_radiation_l_max_its",
600 "pm_radiation_equation_relaxation",
601 "pm_radiation_absolute_tolerance"},
602 false);
603
604 // We check for input errors with regards to the passive scalar equations. At the same time, we
605 // set up the corresponding system numbers
607 {
609 paramError("passive_scalar_equation_relaxation",
610 "The number of equation relaxation parameters does not match the number of "
611 "passive scalar equations!");
613 paramError("passive_scalar_absolute_tolerance",
614 "The number of absolute tolerances does not match the number of "
615 "passive scalar equations!");
616 }
618 {
619 const auto & passive_scalar_petsc_options =
620 getParam<MultiMooseEnum>("passive_scalar_petsc_options");
621 const auto & passive_scalar_petsc_pair_options = getParam<MooseEnumItem, std::string>(
622 "passive_scalar_petsc_options_iname", "passive_scalar_petsc_options_value");
624 passive_scalar_petsc_options, "", *this, _passive_scalar_petsc_options);
625 Moose::PetscSupport::addPetscPairsToPetscOptions(passive_scalar_petsc_pair_options,
627 "",
628 *this,
630
632 getParam<Real>("passive_scalar_l_tol");
634 getParam<Real>("passive_scalar_l_abs_tol");
636 getParam<unsigned int>("passive_scalar_l_max_its");
637 }
638 else
639 checkDependentParameterError("passive_scalar_systems",
640 {"passive_scalar_petsc_options",
641 "passive_scalar_petsc_options_iname",
642 "passive_scalar_petsc_options_value",
643 "passive_scalar_l_tol",
644 "passive_scalar_l_abs_tol",
645 "passive_scalar_l_max_its",
646 "passive_scalar_equation_relaxation",
647 "passive_scalar_absolute_tolerance"},
648 false);
649
650 // We check for input errors with regards to the surrogate turbulence equations. At the same time,
651 // we set up the corresponding system numbers
653 {
655 paramError("turbulence_equation_relaxation",
656 "The number of equation relaxation parameters does not match the number of "
657 "turbulence equations!");
659 paramError("turbulence_absolute_tolerance",
660 "The number of absolute tolerances does not match the number of "
661 "turbulence equations!");
662 if (_turbulence_field_min_limit.empty())
663 // If no minimum bounds are given, initialize to default value 1e-8
665
666 // Assign turbulence field relaxation as 1.0 if not defined
669
670 const auto & turbulence_petsc_options = getParam<MultiMooseEnum>("turbulence_petsc_options");
671 const auto & turbulence_petsc_pair_options = getParam<MooseEnumItem, std::string>(
672 "turbulence_petsc_options_iname", "turbulence_petsc_options_value");
674 turbulence_petsc_options, "", *this, _turbulence_petsc_options);
675 Moose::PetscSupport::addPetscPairsToPetscOptions(turbulence_petsc_pair_options,
677 "",
678 *this,
680
681 _turbulence_linear_control.real_valued_data["rel_tol"] = getParam<Real>("turbulence_l_tol");
682 _turbulence_linear_control.real_valued_data["abs_tol"] = getParam<Real>("turbulence_l_abs_tol");
684 getParam<unsigned int>("turbulence_l_max_its");
685 }
686 else
687 checkDependentParameterError("turbulence_systems",
688 {"turbulence_petsc_options",
689 "turbulence_petsc_options_iname",
690 "turbulence_petsc_options_value",
691 "turbulence_l_tol",
692 "turbulence_l_abs_tol",
693 "turbulence_l_max_its",
694 "turbulence_equation_relaxation",
695 "turbulence_field_relaxation",
696 "turbulence_field_min_limit",
697 "turbulence_absolute_tolerance"},
698 false);
699}
700
701void
703{
704 if (_pin_pressure)
706 _problem.mesh(),
707 getParam<Point>("pressure_pin_point"));
708}
709
710void
711SIMPLESolveBase::checkDependentParameterError(const std::string & main_parameter,
712 const std::vector<std::string> & dependent_parameters,
713 const bool should_be_defined)
714{
715 for (const auto & param : dependent_parameters)
716 if (parameters().isParamSetByUser(param) == !should_be_defined)
717 paramError(param,
718 "This parameter should " + std::string(should_be_defined ? "" : "not") +
719 " be given by the user with the corresponding " + main_parameter +
720 " setting!");
721}
InputParameters emptyInputParameters()
void ErrorVector unsigned int
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
virtual MooseMesh & mesh() override
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
bool isParamSetByUser(const std::string &name) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
const InputParameters & parameters() const
void paramError(const std::string &param, Args... args) const
virtual unsigned int dimension() const
const std::vector< Real > _turbulence_equation_relaxation
The user-defined relaxation parameter(s) for the turbulence equation(s)
const bool _has_energy_system
Boolean for easy check if a fluid energy system shall be solved or not.
dof_id_type _pressure_pin_dof
The dof ID where the pressure needs to be pinned.
const bool _has_turbulence_systems
Boolean for easy check if a turbulence scalar systems shall be solved or not.
SIMPLESolverConfiguration _pm_radiation_linear_control
Options for the linear solver of the participating media radiation equation(s)
const std::vector< SolverSystemName > & _passive_scalar_system_names
The names of the passive scalar systems.
const std::vector< Real > _pm_radiation_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in participating media radiation.
Moose::PetscSupport::PetscOptions _turbulence_petsc_options
Options which hold the petsc settings for the turbulence equation(s)
const bool _has_pm_radiation_systems
Boolean for easy check if participating media radiation systems shall be solved or not.
const std::vector< SolverSystemName > & _turbulence_system_names
The names of the turbulence systems.
const std::vector< Real > _passive_scalar_equation_relaxation
The user-defined relaxation parameter(s) for the passive scalar equation(s)
const bool _has_solid_energy_system
Boolean for easy check if a solid energy system shall be solved or not.
Moose::PetscSupport::PetscOptions _passive_scalar_petsc_options
Options which hold the petsc settings for the passive scalar equation(s)
SIMPLESolverConfiguration _pressure_linear_control
Options for the linear solver of the pressure equation.
static InputParameters validParams()
std::vector< Real > _turbulence_field_relaxation
The user-defined relaxation parameter(s) for the turbulence field(s)
const std::vector< Real > _turbulence_absolute_tolerance
The user-defined absolute tolerance for determining the convergence turbulence variables.
const std::vector< Real > _momentum_absolute_tolerance
The user-defined absolute tolerance(s) for determining the convergence in momentum.
SIMPLESolverConfiguration _solid_energy_linear_control
Options for the linear solver of the energy equation.
void setupPressurePin()
Setup pressure pin if there is need for one.
const bool _has_passive_scalar_systems
Boolean for easy check if a passive scalar systems shall be solved or not.
std::vector< Real > _turbulence_field_min_limit
The user-defined lower limit for turbulent quantities e.g. k, eps/omega, etc..
Moose::PetscSupport::PetscOptions _pm_radiation_petsc_options
Options which hold the petsc settings for the participating media radiation equation(s)
const std::vector< SolverSystemName > & _pm_radiation_system_names
The names of the participating media radiation systems.
Moose::PetscSupport::PetscOptions _momentum_petsc_options
Options which hold the petsc settings for the momentum equation.
SIMPLESolveBase(Executioner &ex)
SIMPLESolverConfiguration _energy_linear_control
Options for the linear solver of the energy equation.
Moose::PetscSupport::PetscOptions _solid_energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
Moose::PetscSupport::PetscOptions _pressure_petsc_options
Options which hold the petsc settings for the pressure equation.
void checkDependentParameterError(const std::string &main_parameter, const std::vector< std::string > &dependent_parameters, const bool should_be_defined)
const std::vector< Real > _passive_scalar_absolute_tolerance
The user-defined absolute tolerance for determining the convergence in passive scalars.
SIMPLESolverConfiguration _turbulence_linear_control
Options for the linear solver of the turbulence equation(s)
const std::vector< SolverSystemName > & _momentum_system_names
The names of the momentum systems.
SIMPLESolverConfiguration _momentum_linear_control
Options for the linear solver of the momentum equation.
SIMPLESolverConfiguration _passive_scalar_linear_control
Options for the linear solver of the passive scalar equation(s)
const bool _pin_pressure
If the pressure needs to be pinned.
Moose::PetscSupport::PetscOptions _energy_petsc_options
Options which hold the petsc settings for the fluid energy equation.
const std::vector< Real > _pm_radiation_equation_relaxation
The user-defined relaxation parameter(s) for the participating media radiation equation(s)
FEProblemBase & _problem
std::map< std::string, int > int_valued_data
std::map< std::string, Real > real_valued_data
MultiMooseEnum getCommonPetscFlags()
MultiMooseEnum getCommonPetscKeys()
void addPetscFlagsToPetscOptions(const MultiMooseEnum &petsc_flags, std::string prefix, const ParallelParamObject &param_object, PetscOptions &petsc_options)
void addPetscPairsToPetscOptions(const std::vector< std::pair< MooseEnumItem, std::string > > &petsc_pair_options, const unsigned int mesh_dimension, std::string prefix, const ParallelParamObject &param_object, PetscOptions &petsc_options)
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.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...