22 params.
addClassDescription(
"Base class for Physics defining the Navier Stokes flow equations");
25 params.
addParam<
bool>(
"add_flow_equations",
27 "Whether to add the flow equations. This parameter is not necessary when " 28 "using the Physics syntax");
38 params.addParam<
bool>(
"include_deviatoric_stress",
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",
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",
50 "When true, automatically adds INSFVMomentumViscousSourceRZ to the radial " 51 "momentum equation on RZ blocks. Disable if this term should be omitted.");
58 params.addParam<UserObjectName>(
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.");
66 params.addParam<std::vector<std::vector<MooseFunctorName>>>(
67 "momentum_wall_functors",
69 "Functors for each component of the velocity value on walls. This is only necessary for the " 70 "fixed-velocity momentum wall types.");
88 MooseEnum coeff_interp_method(
"average harmonic",
"harmonic");
89 params.addParam<
MooseEnum>(
"mu_interp_method",
91 "Switch that can select face interpolation method for the viscosity.");
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");
100 params.addParamNamesToGroup(
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");
109 params.addParamNamesToGroup(
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",
114 params.addParamNamesToGroup(
"thermal_expansion",
"Gravity treatment");
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),
129 isParamValid(
"velocity_variable")
130 ? getParam<
std::vector<
std::string>>(
"velocity_variable")
131 : (_porous_medium_treatment
135 _pressure_name(isParamValid(
"pressure_variable")
136 ? getParam<NonlinearVariableName>(
"pressure_variable")
138 _fluid_temperature_name(isParamValid(
"fluid_temperature_variable")
139 ? getParam<NonlinearVariableName>(
"fluid_temperature_variable")
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"))
168 checkVectorParamsSameLengthIfSet<PostprocessorName, Point>(
"flux_inlet_pps",
169 "flux_inlet_directions");
178 "Solving for dynamic pressure is only implemented for incompressible flow");
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>,
188 "inlet_boundaries",
"momentum_inlet_functors",
"flux_inlet_pps");
189 checkVectorParamsNoOverlap<BoundaryName>(
190 {
"inlet_boundaries",
"outlet_boundaries",
"wall_boundaries"});
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!");
209 "friction_blocks",
"friction_types");
210 checkTwoDVectorParamsSameLength<std::string, std::string>(
"friction_types",
"friction_coeffs");
222 std::vector<BoundaryName> inlet_boundaries_with_functors;
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"));
235 std::vector<BoundaryName> outlet_boundaries_with_functors;
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())
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()) +
")");
248 outlet_boundaries_with_functors, pressure_functors);
254 std::vector<BoundaryName> wall_boundaries_with_functors;
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())
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()) +
")");
268 Moose::createMapFromVectors<BoundaryName, std::vector<MooseFunctorName>>(
269 wall_boundaries_with_functors, momentum_wall_functors);
323 for (
unsigned int dim_i = 0; dim_i <
dimension(); ++dim_i)
332 "PINSFVSpeedFunctorMaterial",
prefix() +
"pins_speed_material", params);
338 const std::string class_name =
"ADVectorMagnitudeFunctorMaterial";
342 const std::vector<std::string> param_names{
"x_functor",
"y_functor",
"z_functor"};
343 for (
unsigned int dim_i = 0; dim_i <
dimension(); ++dim_i)
345 params.
set<MooseFunctorName>(
"vector_magnitude_name") =
NS::speed;
355 const std::string class_name =
356 use_ad ?
"GeneralFunctorFluidProps" :
"NonADGeneralFunctorFluidProps";
365 params.
set<
bool>(
"force_define_density") =
true;
369 params.
set<MooseFunctorName>(
"characteristic_length") =
"1";
375 "Specifying the fluid properties user object does not define the GeneralFunctorFluidProps " 376 "when using the porous medium treatment. You have to define this object in the input");
382 params.
set<Point>(
"reference_pressure_point") = getParam<Point>(
"reference_pressure_point");
385 "Default value of (0,0,0) used. If this point is outside the flow domain, the " 386 "simulation will error");
387 params.
set<
Real>(
"reference_pressure") = getParam<Real>(
"reference_pressure");
389 params.
set<Point>(
"gravity") = getParam<RealVectorValue>(
"gravity");
400 getParam<std::vector<FunctionName>>(
"initial_velocity").size() != 0)
403 "Velocity is defined externally of WCNSFVFlowPhysicsBase, so should the inital " 408 "Pressure is defined externally of WCNSFVFlowPhysicsBase, so should the inital " 412 if (
getParam<std::vector<FunctionName>>(
"initial_velocity").size() !=
dimension() &&
413 getParam<std::vector<FunctionName>>(
"initial_velocity").size() != 3 &&
414 getParam<std::vector<FunctionName>>(
"initial_velocity").size() != 0)
417 "The number of velocity components in the " +
type() +
" initial condition is not " +
422 auto vvalue = getParam<std::vector<FunctionName>>(
"initial_velocity");
427 params.
set<FunctionName>(
"function") = vvalue[
d];
443 params.
set<FunctionName>(
"function") = getParam<FunctionName>(
"initial_pressure");
452 unsigned short ghost_layers = 2;
459 const auto momentum_inlet_types = getParam<MultiMooseEnum>(
"momentum_inlet_types");
461 for (
unsigned int bc_ind = 0; bc_ind < momentum_inlet_types.size(); ++bc_ind)
462 if (momentum_inlet_types[bc_ind] ==
"flux-mass" ||
463 momentum_inlet_types[bc_ind] ==
"flux-velocity")
465 const std::string pp_type =
"AreaPostprocessor";
490 mooseError(
"Short Variable name '", short_name,
"' not recognized.");
507 return getCoupledPhysics<WCNSFVTurbulencePhysicsBase>(
508 getParam<PhysicsName>(
"coupled_turbulence_physics"));
512 const auto all_turbulence_physics = getCoupledPhysics<const WCNSFVTurbulencePhysicsBase>(
true);
513 for (
const auto physics : all_turbulence_physics)
516 physics->name(), physics->blocks(),
false))
520 "' with an incompatible block restriction. It will thus not be coupled " 521 "to this flow equations physics");
528 const UserObjectName &
531 mooseAssert(!
_rc_uo_name.empty(),
"The Rhie-Chow user-object name should be set!");
535 std::vector<SubdomainName>
538 std::vector<SubdomainName> rz_blocks;
541 const bool use_all_blocks =
545 std::vector<SubdomainID> block_ids;
548 const auto & mesh_blocks =
mesh.meshSubdomains();
549 block_ids.insert(block_ids.end(), mesh_blocks.begin(), mesh_blocks.end());
554 for (
const auto subdomain_id : block_ids)
557 auto name =
mesh.getSubdomainName(subdomain_id);
560 rz_blocks.push_back(
name);
573 if (rz_blocks.empty())
std::string prefix() const
Creates all the objects needed to solve the Navier-Stokes equations with the SIMPLE algorithm using t...
virtual void addFVInitialCondition(const std::string &ic_name, const std::string &name, InputParameters ¶meters)
static InputParameters validParams()
const bool _has_flow_equations
Boolean to keep track of whether the flow equations should be created.
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of algebraic ghosting layers needed.
const std::vector< std::string > & getVelocityNames() const
To interface with other Physics.
Base class for a Physics that creates all the objects needed to add a turbulence model to an incompre...
void assignBlocks(InputParameters ¶ms, const std::vector< SubdomainName > &blocks) const
std::map< BoundaryName, MooseEnum > _momentum_inlet_types
Momentum inlet boundary types.
const std::vector< BoundaryName > _outlet_boundaries
Boundaries with a flow outlet specified on them.
void paramError(const std::string ¶m, Args... args) const
virtual void addSeparatorBC()=0
const T & getParam(const std::string &name) const
static const std::string speed
void addRequiredPhysicsTask(const std::string &task)
virtual void initializePhysicsAdditional() override
const MooseFunctorName _density_name
Name of the density material property.
virtual void needFV() override
virtual void addMaterials() override
const InputParameters & parameters() const
static const std::string velocity_z
virtual void actOnAdditionalTasks() override
static const std::string density
InputParameters getValidParams(const std::string &name) const
void mooseInfoRepeated(Args &&... args)
static const std::string fluid
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_inlet_functors
Functors describing the momentum inlet for each boundary.
virtual void addOutletBC()=0
virtual void addFunctorMaterial(const std::string &functor_material_name, const std::string &name, InputParameters ¶meters)
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_wall_functors
Functors describing the momentum for each wall boundary.
static const std::string velocity_x
const NonlinearVariableName _pressure_name
Pressure name.
static const std::string temperature
const MooseFunctorName _porosity_name
Name of the porosity functor.
virtual void addWallsBC()=0
bool hasUserObject(const std::string &name) const
bool shouldCreateIC(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool ic_is_default_ic, const bool error_if_already_defined) const
static InputParameters validParams()
bool allMeshBlocks(const std::vector< SubdomainName > &blocks) const
const bool _porous_medium_treatment
Whether to use the porous medium treatment.
std::vector< SubdomainName > _blocks
const std::vector< BoundaryName > _wall_boundaries
Boundaries which define a wall (slip/noslip/etc.)
virtual void addPostprocessors() override
unsigned int dimension() const
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 FEProblemBase & getProblem()
virtual void addPostprocessor(const std::string &pp_name, const std::string &name, InputParameters ¶meters)
static const std::string porosity
static InputParameters validParams()
const std::string & name() const
static InputParameters commonNavierStokesFlowParams()
static const std::string T_fluid
std::vector< std::vector< SubdomainName > > _friction_blocks
Subdomains where we want to have volumetric friction.
const NonlinearVariableName & getFluidTemperatureName() const
std::map< BoundaryName, MooseEnum > _momentum_outlet_types
Momentum outlet boundary types.
unsigned int getAxisymmetricRadialCoord() const
static const std::string superficial_velocity_vector[3]
std::vector< SubdomainName > getAxisymmetricRZBlocks() const
Return the set of blocks restricted to an RZ coordinate system.
const std::vector< std::string > _velocity_names
Velocity names.
virtual void addInletBC()=0
Functions adding boundary conditions for the flow simulation.
MooseFunctorName getPorosityFunctorName(const bool smoothed) const
static InputParameters commonMomentumBoundaryFluxesParams()
const std::string & type() const
const std::string & _current_task
static const std::string velocity_y
void addAxisymmetricViscousSource()
Adds the cylindrical source kernel for the radial momentum equation when requested and valid...
std::string stringify(const T &t)
const bool _solve_for_dynamic_pressure
Whether we are solving for the total or dynamic pressure.
const MooseEnum _compressibility
Compressibility type, can be compressible, incompressible or weakly-compressible. ...
bool checkBlockRestrictionIdentical(const std::string &object_name, const std::vector< SubdomainName > &blocks, const bool error_if_not_identical=true) const
MooseFunctorName _flow_porosity_functor_name
Name of the porosity functor for the flow equations (if smoothed)
static InputParameters commonMomentumEquationParams()
bool _define_variables
Whether to define variables if they do not exist.
void addPorousMediumSpeedMaterial()
Add material to define the local speed in porous medium flows.
UserObjectName _rc_uo_name
name of the Rhie Chow user object
std::map< BoundaryName, MooseEnum > _momentum_wall_types
Momentum wall boundary types.
const NonlinearVariableName _fluid_temperature_name
Fluid temperature name.
VariableName getFlowVariableName(const std::string &default_name) const
Convenience routine to be able to retrieve the actual variable names from their default names...
void addNonPorousMediumSpeedMaterial()
Add material to define the local speed with no porous medium treatment.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const bool _add_rz_viscous_source
Whether to automatically add the cylindrical viscous source term.
std::map< BoundaryName, MooseFunctorName > _pressure_functors
Functors describing the outlet pressure on each boundary.
void addFluidPropertiesFunctorMaterial()
Function which adds the general functor fluid properties functor material to define fluid functor mat...
virtual bool hasForchheimerFriction() const =0
Return whether a Forchheimer friction model is in use.
static const std::string pressure
const UserObjectName & rhieChowUOName() const
Return the name of the Rhie Chow user object.
IntRange< T > make_range(T beg, T end)
virtual MooseMesh & mesh() override
void mooseError(Args &&... args) const
virtual void addFVBCs() override
virtual void addInitialConditions() override
WCNSFVFlowPhysicsBase(const InputParameters ¶meters)
bool isParamValid(const std::string &name) const
Base class to hold common parameters and utilities between all the weakly compressible Navier Stokes-...
const std::vector< BoundaryName > _inlet_boundaries
Boundaries with a flow inlet specified on them.
void paramWarning(const std::string ¶m, Args... args) const
const std::string velocity_vector[3]
const WCNSFVTurbulencePhysicsBase * getCoupledTurbulencePhysics() const
Find the turbulence physics.
std::vector< Point > _flux_inlet_directions
Direction of each flux inlet. Indexing based on the number of flux boundaries.
bool parsesToReal(const std::string &input, Real *parsed_real)
bool isParamSetByUser(const std::string &name) const
static InputParameters commonMomentumBoundaryTypesParams()
const WCNSFVTurbulencePhysicsBase * _turbulence_physics
Can be set to a coupled turbulence physics.
void paramInfo(const std::string ¶m, Args... args) const
const ExecFlagType EXEC_INITIAL
const NonlinearVariableName & getPressureName() const