https://mooseframework.inl.gov
Loading...
Searching...
No Matches
WCNSFVFlowPhysicsBase.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
13#include "NSFVBase.h"
14#include "MapConversionUtils.h"
15#include "NS.h"
16#include "MooseMesh.h"
17
20{
22 params.addClassDescription("Base class for Physics defining the Navier Stokes flow equations");
23
25 params.addParam<bool>("add_flow_equations",
26 true,
27 "Whether to add the flow equations. This parameter is not necessary when "
28 "using the Physics syntax");
29
30 // We pull in parameters from various flow objects. This helps make sure the parameters are
31 // spelled the same way and match the evolution of other objects.
32 // If we remove these objects, or change their parameters, these parameters should be updated
33 // Downstream actions must either implement all these options, or redefine the parameter with
34 // a restricted MooseEnum, or place an error in the constructor for unsupported configurations
35 // We mostly pull the boundary parameters from NSFV Action
36
38 params.addParam<bool>("include_deviatoric_stress",
39 false,
40 "Whether to include the symmetrized viscous stress contribution "
41 "(grad(u)+grad(u)^T).");
42 params.deprecateParam(
43 "include_deviatoric_stress", "include_symmetrized_viscous_stress", "12/31/2025");
44 params.addParam<bool>("include_isotropic_viscous_stress",
45 false,
46 "Whether to add the isotropic -(2/3) mu div(u) I contribution to the "
47 "viscous stress (requires complete expansion of the velocity gradient).");
48 params.addParam<bool>("add_rz_viscous_source",
49 true,
50 "When true, automatically adds INSFVMomentumViscousSourceRZ to the radial "
51 "momentum equation on RZ blocks. Disable if this term should be omitted.");
52
53 // Momentum boundary conditions are important for advection problems as well
55
56 // Convenient for sharing the executioner block with a non-Physics syntax
57 // or for defining the RhieChow user object outside the Physics
58 params.addParam<UserObjectName>(
59 "rhie_chow_uo_name",
60 "Name of the Rhie Chow user object. Defaults to 'pins_rhie_chow_interpolator' for porous "
61 "flow and 'ins_rhie_chow_interpolator' for non-porous.");
62
63 // Specify the weakly compressible boundary flux information. They are used for specifying in flux
64 // boundary conditions for advection physics in WCNSFV
66 params.addParam<std::vector<std::vector<MooseFunctorName>>>(
67 "momentum_wall_functors",
68 {},
69 "Functors for each component of the velocity value on walls. This is only necessary for the "
70 "fixed-velocity momentum wall types.");
71
72 // Most downstream physics implementations are valid for porous media too
73 // If yours is not, please remember to disable the 'porous_medium_treatment' parameter
74 params.transferParam<bool>(NSFVBase::validParams(), "porous_medium_treatment");
75 params.transferParam<MooseFunctorName>(NSFVBase::validParams(), "porosity");
76
77 // Initialization parameters
78 params.transferParam<std::vector<FunctionName>>(NSFVBase::validParams(), "initial_velocity");
79 params.transferParam<FunctionName>(NSFVBase::validParams(), "initial_pressure");
80
81 // Spatial discretization scheme
82 // Specify the numerical schemes for interpolations of velocity and pressure
83 params.transferParam<MooseEnum>(NSFVBase::validParams(), "velocity_interpolation");
84 params.transferParam<MooseEnum>(NSFVBase::validParams(), "momentum_advection_interpolation");
85 params.transferParam<MooseEnum>(NSFVBase::validParams(), "momentum_face_interpolation");
86 params.transferParam<bool>(NSFVBase::validParams(), "momentum_two_term_bc_expansion");
87 params.transferParam<bool>(NSFVBase::validParams(), "pressure_two_term_bc_expansion");
88 MooseEnum coeff_interp_method("average harmonic", "harmonic");
89 params.addParam<MooseEnum>("mu_interp_method",
90 coeff_interp_method,
91 "Switch that can select face interpolation method for the viscosity.");
92
93 // Fluid properties
94 params.addParam<UserObjectName>(NS::fluid, "Fluid properties userobject");
95 params.addParam<FunctionName>(
96 "mu_rampdown", 1, "A function describing a ramp down of viscosity over time");
97 params.addParamNamesToGroup(NS::fluid + " mu_rampdown", "Material properties");
98
99 // Parameter groups
101 "velocity_variable pressure_variable initial_pressure initial_velocity", "Variables");
102 params.addParamNamesToGroup("density dynamic_viscosity", "Material properties");
103 params.addParamNamesToGroup("inlet_boundaries momentum_inlet_types momentum_inlet_functors",
104 "Inlet boundary conditions");
105 params.addParamNamesToGroup("outlet_boundaries momentum_outlet_types pressure_functors",
106 "Outlet boundary conditions");
107 params.addParamNamesToGroup("wall_boundaries momentum_wall_types momentum_wall_functors",
108 "Wall boundary conditions");
110 "include_symmetrized_viscous_stress include_isotropic_viscous_stress velocity_interpolation "
111 "momentum_advection_interpolation momentum_two_term_bc_expansion "
112 "pressure_two_term_bc_expansion mu_interp_method momentum_face_interpolation",
113 "Numerical scheme");
114 params.addParamNamesToGroup("thermal_expansion", "Gravity treatment");
115
116 return params;
117}
118
120 : NavierStokesPhysicsBase(parameters),
121 _has_flow_equations(getParam<bool>("add_flow_equations")),
122 _add_rz_viscous_source(getParam<bool>("add_rz_viscous_source")),
123 _compressibility(getParam<MooseEnum>("compressibility")),
124 _solve_for_dynamic_pressure(getParam<bool>("solve_for_dynamic_pressure")),
125 _porous_medium_treatment(getParam<bool>("porous_medium_treatment")),
126 _porosity_name(getParam<MooseFunctorName>("porosity")),
127 _flow_porosity_functor_name(_porosity_name),
128 _velocity_names(
129 isParamValid("velocity_variable")
130 ? getParam<std::vector<std::string>>("velocity_variable")
131 : (_porous_medium_treatment
132 ? std::vector<std::string>(NS::superficial_velocity_vector,
133 NS::superficial_velocity_vector + 3)
134 : std::vector<std::string>(NS::velocity_vector, NS::velocity_vector + 3))),
135 _pressure_name(isParamValid("pressure_variable")
136 ? getParam<NonlinearVariableName>("pressure_variable")
137 : NS::pressure),
138 _fluid_temperature_name(isParamValid("fluid_temperature_variable")
139 ? getParam<NonlinearVariableName>("fluid_temperature_variable")
140 : NS::T_fluid),
141 _density_name(getParam<MooseFunctorName>("density")),
142 _density_gravity_name(isParamValid("density_for_gravity_terms")
143 ? getParam<MooseFunctorName>("density_for_gravity_terms")
144 : getParam<MooseFunctorName>("density")),
145 _dynamic_viscosity_name(getParam<MooseFunctorName>("dynamic_viscosity")),
146 _include_symmetrized_viscous_stress(getParam<bool>("include_symmetrized_viscous_stress")),
147 _include_isotropic_viscous_stress(getParam<bool>("include_isotropic_viscous_stress")),
148 _rc_uo_name(isParamValid("rhie_chow_uo_name")
149 ? getParam<UserObjectName>("rhie_chow_uo_name")
150 : (_porous_medium_treatment ? "pins_rhie_chow_interpolator"
151 : "ins_rhie_chow_interpolator")),
152 _velocity_interpolation(getParam<MooseEnum>("velocity_interpolation")),
153 _momentum_advection_interpolation(getParam<MooseEnum>("momentum_advection_interpolation")),
154 _momentum_face_interpolation(getParam<MooseEnum>("momentum_face_interpolation")),
155 _friction_blocks(getParam<std::vector<std::vector<SubdomainName>>>("friction_blocks")),
156 _friction_types(getParam<std::vector<std::vector<std::string>>>("friction_types")),
157 _friction_coeffs(getParam<std::vector<std::vector<std::string>>>("friction_coeffs")),
158 _inlet_boundaries(getParam<std::vector<BoundaryName>>("inlet_boundaries")),
159 _outlet_boundaries(getParam<std::vector<BoundaryName>>("outlet_boundaries")),
160 _wall_boundaries(getParam<std::vector<BoundaryName>>("wall_boundaries")),
161 _hydraulic_separators(getParam<std::vector<BoundaryName>>("hydraulic_separator_sidesets")),
162 _flux_inlet_pps(getParam<std::vector<PostprocessorName>>("flux_inlet_pps")),
163 _flux_inlet_directions(getParam<std::vector<Point>>("flux_inlet_directions"))
164{
165 // Inlet boundary parameter checking
166 checkSecondParamSetOnlyIfFirstOneSet("flux_inlet_pps", "flux_inlet_directions");
167 if (_flux_inlet_directions.size())
168 checkVectorParamsSameLengthIfSet<PostprocessorName, Point>("flux_inlet_pps",
169 "flux_inlet_directions");
170
171 // Boussinesq parameters checks
172 checkSecondParamSetOnlyIfFirstOneTrue("boussinesq_approximation", "ref_temperature");
173 checkSecondParamSetOnlyIfFirstOneSet("gravity", "boussinesq_approximation");
174
175 // Dynamic pressure parameter checks
176 if (_compressibility != "incompressible" && _solve_for_dynamic_pressure)
177 paramError("compressibility",
178 "Solving for dynamic pressure is only implemented for incompressible flow");
179
180 // Boundary parameters checking
181 checkVectorParamAndMultiMooseEnumLength<BoundaryName>("inlet_boundaries", "momentum_inlet_types");
182 checkVectorParamAndMultiMooseEnumLength<BoundaryName>("outlet_boundaries",
183 "momentum_outlet_types");
184 checkVectorParamAndMultiMooseEnumLength<BoundaryName>("wall_boundaries", "momentum_wall_types");
186 std::vector<MooseFunctorName>,
187 PostprocessorName>(
188 "inlet_boundaries", "momentum_inlet_functors", "flux_inlet_pps");
189 checkVectorParamsNoOverlap<BoundaryName>(
190 {"inlet_boundaries", "outlet_boundaries", "wall_boundaries"});
191
192 // Porous media parameters
193 checkSecondParamSetOnlyIfFirstOneTrue("porous_medium_treatment", "porosity");
194
196 for (const auto & name : NS::velocity_vector)
197 {
198 const auto & it = std::find(_velocity_names.begin(), _velocity_names.end(), name);
199 if (it != _velocity_names.end())
200 paramError("velocity_variable",
201 "For porous medium simulations, functor name " + *it +
202 " is already reserved for the automatically-computed interstitial velocity. "
203 "Please choose another name for your external velocity variable!");
204 }
205
206 // Friction parameter checks
207 if (_friction_blocks.size())
208 checkVectorParamsSameLength<std::vector<SubdomainName>, std::vector<std::string>>(
209 "friction_blocks", "friction_types");
210 checkTwoDVectorParamsSameLength<std::string, std::string>("friction_types", "friction_coeffs");
211
212 // Create maps for boundary-restricted parameters
213 _momentum_inlet_types = Moose::createMapFromVectorAndMultiMooseEnum<BoundaryName>(
214 _inlet_boundaries, getParam<MultiMooseEnum>("momentum_inlet_types"));
215 _momentum_outlet_types = Moose::createMapFromVectorAndMultiMooseEnum<BoundaryName>(
216 _outlet_boundaries, getParam<MultiMooseEnum>("momentum_outlet_types"));
217 _momentum_wall_types = Moose::createMapFromVectorAndMultiMooseEnum<BoundaryName>(
218 _wall_boundaries, getParam<MultiMooseEnum>("momentum_wall_types"));
219 if (isParamSetByUser("momentum_inlet_functors"))
220 {
221 // Not all inlet boundary types require the specification of an inlet functor
222 std::vector<BoundaryName> inlet_boundaries_with_functors;
223 for (const auto & boundary : _inlet_boundaries)
224 if (libmesh_map_find(_momentum_inlet_types, boundary) == "fixed-velocity" ||
225 libmesh_map_find(_momentum_inlet_types, boundary) == "fixed-pressure")
226 inlet_boundaries_with_functors.push_back(boundary);
228 Moose::createMapFromVectors<BoundaryName, std::vector<MooseFunctorName>>(
229 inlet_boundaries_with_functors,
230 getParam<std::vector<std::vector<MooseFunctorName>>>("momentum_inlet_functors"));
231 }
232 if (isParamSetByUser("pressure_functors"))
233 {
234 // Not all outlet boundary types require the specification of an inlet functor
235 std::vector<BoundaryName> outlet_boundaries_with_functors;
236 for (const auto & boundary : _outlet_boundaries)
237 if (libmesh_map_find(_momentum_outlet_types, boundary) == "fixed-pressure-zero-gradient" ||
238 libmesh_map_find(_momentum_outlet_types, boundary) == "fixed-pressure")
239 outlet_boundaries_with_functors.push_back(boundary);
240 const auto & pressure_functors = getParam<std::vector<MooseFunctorName>>("pressure_functors");
241 if (outlet_boundaries_with_functors.size() != pressure_functors.size())
242 paramError("pressure_functors",
243 "Size (" + std::to_string(pressure_functors.size()) +
244 ") is not the same as the number of pressure outlet boundaries in "
245 "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
246 std::to_string(outlet_boundaries_with_functors.size()) + ")");
247 _pressure_functors = Moose::createMapFromVectors<BoundaryName, MooseFunctorName>(
248 outlet_boundaries_with_functors, pressure_functors);
249 }
250
251 if (isParamSetByUser("momentum_wall_functors"))
252 {
253 // Not all wall boundary types require the specification of an inlet functor
254 std::vector<BoundaryName> wall_boundaries_with_functors;
255 for (const auto & boundary : _wall_boundaries)
256 if (libmesh_map_find(_momentum_wall_types, boundary) == "noslip")
257 wall_boundaries_with_functors.push_back(boundary);
258 const auto & momentum_wall_functors =
259 getParam<std::vector<std::vector<MooseFunctorName>>>("momentum_wall_functors");
260 if (wall_boundaries_with_functors.size() != momentum_wall_functors.size())
261 paramError("momentum_wall_functors",
262 "Size (" + std::to_string(momentum_wall_functors.size()) +
263 ") is not the same as the number of momentum_wall wall boundaries with "
264 "no-slip boundary conditions ' (size " +
265 std::to_string(wall_boundaries_with_functors.size()) + ")");
266
268 Moose::createMapFromVectors<BoundaryName, std::vector<MooseFunctorName>>(
269 wall_boundaries_with_functors, momentum_wall_functors);
270 }
271
272 addRequiredPhysicsTask("add_geometric_rm");
273 addRequiredPhysicsTask("add_variables_physics");
274 addRequiredPhysicsTask("add_ics_physics");
275 addRequiredPhysicsTask("add_materials_physics");
276 addRequiredPhysicsTask("add_user_object");
277 addRequiredPhysicsTask("add_postprocessor");
278 addRequiredPhysicsTask("add_corrector");
279 addRequiredPhysicsTask("get_turbulence_physics");
280}
281
282void
287
288void
290{
291 // Turbulence physics would not be initialized before this task
292 if (_current_task == "get_turbulence_physics")
294}
295
296void
304
305void
316
317void
319{
320 InputParameters params = getFactory().getValidParams("PINSFVSpeedFunctorMaterial");
321 assignBlocks(params, _blocks);
322
323 for (unsigned int dim_i = 0; dim_i < dimension(); ++dim_i)
324 params.set<MooseFunctorName>(NS::superficial_velocity_vector[dim_i]) = _velocity_names[dim_i];
326 params.set<MooseFunctorName>(NS::porosity) = _flow_porosity_functor_name;
327 else
328 params.set<MooseFunctorName>(NS::porosity) = "1";
329 params.set<bool>("define_interstitial_velocity_components") = _porous_medium_treatment;
330
332 "PINSFVSpeedFunctorMaterial", prefix() + "pins_speed_material", params);
333}
334
335void
337{
338 // Not very future-proof but it works
339 const bool use_ad = !dynamic_cast<WCNSLinearFVFlowPhysics *>(this);
340 const std::string class_name =
341 use_ad ? "ADVectorMagnitudeFunctorMaterial" : "VectorMagnitudeFunctorMaterial";
342 InputParameters params = getFactory().getValidParams(class_name);
343 assignBlocks(params, _blocks);
344
345 const std::vector<std::string> param_names{"x_functor", "y_functor", "z_functor"};
346 for (unsigned int dim_i = 0; dim_i < dimension(); ++dim_i)
347 params.set<MooseFunctorName>(param_names[dim_i]) = _velocity_names[dim_i];
348 params.set<MooseFunctorName>("vector_magnitude_name") = NS::speed;
349
350 getProblem().addFunctorMaterial(class_name, prefix() + "ins_speed_material", params);
351}
352
353void
355{
356 // Not very future-proof but it works
357 const bool use_ad = !dynamic_cast<WCNSLinearFVFlowPhysics *>(this);
358 const std::string class_name =
359 use_ad ? "GeneralFunctorFluidProps" : "NonADGeneralFunctorFluidProps";
360 InputParameters params = getFactory().getValidParams(class_name);
361 assignBlocks(params, _blocks);
362
363 params.set<MooseFunctorName>(NS::pressure) = _pressure_name;
364 params.set<MooseFunctorName>(NS::T_fluid) = _fluid_temperature_name;
365 params.set<MooseFunctorName>(NS::speed) = NS::speed;
366 params.applySpecificParameters(parameters(), {NS::fluid, NS::density, "mu_rampdown"});
368 params.set<bool>("force_define_density") = true;
370 {
371 params.set<MooseFunctorName>(NS::porosity) = "1";
372 params.set<MooseFunctorName>("characteristic_length") = "1";
373 }
374 else
375 // not implemented yet
376 paramInfo(
377 NS::fluid,
378 "Specifying the fluid properties user object does not define the GeneralFunctorFluidProps "
379 "when using the porous medium treatment. You have to define this object in the input");
380
381 // Dynamic pressure
382 params.set<bool>("solving_for_dynamic_pressure") = _solve_for_dynamic_pressure;
384 {
385 params.set<Point>("reference_pressure_point") = getParam<Point>("reference_pressure_point");
386 if (!isParamSetByUser("reference_pressure_point"))
387 paramWarning("reference_pressure_point",
388 "Default value of (0,0,0) used. If this point is outside the flow domain, the "
389 "simulation will error");
390 params.set<Real>("reference_pressure") = getParam<Real>("reference_pressure");
391 }
392 params.set<Point>("gravity") = getParam<RealVectorValue>("gravity");
393
395 getProblem().addFunctorMaterial(class_name, prefix() + "functor_fluidprops", params);
396}
397
398void
400{
401 if (!_define_variables && parameters().isParamSetByUser("initial_velocity") &&
402 parameters().isParamSetByUser("velocity_variable") &&
403 getParam<std::vector<FunctionName>>("initial_velocity").size() != 0)
404 // TODO: Rework and remove this last statement once the NSFV action is removed
405 paramError("initial_velocity",
406 "Velocity is defined externally of WCNSFVFlowPhysicsBase, so should the inital "
407 "conditions");
408 if (!_define_variables && parameters().isParamSetByUser("initial_pressure") &&
409 parameters().isParamSetByUser("pressure_variable"))
410 paramError("initial_pressure",
411 "Pressure is defined externally of WCNSFVFlowPhysicsBase, so should the inital "
412 "condition");
413
414 // Check dimension
415 if (getParam<std::vector<FunctionName>>("initial_velocity").size() != dimension() &&
416 getParam<std::vector<FunctionName>>("initial_velocity").size() != 3 &&
417 getParam<std::vector<FunctionName>>("initial_velocity").size() != 0)
418 // TODO: Rework and remove this last statement once the NSFV action is removed
419 paramError("initial_velocity",
420 "The number of velocity components in the " + type() + " initial condition is not " +
421 std::to_string(dimension()) + " or 3!");
422
423 InputParameters params = getFactory().getValidParams("FVFunctionIC");
424 assignBlocks(params, _blocks);
425 auto vvalue = getParam<std::vector<FunctionName>>("initial_velocity");
426
427 for (const auto d : make_range(dimension()))
428 {
429 params.set<VariableName>("variable") = _velocity_names[d];
430 params.set<FunctionName>("function") = vvalue[d];
431
433 _blocks,
434 /*whether IC is a default*/ !isParamSetByUser("initial_velocity"),
435 /*error if already an IC*/ isParamSetByUser("initial_velocity")))
437 "FVFunctionIC", prefix() + _velocity_names[d] + "_ic", params);
438 }
439
441 _blocks,
442 /*whether IC is a default*/ !isParamSetByUser("initial_pressure"),
443 /*error if already an IC*/ isParamSetByUser("initial_pressure")))
444 {
445 params.set<VariableName>("variable") = _pressure_name;
446 params.set<FunctionName>("function") = getParam<FunctionName>("initial_pressure");
447
448 getProblem().addFVInitialCondition("FVFunctionIC", prefix() + _pressure_name + "_ic", params);
449 }
450}
451
452unsigned short
454{
455 unsigned short ghost_layers = 2;
456 return ghost_layers;
457}
458
459void
461{
462 const auto momentum_inlet_types = getParam<MultiMooseEnum>("momentum_inlet_types");
463
464 for (unsigned int bc_ind = 0; bc_ind < momentum_inlet_types.size(); ++bc_ind)
465 if (momentum_inlet_types[bc_ind] == "flux-mass" ||
466 momentum_inlet_types[bc_ind] == "flux-velocity")
467 {
468 const std::string pp_type = "AreaPostprocessor";
469 InputParameters params = getFactory().getValidParams(pp_type);
470 params.set<std::vector<BoundaryName>>("boundary") = {_inlet_boundaries[bc_ind]};
471 params.set<ExecFlagEnum>("execute_on") = EXEC_INITIAL;
472
473 const auto name_pp = "area_pp_" + _inlet_boundaries[bc_ind];
474 if (!getProblem().hasUserObject(name_pp))
475 getProblem().addPostprocessor(pp_type, name_pp, params);
476 }
477}
478
479VariableName
480WCNSFVFlowPhysicsBase::getFlowVariableName(const std::string & short_name) const
481{
482 if (short_name == NS::pressure)
483 return getPressureName();
484 else if (short_name == NS::velocity_x && dimension() > 0)
485 return getVelocityNames()[0];
486 else if (short_name == NS::velocity_y && dimension() > 1)
487 return getVelocityNames()[1];
488 else if (short_name == NS::velocity_z && dimension() > 2)
489 return getVelocityNames()[2];
490 else if (short_name == NS::temperature)
492 else
493 mooseError("Short Variable name '", short_name, "' not recognized.");
494}
495
496MooseFunctorName
498{
499 if (smoothed)
501 else
502 return _porosity_name;
503}
504
507{
508 // User passed it, just use that
509 if (isParamValid("coupled_turbulence_physics"))
510 return getCoupledPhysics<WCNSFVTurbulencePhysicsBase>(
511 getParam<PhysicsName>("coupled_turbulence_physics"));
512 // Look for any physics of the right type, and check the block restriction
513 else
514 {
515 const auto all_turbulence_physics = getCoupledPhysics<const WCNSFVTurbulencePhysicsBase>(true);
516 for (const auto physics : all_turbulence_physics)
517 {
519 physics->name(), physics->blocks(), /*error_if_not_identical=*/false))
520 return physics;
521 else if (_verbose)
522 mooseInfoRepeated("Detected Turbulence Physics '" + physics->name() +
523 "' with an incompatible block restriction. It will thus not be coupled "
524 "to this flow equations physics");
525 }
526 }
527 // Did not find one
528 return nullptr;
529}
530
531const UserObjectName &
533{
534 mooseAssert(!_rc_uo_name.empty(), "The Rhie-Chow user-object name should be set!");
535 return _rc_uo_name;
536}
537
538std::vector<SubdomainName>
540{
541 std::vector<SubdomainName> rz_blocks;
542 const auto & mesh = getProblem().mesh();
543
544 const bool use_all_blocks =
545 _blocks.empty() || allMeshBlocks(_blocks) ||
546 std::find(_blocks.begin(), _blocks.end(), "ANY_BLOCK_ID") != _blocks.end();
547
548 std::vector<SubdomainID> block_ids;
549 if (use_all_blocks)
550 {
551 const auto & mesh_blocks = mesh.meshSubdomains();
552 block_ids.insert(block_ids.end(), mesh_blocks.begin(), mesh_blocks.end());
553 }
554 else
555 block_ids = mesh.getSubdomainIDs(_blocks);
556
557 for (const auto subdomain_id : block_ids)
558 if (mesh.getCoordSystem(subdomain_id) == Moose::COORD_RZ)
559 {
560 auto name = mesh.getSubdomainName(subdomain_id);
561 if (name.empty())
562 name = Moose::stringify(subdomain_id);
563 rz_blocks.push_back(name);
564 }
565
566 return rz_blocks;
567}
568
569void
571{
573 return;
574
575 const auto rz_blocks = getAxisymmetricRZBlocks();
576 if (rz_blocks.empty())
577 return;
578
579 const auto radial_index = getProblem().mesh().getAxisymmetricRadialCoord();
580 addAxisymmetricViscousSourceKernel(rz_blocks, radial_index);
581}
void mooseInfoRepeated(Args &&... args)
const ExecFlagType EXEC_INITIAL
const std::string & _current_task
virtual void needFV() override
virtual void addPostprocessor(const std::string &pp_name, const std::string &name, InputParameters &parameters)
bool hasUserObject(const std::string &name) const
virtual MooseMesh & mesh() override
virtual void addFVInitialCondition(const std::string &ic_name, const std::string &name, InputParameters &parameters)
virtual void addFunctorMaterial(const std::string &functor_material_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
void checkVectorParamLengthSameAsCombinedOthers(const std::string &param1, const std::string &param2, const std::string &param3) const
void checkSecondParamSetOnlyIfFirstOneTrue(const std::string &param1, const std::string &param2) const
void checkSecondParamSetOnlyIfFirstOneSet(const std::string &param1, const std::string &param2) const
void applySpecificParameters(const InputParameters &common, const std::vector< std::string > &include, bool allow_private=false)
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)
void deprecateParam(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
T & set(const std::string &name, bool quiet_mode=false)
const InputParameters & parameters() const
const std::string & type() const
void paramInfo(const std::string &param, Args... args) const
void paramWarning(const std::string &param, Args... args) const
const std::string & name() const
void paramError(const std::string &param, Args... args) const
bool isParamSetByUser(const std::string &name) const
void mooseError(Args &&... args) const
const T & getParam(const std::string &name) const
bool isParamValid(const std::string &name) const
unsigned int getAxisymmetricRadialCoord() const
static InputParameters commonMomentumEquationParams()
Definition NSFVBase.C:55
static InputParameters commonMomentumBoundaryTypesParams()
Definition NSFVBase.C:144
static InputParameters validParams()
Definition NSFVBase.C:371
static InputParameters commonMomentumBoundaryFluxesParams()
Definition NSFVBase.C:168
static InputParameters commonNavierStokesFlowParams()
Definition NSFVBase.C:17
Base class to hold common parameters and utilities between all the weakly compressible Navier Stokes-...
static InputParameters validParams()
bool _define_variables
Whether to define variables if they do not exist.
virtual FEProblemBase & getProblem()
Factory & getFactory()
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 checkBlockRestrictionIdentical(const std::string &object_name, const std::vector< SubdomainName > &blocks, const bool error_if_not_identical=true) const
bool allMeshBlocks(const std::vector< SubdomainName > &blocks) const
void assignBlocks(InputParameters &params, const std::vector< SubdomainName > &blocks) const
unsigned int dimension() const
std::string prefix() const
std::vector< SubdomainName > _blocks
const bool _verbose
void addRequiredPhysicsTask(const std::string &task)
virtual void addInitialConditions() override
std::map< BoundaryName, MooseEnum > _momentum_outlet_types
Momentum outlet boundary types.
std::vector< std::vector< SubdomainName > > _friction_blocks
Subdomains where we want to have volumetric friction.
static InputParameters validParams()
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_wall_functors
Functors describing the momentum for each wall boundary.
std::map< BoundaryName, MooseEnum > _momentum_inlet_types
Momentum inlet boundary types.
void addNonPorousMediumSpeedMaterial()
Add material to define the local speed with no porous medium treatment.
std::map< BoundaryName, MooseFunctorName > _pressure_functors
Functors describing the outlet pressure on each boundary.
const MooseEnum _compressibility
Compressibility type, can be compressible, incompressible or weakly-compressible.
const NonlinearVariableName & getPressureName() const
const std::vector< std::string > _velocity_names
Velocity names.
const std::vector< BoundaryName > _wall_boundaries
Boundaries which define a wall (slip/noslip/etc.)
MooseFunctorName _flow_porosity_functor_name
Name of the porosity functor for the flow equations (if smoothed)
void addAxisymmetricViscousSource()
Adds the cylindrical source kernel for the radial momentum equation when requested and valid.
virtual void addPostprocessors() override
virtual void actOnAdditionalTasks() override
const NonlinearVariableName _pressure_name
Pressure name.
const WCNSFVTurbulencePhysicsBase * getCoupledTurbulencePhysics() const
Find the turbulence physics.
const bool _has_flow_equations
Boolean to keep track of whether the flow equations should be created.
const std::vector< std::string > & getVelocityNames() const
To interface with other Physics.
virtual void addAxisymmetricViscousSourceKernel(const std::vector< SubdomainName > &, unsigned int)
Derived classes must override this hook to add the actual object that implements the axisymmetric vis...
virtual bool hasForchheimerFriction() const =0
Return whether a Forchheimer friction model is in use.
const NonlinearVariableName _fluid_temperature_name
Fluid temperature name.
std::vector< SubdomainName > getAxisymmetricRZBlocks() const
Return the set of blocks restricted to an RZ coordinate system.
const NonlinearVariableName & getFluidTemperatureName() const
const bool _porous_medium_treatment
Whether to use the porous medium treatment.
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_inlet_functors
Functors describing the momentum inlet for each boundary.
virtual void initializePhysicsAdditional() override
const std::vector< BoundaryName > _outlet_boundaries
Boundaries with a flow outlet specified on them.
const UserObjectName & rhieChowUOName() const
Return the name of the Rhie Chow user object.
void addFluidPropertiesFunctorMaterial()
Function which adds the general functor fluid properties functor material to define fluid functor mat...
virtual void addInletBC()=0
Functions adding boundary conditions for the flow simulation.
std::vector< Point > _flux_inlet_directions
Direction of each flux inlet. Indexing based on the number of flux boundaries.
WCNSFVFlowPhysicsBase(const InputParameters &parameters)
std::map< BoundaryName, MooseEnum > _momentum_wall_types
Momentum wall boundary types.
VariableName getFlowVariableName(const std::string &default_name) const
Convenience routine to be able to retrieve the actual variable names from their default names.
const bool _solve_for_dynamic_pressure
Whether we are solving for the total or dynamic pressure.
UserObjectName _rc_uo_name
name of the Rhie Chow user object
MooseFunctorName getPorosityFunctorName(const bool smoothed) const
const bool _add_rz_viscous_source
Whether to automatically add the cylindrical viscous source term.
virtual void addMaterials() override
virtual void addWallsBC()=0
virtual void addOutletBC()=0
const MooseFunctorName _density_name
Name of the density material property.
virtual void addFVBCs() override
const MooseFunctorName _porosity_name
Name of the porosity functor.
const WCNSFVTurbulencePhysicsBase * _turbulence_physics
Can be set to a coupled turbulence physics.
void addPorousMediumSpeedMaterial()
Add material to define the local speed in porous medium flows.
virtual void addSeparatorBC()=0
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of algebraic ghosting layers needed.
const std::vector< BoundaryName > _inlet_boundaries
Boundaries with a flow inlet specified on them.
Base class for a Physics that creates all the objects needed to add a turbulence model to an incompre...
Creates all the objects needed to solve the Navier-Stokes equations with the SIMPLE algorithm using t...
MeshBase & mesh
bool parsesToReal(const std::string &input, Real *parsed_real)
std::string stringify(const T &t)
static const std::string density
Definition NS.h:34
static const std::string T_fluid
Definition NS.h:110
static const std::string velocity_y
Definition NS.h:48
static const std::string temperature
Definition NS.h:60
const std::string velocity_vector[3]
Definition NS.h:50
static const std::string velocity_z
Definition NS.h:49
static const std::string porosity
Definition NS.h:108
static const std::string speed
Definition NS.h:147
static const std::string velocity_x
Definition NS.h:47
static const std::string fluid
Definition NS.h:88
static const std::string superficial_velocity_vector[3]
Definition NS.h:55
static const std::string pressure
Definition NS.h:57