https://mooseframework.inl.gov
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 
20 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "get_turbulence_physics");
21 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "add_variable");
22 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "add_fv_kernel");
23 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "add_fv_bc");
24 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "add_ic");
25 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "add_aux_variable");
26 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "add_aux_kernel");
27 registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "add_material");
28 
31 {
34  params.addClassDescription(
35  "Define a turbulence model for a incompressible or weakly-compressible Navier Stokes "
36  "flow with a finite volume discretization");
37 
38  MooseEnum turbulence_type("mixing-length k-epsilon none", "none");
39  params.addParam<MooseEnum>(
40  "turbulence_handling",
41  turbulence_type,
42  "The way turbulent diffusivities are determined in the turbulent regime.");
44  params.transferParam<bool>(NSFVBase::validParams(), "mixing_length_two_term_bc_expansion");
45 
46  // TODO Added to facilitate transition, remove default once NavierStokesFV action is removed
47  params.addParam<AuxVariableName>(
48  "mixing_length_name", "mixing_length", "Name of the mixing length auxiliary variable");
49  params.deprecateParam("mixing_length_walls", "turbulence_walls", "");
50 
51  // Not implemented, re-enable with k-epsilon
52  params.suppressParameter<MooseEnum>("preconditioning");
53 
54  // K-Epsilon parameters
55  params.addParam<MooseFunctorName>(
56  "tke_name", NS::TKE, "Name of the turbulent kinetic energy variable");
57  params.addParam<MooseFunctorName>(
58  "tked_name", NS::TKED, "Name of the turbulent kinetic energy dissipation variable");
59  params.addParam<FunctionName>(
60  "initial_tke", "0", "Initial value for the turbulence kinetic energy");
61  params.addParam<FunctionName>(
62  "initial_tked", "0", "Initial value for the turbulence kinetic energy dissipation");
63  params.addParam<FunctionName>("initial_mu_t", "Initial value for the turbulence viscosity");
64 
65  params.addParam<Real>("C1_eps",
66  "C1 coefficient for the turbulent kinetic energy dissipation equation");
67  params.addParam<Real>("C2_eps",
68  "C2 coefficient for the turbulent kinetic energy dissipation equation");
69  params.addParam<MooseFunctorName>(
70  "sigma_k", "Scaling coefficient for the turbulent kinetic energy diffusion term");
71  params.addParam<MooseFunctorName>(
72  "sigma_eps",
73  "Scaling coefficient for the turbulent kinetic energy dissipation diffusion term");
74  params.addParam<MooseFunctorName>(
75  NS::turbulent_Prandtl, NS::turbulent_Prandtl, "Turbulent Prandtl number");
76  params.transferParam<Real>(INSFVTKESourceSink::validParams(), "C_pl");
77 
78  // Boundary parameters
79  params.addParam<bool>("bulk_wall_treatment", true, "Whether to treat the wall cell as bulk");
80  MooseEnum wall_treatment("eq_newton eq_incremental eq_linearized neq", "neq");
81  params.addParam<MooseEnum>("wall_treatment_eps",
82  wall_treatment,
83  "The method used for computing the epsilon wall functions");
84  params.addParam<MooseEnum>("wall_treatment_T",
85  wall_treatment,
86  "The method used for computing the temperature wall functions");
87  params.transferParam<Real>(INSFVTurbulentViscosityWallFunction::validParams(), "C_mu");
88 
89  // K-Epsilon numerical scheme parameters
90  MooseEnum face_interpol_types("average skewness-corrected", "average");
91  MooseEnum adv_interpol_types("average upwind", "upwind");
92  params.addRangeCheckedParam<Real>(
93  "tke_scaling",
94  1.0,
95  "tke_scaling > 0.0",
96  "The scaling factor for the turbulent kinetic energy equation.");
97  params.addParam<MooseEnum>("tke_face_interpolation",
98  face_interpol_types,
99  "The numerical scheme to interpolate the TKE to the "
100  "face (separate from the advected quantity interpolation).");
101  params.addParam<MooseEnum>("tke_advection_interpolation",
102  adv_interpol_types,
103  "The numerical scheme to interpolate the TKE to the "
104  "face when in the advection kernel.");
105  // Better Jacobian if not linearizing sink and sources
106  params.addParam<bool>("linearize_sink_sources", false, "Whether to linearize the source term");
107  // Better convergence on some cases when neglecting advection derivatives
108  params.addParam<bool>(
109  "neglect_advection_derivatives",
110  false,
111  "Whether to remove the off-diagonal velocity term in the TKE and TKED advection term");
112  params.addParam<bool>(
113  "tke_two_term_bc_expansion",
114  true,
115  "If a two-term Taylor expansion is needed for the determination of the boundary values"
116  "of the turbulent kinetic energy.");
117  params.addRangeCheckedParam<Real>(
118  "tked_scaling",
119  1.0,
120  "tked_scaling > 0.0",
121  "The scaling factor for the turbulent kinetic energy dissipation equation.");
122  params.addParam<MooseEnum>("tked_face_interpolation",
123  face_interpol_types,
124  "The numerical scheme to interpolate the TKED to the "
125  "face (separate from the advected quantity interpolation).");
126  params.addParam<MooseEnum>("tked_advection_interpolation",
127  adv_interpol_types,
128  "The numerical scheme to interpolate the TKED to the "
129  "face when in the advection kernel.");
130  params.addParam<bool>(
131  "tked_two_term_bc_expansion",
132  true,
133  "If a two-term Taylor expansion is needed for the determination of the boundary values"
134  "of the turbulent kinetic energy dissipation.");
135  params.addParam<bool>(
136  "turbulent_viscosity_two_term_bc_expansion",
137  true,
138  "If a two-term Taylor expansion is needed for the determination of the boundary values"
139  "of the turbulent viscosity.");
140  MooseEnum coeff_interp_method("average harmonic", "harmonic");
141  params.addParam<MooseEnum>("turbulent_viscosity_interp_method",
142  coeff_interp_method,
143  "Face interpolation method for the turbulent viscosity");
144  params.addParam<bool>("mu_t_as_aux_variable",
145  false,
146  "Whether to use an auxiliary variable instead of a functor material "
147  "property for the turbulent viscosity");
148  params.addParam<bool>("output_mu_t", true, "Whether to add mu_t to the field outputs");
149  params.addParam<bool>("k_t_as_aux_variable",
150  false,
151  "Whether to use an auxiliary variable for the turbulent conductivity");
152 
153  // Add the coupled physics
154  // TODO Remove the defaults once NavierStokesFV action is removed
155  // It is a little risky right now because the user could forget to pass the parameter and
156  // be missing the influence of turbulence on either of these physics. There is a check in the
157  // constructor to present this from happening
158  params.addParam<PhysicsName>(
159  "fluid_heat_transfer_physics",
160  "NavierStokesFV",
161  "WCNSFVFluidHeatTransferPhysics generating the heat advection equations");
162  params.addParam<PhysicsName>(
163  "scalar_transport_physics",
164  "NavierStokesFV",
165  "WCNSFVScalarTransportPhysics generating the scalar advection equations");
166 
167  // Parameter groups
168  params.addParamNamesToGroup("mixing_length_name mixing_length_two_term_bc_expansion",
169  "Mixing length model");
170  params.addParamNamesToGroup("fluid_heat_transfer_physics turbulent_prandtl "
171  "scalar_transport_physics Sc_t",
172  "Coupled Physics");
173  params.addParamNamesToGroup("initial_tke initial_tked C1_eps C2_eps sigma_k sigma_eps",
174  "K-Epsilon model");
175  params.addParamNamesToGroup("C_mu bulk_wall_treatment wall_treatment_eps wall_treatment_T",
176  "K-Epsilon wall function");
177  params.addParamNamesToGroup(
178  "tke_scaling tke_face_interpolation tke_two_term_bc_expansion tked_scaling "
179  "tked_face_interpolation tked_two_term_bc_expansion "
180  "turbulent_viscosity_two_term_bc_expansion turbulent_viscosity_interp_method "
181  "mu_t_as_aux_variable k_t_as_aux_variable linearize_sink_sources",
182  "K-Epsilon model numerical");
183 
184  return params;
185 }
186 
188  : NavierStokesPhysicsBase(parameters),
190  _turbulence_model(getParam<MooseEnum>("turbulence_handling")),
191  _mixing_length_name(getParam<AuxVariableName>("mixing_length_name")),
192  _turbulence_walls(getParam<std::vector<BoundaryName>>("turbulence_walls")),
193  _wall_treatment_eps(getParam<MooseEnum>("wall_treatment_eps")),
194  _wall_treatment_temp(getParam<MooseEnum>("wall_treatment_T")),
195  _tke_name(getParam<MooseFunctorName>("tke_name")),
196  _tked_name(getParam<MooseFunctorName>("tked_name"))
197 {
198  if (_verbose && _turbulence_model != "none")
199  _console << "Creating a " << std::string(_turbulence_model) << " turbulence model."
200  << std::endl;
201 
202  // Keep track of the variable names, for loading variables from files notably
203  if (_turbulence_model == "mixing-length")
205  else if (_turbulence_model == "k-epsilon")
206  {
209  if (getParam<bool>("mu_t_as_aux_variable"))
211  if (getParam<bool>("k_t_as_aux_variable"))
213  }
214 
215  // Parameter checks
216  if (_turbulence_model == "none")
217  errorInconsistentDependentParameter("turbulence_handling", "none", {"turbulence_walls"});
218  if (_turbulence_model != "mixing-length")
219  errorDependentParameter("turbulence_handling",
220  "mixing-length",
221  {"mixing_length_delta",
222  "mixing_length_aux_execute_on",
223  "von_karman_const",
224  "von_karman_const_0",
225  "mixing_length_two_term_bc_expansion"});
226  if (_turbulence_model != "k-epsilon")
227  {
228  errorDependentParameter("turbulence_handling",
229  "k-epsilon",
230  {"C_mu",
231  "C1_eps",
232  "C2_eps",
233  "bulk_wall_treatment",
234  "tke_scaling",
235  "tke_face_interpolation",
236  "tke_two_term_bc_expansion",
237  "tked_scaling",
238  "tked_face_interpolation",
239  "tked_two_term_bc_expansion",
240  "turbulent_viscosity_two_term_bc_expansion"});
241  checkSecondParamSetOnlyIfFirstOneTrue("mu_t_as_aux_variable", "initial_mu_t");
242  }
243 }
244 
245 void
247 {
248  if (_turbulence_model == "k-epsilon")
250 }
251 
252 void
254 {
255  // Other Physics may not exist or be initialized at construction time, so
256  // we retrieve them now, on this task which occurs after 'init_physics'
257  if (_current_task == "get_turbulence_physics")
259 }
260 
261 void
263 {
264  // _flow_equations_physics is initialized by 'WCNSFVCoupledAdvectionPhysicsHelper'
266  _has_flow_equations = true;
267  else
268  _has_flow_equations = false;
269 
270  // Sanity check for interaction for fluid heat transfer physics
271  if (isParamValid("fluid_heat_transfer_physics") && _turbulence_model != "none")
272  {
273  _fluid_energy_physics = getCoupledPhysics<WCNSFVFluidHeatTransferPhysics>(
274  getParam<PhysicsName>("fluid_heat_transfer_physics"), true);
275  // Check for a missing parameter / do not support isolated physics for now
276  if (!_fluid_energy_physics &&
277  !getCoupledPhysics<const WCNSFVFluidHeatTransferPhysics>(true).empty())
278  paramError("fluid_heat_transfer_physics",
279  "We currently do not support creating both turbulence physics and fluid heat "
280  "transfer physics that are not coupled together. Use "
281  "'fluid_heat_transfer_physics' to explicitly specify the coupling");
283  _has_energy_equation = true;
284  else
285  _has_energy_equation = false;
286  }
287  else
288  {
289  _has_energy_equation = false;
290  _fluid_energy_physics = nullptr;
291  }
292 
293  // Sanity check for interaction with scalar transport physics
294  if (isParamValid("scalar_transport_physics") && _turbulence_model != "none")
295  {
296  _scalar_transport_physics = getCoupledPhysics<WCNSFVScalarTransportPhysics>(
297  getParam<PhysicsName>("scalar_transport_physics"), true);
299  !getCoupledPhysics<const WCNSFVScalarTransportPhysics>(true).empty())
300  paramError(
301  "scalar_transport_physics",
302  "We currently do not support creating both turbulence physics and scalar transport "
303  "physics that are not coupled together");
305  _has_scalar_equations = true;
306  else
307  _has_scalar_equations = false;
308  }
309  else
310  {
311  _has_scalar_equations = false;
312  _scalar_transport_physics = nullptr;
313  }
314 
315  // To help remediate the danger of the parameter setup
316  if (_verbose)
317  {
319  mooseInfoRepeated("Coupling turbulence physics with fluid heat transfer physics " +
321  else
322  mooseInfoRepeated("No fluid heat transfer equation considered by this turbulence "
323  "physics.");
325  mooseInfoRepeated("Coupling turbulence physics with scalar transport physics " +
327  else
328  mooseInfoRepeated("No scalar transport equations considered by this turbulence physics.");
329  }
330 }
331 
332 void
334 {
335  if (_turbulence_model == "mixing-length" || _turbulence_model == "none")
336  return;
337  else if (_turbulence_model == "k-epsilon")
338  {
339  // Dont add if the user already defined the variable
340  // Add turbulent kinetic energy variable
341  if (!shouldCreateVariable(_tke_name, _blocks, /*error if aux*/ true))
343  {"system_names", "tke_scaling", "tke_face_interpolation", "tke_two_term_bc_expansion"},
344  "INSFVEnergyVariable");
345  else if (_define_variables)
346  {
347  auto params = getFactory().getValidParams("INSFVEnergyVariable");
348  assignBlocks(params, _blocks);
349  params.set<std::vector<Real>>("scaling") = {getParam<Real>("tke_scaling")};
350  params.set<MooseEnum>("face_interp_method") = getParam<MooseEnum>("tke_face_interpolation");
351  params.set<bool>("two_term_boundary_expansion") = getParam<bool>("tke_two_term_bc_expansion");
352  params.set<SolverSystemName>("solver_sys") = getSolverSystem(_tke_name);
353 
354  getProblem().addVariable("INSFVEnergyVariable", _tke_name, params);
355  }
356  else
357  paramError("turbulence_kinetic_energy_variable",
358  "Variable (" + _tke_name +
359  ") supplied to the WCNSFVTurbulencePhysics does not exist!");
360 
361  // Add turbulent kinetic energy dissipation variable
362  if (!shouldCreateVariable(_tked_name, _blocks, /*error if aux*/ true))
364  {"system_names", "tked_scaling", "tked_face_interpolation", "tked_two_term_bc_expansion"},
365  "INSFVEnergyVariable");
366  else if (_define_variables)
367  {
368  auto params = getFactory().getValidParams("INSFVEnergyVariable");
369  assignBlocks(params, _blocks);
370  params.set<std::vector<Real>>("scaling") = {getParam<Real>("tked_scaling")};
371  params.set<MooseEnum>("face_interp_method") = getParam<MooseEnum>("tked_face_interpolation");
372  params.set<bool>("two_term_boundary_expansion") =
373  getParam<bool>("tked_two_term_bc_expansion");
374  params.set<SolverSystemName>("solver_sys") = getSolverSystem(_tked_name);
375  getProblem().addVariable("INSFVEnergyVariable", _tked_name, params);
376  }
377  else
378  paramError("turbulence_kinetic_energy_dissipation_variable",
379  "Variable (" + _tked_name +
380  ") supplied to the WCNSFVTurbulencePhysics does not exist!");
381  }
382 }
383 
384 void
386 {
387  if (_turbulence_model == "mixing-length" && _define_variables)
388  {
389  auto params = getFactory().getValidParams("MooseVariableFVReal");
390  assignBlocks(params, _blocks);
391  if (isParamValid("mixing_length_two_term_bc_expansion"))
392  params.set<bool>("two_term_boundary_expansion") =
393  getParam<bool>("mixing_length_two_term_bc_expansion");
394  if (!shouldCreateVariable(_tke_name, _blocks, /*error if aux*/ false))
395  reportPotentiallyMissedParameters({"mixing_length_two_term_bc_expansion"},
396  "MooseVariableFVReal");
397  else
398  getProblem().addAuxVariable("MooseVariableFVReal", _mixing_length_name, params);
399  }
400  if (_turbulence_model == "k-epsilon" && getParam<bool>("mu_t_as_aux_variable"))
401  {
402  auto params = getFactory().getValidParams("MooseVariableFVReal");
403  assignBlocks(params, _blocks);
404  if (isParamValid("turbulent_viscosity_two_term_bc_expansion"))
405  params.set<bool>("two_term_boundary_expansion") =
406  getParam<bool>("turbulent_viscosity_two_term_bc_expansion");
407  if (!shouldCreateVariable(_turbulent_viscosity_name, _blocks, /*error if aux*/ false))
408  reportPotentiallyMissedParameters({"turbulent_viscosity_two_term_bc_expansion"},
409  "MooseVariableFVReal");
410  else
411  getProblem().addAuxVariable("MooseVariableFVReal", _turbulent_viscosity_name, params);
412  }
413  if (_turbulence_model == "k-epsilon" && getParam<bool>("k_t_as_aux_variable"))
414  {
415  auto params = getFactory().getValidParams("MooseVariableFVReal");
416  assignBlocks(params, _blocks);
417  if (shouldCreateVariable(NS::k_t, _blocks, /*error if aux*/ false))
418  getProblem().addAuxVariable("MooseVariableFVReal", NS::k_t, params);
419  }
420 }
421 
422 void
424 {
425  if (_turbulence_model == "none")
426  return;
427 
428  // Turbulence terms in other equations
435 
436  // Turbulence models with their own set of equations
437  if (_turbulence_model == "k-epsilon")
438  {
439  if (isTransient())
443  addKEpsilonSink();
444  }
445 }
446 
447 void
449 {
450  if (_turbulence_model == "mixing-length")
451  {
452  const std::string u_names[3] = {"u", "v", "w"};
453  const std::string kernel_type = "INSFVMixingLengthReynoldsStress";
454  InputParameters params = getFactory().getValidParams(kernel_type);
455  assignBlocks(params, _blocks);
456  params.set<MooseFunctorName>(NS::density) = _density_name;
457  params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
458 
459  std::string kernel_name = prefix() + "ins_momentum_mixing_length_reynolds_stress_";
461  kernel_name = prefix() + "pins_momentum_mixing_length_reynolds_stress_";
462 
463  params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
464  for (const auto dim_i : make_range(dimension()))
465  params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
466 
467  for (const auto d : make_range(dimension()))
468  {
469  params.set<NonlinearVariableName>("variable") = _velocity_names[d];
470  params.set<MooseEnum>("momentum_component") = NS::directions[d];
471 
472  getProblem().addFVKernel(kernel_type, kernel_name + NS::directions[d], params);
473  }
474  }
475  else if (_turbulence_model == "k-epsilon")
476  {
477  // We rely on using the turbulent viscosity in the flow equation
478  // This check is rudimentary, we should think of a better way
479  // We could also check for the use of 'mu_t' with the right parameters already
482  mooseError(
483  "Regular fluid viscosity 'mu' should be used for the momentum diffusion term. You are "
484  "currently using: " +
486 
487  const std::string u_names[3] = {"u", "v", "w"};
488  const std::string kernel_type = "INSFVMomentumDiffusion";
489  InputParameters params = getFactory().getValidParams(kernel_type);
490  assignBlocks(params, _blocks);
491  params.set<MooseFunctorName>("mu") = _turbulent_viscosity_name;
492  params.set<MooseEnum>("mu_interp_method") =
493  getParam<MooseEnum>("turbulent_viscosity_interp_method");
494  params.set<MooseEnum>("variable_interp_method") =
496  params.set<bool>("complete_expansion") = true;
497 
498  std::string kernel_name = prefix() + "ins_momentum_k_epsilon_reynolds_stress_";
500  kernel_name = prefix() + "pins_momentum_k_epsilon_reynolds_stress_";
501 
502  params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
503  for (const auto dim_i : make_range(dimension()))
504  params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
505 
506  for (const auto d : make_range(dimension()))
507  {
508  params.set<NonlinearVariableName>("variable") = _velocity_names[d];
509  params.set<MooseEnum>("momentum_component") = NS::directions[d];
510 
511  getProblem().addFVKernel(kernel_type, kernel_name + NS::directions[d], params);
512  }
513  }
514 }
515 
516 void
518 {
519  if (_turbulence_model == "mixing-length")
520  {
521  const std::string u_names[3] = {"u", "v", "w"};
522  const std::string kernel_type = "WCNSFVMixingLengthEnergyDiffusion";
523  InputParameters params = getFactory().getValidParams(kernel_type);
524  assignBlocks(params, _blocks);
525  params.set<MooseFunctorName>(NS::density) = _density_name;
526  params.set<MooseFunctorName>(NS::cp) = _fluid_energy_physics->getSpecificHeatName();
527  params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
528  params.set<Real>("schmidt_number") = getParam<Real>("turbulent_prandtl");
529  params.set<NonlinearVariableName>("variable") =
531 
532  for (const auto dim_i : make_range(dimension()))
533  params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
534 
537  kernel_type, prefix() + "pins_energy_mixing_length_diffusion", params);
538  else
540  kernel_type, prefix() + "ins_energy_mixing_length_diffusion", params);
541  }
542  else if (_turbulence_model == "k-epsilon")
543  {
544  const std::string kernel_type = "FVDiffusion";
545  const auto T_fluid_name = _flow_equations_physics->getFluidTemperatureName();
546  InputParameters params = getFactory().getValidParams(kernel_type);
547  assignBlocks(params, _blocks);
548  params.set<NonlinearVariableName>("variable") = T_fluid_name;
549  params.set<MooseFunctorName>("coeff") = NS::k_t;
550  getProblem().addFVKernel(kernel_type, prefix() + T_fluid_name + "_turbulent_diffusion", params);
551  }
552 }
553 
554 void
556 {
557  const auto & passive_scalar_names = _scalar_transport_physics->getAdvectedScalarNames();
558  const auto & passive_scalar_schmidt_number = getParam<std::vector<Real>>("Sc_t");
559  if (passive_scalar_schmidt_number.size() != passive_scalar_names.size() &&
560  passive_scalar_schmidt_number.size() != 1)
561  paramError(
562  "Sc_t",
563  "The number of turbulent Schmidt numbers defined is not equal to the number of passive "
564  "scalar fields!");
565 
566  if (_turbulence_model == "mixing-length")
567  {
568  const std::string u_names[3] = {"u", "v", "w"};
569  const std::string kernel_type = "INSFVMixingLengthScalarDiffusion";
570  InputParameters params = getFactory().getValidParams(kernel_type);
571  assignBlocks(params, _blocks);
572  params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
573  for (const auto dim_i : make_range(dimension()))
574  params.set<MooseFunctorName>(u_names[dim_i]) = _velocity_names[dim_i];
575 
576  for (const auto & name_i : index_range(passive_scalar_names))
577  {
578  params.set<NonlinearVariableName>("variable") = passive_scalar_names[name_i];
579  if (passive_scalar_schmidt_number.size() > 1)
580  params.set<Real>("schmidt_number") = passive_scalar_schmidt_number[name_i];
581  else if (passive_scalar_schmidt_number.size() == 1)
582  params.set<Real>("schmidt_number") = passive_scalar_schmidt_number[0];
583  else
584  params.set<Real>("schmidt_number") = 1.0;
585 
587  kernel_type, prefix() + passive_scalar_names[name_i] + "_mixing_length", params);
588  }
589  }
590  else if (_turbulence_model == "k-epsilon")
591  {
592  const std::string kernel_type = "FVDiffusion";
593  InputParameters params = getFactory().getValidParams(kernel_type);
594  assignBlocks(params, _blocks);
595 
596  for (const auto & name_i : index_range(passive_scalar_names))
597  {
598  params.set<NonlinearVariableName>("variable") = passive_scalar_names[name_i];
599  params.set<MooseFunctorName>("coeff") = NS::mu_t_passive_scalar;
601  kernel_type, prefix() + passive_scalar_names[name_i] + "_turbulent_diffusion", params);
602  }
603  }
604 }
605 
606 void
608 {
609  const std::string kernel_type = "FVFunctorTimeKernel";
610  InputParameters params = getFactory().getValidParams(kernel_type);
611  assignBlocks(params, _blocks);
612 
613  params.set<NonlinearVariableName>("variable") = _tke_name;
614  if (shouldCreateTimeDerivative(_tke_name, _blocks, /*error if already defined*/ false))
615  getProblem().addFVKernel(kernel_type, prefix() + "tke_time", params);
616  params.set<NonlinearVariableName>("variable") = _tked_name;
617  if (shouldCreateTimeDerivative(_tked_name, _blocks, /*error if already defined*/ false))
618  getProblem().addFVKernel(kernel_type, prefix() + "tked_time", params);
619 }
620 
621 void
623 {
624  const std::string kernel_type = "INSFVTurbulentAdvection";
625  InputParameters params = getFactory().getValidParams(kernel_type);
626 
627  assignBlocks(params, _blocks);
628 
629  params.set<MooseEnum>("velocity_interp_method") = _velocity_interpolation;
630  params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
631  params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
632  params.set<bool>("neglect_advection_derivatives") =
633  getParam<bool>("neglect_advection_derivatives");
634 
635  params.set<MooseEnum>("advected_interp_method") =
636  getParam<MooseEnum>("tke_advection_interpolation");
637  params.set<NonlinearVariableName>("variable") = _tke_name;
638  getProblem().addFVKernel(kernel_type, prefix() + "tke_advection", params);
639  params.set<NonlinearVariableName>("variable") = _tked_name;
640  params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
641  params.set<MooseEnum>("advected_interp_method") =
642  getParam<MooseEnum>("tked_advection_interpolation");
643  getProblem().addFVKernel(kernel_type, prefix() + "tked_advection", params);
644 }
645 
646 void
648 {
649  {
650  const std::string kernel_type = "INSFVTurbulentDiffusion";
651  InputParameters params = getFactory().getValidParams(kernel_type);
652  assignBlocks(params, _blocks);
653 
654  params.set<NonlinearVariableName>("variable") = _tke_name;
655  params.set<MooseFunctorName>("coeff") = _flow_equations_physics->dynamicViscosityName();
656  getProblem().addFVKernel(kernel_type, prefix() + "tke_diffusion_mu", params);
657 
658  params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
659  params.set<NonlinearVariableName>("variable") = _tked_name;
660  getProblem().addFVKernel(kernel_type, prefix() + "tked_diffusion_mu", params);
661  }
662 
663  {
664  const std::string kernel_type = "INSFVTurbulentDiffusion";
665  InputParameters params = getFactory().getValidParams(kernel_type);
666  assignBlocks(params, _blocks);
667 
668  params.set<NonlinearVariableName>("variable") = _tke_name;
669  params.set<MooseFunctorName>("coeff") = _turbulent_viscosity_name;
670  params.set<MooseFunctorName>("scaling_coef") = getParam<MooseFunctorName>("sigma_k");
671  params.set<MooseEnum>("coeff_interp_method") =
672  getParam<MooseEnum>("turbulent_viscosity_interp_method");
673  getProblem().addFVKernel(kernel_type, prefix() + "tke_diffusion_mu_turb", params);
674 
675  params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
676  params.set<NonlinearVariableName>("variable") = _tked_name;
677  params.set<MooseFunctorName>("scaling_coef") = getParam<MooseFunctorName>("sigma_eps");
678  getProblem().addFVKernel(kernel_type, prefix() + "tked_diffusion_mu_turb", params);
679  }
680 }
681 
682 void
684 {
685  const std::string u_names[3] = {"u", "v", "w"};
686  {
687  const std::string kernel_type = "INSFVTKESourceSink";
688  InputParameters params = getFactory().getValidParams(kernel_type);
689  assignBlocks(params, _blocks);
690  params.set<NonlinearVariableName>("variable") = _tke_name;
691  params.set<MooseFunctorName>(NS::TKED) = _tked_name;
692  params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
693  params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
694  params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
695  params.set<Real>("C_pl") = getParam<Real>("C_pl");
696  params.set<bool>("linearized_model") = getParam<bool>("linearize_sink_sources");
697  params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
698  params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
699  // Currently only Newton method for WCNSFVTurbulencePhysics
700  params.set<bool>("newton_solve") = true;
701  for (const auto d : make_range(dimension()))
702  params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
703  getProblem().addFVKernel(kernel_type, prefix() + "tke_source_sink", params);
704  }
705 
706  {
707  const std::string kernel_type = "INSFVTKEDSourceSink";
708  InputParameters params = getFactory().getValidParams(kernel_type);
709  assignBlocks(params, _blocks);
710  params.set<NonlinearVariableName>("variable") = _tked_name;
711  params.set<MooseFunctorName>(NS::TKE) = _tke_name;
712  params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
713  params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
714  params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
715  params.set<Real>("C_pl") = getParam<Real>("C_pl");
716  params.set<bool>("linearized_model") = getParam<bool>("linearize_sink_sources");
717  params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
718  params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
719  params.set<Real>("C1_eps") = getParam<Real>("C1_eps");
720  params.set<Real>("C2_eps") = getParam<Real>("C2_eps");
721  // Currently only Newton method for WCNSFVTurbulencePhysics
722  params.set<bool>("newton_solve") = true;
723  for (const auto d : make_range(dimension()))
724  params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
725  getProblem().addFVKernel(kernel_type, prefix() + "tked_source_sink", params);
726  }
727 }
728 
729 void
731 {
732  // Note that if we are restarting this will overwrite the restarted mixing-length
733  if (_turbulence_model == "mixing-length")
734  {
735  const std::string ml_kernel_type = "WallDistanceMixingLengthAux";
736  InputParameters ml_params = getFactory().getValidParams(ml_kernel_type);
737  assignBlocks(ml_params, _blocks);
738  ml_params.set<AuxVariableName>("variable") = _mixing_length_name;
739  ml_params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
740  if (parameters().isParamValid("mixing_length_aux_execute_on"))
741  ml_params.set<ExecFlagEnum>("execute_on") =
742  getParam<ExecFlagEnum>("mixing_length_aux_execute_on");
743  else
744  ml_params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
745  ml_params.set<MooseFunctorName>("von_karman_const") =
746  getParam<MooseFunctorName>("von_karman_const");
747  ml_params.set<MooseFunctorName>("von_karman_const_0") =
748  getParam<MooseFunctorName>("von_karman_const_0");
749  ml_params.set<MooseFunctorName>("delta") = getParam<MooseFunctorName>("mixing_length_delta");
750 
751  getProblem().addAuxKernel(ml_kernel_type, prefix() + "mixing_length_aux ", ml_params);
752  }
753 
754  if (_turbulence_model == "k-epsilon" && getParam<bool>("mu_t_as_aux_variable"))
755  {
756  const std::string u_names[3] = {"u", "v", "w"};
757  const std::string mut_kernel_type = "kEpsilonViscosityAux";
758  InputParameters params = getFactory().getValidParams(mut_kernel_type);
759  assignBlocks(params, _blocks);
760  params.set<AuxVariableName>("variable") = _turbulent_viscosity_name;
761  for (const auto d : make_range(dimension()))
762  params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
763  params.set<MooseFunctorName>(NS::TKE) = _tke_name;
764  params.set<MooseFunctorName>(NS::TKED) = _tked_name;
765  params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
766  params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
767  params.set<Real>("C_mu") = getParam<Real>("C_mu");
768  params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
769  params.set<bool>("bulk_wall_treatment") = getParam<bool>("bulk_wall_treatment");
770  params.set<std::vector<BoundaryName>>("walls") = _turbulence_walls;
771  params.set<ExecFlagEnum>("execute_on") = {EXEC_NONLINEAR};
772  params.set<bool>("newton_solve") = true;
773  getProblem().addAuxKernel(mut_kernel_type, prefix() + "mixing_length_aux ", params);
774  }
775  if (_turbulence_model == "k-epsilon" && getParam<bool>("k_t_as_aux_variable") &&
777  {
778  const std::string kt_kernel_type = "TurbulentConductivityAux";
779  InputParameters params = getFactory().getValidParams(kt_kernel_type);
780  assignBlocks(params, _blocks);
781  params.set<AuxVariableName>("variable") = NS::k_t;
782  params.set<MooseFunctorName>(NS::cp) = _fluid_energy_physics->getSpecificHeatName();
783  params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
784  params.set<MooseFunctorName>(NS::turbulent_Prandtl) = getParam<MooseFunctorName>("Pr_t");
785  params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_NONLINEAR};
786  getProblem().addAuxKernel(kt_kernel_type, prefix() + "turbulent_conductivity_aux ", params);
787  }
788 }
789 
790 void
792 {
793  const std::string u_names[3] = {"u", "v", "w"};
794 
795  if (_turbulence_model == "k-epsilon" && getParam<bool>("mu_t_as_aux_variable"))
796  {
797  mooseAssert(_flow_equations_physics, "Should have a flow equation physics");
798  const std::string bc_type = "INSFVTurbulentViscosityWallFunction";
799  InputParameters params = getFactory().getValidParams(bc_type);
800  params.set<std::vector<BoundaryName>>("boundary") = _turbulence_walls;
801  params.set<NonlinearVariableName>("variable") = _turbulent_viscosity_name;
802  params.set<MooseFunctorName>(NS::density) = _flow_equations_physics->densityName();
803  params.set<MooseFunctorName>(NS::mu) = _flow_equations_physics->dynamicViscosityName();
804  params.set<MooseFunctorName>(NS::mu_t) = _turbulent_viscosity_name;
805  params.set<MooseFunctorName>(NS::TKE) = _tke_name;
806  params.set<MooseEnum>("wall_treatment") = _wall_treatment_eps;
807  for (const auto d : make_range(dimension()))
808  params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
809 
810  getProblem().addFVBC(bc_type, prefix() + "turbulence_walls", params);
811  // Energy wall function boundary conditions are added in the WCNSFVFluidEnergyPhysics
812  // because it facilitates counting the number of walls, specifying energy wall functors
813  // the same way as for boundary conditions
814  }
815 }
816 
817 void
819 {
820  if (_turbulence_model == "mixing-length" || _turbulence_model == "none")
821  return;
822  const std::string ic_type = "FunctionIC";
823  InputParameters params = getFactory().getValidParams(ic_type);
824 
825  // Parameter checking: error if initial conditions are provided but not going to be used
826  if ((getParam<bool>("initialize_variables_from_mesh_file") || !_define_variables) &&
827  ((getParam<bool>("mu_t_as_aux_variable") && isParamValid("initial_mu_t")) ||
828  isParamSetByUser("initial_tke") || isParamSetByUser("initial_tked")))
829  mooseError("inital_mu_t/tke/tked should not be provided if we are restarting from a mesh file "
830  "or not defining variables in the Physics");
831 
832  // do not set initial conditions if we are not defining variables
833  if (!_define_variables)
834  return;
835  // on regular restarts (from checkpoint), we obey the user specification of initial conditions
836 
837  if (getParam<bool>("mu_t_as_aux_variable"))
838  {
839  const auto rho_name = _flow_equations_physics->densityName();
840  // If the user provided an initial value, we use that
841  if (isParamValid("initial_mu_t"))
842  params.set<FunctionName>("function") = getParam<FunctionName>("initial_mu_t");
843  // If we can compute the initialization value from the user parameters, we do that
844  else if (MooseUtils::isFloat(rho_name) &&
845  MooseUtils::isFloat(getParam<FunctionName>("initial_tke")) &&
846  MooseUtils::isFloat(getParam<FunctionName>("initial_tked")))
847  params.set<FunctionName>("function") =
848  std::to_string(std::atof(rho_name.c_str()) * getParam<Real>("C_mu") *
849  std::pow(std::atof(getParam<FunctionName>("initial_tke").c_str()), 2) /
850  std::atof(getParam<FunctionName>("initial_tked").c_str()));
851  else
852  paramError("initial_mu_t",
853  "Initial turbulent viscosity should be provided. A sensible value is "
854  "rho * C_mu TKE_initial^2 / TKED_initial");
855 
856  params.set<VariableName>("variable") = _turbulent_viscosity_name;
857  // Always obey the user specification of an initial condition
859  _blocks,
860  /*whether IC is a default*/ !isParamSetByUser("initial_mu_t"),
861  /*error if already an IC*/ isParamSetByUser("initial_mu_t")))
862  getProblem().addInitialCondition(ic_type, prefix() + "initial_mu_turb", params);
863  }
864  else if (isParamSetByUser("initial_mu_t"))
865  paramError("initial_mu_t",
866  "This parameter can only be specified if 'mu_t_as_aux_variable=true'");
867 
868  params.set<VariableName>("variable") = _tke_name;
869  params.set<FunctionName>("function") = getParam<FunctionName>("initial_tke");
871  _blocks,
872  /*whether IC is a default*/ !isParamSetByUser("initial_tke"),
873  /*error if already an IC*/ isParamSetByUser("initial_tke")))
874  getProblem().addInitialCondition(ic_type, prefix() + "initial_tke", params);
875  params.set<VariableName>("variable") = _tked_name;
876  params.set<FunctionName>("function") = getParam<FunctionName>("initial_tked");
878  _blocks,
879  /*whether IC is a default*/ !isParamSetByUser("initial_tked"),
880  /*error if already an IC*/ isParamSetByUser("initial_tked")))
881  getProblem().addInitialCondition(ic_type, prefix() + "initial_tked", params);
882 }
883 
884 void
886 {
887  if (_turbulence_model == "mixing-length")
888  {
889  const std::string u_names[3] = {"u", "v", "w"};
890  InputParameters params =
891  getFactory().getValidParams("MixingLengthTurbulentViscosityFunctorMaterial");
892  assignBlocks(params, _blocks);
893 
894  for (const auto d : make_range(dimension()))
895  params.set<MooseFunctorName>(u_names[d]) = _velocity_names[d];
896 
897  params.set<MooseFunctorName>(NS::mixing_length) = _mixing_length_name;
898  params.set<MooseFunctorName>(NS::density) = _density_name;
899  params.set<MooseFunctorName>(NS::mu) = _dynamic_viscosity_name;
900 
901  getProblem().addMaterial("MixingLengthTurbulentViscosityFunctorMaterial",
902  prefix() + "mixing_length_material",
903  params);
904  }
905  else if (_turbulence_model == "k-epsilon")
906  {
907  if (!getProblem().hasFunctor(NS::mu_eff, /*thread_id=*/0))
908  {
909  InputParameters params = getFactory().getValidParams("ADParsedFunctorMaterial");
910  assignBlocks(params, _blocks);
911  const auto mu_name = _flow_equations_physics->dynamicViscosityName();
912 
913  // Avoid defining floats as functors in the parsed expression
915  params.set<std::vector<std::string>>("functor_names") = {_turbulent_viscosity_name,
916  mu_name};
918  params.set<std::vector<std::string>>("functor_names") = {mu_name};
920  params.set<std::vector<std::string>>("functor_names") = {_turbulent_viscosity_name};
921 
922  params.set<std::string>("expression") =
924  params.set<std::string>("property_name") = NS::mu_eff;
925  getProblem().addMaterial("ADParsedFunctorMaterial", prefix() + "effective_viscosity", params);
926  }
927  if (!getParam<bool>("mu_t_as_aux_variable"))
928  {
929  InputParameters params = getFactory().getValidParams("INSFVkEpsilonViscosityFunctorMaterial");
930  params.set<MooseFunctorName>(NS::TKE) = _tke_name;
931  params.set<MooseFunctorName>(NS::TKED) = _tked_name;
932  params.set<MooseFunctorName>(NS::density) = _density_name;
933  params.set<ExecFlagEnum>("execute_on") = {EXEC_NONLINEAR};
934  if (getParam<bool>("output_mu_t"))
935  params.set<std::vector<OutputName>>("outputs") = {"all"};
937  "INSFVkEpsilonViscosityFunctorMaterial", prefix() + "compute_mu_t", params);
938  }
939 
940  if (_has_energy_equation && !getProblem().hasFunctor(NS::k_t, /*thread_id=*/0))
941  {
942  mooseAssert(!getParam<bool>("k_t_as_aux_variable"), "k_t should exist");
943  InputParameters params = getFactory().getValidParams("ADParsedFunctorMaterial");
944  assignBlocks(params, _blocks);
945  const auto mu_t_name = NS::mu_t;
946  const auto cp_name = _fluid_energy_physics->getSpecificHeatName();
947  const auto Pr_t_name = getParam<MooseFunctorName>("Pr_t");
948 
949  // Avoid defining floats as functors in the parsed expression
950  if (!MooseUtils::isFloat(cp_name) && !MooseUtils::isFloat(Pr_t_name))
951  params.set<std::vector<std::string>>("functor_names") = {cp_name, Pr_t_name, mu_t_name};
952  else if (MooseUtils::isFloat(cp_name) && !MooseUtils::isFloat(Pr_t_name))
953  params.set<std::vector<std::string>>("functor_names") = {Pr_t_name, mu_t_name};
954  else if (!MooseUtils::isFloat(cp_name) && MooseUtils::isFloat(Pr_t_name))
955  params.set<std::vector<std::string>>("functor_names") = {cp_name, mu_t_name};
956  else
957  params.set<std::vector<std::string>>("functor_names") = {mu_t_name};
958 
959  params.set<std::string>("expression") = mu_t_name + "*" + cp_name + "/" + Pr_t_name;
960  params.set<std::string>("property_name") = NS::k_t;
961  params.set<ExecFlagEnum>("execute_on") = {EXEC_NONLINEAR};
962  params.set<std::vector<OutputName>>("outputs") = {"all"};
964  "ADParsedFunctorMaterial", prefix() + "turbulent_heat_eff_conductivity", params);
965  }
966 
967  if (_has_scalar_equations && !getProblem().hasFunctor(NS::mu_t_passive_scalar, /*thread_id=*/0))
968  {
969  InputParameters params = getFactory().getValidParams("ADParsedFunctorMaterial");
970  assignBlocks(params, _blocks);
971  const auto & rho_name = _flow_equations_physics->densityName();
972 
973  // Avoid defining floats as functors in the parsed expression
975  params.set<std::vector<std::string>>("functor_names") = {_turbulent_viscosity_name,
976  rho_name};
978  params.set<std::vector<std::string>>("functor_names") = {rho_name};
980  params.set<std::vector<std::string>>("functor_names") = {_turbulent_viscosity_name};
981 
982  const auto turbulent_schmidt_number = getParam<std::vector<Real>>("Sc_t");
983  if (turbulent_schmidt_number.size() != 1)
984  paramError(
985  "passive_scalar_schmidt_number",
986  "Only one passive scalar turbulent Schmidt number can be specified with k-epsilon");
987  params.set<std::string>("expression") = _turbulent_viscosity_name + "/" + rho_name + " / " +
988  std::to_string(turbulent_schmidt_number[0]);
989  params.set<std::string>("property_name") = NS::mu_t_passive_scalar;
991  "ADParsedFunctorMaterial", prefix() + "scalar_turbulent_diffusivity", params);
992  }
993  }
994 }
995 
996 unsigned short
998 {
999  unsigned short ghost_layers = _flow_equations_physics->getNumberAlgebraicGhostingLayersNeeded();
1000  // due to the computation of the eddy-diffusivity from the strain tensor
1001  if (_turbulence_model == "mixing-length")
1002  ghost_layers = std::max(ghost_layers, (unsigned short)3);
1003  return ghost_layers;
1004 }
std::string prefix() const
virtual void addInitialConditions() override
static InputParameters validParams()
Definition: NSFVBase.C:368
bool hasFlowEquations() const
Whether the physics is actually creating the flow equations.
virtual void initializePhysicsAdditional() override
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of algebraic ghosting layers needed.
static const std::string mu_t
Definition: NS.h:125
void assignBlocks(InputParameters &params, const std::vector< SubdomainName > &blocks) const
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
Creates all the objects needed to add a turbulence model to an incompressible / weakly-compressible N...
const MooseFunctorName & dynamicViscosityName() const
Return the name of the dynamic viscosity functor.
static const std::string turbulent_Prandtl
Definition: NS.h:138
const MooseFunctorName _density_name
Name of the density material property.
Factory & getFactory()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const VariableName _tke_name
Name of the turbulent kinetic energy.
WCNSFVTurbulencePhysics(const InputParameters &parameters)
static const std::string mixing_length
Definition: NS.h:74
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
T & set(const std::string &name, bool quiet_mode=false)
void addFlowTurbulenceKernels()
Functions adding kernels for turbulence in the other equation(s)
static const std::string density
Definition: NS.h:33
InputParameters getValidParams(const std::string &name) const
static const std::string TKE
Definition: NS.h:176
const WCNSFVFluidHeatTransferPhysics * _fluid_energy_physics
The heat advection physics to add turbulent mixing for.
void mooseInfoRepeated(Args &&... args)
void retrieveCoupledPhysics()
Retrieve the other WCNSFVPhysics at play in the simulation to be able to add the relevant terms (turb...
const bool _verbose
registerMooseAction("NavierStokesApp", WCNSFVTurbulencePhysics, "get_turbulence_physics")
const ExecFlagType EXEC_TIMESTEP_END
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
bool shouldCreateIC(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool ic_is_default_ic, const bool error_if_already_defined) const
bool shouldCreateTimeDerivative(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_already_defined) const
virtual void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
bool isFloat(const std::string &str)
const MooseFunctorName _dynamic_viscosity_name
Name of the dynamic viscosity material property.
static InputParameters commonTurbulenceParams()
Definition: NSFVBase.C:325
virtual const std::string & name() const
std::vector< SubdomainName > _blocks
unsigned int dimension() const
MooseEnum _wall_treatment_eps
Turbulence wall treatment for epsilon (same for all walls currently)
const MooseFunctorName & densityName() const
Return the name of the density functor.
static const std::string directions[3]
Definition: NS.h:22
bool hasScalarEquations() const
Whether the physics is actually creating the scalar advection equations.
virtual void addFVBCs() override
void errorDependentParameter(const std::string &param1, const std::string &value_not_set, const std::vector< std::string > &dependent_params) const
bool isParamValid(const std::string &name) const
virtual void addInitialCondition(const std::string &ic_name, const std::string &name, InputParameters &parameters)
void saveAuxVariableName(const VariableName &var_name)
virtual FEProblemBase & getProblem()
static InputParameters validParams()
static const std::string cp
Definition: NS.h:121
virtual UserObjectName rhieChowUOName() const =0
Return the name of the Rhie Chow user object.
const SolverSystemName & getSolverSystem(unsigned int variable_index) const
void addKEpsilonTimeDerivatives()
Functions adding kernels for the k-epsilon to the k-epsilon equations.
const MooseFunctorName & getSpecificHeatName() const
Get the name of the specific heat material property.
const NonlinearVariableName & getFluidTemperatureName() const
bool hasEnergyEquation() const
Whether the physics is actually creating the heat equation.
static const std::string mu
Definition: NS.h:123
static InputParameters validParams()
virtual void actOnAdditionalTasks() override
const bool _porous_medium_treatment
Switch to show if porous medium treatment is requested or not.
const std::string & _current_task
static InputParameters validParams()
registerNavierStokesPhysicsBaseTasks("NavierStokesApp", WCNSFVTurbulencePhysics)
const MooseEnum & getMomentumFaceInterpolationMethod() const
Get the face interpolation method for momentum (mostly used in the stress terms)
void needSolutionState(unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
void paramError(const std::string &param, Args... args) const
Helper class to interact with a flow and turbulence physics for a Physics that solves an advection pr...
const MooseEnum _turbulence_model
Turbulence model to create the equation(s) for.
const VariableName _tked_name
Name of the turbulent kinetic energy dissipation.
void errorInconsistentDependentParameter(const std::string &param1, const std::string &value_set, const std::vector< std::string > &dependent_params) const
virtual void addMaterials() override
static const std::string mu_eff
Definition: NS.h:129
virtual void addFVKernels() override
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
const WCNSFVScalarTransportPhysics * _scalar_transport_physics
The scalar advection physics to add turbulent mixing for.
bool _define_variables
Whether to define variables if they do not exist.
const std::vector< std::string > _velocity_names
Velocity names.
const ExecFlagType EXEC_NONLINEAR
bool isParamSetByUser(const std::string &nm) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableName _mixing_length_name
Name of the mixing length auxiliary variable.
const VariableName _turbulent_viscosity_name
Name of the turbulence viscosity auxiliary variable (or property)
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of ghosting layers needed.
IntRange< T > make_range(T beg, T end)
static const std::string TKED
Definition: NS.h:177
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const InputParameters & parameters() const
const std::vector< NonlinearVariableName > & getAdvectedScalarNames() const
Get the names of the advected scalar quantity variables.
Base class to hold common parameters and utilities between all the weakly compressible Navier Stokes-...
const ConsoleStream _console
void reportPotentiallyMissedParameters(const std::vector< std::string > &param_names, const std::string &object_type) const
virtual void addAuxiliaryKernels() override
static const std::string mu_t_passive_scalar
Definition: NS.h:127
void checkSecondParamSetOnlyIfFirstOneTrue(const std::string &param1, const std::string &param2) const
static const std::string k_t
Definition: NS.h:132
std::vector< BoundaryName > _turbulence_walls
List of boundaries to act as walls for turbulence models.
virtual void addFVKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
virtual void addFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters &parameters)
virtual void addSolverVariables() override
MooseUnits pow(const MooseUnits &, int)
virtual void addAuxiliaryVariables() override
void saveSolverVariableName(const VariableName &var_name)
const WCNSFVFlowPhysicsBase * _flow_equations_physics
Flow physics.
auto index_range(const T &sizable)
bool isTransient() const
const MooseEnum _velocity_interpolation
The velocity / momentum face interpolation method for advecting other quantities. ...
bool isParamValid(const std::string &name) const
const ExecFlagType EXEC_INITIAL