27 "Define a turbulence model for a incompressible or weakly-compressible Navier Stokes " 28 "flow with a finite volume discretization");
30 MooseEnum turbulence_type(
"mixing-length k-epsilon none",
"none");
32 "turbulence_handling",
34 "The way turbulent diffusivities are determined in the turbulent regime.");
37 params.deprecateParam(
"mixing_length_walls",
"turbulence_walls",
"");
40 params.suppressParameter<
MooseEnum>(
"preconditioning");
43 params.addParam<MooseFunctorName>(
44 "tke_name",
NS::TKE,
"Name of the turbulent kinetic energy variable");
45 params.addParam<MooseFunctorName>(
46 "tked_name",
NS::TKED,
"Name of the turbulent kinetic energy dissipation variable");
47 params.addParam<FunctionName>(
48 "initial_tke",
"0",
"Initial value for the turbulence kinetic energy");
49 params.addParam<FunctionName>(
50 "initial_tked",
"0",
"Initial value for the turbulence kinetic energy dissipation");
51 params.addParam<FunctionName>(
"initial_mu_t",
"Initial value for the turbulence viscosity");
53 params.addParam<MooseFunctorName>(
54 "C1_eps",
"C1 coefficient for the turbulent kinetic energy dissipation equation");
55 params.addParam<MooseFunctorName>(
56 "C2_eps",
"C2 coefficient for the turbulent kinetic energy dissipation equation");
57 params.addParam<MooseFunctorName>(
58 "sigma_k",
"Scaling coefficient for the turbulent kinetic energy diffusion term");
59 params.addParam<MooseFunctorName>(
61 "Scaling coefficient for the turbulent kinetic energy dissipation diffusion term");
62 params.addParam<MooseFunctorName>(
68 params.addParam<
bool>(
"bulk_wall_treatment",
true,
"Whether to treat the wall cell as bulk");
69 MooseEnum wall_treatment(
"eq_newton eq_incremental eq_linearized neq",
"neq");
70 params.addParam<
MooseEnum>(
"wall_treatment_eps",
72 "The method used for computing the epsilon wall functions and the " 73 "turbulence viscosity wall functions");
74 params.addParam<
MooseEnum>(
"wall_treatment_T",
76 "The method used for computing the temperature wall functions");
80 MooseEnum face_interpol_types(
"average skewness-corrected",
"average");
81 MooseEnum adv_interpol_types(
"average upwind",
"upwind");
82 params.addParam<
MooseEnum>(
"tke_face_interpolation",
84 "The numerical scheme to interpolate the TKE to the " 85 "face (separate from the advected quantity interpolation).");
86 params.addParam<
MooseEnum>(
"tke_advection_interpolation",
88 "The numerical scheme to interpolate the TKE to the " 89 "face when in the advection kernel.");
90 params.addParam<
bool>(
91 "tke_two_term_bc_expansion",
93 "If a two-term Taylor expansion is needed for the determination of the boundary values" 94 "of the turbulent kinetic energy.");
96 params.addParam<
MooseEnum>(
"tked_face_interpolation",
98 "The numerical scheme to interpolate the TKED to the " 99 "face (separate from the advected quantity interpolation).");
100 params.addParam<
MooseEnum>(
"tked_advection_interpolation",
102 "The numerical scheme to interpolate the TKED to the " 103 "face when in the advection kernel.");
104 params.addParam<
bool>(
105 "tked_two_term_bc_expansion",
107 "If a two-term Taylor expansion is needed for the determination of the boundary values" 108 "of the turbulent kinetic energy dissipation.");
109 params.addParam<
bool>(
110 "turbulent_viscosity_two_term_bc_expansion",
112 "If a two-term Taylor expansion is needed for the determination of the boundary values" 113 "of the turbulent viscosity.");
114 params.addParam<
bool>(
"mu_t_as_aux_variable",
116 "Whether to use an auxiliary variable instead of a functor material " 117 "property for the turbulent viscosity");
118 params.addParam<
bool>(
"output_mu_t",
true,
"Whether to add mu_t to the field outputs");
119 params.addParam<
bool>(
"k_t_as_aux_variable",
121 "Whether to use an auxiliary variable for the turbulent conductivity");
128 params.addParam<PhysicsName>(
129 "fluid_heat_transfer_physics",
131 "WCNS(Linear)FVFluidHeatTransferPhysics generating the heat advection equations");
132 params.addParam<PhysicsName>(
133 "scalar_transport_physics",
135 "WCNS(Linear)FVScalarTransportPhysics generating the scalar advection equations");
138 params.addParamNamesToGroup(
"fluid_heat_transfer_physics turbulent_prandtl " 139 "scalar_transport_physics Sc_t",
141 params.addParamNamesToGroup(
"initial_tke initial_tked C1_eps C2_eps sigma_k sigma_eps",
143 params.addParamNamesToGroup(
"C_mu bulk_wall_treatment wall_treatment_eps wall_treatment_T",
144 "K-Epsilon wall function");
145 params.addParamNamesToGroup(
"tke_face_interpolation tke_two_term_bc_expansion " 146 "tked_face_interpolation tked_two_term_bc_expansion " 147 "turbulent_viscosity_two_term_bc_expansion " 148 "mu_t_as_aux_variable k_t_as_aux_variable",
149 "K-Epsilon model numerical");
157 _turbulence_model(getParam<
MooseEnum>(
"turbulence_handling")),
158 _turbulence_walls(getParam<
std::vector<BoundaryName>>(
"turbulence_walls")),
159 _wall_treatment_eps(getParam<
MooseEnum>(
"wall_treatment_eps")),
160 _wall_treatment_temp(getParam<
MooseEnum>(
"wall_treatment_T")),
161 _tke_name(getParam<MooseFunctorName>(
"tke_name")),
162 _tked_name(getParam<MooseFunctorName>(
"tked_name"))
173 if (getParam<bool>(
"mu_t_as_aux_variable"))
175 if (getParam<bool>(
"k_t_as_aux_variable"))
189 "bulk_wall_treatment",
191 "tke_face_interpolation",
192 "tke_two_term_bc_expansion",
194 "tked_face_interpolation",
195 "tked_two_term_bc_expansion",
196 "turbulent_viscosity_two_term_bc_expansion"});
223 getParam<PhysicsName>(
"fluid_heat_transfer_physics"),
true);
226 !getCoupledPhysics<const WCNSFVFluidHeatTransferPhysicsBase>(
true).empty())
228 "We currently do not support creating both turbulence physics and fluid heat " 229 "transfer physics that are not coupled together. Use " 230 "'fluid_heat_transfer_physics' to explicitly specify the coupling");
246 getParam<PhysicsName>(
"scalar_transport_physics"),
true);
248 !getCoupledPhysics<const WCNSFVScalarTransportPhysicsBase>(
true).empty())
250 "scalar_transport_physics",
251 "We currently do not support creating both turbulence physics and scalar transport " 252 "physics that are not coupled together");
268 mooseInfoRepeated(
"Coupling turbulence physics with fluid heat transfer physics " +
271 mooseInfoRepeated(
"No fluid heat transfer equation considered by this turbulence " 277 mooseInfoRepeated(
"No scalar transport equations considered by this turbulence physics.");
286 const std::string ic_type =
"FVFunctionIC";
290 if ((getParam<bool>(
"initialize_variables_from_mesh_file") || !
_define_variables) &&
291 ((getParam<bool>(
"mu_t_as_aux_variable") &&
isParamValid(
"initial_mu_t")) ||
293 mooseError(
"inital_mu_t/tke/tked should not be provided if we are restarting from a mesh file " 294 "or not defining variables in the Physics");
301 if (getParam<bool>(
"mu_t_as_aux_variable"))
306 params.
set<FunctionName>(
"function") = getParam<FunctionName>(
"initial_mu_t");
308 else if (MooseUtils::isFloat(rho_name) &&
309 MooseUtils::isFloat(getParam<FunctionName>(
"initial_tke")) &&
310 MooseUtils::isFloat(getParam<FunctionName>(
"initial_tked")))
311 params.
set<FunctionName>(
"function") =
312 std::to_string(std::atof(rho_name.c_str()) * getParam<Real>(
"C_mu") *
313 std::pow(std::atof(getParam<FunctionName>(
"initial_tke").c_str()), 2) /
314 std::atof(getParam<FunctionName>(
"initial_tked").c_str()));
317 "Initial turbulent viscosity should be provided. A sensible value is " 318 "rho * C_mu TKE_initial^2 / TKED_initial");
330 "This parameter can only be specified if 'mu_t_as_aux_variable=true'");
333 params.
set<FunctionName>(
"function") = getParam<FunctionName>(
"initial_tke");
340 params.
set<FunctionName>(
"function") = getParam<FunctionName>(
"initial_tked");
353 const auto var_type = is_linear ?
"MooseLinearVariableFVReal" :
"MooseVariableFVReal";
359 if (!is_linear &&
isParamValid(
"turbulent_viscosity_two_term_bc_expansion"))
360 params.set<
bool>(
"two_term_boundary_expansion") =
361 getParam<bool>(
"turbulent_viscosity_two_term_bc_expansion");
379 const std::string u_names[3] = {
"u",
"v",
"w"};
398 params.set<
bool>(
"newton_solve") = !is_linear;
399 params.applySpecificParameters(
parameters(), {
"C_mu",
"bulk_wall_treatment",
"mu_t_ratio_max"});
405 getParam<bool>(
"k_t_as_aux_variable"))
409 params.set<AuxVariableName>(
"variable") =
NS::k_t;
412 params.applySpecificParameters(
parameters(), {
"Pr_t"});
414 "TurbulentConductivityAux",
name() +
"_thermal_conductivity_aux", params);
427 const auto mat_type =
428 is_linear ?
"FunctorEffectiveDynamicViscosity" :
"ADFunctorEffectiveDynamicViscosity";
434 params.
set<MooseFunctorName>(
NS::mu_t +
"_inverse_factor") =
"1";
437 if (!getParam<bool>(
"mu_t_as_aux_variable"))
444 if (getParam<bool>(
"output_mu_t"))
445 params.
set<std::vector<OutputName>>(
"outputs") = {
"all"};
447 "INSFVkEpsilonViscosityFunctorMaterial",
prefix() +
"compute_mu_t", params);
452 mooseAssert(!getParam<bool>(
"k_t_as_aux_variable"),
"k_t should not exist");
453 const auto object_type = is_linear ?
"ParsedFunctorMaterial" :
"ADParsedFunctorMaterial";
458 const auto Pr_t_name = getParam<MooseFunctorName>(
"Pr_t");
461 if (!MooseUtils::isFloat(cp_name) && !MooseUtils::isFloat(Pr_t_name))
462 params.
set<std::vector<std::string>>(
"functor_names") = {cp_name, Pr_t_name, mu_t_name};
463 else if (MooseUtils::isFloat(cp_name) && !MooseUtils::isFloat(Pr_t_name))
464 params.
set<std::vector<std::string>>(
"functor_names") = {Pr_t_name, mu_t_name};
465 else if (!MooseUtils::isFloat(cp_name) && MooseUtils::isFloat(Pr_t_name))
466 params.
set<std::vector<std::string>>(
"functor_names") = {cp_name, mu_t_name};
468 params.
set<std::vector<std::string>>(
"functor_names") = {mu_t_name};
470 params.
set<std::string>(
"expression") = mu_t_name +
"*" + cp_name +
"/" + Pr_t_name;
471 params.
set<std::string>(
"property_name") =
NS::k_t;
473 params.
set<std::vector<OutputName>>(
"outputs") = {
"all"};
480 "passive_scalar_diffusivity");
481 const auto mat_type =
482 is_linear ?
"FunctorEffectiveDynamicViscosity" :
"ADFunctorEffectiveDynamicViscosity";
487 params.
set<MooseFunctorName>(
NS::mu_t +
"_inverse_factor") = rho_name;
488 const auto turbulent_schmidt_number = getParam<std::vector<Real>>(
"Sc_t");
494 if (!
getProblem().hasFunctor(scalar_diffs[i] +
"_eff", 0))
496 params.
set<MooseFunctorName>(
"property_name") = scalar_diffs[i] +
"_plus_mut/Sc_t";
497 params.
set<
bool>(
"add_dynamic_viscosity") =
true;
499 (turbulent_schmidt_number.size() == 1 ? turbulent_schmidt_number[0]
500 : turbulent_schmidt_number[i]);
502 mat_type,
prefix() +
"mu_eff_passive_scalar_" + std::to_string(i), params);
508 params.
set<MooseFunctorName>(
"property_name") =
"mu_t_passive_scalar";
509 params.
set<
bool>(
"add_dynamic_viscosity") =
false;
510 if (turbulent_schmidt_number.size() != 1)
512 "A single passive scalar turbulent Schmidt number can and must be specified " 513 "with k-epsilon and the WCNSFV discretization.");
514 params.
set<
Real>(
NS::mu_t +
"_extra_inverse_factor") = turbulent_schmidt_number[0];
static InputParameters validParams()
std::string prefix() const
virtual void addFVInitialCondition(const std::string &ic_name, const std::string &name, InputParameters ¶meters)
virtual void actOnAdditionalTasks() override
const VariableName _turbulent_viscosity_name
Name of the turbulence viscosity auxiliary variable (or property)
bool hasFlowEquations() const
Whether the physics is actually creating the flow equations.
void retrieveCoupledPhysics()
Retrieve the other WCNSFVPhysics at play in the simulation to be able to add the relevant terms (turb...
static const std::string mu_t
void assignBlocks(InputParameters ¶ms, const std::vector< SubdomainName > &blocks) const
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
const MooseFunctorName & dynamicViscosityName() const
Return the name of the dynamic viscosity functor.
static const std::string turbulent_Prandtl
const MooseFunctorName _density_name
Name of the density material property.
void paramError(const std::string ¶m, Args... args) const
const T & getParam(const std::string &name) const
const VariableName _tked_name
Name of the turbulent kinetic energy dissipation.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
const InputParameters & parameters() const
static InputParameters validParams()
static const std::string density
InputParameters getValidParams(const std::string &name) const
static const std::string TKE
void reportPotentiallyMissedParameters(const std::vector< std::string > ¶m_names, const std::string &object_type, const std::string &object_name="") const
void mooseInfoRepeated(Args &&... args)
virtual void addInitialConditions() override
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
bool shouldCreateIC(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool ic_is_default_ic, const bool error_if_already_defined) const
virtual void addAuxVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶ms)
const MooseEnum _turbulence_model
Turbulence model to create the equation(s) for.
static InputParameters commonTurbulenceParams()
std::vector< SubdomainName > _blocks
unsigned int dimension() const
const MooseFunctorName & densityName() const
Return the name of the density functor.
bool hasScalarEquations() const
Whether the physics is actually creating the scalar advection equations.
std::vector< BoundaryName > _turbulence_walls
List of boundaries to act as walls for turbulence models.
void saveAuxVariableName(const VariableName &var_name)
virtual FEProblemBase & getProblem()
virtual void addAuxiliaryKernels() override
bool _has_energy_equation
static InputParameters validParams()
static const std::string cp
Creates all the objects needed to add a turbulence model to an incompressible / weakly-compressible N...
const std::string & name() const
const MooseFunctorName & getSpecificHeatName() const
Get the name of the specific heat material property.
virtual void addMaterials() override
bool hasEnergyEquation() const
Whether the physics is actually creating the heat equation.
static const std::string mu
const VariableName _tke_name
Name of the turbulent kinetic energy.
const std::string & _current_task
static InputParameters validParams()
Helper class to interact with a flow and turbulence physics for a Physics that solves an advection pr...
const WCNSFVFluidHeatTransferPhysicsBase * _fluid_energy_physics
The heat advection physics to add turbulent mixing for.
static const std::string mu_eff
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
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
static const std::string TKED
void mooseError(Args &&... args) const
const WCNSFVScalarTransportPhysicsBase * _scalar_transport_physics
The scalar advection physics to add turbulent mixing for.
bool isParamValid(const std::string &name) const
Base class to hold common parameters and utilities between all the weakly compressible Navier Stokes-...
const ConsoleStream _console
bool hasFunctor(const std::string &name, const THREAD_ID tid) const
static const std::string k_t
static InputParameters validParams()
static InputParameters validParams()
MooseEnum _wall_treatment_eps
Turbulence wall treatment for epsilon (same for all walls currently)
bool isParamSetByUser(const std::string &name) const
MooseUnits pow(const MooseUnits &, int)
void saveSolverVariableName(const VariableName &var_name)
const WCNSFVFlowPhysicsBase * _flow_equations_physics
Flow physics.
auto index_range(const T &sizable)
WCNSFVTurbulencePhysicsBase(const InputParameters ¶meters)
virtual void addAuxiliaryVariables() override
bool _has_scalar_equations