https://mooseframework.inl.gov
Loading...
Searching...
No Matches
WCNSFVTurbulencePhysics.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
11#include "WCNSFVFlowPhysics.h"
16#include "INSFVTKESourceSink.h"
17#include "NSFVBase.h"
18#include "MooseMesh.h"
19
21
24{
27 "Define a turbulence model for a incompressible or weakly-compressible Navier Stokes "
28 "flow with a finite volume discretization");
29
30 // TODO Added to facilitate transition, remove default once NavierStokesFV action is removed
31 params.addParam<AuxVariableName>(
32 "mixing_length_name", "mixing_length", "Name of the mixing length auxiliary variable");
33 params.transferParam<bool>(NSFVBase::validParams(), "mixing_length_two_term_bc_expansion");
34
35 // K-Epsilon numerical scheme parameters
36 params.addRangeCheckedParam<Real>(
37 "tke_scaling",
38 1.0,
39 "tke_scaling > 0.0",
40 "The scaling factor for the turbulent kinetic energy equation.");
41 params.addRangeCheckedParam<Real>(
42 "tked_scaling",
43 1.0,
44 "tked_scaling > 0.0",
45 "The scaling factor for the turbulent kinetic energy dissipation equation.");
46
47 // Better Jacobian if not linearizing sink and sources
48 params.addParam<bool>("linearize_sink_sources", false, "Whether to linearize the source term");
49 // Better convergence on some cases when neglecting advection derivatives
50 params.addParam<bool>(
51 "neglect_advection_derivatives",
52 false,
53 "Whether to remove the off-diagonal velocity term in the TKE and TKED advection term");
54 MooseEnum coeff_interp_method("average harmonic", "harmonic");
55 params.addParam<MooseEnum>("turbulent_viscosity_interp_method",
56 coeff_interp_method,
57 "Face interpolation method for the turbulent viscosity");
58
59 params.addParamNamesToGroup("tke_scaling tked_scaling "
60 "turbulent_viscosity_interp_method linearize_sink_sources",
61 "K-Epsilon model numerical");
62
63 return params;
64}
65
67 : WCNSFVTurbulencePhysicsBase(parameters),
68 _mixing_length_name(getParam<AuxVariableName>("mixing_length_name"))
69{
70 // Keep track of the variable names, for loading variables from files notably
71 if (_turbulence_model == "mixing-length")
73
74 // Parameter checks
75 if (_turbulence_model != "mixing-length")
76 errorDependentParameter("turbulence_handling",
77 "mixing-length",
78 {"mixing_length_delta",
79 "mixing_length_aux_execute_on",
80 "von_karman_const",
81 "von_karman_const_0",
82 "mixing_length_two_term_bc_expansion"});
83}
84
85void
87{
88 if (_turbulence_model == "k-epsilon")
89 getProblem().needSolutionState(2, Moose::SolutionIterationType::Nonlinear);
90}
91
92void
94{
95 if (_turbulence_model == "mixing-length" || _turbulence_model == "none")
96 return;
97 else if (_turbulence_model == "k-epsilon")
98 {
99 // Dont add if the user already defined the variable
100 // Add turbulent kinetic energy variable
101 if (!shouldCreateVariable(_tke_name, _blocks, /*error if aux*/ true))
103 {"system_names", "tke_scaling", "tke_face_interpolation", "tke_two_term_bc_expansion"},
104 "INSFVEnergyVariable");
105 else if (_define_variables)
106 {
107 auto params = getFactory().getValidParams("INSFVEnergyVariable");
108 assignBlocks(params, _blocks);
109 params.set<std::vector<Real>>("scaling") = {getParam<Real>("tke_scaling")};
110 params.set<MooseEnum>("face_interp_method") = getParam<MooseEnum>("tke_face_interpolation");
111 params.set<bool>("two_term_boundary_expansion") = getParam<bool>("tke_two_term_bc_expansion");
112 params.set<SolverSystemName>("solver_sys") = getSolverSystem(_tke_name);
113
114 getProblem().addVariable("INSFVEnergyVariable", _tke_name, params);
115 }
116 else
117 paramError("turbulence_kinetic_energy_variable",
118 "Variable (" + _tke_name +
119 ") supplied to the WCNSFVTurbulencePhysics does not exist!");
120
121 // Add turbulent kinetic energy dissipation variable
122 if (!shouldCreateVariable(_tked_name, _blocks, /*error if aux*/ true))
124 {"system_names", "tked_scaling", "tked_face_interpolation", "tked_two_term_bc_expansion"},
125 "INSFVEnergyVariable");
126 else if (_define_variables)
127 {
128 auto params = getFactory().getValidParams("INSFVEnergyVariable");
129 assignBlocks(params, _blocks);
130 params.set<std::vector<Real>>("scaling") = {getParam<Real>("tked_scaling")};
131 params.set<MooseEnum>("face_interp_method") = getParam<MooseEnum>("tked_face_interpolation");
132 params.set<bool>("two_term_boundary_expansion") =
133 getParam<bool>("tked_two_term_bc_expansion");
134 params.set<SolverSystemName>("solver_sys") = getSolverSystem(_tked_name);
135 getProblem().addVariable("INSFVEnergyVariable", _tked_name, params);
136 }
137 else
138 paramError("turbulence_kinetic_energy_dissipation_variable",
139 "Variable (" + _tked_name +
140 ") supplied to the WCNSFVTurbulencePhysics does not exist!");
141 }
142}
143
144void
146{
147 if (_turbulence_model == "mixing-length" && _define_variables)
148 {
149 auto params = getFactory().getValidParams("MooseVariableFVReal");
150 assignBlocks(params, _blocks);
151 if (isParamValid("mixing_length_two_term_bc_expansion"))
152 params.set<bool>("two_term_boundary_expansion") =
153 getParam<bool>("mixing_length_two_term_bc_expansion");
154 if (!shouldCreateVariable(_mixing_length_name, _blocks, /*error if aux*/ false))
155 reportPotentiallyMissedParameters({"mixing_length_two_term_bc_expansion"},
156 "MooseVariableFVReal");
157 else
158 getProblem().addAuxVariable("MooseVariableFVReal", _mixing_length_name, params);
159 }
161}
162
163void
165{
166 if (_turbulence_model == "none")
167 return;
168
169 // Turbulence terms in other equations
176
177 // Turbulence models with their own set of equations
178 if (_turbulence_model == "k-epsilon")
179 {
180 if (isTransient())
185 }
186}
187
188void
190{
191 if (_turbulence_model == "mixing-length")
192 {
193 const std::string u_names[3] = {"u", "v", "w"};
194 const std::string kernel_type = "INSFVMixingLengthReynoldsStress";
195 InputParameters params = getFactory().getValidParams(kernel_type);
196 assignBlocks(params, _blocks);
197 params.set<MooseFunctorName>(NS::density) = _density_name;
198 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
199
200 std::string kernel_name = prefix() + "ins_momentum_mixing_length_reynolds_stress_";
202 kernel_name = prefix() + "pins_momentum_mixing_length_reynolds_stress_";
203
204 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
205 for (const auto dim_i : make_range(dimension()))
206 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
207
208 for (const auto d : make_range(dimension()))
209 {
210 params.set<NonlinearVariableName>("variable") = _velocity_names[d];
211 params.set<MooseEnum>("momentum_component") = NS::directions[d];
212
213 getProblem().addFVKernel(kernel_type, kernel_name + NS::directions[d], params);
214 }
215 }
216 else if (_turbulence_model == "k-epsilon")
217 {
218 // We rely on using the turbulent viscosity in the flow equation
219 // This check is rudimentary, we should think of a better way
220 // We could also check for the use of 'mu_t' with the right parameters already
222 !MooseUtils::isFloat(_flow_equations_physics->dynamicViscosityName()))
224 "Regular fluid viscosity 'mu' should be used for the momentum diffusion term. You are "
225 "currently using: " +
227
228 const std::string u_names[3] = {"u", "v", "w"};
229 const std::string kernel_type = "INSFVMomentumDiffusion";
230 InputParameters params = getFactory().getValidParams(kernel_type);
231 assignBlocks(params, _blocks);
232 params.set<MooseFunctorName>("mu") = _turbulent_viscosity_name;
233 params.set<MooseEnum>("mu_interp_method") =
234 getParam<MooseEnum>("turbulent_viscosity_interp_method");
235 params.set<MooseEnum>("variable_interp_method") =
237 params.set<bool>("complete_expansion") = true;
239 params.set<bool>("include_isotropic_viscous_stress") = true;
240
241 std::string kernel_name = prefix() + "ins_momentum_k_epsilon_reynolds_stress_";
243 kernel_name = prefix() + "pins_momentum_k_epsilon_reynolds_stress_";
244
245 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
246 for (const auto dim_i : make_range(dimension()))
247 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
248
249 for (const auto d : make_range(dimension()))
250 {
251 params.set<NonlinearVariableName>("variable") = _velocity_names[d];
252 params.set<MooseEnum>("momentum_component") = NS::directions[d];
253
254 getProblem().addFVKernel(kernel_type, kernel_name + NS::directions[d], params);
255 }
256
257 // We only add it here because the mixing length kernels deal with this
258 // withn the kernel. For mixing length see issue: #32112
261 }
262}
263
264void
266{
267 if (_turbulence_model == "none")
268 return;
270 return;
272 return;
273
274 const auto rz_blocks = _flow_equations_physics->getAxisymmetricRZBlocks();
275 if (rz_blocks.empty())
276 return;
277
278 const auto radial_index =
280
281 InputParameters params = getFactory().getValidParams("INSFVMomentumViscousSourceRZ");
282 assignBlocks(params, rz_blocks);
283 params.set<MooseFunctorName>(NS::mu) = _turbulent_viscosity_name;
284 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
285 params.set<MooseEnum>("momentum_component") = NS::directions[radial_index];
286 params.set<bool>("complete_expansion") =
288 params.set<NonlinearVariableName>("variable") =
290
291 getProblem().addFVKernel("INSFVMomentumViscousSourceRZ",
292 prefix() + "ins_momentum_turbulent_viscous_source_rz_" +
293 NS::directions[radial_index],
294 params);
295}
296
297void
299{
300 if (_turbulence_model == "mixing-length")
301 {
302 const std::string u_names[3] = {"u", "v", "w"};
303 const std::string kernel_type = "WCNSFVMixingLengthEnergyDiffusion";
304 InputParameters params = getFactory().getValidParams(kernel_type);
305 assignBlocks(params, _blocks);
306 params.set<MooseFunctorName>(NS::density) = _density_name;
307 params.set<MooseFunctorName>(NS::cp) = _fluid_energy_physics->getSpecificHeatName();
308 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
309 params.set<Real>("schmidt_number") = getParam<Real>("turbulent_prandtl");
310 params.set<NonlinearVariableName>("variable") =
312
313 for (const auto dim_i : make_range(dimension()))
314 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
315
318 kernel_type, prefix() + "pins_energy_mixing_length_diffusion", params);
319 else
321 kernel_type, prefix() + "ins_energy_mixing_length_diffusion", params);
322 }
323 else if (_turbulence_model == "k-epsilon")
324 {
325 const std::string kernel_type = "FVDiffusion";
326 const auto T_fluid_name = _flow_equations_physics->getFluidTemperatureName();
327 InputParameters params = getFactory().getValidParams(kernel_type);
328 assignBlocks(params, _blocks);
329 params.set<NonlinearVariableName>("variable") = T_fluid_name;
330 params.set<MooseFunctorName>("coeff") = NS::k_t;
331 getProblem().addFVKernel(kernel_type, prefix() + T_fluid_name + "_turbulent_diffusion", params);
332 }
333}
334
335void
337{
338 const auto & passive_scalar_names = _scalar_transport_physics->getAdvectedScalarNames();
339 const auto & passive_scalar_schmidt_number = getParam<std::vector<Real>>("Sc_t");
340 if (passive_scalar_schmidt_number.size() != passive_scalar_names.size() &&
341 passive_scalar_schmidt_number.size() != 1)
343 "Sc_t",
344 "The number of turbulent Schmidt numbers defined is not equal to the number of passive "
345 "scalar fields!");
346
347 if (_turbulence_model == "mixing-length")
348 {
349 const std::string u_names[3] = {"u", "v", "w"};
350 const std::string kernel_type = "INSFVMixingLengthScalarDiffusion";
351 InputParameters params = getFactory().getValidParams(kernel_type);
352 assignBlocks(params, _blocks);
353 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
354 for (const auto dim_i : make_range(dimension()))
355 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
356
357 for (const auto & name_i : index_range(passive_scalar_names))
358 {
359 params.set<NonlinearVariableName>("variable") = passive_scalar_names[name_i];
360 if (passive_scalar_schmidt_number.size() > 1)
361 params.set<Real>("schmidt_number") = passive_scalar_schmidt_number[name_i];
362 else if (passive_scalar_schmidt_number.size() == 1)
363 params.set<Real>("schmidt_number") = passive_scalar_schmidt_number[0];
364 else
365 params.set<Real>("schmidt_number") = 1.0;
366
368 kernel_type, prefix() + passive_scalar_names[name_i] + "_mixing_length", params);
369 }
370 }
371 else if (_turbulence_model == "k-epsilon")
372 {
373 const std::string kernel_type = "FVDiffusion";
374 InputParameters params = getFactory().getValidParams(kernel_type);
375 assignBlocks(params, _blocks);
376
377 for (const auto & name_i : index_range(passive_scalar_names))
378 {
379 params.set<NonlinearVariableName>("variable") = passive_scalar_names[name_i];
380 params.set<MooseFunctorName>("coeff") = NS::mu_t_passive_scalar;
382 kernel_type, prefix() + passive_scalar_names[name_i] + "_turbulent_diffusion", params);
383 }
384 }
385}
386
387void
389{
390 const std::string kernel_type = "FVFunctorTimeKernel";
391 InputParameters params = getFactory().getValidParams(kernel_type);
392 assignBlocks(params, _blocks);
393
394 params.set<NonlinearVariableName>("variable") = _tke_name;
395 if (shouldCreateTimeDerivative(_tke_name, _blocks, /*error if already defined*/ false))
396 getProblem().addFVKernel(kernel_type, prefix() + "tke_time", params);
397 params.set<NonlinearVariableName>("variable") = _tked_name;
398 if (shouldCreateTimeDerivative(_tked_name, _blocks, /*error if already defined*/ false))
399 getProblem().addFVKernel(kernel_type, prefix() + "tked_time", params);
400}
401
402void
404{
405 const std::string kernel_type = "INSFVTurbulentAdvection";
406 InputParameters params = getFactory().getValidParams(kernel_type);
407
408 assignBlocks(params, _blocks);
409
410 params.set<MooseEnum>("velocity_interp_method") = _velocity_interpolation;
411 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
412 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
413 params.set<bool>("neglect_advection_derivatives") =
414 getParam<bool>("neglect_advection_derivatives");
415
416 params.set<MooseEnum>("advected_interp_method") =
417 getParam<MooseEnum>("tke_advection_interpolation");
418 params.set<NonlinearVariableName>("variable") = _tke_name;
419 getProblem().addFVKernel(kernel_type, prefix() + "tke_advection", params);
420 params.set<NonlinearVariableName>("variable") = _tked_name;
421 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
422 params.set<MooseEnum>("advected_interp_method") =
423 getParam<MooseEnum>("tked_advection_interpolation");
424 getProblem().addFVKernel(kernel_type, prefix() + "tked_advection", params);
425}
426
427void
429{
430 {
431 const std::string kernel_type = "INSFVTurbulentDiffusion";
432 InputParameters params = getFactory().getValidParams(kernel_type);
433 assignBlocks(params, _blocks);
434
435 params.set<NonlinearVariableName>("variable") = _tke_name;
436 params.set<MooseFunctorName>("coeff") = _flow_equations_physics->dynamicViscosityName();
437 getProblem().addFVKernel(kernel_type, prefix() + "tke_diffusion_mu", params);
438
439 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
440 params.set<NonlinearVariableName>("variable") = _tked_name;
441 getProblem().addFVKernel(kernel_type, prefix() + "tked_diffusion_mu", params);
442 }
443
444 {
445 const std::string kernel_type = "INSFVTurbulentDiffusion";
446 InputParameters params = getFactory().getValidParams(kernel_type);
447 assignBlocks(params, _blocks);
448
449 params.set<NonlinearVariableName>("variable") = _tke_name;
450 params.set<MooseFunctorName>("coeff") = _turbulent_viscosity_name;
451 params.set<MooseFunctorName>("scaling_coef") = getParam<MooseFunctorName>("sigma_k");
452 params.set<MooseEnum>("coeff_interp_method") =
453 getParam<MooseEnum>("turbulent_viscosity_interp_method");
454 getProblem().addFVKernel(kernel_type, prefix() + "tke_diffusion_mu_turb", params);
455
456 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
457 params.set<NonlinearVariableName>("variable") = _tked_name;
458 params.set<MooseFunctorName>("scaling_coef") = getParam<MooseFunctorName>("sigma_eps");
459 getProblem().addFVKernel(kernel_type, prefix() + "tked_diffusion_mu_turb", params);
460 }
461}
462
463void
465{
466 const std::string u_names[3] = {"u", "v", "w"};
467 {
468 const std::string kernel_type = "INSFVTKESourceSink";
469 InputParameters params = getFactory().getValidParams(kernel_type);
470 assignBlocks(params, _blocks);
471 params.set<NonlinearVariableName>("variable") = _tke_name;
472 params.set<MooseFunctorName>(NS::TKED) = _tked_name;
473 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
474 params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
475 params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
476 params.set<Real>("C_mu") = getParam<Real>("C_mu");
477 params.set<Real>("C_pl") = getParam<Real>("C_pl");
478 params.set<bool>("linearized_model") = getParam<bool>("linearize_sink_sources");
479 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
480 params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
481 // Currently only Newton method for WCNSFVTurbulencePhysics
482 params.set<bool>("newton_solve") = true;
483 for (const auto d : make_range(dimension()))
484 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
485 getProblem().addFVKernel(kernel_type, prefix() + "tke_source_sink", params);
486 }
487
488 {
489 const std::string kernel_type = "INSFVTKEDSourceSink";
490 InputParameters params = getFactory().getValidParams(kernel_type);
491 assignBlocks(params, _blocks);
492 params.set<NonlinearVariableName>("variable") = _tked_name;
493 params.set<MooseFunctorName>(NS::TKE) = _tke_name;
494 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
495 params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
496 params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
497 params.set<Real>("C_mu") = getParam<Real>("C_mu");
498 params.set<Real>("C_pl") = getParam<Real>("C_pl");
499 params.set<bool>("linearized_model") = getParam<bool>("linearize_sink_sources");
500 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
501 params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
502 params.set<MooseFunctorName>("C1_eps") = getParam<MooseFunctorName>("C1_eps");
503 params.set<MooseFunctorName>("C2_eps") = getParam<MooseFunctorName>("C2_eps");
504 // Currently only Newton method for WCNSFVTurbulencePhysics
505 params.set<bool>("newton_solve") = true;
506 for (const auto d : make_range(dimension()))
507 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
508 getProblem().addFVKernel(kernel_type, prefix() + "tked_source_sink", params);
509 }
510}
511
512void
514{
516
517 // Note that if we are restarting this will overwrite the restarted mixing-length
518 if (_turbulence_model == "mixing-length")
519 {
520 const std::string ml_kernel_type = "WallDistanceMixingLengthAux";
521 InputParameters ml_params = getFactory().getValidParams(ml_kernel_type);
522 assignBlocks(ml_params, _blocks);
523 ml_params.set<AuxVariableName>("variable") = _mixing_length_name;
524 ml_params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
525 if (parameters().isParamValid("mixing_length_aux_execute_on"))
526 ml_params.set<ExecFlagEnum>("execute_on") =
527 getParam<ExecFlagEnum>("mixing_length_aux_execute_on");
528 else
529 ml_params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
530 ml_params.set<MooseFunctorName>("von_karman_const") =
531 getParam<MooseFunctorName>("von_karman_const");
532 ml_params.set<MooseFunctorName>("von_karman_const_0") =
533 getParam<MooseFunctorName>("von_karman_const_0");
534 ml_params.set<MooseFunctorName>("delta") = getParam<MooseFunctorName>("mixing_length_delta");
535
536 getProblem().addAuxKernel(ml_kernel_type, prefix() + "mixing_length_aux ", ml_params);
537 }
538}
539
540void
542{
543 const std::string u_names[3] = {"u", "v", "w"};
544
545 if (_turbulence_model == "k-epsilon" && getParam<bool>("mu_t_as_aux_variable"))
546 {
547 mooseAssert(_flow_equations_physics, "Should have a flow equation physics");
548 const std::string bc_type = "INSFVTurbulentViscosityWallFunction";
549 InputParameters params = getFactory().getValidParams(bc_type);
550 params.set<std::vector<BoundaryName>>("boundary") = _turbulence_walls;
551 params.set<NonlinearVariableName>("variable") = _turbulent_viscosity_name;
552 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
553 params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
554 params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
555 params.set<MooseFunctorName>(NS::TKE) = _tke_name;
556 params.set<Real>("C_mu") = getParam<Real>("C_mu");
557 params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
558 for (const auto d : make_range(dimension()))
559 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
560
561 getProblem().addFVBC(bc_type, prefix() + "turbulence_walls", params);
562 // Energy wall function boundary conditions are added in the WCNSFVFluidEnergyPhysics
563 // because it facilitates counting the number of walls, specifying energy wall functors
564 // the same way as for boundary conditions
565 }
566}
567
568void
570{
571 if (_turbulence_model == "mixing-length")
572 {
573 const std::string u_names[3] = {"u", "v", "w"};
574 InputParameters params =
575 getFactory().getValidParams("MixingLengthTurbulentViscosityFunctorMaterial");
576 assignBlocks(params, _blocks);
577
578 for (const auto d : make_range(dimension()))
579 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
580
581 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
582 params.set<MooseFunctorName>(NS::density) = _density_name;
583 params.set<MooseFunctorName>(NS::mu) = _dynamic_viscosity_name;
584
585 getProblem().addMaterial("MixingLengthTurbulentViscosityFunctorMaterial",
586 prefix() + "mixing_length_material",
587 params);
588 }
590}
591
592unsigned short
594{
596 // due to the computation of the eddy-diffusivity from the strain tensor
597 if (_turbulence_model == "mixing-length")
598 ghost_layers = std::max(ghost_layers, (unsigned short)3);
599 return ghost_layers;
600}
const ExecFlagType EXEC_TIMESTEP_END
const ExecFlagType EXEC_INITIAL
registerWCNSFVTurbulenceBaseTasks("NavierStokesApp", WCNSFVTurbulencePhysics)
void needSolutionState(unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
virtual void addFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters &parameters)
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
virtual MooseMesh & mesh() override
virtual void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
virtual void addFVKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
void errorDependentParameter(const std::string &param1, const std::string &value_not_set, const std::vector< std::string > &dependent_params) const
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
void transferParam(const InputParameters &source_param, const std::string &name, const std::string &new_name="", const std::string &new_description="")
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
bool isParamValid(const std::string &name) const
const InputParameters & parameters() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
unsigned int getAxisymmetricRadialCoord() const
static InputParameters validParams()
Definition NSFVBase.C:371
bool _define_variables
Whether to define variables if they do not exist.
virtual FEProblemBase & getProblem()
Factory & getFactory()
bool shouldCreateTimeDerivative(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_already_defined) const
void assignBlocks(InputParameters &params, const std::vector< SubdomainName > &blocks) const
unsigned int dimension() const
void reportPotentiallyMissedParameters(const std::vector< std::string > &param_names, const std::string &object_type, const std::string &object_name="") const
std::string prefix() const
const SolverSystemName & getSolverSystem(unsigned int variable_index) const
void saveAuxVariableName(const VariableName &var_name)
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
bool isTransient() const
std::vector< SubdomainName > _blocks
const WCNSFVFlowPhysicsBase * _flow_equations_physics
Flow physics.
const MooseFunctorName _dynamic_viscosity_name
Name of the dynamic viscosity material property.
const std::vector< std::string > _velocity_names
Velocity names.
const bool _porous_medium_treatment
Switch to show if porous medium treatment is requested or not.
const MooseEnum _velocity_interpolation
The velocity / momentum face interpolation method for advecting other quantities.
const MooseFunctorName _density_name
Name of the density material property.
bool hasFlowEquations() const
Whether the physics is actually creating the flow equations.
const std::vector< std::string > & getVelocityNames() const
To interface with other Physics.
bool includeIsotropicStress() const
Whether to include the isotropic viscous stress contribution.
std::vector< SubdomainName > getAxisymmetricRZBlocks() const
Return the set of blocks restricted to an RZ coordinate system.
const NonlinearVariableName & getFluidTemperatureName() const
const MooseFunctorName & dynamicViscosityName() const
Return the name of the dynamic viscosity functor.
const UserObjectName & rhieChowUOName() const
Return the name of the Rhie Chow user object.
const MooseEnum & getMomentumFaceInterpolationMethod() const
Get the face interpolation method for momentum (mostly used in the stress terms)
bool addAxisymmetricViscousSourceEnabled() const
Whether the cylindrical viscous source helper is enabled.
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of algebraic ghosting layers needed.
const MooseFunctorName & densityName() const
Return the name of the density functor.
bool includeSymmetrizedViscousStress() const
Whether to include the symmetrized contribution in the viscous stress.
const MooseFunctorName & getSpecificHeatName() const
Get the name of the specific heat material property.
const std::vector< NonlinearVariableName > & getAdvectedScalarNames() const
Get the names of the advected scalar quantity variables.
Base class for a Physics that creates all the objects needed to add a turbulence model to an incompre...
std::vector< BoundaryName > _turbulence_walls
List of boundaries to act as walls for turbulence models.
const VariableName _tke_name
Name of the turbulent kinetic energy.
virtual void addAuxiliaryVariables() override
const WCNSFVScalarTransportPhysicsBase * _scalar_transport_physics
The scalar advection physics to add turbulent mixing for.
const WCNSFVFluidHeatTransferPhysicsBase * _fluid_energy_physics
The heat advection physics to add turbulent mixing for.
MooseEnum _wall_treatment_eps
Turbulence wall treatment for epsilon (same for all walls currently)
const VariableName _tked_name
Name of the turbulent kinetic energy dissipation.
const MooseEnum _turbulence_model
Turbulence model to create the equation(s) for.
const VariableName _turbulent_viscosity_name
Name of the turbulence viscosity auxiliary variable (or property)
virtual void addAuxiliaryKernels() override
Creates all the objects needed to add a turbulence model to an incompressible / weakly-compressible N...
WCNSFVTurbulencePhysics(const InputParameters &parameters)
const VariableName _mixing_length_name
Name of the mixing length auxiliary variable.
virtual void addSolverVariables() override
void addKEpsilonTimeDerivatives()
Functions adding kernels for the k-epsilon to the k-epsilon equations.
virtual void addAuxiliaryKernels() override
virtual void addMaterials() override
virtual void initializePhysicsAdditional() override
void addFlowTurbulenceKernels()
Functions adding kernels for turbulence in the other equation(s)
static InputParameters validParams()
virtual void addAuxiliaryVariables() override
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of ghosting layers needed.
virtual void addFVBCs() override
virtual void addFVKernels() override
static const std::string mixing_length
Definition NS.h:75
static const std::string density
Definition NS.h:34
static const std::string TKED
Definition NS.h:181
static const std::string cp
Definition NS.h:125
static const std::string mu_t
Definition NS.h:129
static const std::string mu_t_passive_scalar
Definition NS.h:131
static const std::string mu
Definition NS.h:127
static const std::string TKE
Definition NS.h:180
static const std::string k_t
Definition NS.h:136
static const std::string directions[3]
Definition NS.h:23