Line data Source code
1 : //* This file is part of the MOOSE framework
2 : //* https://mooseframework.inl.gov
3 : //*
4 : //* All rights reserved, see COPYRIGHT for full restrictions
5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 : //*
7 : //* Licensed under LGPL 2.1, please see LICENSE for details
8 : //* https://www.gnu.org/licenses/lgpl-2.1.html
9 :
10 : #include "WCNSFVFlowPhysicsBase.h"
11 : #include "WCNSLinearFVFlowPhysics.h"
12 : #include "WCNSFVTurbulencePhysics.h"
13 : #include "NSFVBase.h"
14 : #include "MapConversionUtils.h"
15 : #include "NS.h"
16 :
17 : InputParameters
18 1981 : WCNSFVFlowPhysicsBase::validParams()
19 : {
20 1981 : InputParameters params = NavierStokesPhysicsBase::validParams();
21 1981 : params.addClassDescription("Base class for Physics defining the Navier Stokes flow equations");
22 :
23 1981 : params += NSFVBase::commonMomentumEquationParams();
24 3962 : params.addParam<bool>("add_flow_equations",
25 3962 : true,
26 : "Whether to add the flow equations. This parameter is not necessary when "
27 : "using the Physics syntax");
28 :
29 : // We pull in parameters from various flow objects. This helps make sure the parameters are
30 : // spelled the same way and match the evolution of other objects.
31 : // If we remove these objects, or change their parameters, these parameters should be updated
32 : // Downstream actions must either implement all these options, or redefine the parameter with
33 : // a restricted MooseEnum, or place an error in the constructor for unsupported configurations
34 : // We mostly pull the boundary parameters from NSFV Action
35 :
36 1981 : params += NSFVBase::commonNavierStokesFlowParams();
37 3962 : params.addParam<bool>(
38 : "include_deviatoric_stress",
39 3962 : false,
40 : "Whether to include the full expansion (the transposed term as well) of the stress tensor");
41 :
42 : // Momentum boundary conditions are important for advection problems as well
43 1981 : params += NSFVBase::commonMomentumBoundaryTypesParams();
44 :
45 : // Specify the weakly compressible boundary flux information. They are used for specifying in flux
46 : // boundary conditions for advection physics in WCNSFV
47 1981 : params += NSFVBase::commonMomentumBoundaryFluxesParams();
48 3962 : params.addParam<std::vector<std::vector<MooseFunctorName>>>(
49 : "momentum_wall_functors",
50 : {},
51 : "Functors for each component of the velocity value on walls. This is only necessary for the "
52 : "fixed-velocity momentum wall types.");
53 :
54 : // Most downstream physics implementations are valid for porous media too
55 : // If yours is not, please remember to disable the 'porous_medium_treatment' parameter
56 1981 : params.transferParam<bool>(NSFVBase::validParams(), "porous_medium_treatment");
57 1981 : params.transferParam<MooseFunctorName>(NSFVBase::validParams(), "porosity");
58 :
59 : // Initialization parameters
60 1981 : params.transferParam<std::vector<FunctionName>>(NSFVBase::validParams(), "initial_velocity");
61 1981 : params.transferParam<FunctionName>(NSFVBase::validParams(), "initial_pressure");
62 :
63 : // Spatial discretization scheme
64 : // Specify the numerical schemes for interpolations of velocity and pressure
65 1981 : params.transferParam<MooseEnum>(NSFVBase::validParams(), "velocity_interpolation");
66 1981 : params.transferParam<MooseEnum>(NSFVBase::validParams(), "momentum_advection_interpolation");
67 1981 : params.transferParam<MooseEnum>(NSFVBase::validParams(), "momentum_face_interpolation");
68 1981 : params.transferParam<bool>(NSFVBase::validParams(), "momentum_two_term_bc_expansion");
69 1981 : params.transferParam<bool>(NSFVBase::validParams(), "pressure_two_term_bc_expansion");
70 3962 : MooseEnum coeff_interp_method("average harmonic", "harmonic");
71 3962 : params.addParam<MooseEnum>("mu_interp_method",
72 : coeff_interp_method,
73 : "Switch that can select face interpolation method for the viscosity.");
74 :
75 : // Fluid properties
76 1981 : params.addParam<UserObjectName>(NS::fluid, "Fluid properties userobject");
77 3962 : params.addParam<FunctionName>(
78 3962 : "mu_rampdown", 1, "A function describing a ramp down of viscosity over time");
79 3962 : params.addParamNamesToGroup(NS::fluid + " mu_rampdown", "Material properties");
80 :
81 : // Parameter groups
82 3962 : params.addParamNamesToGroup(
83 : "velocity_variable pressure_variable initial_pressure initial_velocity", "Variables");
84 3962 : params.addParamNamesToGroup("density dynamic_viscosity", "Material properties");
85 3962 : params.addParamNamesToGroup("inlet_boundaries momentum_inlet_types momentum_inlet_functors",
86 : "Inlet boundary conditions");
87 3962 : params.addParamNamesToGroup("outlet_boundaries momentum_outlet_types pressure_functors",
88 : "Outlet boundary conditions");
89 3962 : params.addParamNamesToGroup("wall_boundaries momentum_wall_types momentum_wall_functors",
90 : "Wall boundary conditions");
91 3962 : params.addParamNamesToGroup(
92 : "include_deviatoric_stress velocity_interpolation momentum_advection_interpolation "
93 : "momentum_two_term_bc_expansion pressure_two_term_bc_expansion mu_interp_method "
94 : "momentum_face_interpolation",
95 : "Numerical scheme");
96 3962 : params.addParamNamesToGroup("thermal_expansion", "Gravity treatment");
97 :
98 1981 : return params;
99 1981 : }
100 :
101 1981 : WCNSFVFlowPhysicsBase::WCNSFVFlowPhysicsBase(const InputParameters & parameters)
102 : : NavierStokesPhysicsBase(parameters),
103 3962 : _has_flow_equations(getParam<bool>("add_flow_equations")),
104 3962 : _compressibility(getParam<MooseEnum>("compressibility")),
105 3962 : _solve_for_dynamic_pressure(getParam<bool>("solve_for_dynamic_pressure")),
106 3962 : _porous_medium_treatment(getParam<bool>("porous_medium_treatment")),
107 3962 : _porosity_name(getParam<MooseFunctorName>("porosity")),
108 : _flow_porosity_functor_name(_porosity_name),
109 4228 : _velocity_names(
110 1981 : isParamValid("velocity_variable")
111 1981 : ? getParam<std::vector<std::string>>("velocity_variable")
112 1715 : : (_porous_medium_treatment
113 1715 : ? std::vector<std::string>(NS::superficial_velocity_vector,
114 : NS::superficial_velocity_vector + 3)
115 : : std::vector<std::string>(NS::velocity_vector, NS::velocity_vector + 3))),
116 4139 : _pressure_name(isParamValid("pressure_variable")
117 2335 : ? getParam<NonlinearVariableName>("pressure_variable")
118 : : NS::pressure),
119 4025 : _fluid_temperature_name(isParamValid("fluid_temperature_variable")
120 2107 : ? getParam<NonlinearVariableName>("fluid_temperature_variable")
121 : : NS::T_fluid),
122 1981 : _density_name(getParam<MooseFunctorName>("density")),
123 3962 : _density_gravity_name(isParamValid("density_gravity")
124 1981 : ? getParam<MooseFunctorName>("density_gravity")
125 5943 : : getParam<MooseFunctorName>("density")),
126 1981 : _dynamic_viscosity_name(getParam<MooseFunctorName>("dynamic_viscosity")),
127 3962 : _velocity_interpolation(getParam<MooseEnum>("velocity_interpolation")),
128 3962 : _momentum_advection_interpolation(getParam<MooseEnum>("momentum_advection_interpolation")),
129 3962 : _momentum_face_interpolation(getParam<MooseEnum>("momentum_face_interpolation")),
130 3962 : _friction_blocks(getParam<std::vector<std::vector<SubdomainName>>>("friction_blocks")),
131 3962 : _friction_types(getParam<std::vector<std::vector<std::string>>>("friction_types")),
132 3962 : _friction_coeffs(getParam<std::vector<std::vector<std::string>>>("friction_coeffs")),
133 3962 : _inlet_boundaries(getParam<std::vector<BoundaryName>>("inlet_boundaries")),
134 3962 : _outlet_boundaries(getParam<std::vector<BoundaryName>>("outlet_boundaries")),
135 3962 : _wall_boundaries(getParam<std::vector<BoundaryName>>("wall_boundaries")),
136 5943 : _hydraulic_separators(getParam<std::vector<BoundaryName>>("hydraulic_separator_sidesets")),
137 3962 : _flux_inlet_pps(getParam<std::vector<PostprocessorName>>("flux_inlet_pps")),
138 7924 : _flux_inlet_directions(getParam<std::vector<Point>>("flux_inlet_directions"))
139 : {
140 : // Inlet boundary parameter checking
141 3962 : checkSecondParamSetOnlyIfFirstOneSet("flux_inlet_pps", "flux_inlet_directions");
142 1981 : if (_flux_inlet_directions.size())
143 36 : checkVectorParamsSameLengthIfSet<PostprocessorName, Point>("flux_inlet_pps",
144 : "flux_inlet_directions");
145 :
146 : // Boussinesq parameters checks
147 3962 : checkSecondParamSetOnlyIfFirstOneTrue("boussinesq_approximation", "ref_temperature");
148 3962 : checkSecondParamSetOnlyIfFirstOneSet("gravity", "boussinesq_approximation");
149 :
150 : // Dynamic pressure parameter checks
151 1981 : if (_compressibility != "incompressible" && _solve_for_dynamic_pressure)
152 0 : paramError("compressibility",
153 : "Solving for dynamic pressure is only implemented for incompressible flow");
154 :
155 : // Boundary parameters checking
156 3960 : checkVectorParamAndMultiMooseEnumLength<BoundaryName>("inlet_boundaries", "momentum_inlet_types");
157 3956 : checkVectorParamAndMultiMooseEnumLength<BoundaryName>("outlet_boundaries",
158 : "momentum_outlet_types");
159 3952 : checkVectorParamAndMultiMooseEnumLength<BoundaryName>("wall_boundaries", "momentum_wall_types");
160 : checkVectorParamLengthSameAsCombinedOthers<BoundaryName,
161 : std::vector<MooseFunctorName>,
162 3948 : PostprocessorName>(
163 : "inlet_boundaries", "momentum_inlet_functors", "flux_inlet_pps");
164 1973 : checkVectorParamsNoOverlap<BoundaryName>(
165 : {"inlet_boundaries", "outlet_boundaries", "wall_boundaries"});
166 :
167 : // Porous media parameters
168 3946 : checkSecondParamSetOnlyIfFirstOneTrue("porous_medium_treatment", "porosity");
169 :
170 1973 : if (_define_variables && _porous_medium_treatment)
171 3366 : for (const auto & name : NS::velocity_vector)
172 : {
173 2525 : const auto & it = std::find(_velocity_names.begin(), _velocity_names.end(), name);
174 2525 : if (it != _velocity_names.end())
175 2 : paramError("velocity_variable",
176 2 : "For porous medium simulations, functor name " + *it +
177 : " is already reserved for the automatically-computed interstitial velocity. "
178 : "Please choose another name for your external velocity variable!");
179 : }
180 :
181 : // Friction parameter checks
182 1971 : if (_friction_blocks.size())
183 348 : checkVectorParamsSameLength<std::vector<SubdomainName>, std::vector<std::string>>(
184 : "friction_blocks", "friction_types");
185 3940 : checkTwoDVectorParamsSameLength<std::string, std::string>("friction_types", "friction_coeffs");
186 :
187 : // Create maps for boundary-restricted parameters
188 3938 : _momentum_inlet_types = Moose::createMapFromVectorAndMultiMooseEnum<BoundaryName>(
189 : _inlet_boundaries, getParam<MultiMooseEnum>("momentum_inlet_types"));
190 3938 : _momentum_outlet_types = Moose::createMapFromVectorAndMultiMooseEnum<BoundaryName>(
191 : _outlet_boundaries, getParam<MultiMooseEnum>("momentum_outlet_types"));
192 3938 : _momentum_wall_types = Moose::createMapFromVectorAndMultiMooseEnum<BoundaryName>(
193 : _wall_boundaries, getParam<MultiMooseEnum>("momentum_wall_types"));
194 3938 : if (isParamSetByUser("momentum_inlet_functors"))
195 : {
196 : // Not all inlet boundary types require the specification of an inlet functor
197 : std::vector<BoundaryName> inlet_boundaries_with_functors;
198 4182 : for (const auto & boundary : _inlet_boundaries)
199 2428 : if (libmesh_map_find(_momentum_inlet_types, boundary) == "fixed-velocity" ||
200 38 : libmesh_map_find(_momentum_inlet_types, boundary) == "fixed-pressure")
201 2390 : inlet_boundaries_with_functors.push_back(boundary);
202 : _momentum_inlet_functors =
203 3584 : Moose::createMapFromVectors<BoundaryName, std::vector<MooseFunctorName>>(
204 : inlet_boundaries_with_functors,
205 : getParam<std::vector<std::vector<MooseFunctorName>>>("momentum_inlet_functors"));
206 1792 : }
207 3938 : if (isParamSetByUser("pressure_functors"))
208 : {
209 : // Not all outlet boundary types require the specification of an inlet functor
210 : std::vector<BoundaryName> outlet_boundaries_with_functors;
211 3518 : for (const auto & boundary : _outlet_boundaries)
212 3528 : if (libmesh_map_find(_momentum_outlet_types, boundary) == "fixed-pressure-zero-gradient" ||
213 1731 : libmesh_map_find(_momentum_outlet_types, boundary) == "fixed-pressure")
214 1778 : outlet_boundaries_with_functors.push_back(boundary);
215 3442 : const auto & pressure_functors = getParam<std::vector<MooseFunctorName>>("pressure_functors");
216 1721 : if (outlet_boundaries_with_functors.size() != pressure_functors.size())
217 4 : paramError("pressure_functors",
218 2 : "Size (" + std::to_string(pressure_functors.size()) +
219 : ") is not the same as the number of pressure outlet boundaries in "
220 2 : "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
221 2 : std::to_string(outlet_boundaries_with_functors.size()) + ")");
222 1719 : _pressure_functors = Moose::createMapFromVectors<BoundaryName, MooseFunctorName>(
223 : outlet_boundaries_with_functors, pressure_functors);
224 1719 : }
225 :
226 3934 : if (isParamSetByUser("momentum_wall_functors"))
227 : {
228 : // Not all wall boundary types require the specification of an inlet functor
229 : std::vector<BoundaryName> wall_boundaries_with_functors;
230 362 : for (const auto & boundary : _wall_boundaries)
231 286 : if (libmesh_map_find(_momentum_wall_types, boundary) == "noslip")
232 286 : wall_boundaries_with_functors.push_back(boundary);
233 : const auto & momentum_wall_functors =
234 152 : getParam<std::vector<std::vector<MooseFunctorName>>>("momentum_wall_functors");
235 76 : if (wall_boundaries_with_functors.size() != momentum_wall_functors.size())
236 0 : paramError("momentum_wall_functors",
237 0 : "Size (" + std::to_string(momentum_wall_functors.size()) +
238 : ") is not the same as the number of momentum_wall wall boundaries with "
239 0 : "no-slip boundary conditions ' (size " +
240 0 : std::to_string(wall_boundaries_with_functors.size()) + ")");
241 :
242 : _momentum_wall_functors =
243 76 : Moose::createMapFromVectors<BoundaryName, std::vector<MooseFunctorName>>(
244 : wall_boundaries_with_functors, momentum_wall_functors);
245 76 : }
246 1967 : }
247 :
248 : void
249 1937 : WCNSFVFlowPhysicsBase::initializePhysicsAdditional()
250 : {
251 1937 : getProblem().needFV();
252 1937 : }
253 :
254 : void
255 25210 : WCNSFVFlowPhysicsBase::actOnAdditionalTasks()
256 : {
257 : // Turbulence physics would not be initialized before this task
258 25210 : if (_current_task == "get_turbulence_physics")
259 1929 : _turbulence_physics = getCoupledTurbulencePhysics();
260 25210 : }
261 :
262 : void
263 1907 : WCNSFVFlowPhysicsBase::addFVBCs()
264 : {
265 1907 : addInletBC();
266 1905 : addOutletBC();
267 1905 : addWallsBC();
268 1905 : addSeparatorBC();
269 1905 : }
270 :
271 : void
272 1915 : WCNSFVFlowPhysicsBase::addMaterials()
273 : {
274 1915 : if (hasForchheimerFriction() || _porous_medium_treatment)
275 879 : addPorousMediumSpeedMaterial();
276 : else
277 1036 : addNonPorousMediumSpeedMaterial();
278 :
279 1915 : if (isParamValid(NS::fluid))
280 19 : addFluidPropertiesFunctorMaterial();
281 1915 : }
282 :
283 : void
284 879 : WCNSFVFlowPhysicsBase::addPorousMediumSpeedMaterial()
285 : {
286 879 : InputParameters params = getFactory().getValidParams("PINSFVSpeedFunctorMaterial");
287 879 : assignBlocks(params, _blocks);
288 :
289 2637 : for (unsigned int dim_i = 0; dim_i < dimension(); ++dim_i)
290 3516 : params.set<MooseFunctorName>(NS::superficial_velocity_vector[dim_i]) = _velocity_names[dim_i];
291 879 : if (_porous_medium_treatment)
292 841 : params.set<MooseFunctorName>(NS::porosity) = _flow_porosity_functor_name;
293 : else
294 76 : params.set<MooseFunctorName>(NS::porosity) = "1";
295 879 : params.set<bool>("define_interstitial_velocity_components") = _porous_medium_treatment;
296 :
297 2637 : getProblem().addFunctorMaterial(
298 879 : "PINSFVSpeedFunctorMaterial", prefix() + "pins_speed_material", params);
299 879 : }
300 :
301 : void
302 1036 : WCNSFVFlowPhysicsBase::addNonPorousMediumSpeedMaterial()
303 : {
304 1036 : const std::string class_name = "ADVectorMagnitudeFunctorMaterial";
305 1036 : InputParameters params = getFactory().getValidParams(class_name);
306 1036 : assignBlocks(params, _blocks);
307 :
308 4144 : const std::vector<std::string> param_names{"x_functor", "y_functor", "z_functor"};
309 3070 : for (unsigned int dim_i = 0; dim_i < dimension(); ++dim_i)
310 4068 : params.set<MooseFunctorName>(param_names[dim_i]) = _velocity_names[dim_i];
311 2072 : params.set<MooseFunctorName>("vector_magnitude_name") = NS::speed;
312 :
313 2072 : getProblem().addFunctorMaterial(class_name, prefix() + "ins_speed_material", params);
314 4144 : }
315 :
316 : void
317 19 : WCNSFVFlowPhysicsBase::addFluidPropertiesFunctorMaterial()
318 : {
319 : // Not very future-proof but it works
320 19 : const bool use_ad = !dynamic_cast<WCNSLinearFVFlowPhysics *>(this);
321 : const std::string class_name =
322 19 : use_ad ? "GeneralFunctorFluidProps" : "NonADGeneralFunctorFluidProps";
323 19 : InputParameters params = getFactory().getValidParams(class_name);
324 19 : assignBlocks(params, _blocks);
325 :
326 19 : params.set<MooseFunctorName>(NS::pressure) = _pressure_name;
327 38 : params.set<MooseFunctorName>(NS::T_fluid) = _fluid_temperature_name;
328 19 : params.set<MooseFunctorName>(NS::speed) = NS::speed;
329 76 : params.applySpecificParameters(parameters(), {NS::fluid, NS::density, "mu_rampdown"});
330 19 : if (!MooseUtils::parsesToReal(_density_name))
331 19 : params.set<bool>("force_define_density") = true;
332 19 : if (!_porous_medium_treatment)
333 : {
334 38 : params.set<MooseFunctorName>(NS::porosity) = "1";
335 38 : params.set<MooseFunctorName>("characteristic_length") = "1";
336 : }
337 : else
338 : // not implemented yet
339 0 : paramWarning(
340 : NS::fluid,
341 : "Specifying the fluid properties user object does not define the GeneralFunctorFluidProps "
342 : "when using the porous medium treatment. You have to define this object in the input");
343 :
344 : // Dynamic pressure
345 19 : params.set<bool>("solving_for_dynamic_pressure") = _solve_for_dynamic_pressure;
346 19 : if (_solve_for_dynamic_pressure)
347 : {
348 0 : params.set<Point>("reference_pressure_point") = getParam<Point>("reference_pressure_point");
349 0 : if (!isParamSetByUser("reference_pressure_point"))
350 0 : paramWarning("reference_pressure_point",
351 : "Default value of (0,0,0) used. If this point is outside the flow domain, the "
352 : "simulation will error");
353 0 : params.set<Real>("reference_pressure") = getParam<Real>("reference_pressure");
354 : }
355 38 : params.set<Point>("gravity") = getParam<RealVectorValue>("gravity");
356 :
357 19 : if (!_porous_medium_treatment)
358 57 : getProblem().addFunctorMaterial(class_name, prefix() + "functor_fluidprops", params);
359 76 : }
360 :
361 : void
362 1923 : WCNSFVFlowPhysicsBase::addInitialConditions()
363 : {
364 1935 : if (!_define_variables && parameters().isParamSetByUser("initial_velocity") &&
365 3854 : parameters().isParamSetByUser("velocity_variable") &&
366 1927 : getParam<std::vector<FunctionName>>("initial_velocity").size() != 0)
367 : // TODO: Rework and remove this last statement once the NSFV action is removed
368 2 : paramError("initial_velocity",
369 : "Velocity is defined externally of WCNSFVFlowPhysicsBase, so should the inital "
370 : "conditions");
371 3842 : if (!_define_variables && parameters().isParamSetByUser("initial_pressure") &&
372 1925 : parameters().isParamSetByUser("pressure_variable"))
373 2 : paramError("initial_pressure",
374 : "Pressure is defined externally of WCNSFVFlowPhysicsBase, so should the inital "
375 : "condition");
376 :
377 : // Check dimension
378 7667 : if (getParam<std::vector<FunctionName>>("initial_velocity").size() != dimension() &&
379 3840 : getParam<std::vector<FunctionName>>("initial_velocity").size() != 3 &&
380 1923 : getParam<std::vector<FunctionName>>("initial_velocity").size() != 0)
381 : // TODO: Rework and remove this last statement once the NSFV action is removed
382 2 : paramError("initial_velocity",
383 4 : "The number of velocity components in the " + type() + " initial condition is not " +
384 2 : std::to_string(dimension()) + " or 3!");
385 :
386 1917 : InputParameters params = getFactory().getValidParams("FunctionIC");
387 1917 : assignBlocks(params, _blocks);
388 3834 : auto vvalue = getParam<std::vector<FunctionName>>("initial_velocity");
389 :
390 7630 : for (const auto d : make_range(dimension()))
391 : {
392 7592 : params.set<VariableName>("variable") = _velocity_names[d];
393 3796 : params.set<FunctionName>("function") = vvalue[d];
394 :
395 7592 : if (shouldCreateIC(_velocity_names[d],
396 : _blocks,
397 11388 : /*whether IC is a default*/ !isParamSetByUser("initial_velocity"),
398 7592 : /*error if already an IC*/ isParamSetByUser("initial_velocity")))
399 14256 : getProblem().addInitialCondition("FunctionIC", prefix() + _velocity_names[d] + "_ic", params);
400 : }
401 :
402 3834 : if (shouldCreateIC(_pressure_name,
403 : _blocks,
404 5751 : /*whether IC is a default*/ !isParamSetByUser("initial_pressure"),
405 3834 : /*error if already an IC*/ isParamSetByUser("initial_pressure")))
406 : {
407 3682 : params.set<VariableName>("variable") = _pressure_name;
408 5523 : params.set<FunctionName>("function") = getParam<FunctionName>("initial_pressure");
409 :
410 7364 : getProblem().addInitialCondition("FunctionIC", prefix() + _pressure_name + "_ic", params);
411 : }
412 1917 : }
413 :
414 : unsigned short
415 15489 : WCNSFVFlowPhysicsBase::getNumberAlgebraicGhostingLayersNeeded() const
416 : {
417 : unsigned short ghost_layers = 2;
418 15489 : return ghost_layers;
419 : }
420 :
421 : void
422 1915 : WCNSFVFlowPhysicsBase::addPostprocessors()
423 : {
424 3830 : const auto momentum_inlet_types = getParam<MultiMooseEnum>("momentum_inlet_types");
425 :
426 4352 : for (unsigned int bc_ind = 0; bc_ind < momentum_inlet_types.size(); ++bc_ind)
427 2437 : if (momentum_inlet_types[bc_ind] == "flux-mass" ||
428 2401 : momentum_inlet_types[bc_ind] == "flux-velocity")
429 : {
430 101 : const std::string pp_type = "AreaPostprocessor";
431 101 : InputParameters params = getFactory().getValidParams(pp_type);
432 303 : params.set<std::vector<BoundaryName>>("boundary") = {_inlet_boundaries[bc_ind]};
433 202 : params.set<ExecFlagEnum>("execute_on") = EXEC_INITIAL;
434 :
435 101 : const auto name_pp = "area_pp_" + _inlet_boundaries[bc_ind];
436 101 : if (!getProblem().hasUserObject(name_pp))
437 101 : getProblem().addPostprocessor(pp_type, name_pp, params);
438 101 : }
439 1915 : }
440 :
441 : VariableName
442 0 : WCNSFVFlowPhysicsBase::getFlowVariableName(const std::string & short_name) const
443 : {
444 0 : if (short_name == NS::pressure)
445 0 : return getPressureName();
446 0 : else if (short_name == NS::velocity_x && dimension() > 0)
447 : return getVelocityNames()[0];
448 0 : else if (short_name == NS::velocity_y && dimension() > 1)
449 : return getVelocityNames()[1];
450 0 : else if (short_name == NS::velocity_z && dimension() > 2)
451 : return getVelocityNames()[2];
452 0 : else if (short_name == NS::temperature)
453 0 : return getFluidTemperatureName();
454 : else
455 0 : mooseError("Short Variable name '", short_name, "' not recognized.");
456 : }
457 :
458 : MooseFunctorName
459 339 : WCNSFVFlowPhysicsBase::getPorosityFunctorName(bool smoothed) const
460 : {
461 339 : if (smoothed)
462 : return _flow_porosity_functor_name;
463 : else
464 : return _porosity_name;
465 : }
466 :
467 : const WCNSFVTurbulencePhysics *
468 1929 : WCNSFVFlowPhysicsBase::getCoupledTurbulencePhysics() const
469 : {
470 : // User passed it, just use that
471 3858 : if (isParamValid("coupled_turbulence_physics"))
472 0 : return getCoupledPhysics<WCNSFVTurbulencePhysics>(
473 : getParam<PhysicsName>("coupled_flow_physics"));
474 : // Look for any physics of the right type, and check the block restriction
475 : else
476 : {
477 1929 : const auto all_turbulence_physics = getCoupledPhysics<const WCNSFVTurbulencePhysics>(true);
478 1929 : for (const auto physics : all_turbulence_physics)
479 1108 : if (checkBlockRestrictionIdentical(
480 : physics->name(), physics->blocks(), /*error_if_not_identical=*/false))
481 : return physics;
482 1929 : }
483 : // Did not find one
484 821 : return nullptr;
485 : }
|