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_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_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<Real>(
192 "energy_field_relaxation",
193 1.0,
194 "0.0<energy_field_relaxation<=1.0",
195 "The relaxation which should be used for the energy field. (=1 for no relaxation, "
196 "diagonal dominance will still be enforced)");
197
198 params.addRangeCheckedParam<unsigned int>(
199 "energy_l_max_its",
200 10000,
201 "0<energy_l_max_its",
202 "The maximum allowed iterations in the linear solver of the energy equation.");
203
205 "energy_equation_relaxation energy_petsc_options energy_petsc_options_iname "
206 "energy_petsc_options_value energy_absolute_tolerance "
207 "energy_l_tol energy_l_abs_tol energy_l_max_its",
208 "Energy Equation");
209
210 /*
211 * Parameters to control the solution of the solid energy equation
212 */
213
214 params.addParam<MultiMooseEnum>("solid_energy_petsc_options",
216 "Singleton PETSc options for the solid energy equation");
217 params.addParam<MultiMooseEnum>("solid_energy_petsc_options_iname",
219 "Names of PETSc name/value pairs for the solid energy equation");
220 params.addParam<std::vector<std::string>>(
221 "solid_energy_petsc_options_value",
222 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
223 "solid energy equation");
224
225 params.addRangeCheckedParam<Real>(
226 "solid_energy_absolute_tolerance",
227 1e-5,
228 "0.0<solid_energy_absolute_tolerance",
229 "The absolute tolerance on the normalized residual of the solid energy equation.");
230
231 params.addRangeCheckedParam<Real>("solid_energy_l_tol",
232 1e-5,
233 "0.0<=solid_energy_l_tol & solid_energy_l_tol<1.0",
234 "The relative tolerance on the normalized residual in the "
235 "linear solver of the solid energy equation.");
236
237 params.addRangeCheckedParam<Real>("solid_energy_l_abs_tol",
238 1e-10,
239 "0.0<solid_energy_l_abs_tol",
240 "The absolute tolerance on the normalized residual in the "
241 "linear solver of the solid energy equation.");
242 params.addRangeCheckedParam<unsigned int>(
243 "solid_energy_l_max_its",
244 10000,
245 "0<solid_energy_l_max_its",
246 "The maximum allowed iterations in the linear solver of the solid energy equation.");
247
248 params.addParamNamesToGroup("solid_energy_petsc_options solid_energy_petsc_options_iname "
249 "solid_energy_petsc_options_value solid_energy_absolute_tolerance "
250 "solid_energy_l_tol solid_energy_l_abs_tol solid_energy_l_max_its",
251 "Solid Energy Equation");
252
253 /*
254 * Parameters to control the solution of each scalar advection system
255 */
256 params.addParam<std::vector<Real>>("passive_scalar_equation_relaxation",
257 std::vector<Real>(),
258 "The relaxation which should be used for the passive scalar "
259 "equations. (=1 for no relaxation, "
260 "diagonal dominance will still be enforced)");
261
262 params.addParam<MultiMooseEnum>("passive_scalar_petsc_options",
264 "Singleton PETSc options for the passive scalar equation(s)");
265 params.addParam<MultiMooseEnum>(
266 "passive_scalar_petsc_options_iname",
268 "Names of PETSc name/value pairs for the passive scalar equation(s)");
269 params.addParam<std::vector<std::string>>(
270 "passive_scalar_petsc_options_value",
271 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
272 "passive scalar equation(s)");
273 params.addParam<std::vector<Real>>(
274 "passive_scalar_absolute_tolerance",
275 std::vector<Real>(),
276 "The absolute tolerance(s) on the normalized residual(s) of the passive scalar equation(s).");
277 params.addRangeCheckedParam<Real>("passive_scalar_l_tol",
278 1e-5,
279 "0.0<=passive_scalar_l_tol & passive_scalar_l_tol<1.0",
280 "The relative tolerance on the normalized residual in the "
281 "linear solver of the passive scalar equation(s).");
282 params.addRangeCheckedParam<Real>("passive_scalar_l_abs_tol",
283 1e-10,
284 "0.0<passive_scalar_l_abs_tol",
285 "The absolute tolerance on the normalized residual in the "
286 "linear solver of the passive scalar equation(s).");
287 params.addParam<unsigned int>(
288 "passive_scalar_l_max_its",
289 10000,
290 "The maximum allowed iterations in the linear solver of the turbulence equation.");
291
293 "passive_scalar_systems passive_scalar_equation_relaxation passive_scalar_petsc_options "
294 "passive_scalar_petsc_options_iname "
295 "passive_scalar_petsc_options_value "
296 "passive_scalar_absolute_tolerance "
297 "passive_scalar_l_tol passive_scalar_l_abs_tol passive_scalar_l_max_its",
298 "Passive Scalars Advection Equation");
299
300 /*
301 * Parameters to control the solution of each participating media radiation equation
302 */
303 params.addParam<std::vector<Real>>(
304 "pm_radiation_equation_relaxation",
305 std::vector<Real>(),
306 "The relaxation which should be used for the participating media radiation "
307 "equations. (=1 for no relaxation, "
308 "diagonal dominance will still be enforced)");
309
310 params.addParam<MultiMooseEnum>(
311 "pm_radiation_petsc_options",
313 "Singleton PETSc options for the participating media radiation equation(s)");
314 params.addParam<MultiMooseEnum>(
315 "pm_radiation_petsc_options_iname",
317 "Names of PETSc name/value pairs for the participating media radiation equation(s)");
318 params.addParam<std::vector<std::string>>(
319 "pm_radiation_petsc_options_value",
320 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
321 "participating media radiation equation(s)");
322 params.addParam<std::vector<Real>>("pm_radiation_absolute_tolerance",
323 std::vector<Real>(),
324 "The absolute tolerance(s) on the normalized residual(s) of "
325 "the participating media radiation equation(s).");
326 params.addRangeCheckedParam<Real>(
327 "pm_radiation_l_tol",
328 1e-5,
329 "0.0<=pm_radiation_l_tol & pm_radiation_l_tol<1.0",
330 "The relative tolerance on the normalized residual in the "
331 "linear solver of the participating media radiation equation(s).");
332 params.addRangeCheckedParam<Real>(
333 "pm_radiation_l_abs_tol",
334 1e-10,
335 "0.0<pm_radiation_l_abs_tol",
336 "The absolute tolerance on the normalized residual in the "
337 "linear solver of the participating media radiation equation(s).");
338 params.addParam<unsigned int>("pm_radiation_l_max_its",
339 10000,
340 "The maximum allowed iterations in the linear solver of the "
341 "participating media radiation equation.");
342
344 "pm_radiation_systems pm_radiation_equation_relaxation pm_radiation_petsc_options "
345 "pm_radiation_petsc_options_iname "
346 "pm_radiation_petsc_options_value "
347 "pm_radiation_absolute_tolerance "
348 "pm_radiation_l_tol pm_radiation_l_abs_tol pm_radiation_l_max_its",
349 "Participating Medium Radiation Equation");
350
351 /*
352 * Parameters to control the solution of each turbulence system
353 */
354 params.addParam<std::vector<Real>>("turbulence_equation_relaxation",
355 std::vector<Real>(),
356 "The relaxation which should be used for the turbulence "
357 "equations. (=1 for no relaxation, "
358 "diagonal dominance will still be enforced)");
359
360 params.addParam<std::vector<Real>>("turbulence_field_relaxation",
361 std::vector<Real>(),
362 "The relaxation which should be used for the turbulence "
363 "fields.");
364
365 params.addParam<std::vector<Real>>(
366 "turbulence_field_min_limit",
367 std::vector<Real>(),
368 "The lower limit imposed on turbulent quantities. The recommended value for robustness "
369 "is 1e-8. This is the imposed default if not set.");
370
371 params.addParam<MultiMooseEnum>("turbulence_petsc_options",
373 "Singleton PETSc options for the turbulence equation(s)");
374 params.addParam<MultiMooseEnum>("turbulence_petsc_options_iname",
376 "Names of PETSc name/value pairs for the turbulence equation(s)");
377 params.addParam<std::vector<std::string>>(
378 "turbulence_petsc_options_value",
379 "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\" for the "
380 "turbulence equation(s)");
381 params.addParam<std::vector<Real>>(
382 "turbulence_absolute_tolerance",
383 std::vector<Real>(),
384 "The absolute tolerance(s) on the normalized residual(s) of the turbulence equation(s).");
385 params.addRangeCheckedParam<Real>("turbulence_l_tol",
386 1e-5,
387 "0.0<=turbulence_l_tol & turbulence_l_tol<1.0",
388 "The relative tolerance on the normalized residual in the "
389 "linear solver of the turbulence equation(s).");
390 params.addRangeCheckedParam<Real>("turbulence_l_abs_tol",
391 1e-10,
392 "0.0<turbulence_l_abs_tol",
393 "The absolute tolerance on the normalized residual in the "
394 "linear solver of the turbulence equation(s).");
395 params.addParam<unsigned int>(
396 "turbulence_l_max_its",
397 10000,
398 "The maximum allowed iterations in the linear solver of the turbulence equation.");
399
400 params.addParamNamesToGroup("turbulence_systems "
401 "turbulence_equation_relaxation "
402 "turbulence_field_relaxation "
403 "turbulence_field_min_limit "
404 "turbulence_petsc_options "
405 "turbulence_petsc_options_iname "
406 "turbulence_petsc_options_value "
407 "turbulence_absolute_tolerance "
408 "turbulence_l_tol turbulence_l_abs_tol turbulence_l_max_its",
409 "Turbulence Equations");
410
411 /*
412 * SIMPLE iteration control
413 */
414
415 params.addRangeCheckedParam<unsigned int>(
416 "num_iterations",
417 1000,
418 "0<num_iterations",
419 "The number of momentum-pressure-(other fields) iterations needed.");
420
421 params.addParam<bool>("continue_on_max_its",
422 false,
423 "If solve should continue if maximum number of iterations is hit.");
424
425 return params;
426}
427
429 : SolveObject(ex),
431 _momentum_system_names(getParam<std::vector<SolverSystemName>>("momentum_systems")),
432 _momentum_l_abs_tol(getParam<Real>("momentum_l_abs_tol")),
433 _momentum_equation_relaxation(getParam<Real>("momentum_equation_relaxation")),
434 _pressure_system_name(getParam<SolverSystemName>("pressure_system")),
435 _pressure_l_abs_tol(getParam<Real>("pressure_l_abs_tol")),
436 _pressure_variable_relaxation(getParam<Real>("pressure_variable_relaxation")),
437 _pin_pressure(getParam<bool>("pin_pressure")),
438 _pressure_pin_value(getParam<Real>("pressure_pin_value")),
439 _pressure_pin_dof(libMesh::invalid_uint),
440 _has_energy_system(isParamValid("energy_system")),
441 _energy_equation_relaxation(getParam<Real>("energy_equation_relaxation")),
442 _energy_l_abs_tol(getParam<Real>("energy_l_abs_tol")),
443 _energy_field_relaxation(getParam<Real>("energy_field_relaxation")),
444 _has_solid_energy_system(_has_energy_system && isParamValid("solid_energy_system")),
445 _solid_energy_l_abs_tol(getParam<Real>("solid_energy_l_abs_tol")),
446 _passive_scalar_system_names(getParam<std::vector<SolverSystemName>>("passive_scalar_systems")),
447 _has_passive_scalar_systems(!_passive_scalar_system_names.empty()),
448 _passive_scalar_equation_relaxation(
449 getParam<std::vector<Real>>("passive_scalar_equation_relaxation")),
450 _passive_scalar_l_abs_tol(getParam<Real>("passive_scalar_l_abs_tol")),
451 _pm_radiation_system_names(getParam<std::vector<SolverSystemName>>("pm_radiation_systems")),
452 _has_pm_radiation_systems(!_pm_radiation_system_names.empty()),
453 _pm_radiation_equation_relaxation(
454 getParam<std::vector<Real>>("pm_radiation_equation_relaxation")),
455 _pm_radiation_l_abs_tol(getParam<Real>("pm_radiation_l_abs_tol")),
456 _turbulence_system_names(getParam<std::vector<SolverSystemName>>("turbulence_systems")),
457 _has_turbulence_systems(!_turbulence_system_names.empty()),
458 _turbulence_equation_relaxation(getParam<std::vector<Real>>("turbulence_equation_relaxation")),
459 _turbulence_field_relaxation(getParam<std::vector<Real>>("turbulence_field_relaxation")),
460 _turbulence_field_min_limit(getParam<std::vector<Real>>("turbulence_field_min_limit")),
461 _turbulence_l_abs_tol(getParam<Real>("turbulence_l_abs_tol")),
462 _momentum_absolute_tolerance(getParam<std::vector<Real>>("momentum_absolute_tolerance")),
463 _pressure_absolute_tolerance(getParam<Real>("pressure_absolute_tolerance")),
464 _energy_absolute_tolerance(getParam<Real>("energy_absolute_tolerance")),
465 _solid_energy_absolute_tolerance(getParam<Real>("solid_energy_absolute_tolerance")),
466 _passive_scalar_absolute_tolerance(
467 getParam<std::vector<Real>>("passive_scalar_absolute_tolerance")),
468 _pm_radiation_absolute_tolerance(
469 getParam<std::vector<Real>>("pm_radiation_absolute_tolerance")),
470 _turbulence_absolute_tolerance(getParam<std::vector<Real>>("turbulence_absolute_tolerance")),
471 _num_iterations(getParam<unsigned int>("num_iterations")),
472 _continue_on_max_its(getParam<bool>("continue_on_max_its")),
473 _print_fields(getParam<bool>("print_fields"))
474{
475 // The momentum absolute tolerances must either be given as a single value
476 // (applied to all components) or one value per momentum component.
479 paramError("momentum_absolute_tolerance",
480 "The number of momentum absolute tolerances must be one or match the number of "
481 "momentum systems.");
482
483 const auto & momentum_petsc_options = getParam<MultiMooseEnum>("momentum_petsc_options");
484 const auto & momentum_petsc_pair_options = getParam<MooseEnumItem, std::string>(
485 "momentum_petsc_options_iname", "momentum_petsc_options_value");
487 momentum_petsc_options, "", *this, _momentum_petsc_options);
489 momentum_petsc_pair_options, _problem.mesh().dimension(), "", *this, _momentum_petsc_options);
490
491 _momentum_linear_control.real_valued_data["rel_tol"] = getParam<Real>("momentum_l_tol");
492 _momentum_linear_control.real_valued_data["abs_tol"] = getParam<Real>("momentum_l_abs_tol");
494 getParam<unsigned int>("momentum_l_max_its");
495
496 const auto & pressure_petsc_options = getParam<MultiMooseEnum>("pressure_petsc_options");
497 const auto & pressure_petsc_pair_options = getParam<MooseEnumItem, std::string>(
498 "pressure_petsc_options_iname", "pressure_petsc_options_value");
500 pressure_petsc_options, "", *this, _pressure_petsc_options);
502 pressure_petsc_pair_options, _problem.mesh().dimension(), "", *this, _pressure_petsc_options);
503
504 _pressure_linear_control.real_valued_data["rel_tol"] = getParam<Real>("pressure_l_tol");
505 _pressure_linear_control.real_valued_data["abs_tol"] = getParam<Real>("pressure_l_abs_tol");
507 getParam<unsigned int>("pressure_l_max_its");
508
510 {
511 const auto & energy_petsc_options = getParam<MultiMooseEnum>("energy_petsc_options");
512 const auto & energy_petsc_pair_options = getParam<MooseEnumItem, std::string>(
513 "energy_petsc_options_iname", "energy_petsc_options_value");
515 energy_petsc_options, "", *this, _energy_petsc_options);
517 energy_petsc_pair_options, _problem.mesh().dimension(), "", *this, _energy_petsc_options);
518
519 _energy_linear_control.real_valued_data["rel_tol"] = getParam<Real>("energy_l_tol");
520 _energy_linear_control.real_valued_data["abs_tol"] = getParam<Real>("energy_l_abs_tol");
521 _energy_linear_control.int_valued_data["max_its"] = getParam<unsigned int>("energy_l_max_its");
522 }
523 else
524 checkDependentParameterError("energy_system",
525 {"energy_petsc_options",
526 "energy_petsc_options_iname",
527 "energy_petsc_options_value",
528 "energy_l_tol",
529 "energy_l_abs_tol",
530 "energy_l_max_its",
531 "energy_absolute_tolerance",
532 "energy_equation_relaxation"},
533 false);
534
536 {
537 const auto & solid_energy_petsc_options =
538 getParam<MultiMooseEnum>("solid_energy_petsc_options");
539 const auto & solid_energy_petsc_pair_options = getParam<MooseEnumItem, std::string>(
540 "solid_energy_petsc_options_iname", "solid_energy_petsc_options_value");
542 solid_energy_petsc_options, "", *this, _solid_energy_petsc_options);
543 Moose::PetscSupport::addPetscPairsToPetscOptions(solid_energy_petsc_pair_options,
545 "",
546 *this,
548
549 _solid_energy_linear_control.real_valued_data["rel_tol"] = getParam<Real>("solid_energy_l_tol");
551 getParam<Real>("solid_energy_l_abs_tol");
553 getParam<unsigned int>("solid_energy_l_max_its");
554 }
555 else
556 checkDependentParameterError("solid_energy_system",
557 {"solid_energy_petsc_options",
558 "solid_energy_petsc_options_iname",
559 "solid_energy_petsc_options_value",
560 "solid_energy_l_tol",
561 "solid_energy_l_abs_tol",
562 "solid_energy_l_max_its",
563 "solid_energy_absolute_tolerance",
564 "solid_energy_equation_relaxation"},
565 false);
566
567 // We check for input errors with regards to the participating media radiation equations. At the
568 // same time, we set up the corresponding system numbers
570 {
572 paramError("pm_radiation_equation_relaxation",
573 "The number of equation relaxation parameters does not match the number of "
574 "participating media radiation equations!");
576 paramError("pm_radiation_absolute_tolerance",
577 "The number of absolute tolerances does not match the number of "
578 "participating media radiation equations!");
579 }
581 {
582 const auto & pm_radiation_petsc_options =
583 getParam<MultiMooseEnum>("pm_radiation_petsc_options");
584 const auto & pm_radiation_petsc_pair_options = getParam<MooseEnumItem, std::string>(
585 "pm_radiation_petsc_options_iname", "pm_radiation_petsc_options_value");
587 pm_radiation_petsc_options, "", *this, _pm_radiation_petsc_options);
588 Moose::PetscSupport::addPetscPairsToPetscOptions(pm_radiation_petsc_pair_options,
590 "",
591 *this,
593
594 _pm_radiation_linear_control.real_valued_data["rel_tol"] = getParam<Real>("pm_radiation_l_tol");
596 getParam<Real>("pm_radiation_l_abs_tol");
598 getParam<unsigned int>("pm_radiation_l_max_its");
599 }
600 else
601 checkDependentParameterError("pm_radiation_systems",
602 {"pm_radiation_petsc_options",
603 "pm_radiation_petsc_options_iname",
604 "pm_radiation_petsc_options_value",
605 "pm_radiation_l_tol",
606 "pm_radiation_l_abs_tol",
607 "pm_radiation_l_max_its",
608 "pm_radiation_equation_relaxation",
609 "pm_radiation_absolute_tolerance"},
610 false);
611
612 // We check for input errors with regards to the passive scalar equations. At the same time, we
613 // set up the corresponding system numbers
615 {
617 paramError("passive_scalar_equation_relaxation",
618 "The number of equation relaxation parameters does not match the number of "
619 "passive scalar equations!");
621 paramError("passive_scalar_absolute_tolerance",
622 "The number of absolute tolerances does not match the number of "
623 "passive scalar equations!");
624 }
626 {
627 const auto & passive_scalar_petsc_options =
628 getParam<MultiMooseEnum>("passive_scalar_petsc_options");
629 const auto & passive_scalar_petsc_pair_options = getParam<MooseEnumItem, std::string>(
630 "passive_scalar_petsc_options_iname", "passive_scalar_petsc_options_value");
632 passive_scalar_petsc_options, "", *this, _passive_scalar_petsc_options);
633 Moose::PetscSupport::addPetscPairsToPetscOptions(passive_scalar_petsc_pair_options,
635 "",
636 *this,
638
640 getParam<Real>("passive_scalar_l_tol");
642 getParam<Real>("passive_scalar_l_abs_tol");
644 getParam<unsigned int>("passive_scalar_l_max_its");
645 }
646 else
647 checkDependentParameterError("passive_scalar_systems",
648 {"passive_scalar_petsc_options",
649 "passive_scalar_petsc_options_iname",
650 "passive_scalar_petsc_options_value",
651 "passive_scalar_l_tol",
652 "passive_scalar_l_abs_tol",
653 "passive_scalar_l_max_its",
654 "passive_scalar_equation_relaxation",
655 "passive_scalar_absolute_tolerance"},
656 false);
657
658 // We check for input errors with regards to the surrogate turbulence equations. At the same time,
659 // we set up the corresponding system numbers
661 {
663 paramError("turbulence_equation_relaxation",
664 "The number of equation relaxation parameters does not match the number of "
665 "turbulence equations!");
667 paramError("turbulence_absolute_tolerance",
668 "The number of absolute tolerances does not match the number of "
669 "turbulence equations!");
670 if (_turbulence_field_min_limit.empty())
671 // If no minimum bounds are given, initialize to default value 1e-8
673
674 // Assign turbulence field relaxation as 1.0 if not defined
677
678 const auto & turbulence_petsc_options = getParam<MultiMooseEnum>("turbulence_petsc_options");
679 const auto & turbulence_petsc_pair_options = getParam<MooseEnumItem, std::string>(
680 "turbulence_petsc_options_iname", "turbulence_petsc_options_value");
682 turbulence_petsc_options, "", *this, _turbulence_petsc_options);
683 Moose::PetscSupport::addPetscPairsToPetscOptions(turbulence_petsc_pair_options,
685 "",
686 *this,
688
689 _turbulence_linear_control.real_valued_data["rel_tol"] = getParam<Real>("turbulence_l_tol");
690 _turbulence_linear_control.real_valued_data["abs_tol"] = getParam<Real>("turbulence_l_abs_tol");
692 getParam<unsigned int>("turbulence_l_max_its");
693 }
694 else
695 checkDependentParameterError("turbulence_systems",
696 {"turbulence_petsc_options",
697 "turbulence_petsc_options_iname",
698 "turbulence_petsc_options_value",
699 "turbulence_l_tol",
700 "turbulence_l_abs_tol",
701 "turbulence_l_max_its",
702 "turbulence_equation_relaxation",
703 "turbulence_field_relaxation",
704 "turbulence_field_min_limit",
705 "turbulence_absolute_tolerance"},
706 false);
707}
708
709void
711{
712 if (_pin_pressure)
714 _problem.mesh(),
715 getParam<Point>("pressure_pin_point"));
716}
717
718void
719SIMPLESolveBase::checkDependentParameterError(const std::string & main_parameter,
720 const std::vector<std::string> & dependent_parameters,
721 const bool should_be_defined)
722{
723 for (const auto & param : dependent_parameters)
724 if (parameters().isParamSetByUser(param) == !should_be_defined)
725 paramError(param,
726 "This parameter should " + std::string(should_be_defined ? "" : "not") +
727 " be given by the user with the corresponding " + main_parameter +
728 " setting!");
729}
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...