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 params.set<std::vector<Real>>("scaling") = {getParam<Real>("tke_scaling")};
109 params.set<MooseEnum>("face_interp_method") = getParam<MooseEnum>("tke_face_interpolation");
110 params.set<bool>("two_term_boundary_expansion") = getParam<bool>("tke_two_term_bc_expansion");
111
112 addSharedSolverVariable("INSFVEnergyVariable", _tke_name, params);
113 }
114 else
115 paramError("turbulence_kinetic_energy_variable",
116 "Variable (" + _tke_name +
117 ") supplied to the WCNSFVTurbulencePhysics does not exist!");
118
119 // Add turbulent kinetic energy dissipation variable
120 if (!shouldCreateVariable(_tked_name, _blocks, /*error if aux*/ true))
122 {"system_names", "tked_scaling", "tked_face_interpolation", "tked_two_term_bc_expansion"},
123 "INSFVEnergyVariable");
124 else if (_define_variables)
125 {
126 auto params = getFactory().getValidParams("INSFVEnergyVariable");
127 params.set<std::vector<Real>>("scaling") = {getParam<Real>("tked_scaling")};
128 params.set<MooseEnum>("face_interp_method") = getParam<MooseEnum>("tked_face_interpolation");
129 params.set<bool>("two_term_boundary_expansion") =
130 getParam<bool>("tked_two_term_bc_expansion");
131 addSharedSolverVariable("INSFVEnergyVariable", _tked_name, params);
132 }
133 else
134 paramError("turbulence_kinetic_energy_dissipation_variable",
135 "Variable (" + _tked_name +
136 ") supplied to the WCNSFVTurbulencePhysics does not exist!");
137 }
138}
139
140void
142{
143 if (_turbulence_model == "mixing-length" && _define_variables)
144 {
145 auto params = getFactory().getValidParams("MooseVariableFVReal");
146 if (isParamValid("mixing_length_two_term_bc_expansion"))
147 params.set<bool>("two_term_boundary_expansion") =
148 getParam<bool>("mixing_length_two_term_bc_expansion");
149 if (!shouldCreateVariable(_mixing_length_name, _blocks, /*error if aux*/ false))
150 reportPotentiallyMissedParameters({"mixing_length_two_term_bc_expansion"},
151 "MooseVariableFVReal");
152 else
153 addSharedAuxVariable("MooseVariableFVReal", _mixing_length_name, params);
154 }
156}
157
158void
160{
161 if (_turbulence_model == "none")
162 return;
163
164 // Turbulence terms in other equations
171
172 // Turbulence models with their own set of equations
173 if (_turbulence_model == "k-epsilon")
174 {
175 if (isTransient())
180 }
181}
182
183void
185{
186 if (_turbulence_model == "mixing-length")
187 {
188 const std::string u_names[3] = {"u", "v", "w"};
189 const std::string kernel_type = "INSFVMixingLengthReynoldsStress";
190 InputParameters params = getFactory().getValidParams(kernel_type);
191 assignBlocks(params, _blocks);
192 params.set<MooseFunctorName>(NS::density) = _density_name;
193 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
194
195 std::string kernel_name = prefix() + "ins_momentum_mixing_length_reynolds_stress_";
197 kernel_name = prefix() + "pins_momentum_mixing_length_reynolds_stress_";
198
199 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
200 for (const auto dim_i : make_range(dimension()))
201 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
202
203 for (const auto d : make_range(dimension()))
204 {
205 params.set<NonlinearVariableName>("variable") = _velocity_names[d];
206 params.set<MooseEnum>("momentum_component") = NS::directions[d];
207
208 getProblem().addFVKernel(kernel_type, kernel_name + NS::directions[d], params);
209 }
210 }
211 else if (_turbulence_model == "k-epsilon")
212 {
213 // We rely on using the turbulent viscosity in the flow equation
214 // This check is rudimentary, we should think of a better way
215 // We could also check for the use of 'mu_t' with the right parameters already
217 !MooseUtils::isFloat(_flow_equations_physics->dynamicViscosityName()))
219 "Regular fluid viscosity 'mu' should be used for the momentum diffusion term. You are "
220 "currently using: " +
222
223 const std::string u_names[3] = {"u", "v", "w"};
224 const std::string kernel_type = "INSFVMomentumDiffusion";
225 InputParameters params = getFactory().getValidParams(kernel_type);
226 assignBlocks(params, _blocks);
227 params.set<MooseFunctorName>("mu") = _turbulent_viscosity_name;
228 params.set<MooseEnum>("mu_interp_method") =
229 getParam<MooseEnum>("turbulent_viscosity_interp_method");
230 params.set<MooseEnum>("variable_interp_method") =
232 params.set<bool>("complete_expansion") = true;
234 params.set<bool>("include_isotropic_viscous_stress") = true;
235
236 std::string kernel_name = prefix() + "ins_momentum_k_epsilon_reynolds_stress_";
238 kernel_name = prefix() + "pins_momentum_k_epsilon_reynolds_stress_";
239
240 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
241 for (const auto dim_i : make_range(dimension()))
242 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
243
244 for (const auto d : make_range(dimension()))
245 {
246 params.set<NonlinearVariableName>("variable") = _velocity_names[d];
247 params.set<MooseEnum>("momentum_component") = NS::directions[d];
248
249 getProblem().addFVKernel(kernel_type, kernel_name + NS::directions[d], params);
250 }
251
252 // We only add it here because the mixing length kernels deal with this
253 // withn the kernel. For mixing length see issue: #32112
256 }
257}
258
259void
261{
262 if (_turbulence_model == "none")
263 return;
265 return;
267 return;
268
269 const auto rz_blocks = _flow_equations_physics->getAxisymmetricRZBlocks();
270 if (rz_blocks.empty())
271 return;
272
273 const auto radial_index =
275
276 InputParameters params = getFactory().getValidParams("INSFVMomentumViscousSourceRZ");
277 assignBlocks(params, rz_blocks);
278 params.set<MooseFunctorName>(NS::mu) = _turbulent_viscosity_name;
279 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
280 params.set<MooseEnum>("momentum_component") = NS::directions[radial_index];
281 params.set<bool>("complete_expansion") =
283 params.set<NonlinearVariableName>("variable") =
285
286 getProblem().addFVKernel("INSFVMomentumViscousSourceRZ",
287 prefix() + "ins_momentum_turbulent_viscous_source_rz_" +
288 NS::directions[radial_index],
289 params);
290}
291
292void
294{
295 if (_turbulence_model == "mixing-length")
296 {
297 const std::string u_names[3] = {"u", "v", "w"};
298 const std::string kernel_type = "WCNSFVMixingLengthEnergyDiffusion";
299 InputParameters params = getFactory().getValidParams(kernel_type);
300 assignBlocks(params, _blocks);
301 params.set<MooseFunctorName>(NS::density) = _density_name;
302 params.set<MooseFunctorName>(NS::cp) = _fluid_energy_physics->getSpecificHeatName();
303 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
304 params.set<Real>("schmidt_number") = getParam<Real>("turbulent_prandtl");
305 params.set<NonlinearVariableName>("variable") =
307
308 for (const auto dim_i : make_range(dimension()))
309 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
310
313 kernel_type, prefix() + "pins_energy_mixing_length_diffusion", params);
314 else
316 kernel_type, prefix() + "ins_energy_mixing_length_diffusion", params);
317 }
318 else if (_turbulence_model == "k-epsilon")
319 {
320 const std::string kernel_type = "FVDiffusion";
321 const auto T_fluid_name = _flow_equations_physics->getFluidTemperatureName();
322 InputParameters params = getFactory().getValidParams(kernel_type);
323 assignBlocks(params, _blocks);
324 params.set<NonlinearVariableName>("variable") = T_fluid_name;
325 params.set<MooseFunctorName>("coeff") = NS::k_eff_t;
326 getProblem().addFVKernel(kernel_type, prefix() + T_fluid_name + "_turbulent_diffusion", params);
327 }
328}
329
330void
332{
333 const auto & passive_scalar_names = _scalar_transport_physics->getAdvectedScalarNames();
334 const auto & passive_scalar_schmidt_number = getParam<std::vector<Real>>("Sc_t");
335 if (passive_scalar_schmidt_number.size() != passive_scalar_names.size() &&
336 passive_scalar_schmidt_number.size() != 1)
338 "Sc_t",
339 "The number of turbulent Schmidt numbers defined is not equal to the number of passive "
340 "scalar fields!");
341
342 if (_turbulence_model == "mixing-length")
343 {
344 const std::string u_names[3] = {"u", "v", "w"};
345 const std::string kernel_type = "INSFVMixingLengthScalarDiffusion";
346 InputParameters params = getFactory().getValidParams(kernel_type);
347 assignBlocks(params, _blocks);
348 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
349 for (const auto dim_i : make_range(dimension()))
350 params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
351
352 for (const auto & name_i : index_range(passive_scalar_names))
353 {
354 params.set<NonlinearVariableName>("variable") = passive_scalar_names[name_i];
355 if (passive_scalar_schmidt_number.size() > 1)
356 params.set<Real>("schmidt_number") = passive_scalar_schmidt_number[name_i];
357 else if (passive_scalar_schmidt_number.size() == 1)
358 params.set<Real>("schmidt_number") = passive_scalar_schmidt_number[0];
359 else
360 params.set<Real>("schmidt_number") = 1.0;
361
363 kernel_type, prefix() + passive_scalar_names[name_i] + "_mixing_length", params);
364 }
365 }
366 else if (_turbulence_model == "k-epsilon")
367 {
368 const std::string kernel_type = "FVDiffusion";
369 InputParameters params = getFactory().getValidParams(kernel_type);
370 assignBlocks(params, _blocks);
371
372 for (const auto & name_i : index_range(passive_scalar_names))
373 {
374 params.set<NonlinearVariableName>("variable") = passive_scalar_names[name_i];
375 params.set<MooseFunctorName>("coeff") = NS::mu_t_passive_scalar;
377 kernel_type, prefix() + passive_scalar_names[name_i] + "_turbulent_diffusion", params);
378 }
379 }
380}
381
382void
384{
385 const std::string kernel_type = "FVFunctorTimeKernel";
386 InputParameters params = getFactory().getValidParams(kernel_type);
387 assignBlocks(params, _blocks);
388
389 params.set<NonlinearVariableName>("variable") = _tke_name;
390 if (shouldCreateTimeDerivative(_tke_name, _blocks, /*error if already defined*/ false))
391 getProblem().addFVKernel(kernel_type, prefix() + "tke_time", params);
392 params.set<NonlinearVariableName>("variable") = _tked_name;
393 if (shouldCreateTimeDerivative(_tked_name, _blocks, /*error if already defined*/ false))
394 getProblem().addFVKernel(kernel_type, prefix() + "tked_time", params);
395}
396
397void
399{
400 const std::string kernel_type = "INSFVTurbulentAdvection";
401 InputParameters params = getFactory().getValidParams(kernel_type);
402
403 assignBlocks(params, _blocks);
404
405 params.set<MooseEnum>("velocity_interp_method") = _velocity_interpolation;
406 params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
407 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
408 params.set<bool>("neglect_advection_derivatives") =
409 getParam<bool>("neglect_advection_derivatives");
410
411 params.set<MooseEnum>("advected_interp_method") =
412 getParam<MooseEnum>("tke_advection_interpolation");
413 params.set<NonlinearVariableName>("variable") = _tke_name;
414 getProblem().addFVKernel(kernel_type, prefix() + "tke_advection", params);
415 params.set<NonlinearVariableName>("variable") = _tked_name;
416 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
417 params.set<MooseEnum>("advected_interp_method") =
418 getParam<MooseEnum>("tked_advection_interpolation");
419 getProblem().addFVKernel(kernel_type, prefix() + "tked_advection", params);
420}
421
422void
424{
425 {
426 const std::string kernel_type = "INSFVTurbulentDiffusion";
427 InputParameters params = getFactory().getValidParams(kernel_type);
428 assignBlocks(params, _blocks);
429
430 params.set<NonlinearVariableName>("variable") = _tke_name;
431 params.set<MooseFunctorName>("coeff") = _flow_equations_physics->dynamicViscosityName();
432 getProblem().addFVKernel(kernel_type, prefix() + "tke_diffusion_mu", params);
433
434 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
435 params.set<NonlinearVariableName>("variable") = _tked_name;
436 getProblem().addFVKernel(kernel_type, prefix() + "tked_diffusion_mu", params);
437 }
438
439 {
440 const std::string kernel_type = "INSFVTurbulentDiffusion";
441 InputParameters params = getFactory().getValidParams(kernel_type);
442 assignBlocks(params, _blocks);
443
444 params.set<NonlinearVariableName>("variable") = _tke_name;
445 params.set<MooseFunctorName>("coeff") = _turbulent_viscosity_name;
446 params.set<MooseFunctorName>("scaling_coef") = getParam<MooseFunctorName>("sigma_k");
447 params.set<MooseEnum>("coeff_interp_method") =
448 getParam<MooseEnum>("turbulent_viscosity_interp_method");
449 getProblem().addFVKernel(kernel_type, prefix() + "tke_diffusion_mu_turb", params);
450
451 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
452 params.set<NonlinearVariableName>("variable") = _tked_name;
453 params.set<MooseFunctorName>("scaling_coef") = getParam<MooseFunctorName>("sigma_eps");
454 getProblem().addFVKernel(kernel_type, prefix() + "tked_diffusion_mu_turb", params);
455 }
456}
457
458void
460{
461 const std::string u_names[3] = {"u", "v", "w"};
462 {
463 const std::string kernel_type = "INSFVTKESourceSink";
464 InputParameters params = getFactory().getValidParams(kernel_type);
465 assignBlocks(params, _blocks);
466 params.set<NonlinearVariableName>("variable") = _tke_name;
467 params.set<MooseFunctorName>(NS::TKED) = _tked_name;
468 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
469 params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
470 params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
471 params.set<Real>("C_mu") = getParam<Real>("C_mu");
472 params.set<Real>("C_pl") = getParam<Real>("C_pl");
473 params.set<bool>("linearized_model") = getParam<bool>("linearize_sink_sources");
474 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
475 params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
476 // Currently only Newton method for WCNSFVTurbulencePhysics
477 params.set<bool>("newton_solve") = true;
478 for (const auto d : make_range(dimension()))
479 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
480 getProblem().addFVKernel(kernel_type, prefix() + "tke_source_sink", params);
481 }
482
483 {
484 const std::string kernel_type = "INSFVTKEDSourceSink";
485 InputParameters params = getFactory().getValidParams(kernel_type);
486 assignBlocks(params, _blocks);
487 params.set<NonlinearVariableName>("variable") = _tked_name;
488 params.set<MooseFunctorName>(NS::TKE) = _tke_name;
489 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
490 params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
491 params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
492 params.set<Real>("C_mu") = getParam<Real>("C_mu");
493 params.set<Real>("C_pl") = getParam<Real>("C_pl");
494 params.set<bool>("linearized_model") = getParam<bool>("linearize_sink_sources");
495 params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
496 params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
497 params.set<MooseFunctorName>("C1_eps") = getParam<MooseFunctorName>("C1_eps");
498 params.set<MooseFunctorName>("C2_eps") = getParam<MooseFunctorName>("C2_eps");
499 // Currently only Newton method for WCNSFVTurbulencePhysics
500 params.set<bool>("newton_solve") = true;
501 for (const auto d : make_range(dimension()))
502 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
503 getProblem().addFVKernel(kernel_type, prefix() + "tked_source_sink", params);
504 }
505}
506
507void
509{
511
512 // Note that if we are restarting this will overwrite the restarted mixing-length
513 if (_turbulence_model == "mixing-length")
514 {
515 const std::string ml_kernel_type = "WallDistanceMixingLengthAux";
516 InputParameters ml_params = getFactory().getValidParams(ml_kernel_type);
517 assignBlocks(ml_params, _blocks);
518 ml_params.set<AuxVariableName>("variable") = _mixing_length_name;
519 ml_params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
520 if (parameters().isParamValid("mixing_length_aux_execute_on"))
521 ml_params.set<ExecFlagEnum>("execute_on") =
522 getParam<ExecFlagEnum>("mixing_length_aux_execute_on");
523 else
524 ml_params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
525 ml_params.set<MooseFunctorName>("von_karman_const") =
526 getParam<MooseFunctorName>("von_karman_const");
527 ml_params.set<MooseFunctorName>("von_karman_const_0") =
528 getParam<MooseFunctorName>("von_karman_const_0");
529 ml_params.set<MooseFunctorName>("delta") = getParam<MooseFunctorName>("mixing_length_delta");
530
531 getProblem().addAuxKernel(ml_kernel_type, prefix() + "mixing_length_aux ", ml_params);
532 }
533}
534
535void
537{
538 const std::string u_names[3] = {"u", "v", "w"};
539
540 if (_turbulence_model == "k-epsilon" && getParam<bool>("mu_t_as_aux_variable"))
541 {
542 mooseAssert(_flow_equations_physics, "Should have a flow equation physics");
543 const std::string bc_type = "INSFVTurbulentViscosityWallFunction";
544 InputParameters params = getFactory().getValidParams(bc_type);
545 params.set<std::vector<BoundaryName>>("boundary") = _turbulence_walls;
546 params.set<NonlinearVariableName>("variable") = _turbulent_viscosity_name;
547 params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
548 params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
549 params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
550 params.set<MooseFunctorName>(NS::TKE) = _tke_name;
551 params.set<Real>("C_mu") = getParam<Real>("C_mu");
552 params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
553 for (const auto d : make_range(dimension()))
554 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
555
556 getProblem().addFVBC(bc_type, prefix() + "turbulence_walls", params);
557 // Energy wall function boundary conditions are added in the WCNSFVFluidEnergyPhysics
558 // because it facilitates counting the number of walls, specifying energy wall functors
559 // the same way as for boundary conditions
560 }
561}
562
563void
565{
566 if (_turbulence_model == "mixing-length")
567 {
568 const std::string u_names[3] = {"u", "v", "w"};
569 InputParameters params =
570 getFactory().getValidParams("MixingLengthTurbulentViscosityFunctorMaterial");
571 assignBlocks(params, _blocks);
572
573 for (const auto d : make_range(dimension()))
574 params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
575
576 params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
577 params.set<MooseFunctorName>(NS::density) = _density_name;
578 params.set<MooseFunctorName>(NS::mu) = _dynamic_viscosity_name;
579
580 getProblem().addMaterial("MixingLengthTurbulentViscosityFunctorMaterial",
581 prefix() + "mixing_length_material",
582 params);
583 }
585}
586
587unsigned short
589{
591 // due to the computation of the eddy-diffusivity from the strain tensor
592 if (_turbulence_model == "mixing-length")
593 ghost_layers = std::max(ghost_layers, (unsigned short)3);
594 return ghost_layers;
595}
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 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 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:378
bool _define_variables
Whether to define variables if they do not exist.
void addSharedAuxVariable(const std::string &var_type, const VariableName &var_name, const InputParameters &params)
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
void addSharedSolverVariable(const std::string &var_type, const VariableName &var_name, InputParameters params)
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:182
static const std::string cp
Definition NS.h:125
static const std::string mu_t
Definition NS.h:129
static const std::string k_eff_t
Definition NS.h:137
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:181
static const std::string directions[3]
Definition NS.h:23