21 params.
addClassDescription(
"Base class for Physics defining the Navier Stokes flow equations");
24 params.
addParam<
bool>(
"add_flow_equations",
26 "Whether to add the flow equations. This parameter is not necessary when " 27 "using the Physics syntax");
37 params.addParam<
bool>(
38 "include_deviatoric_stress",
40 "Whether to include the full expansion (the transposed term as well) of the stress tensor");
48 params.addParam<std::vector<std::vector<MooseFunctorName>>>(
49 "momentum_wall_functors",
51 "Functors for each component of the velocity value on walls. This is only necessary for the " 52 "fixed-velocity momentum wall types.");
70 MooseEnum coeff_interp_method(
"average harmonic",
"harmonic");
71 params.addParam<
MooseEnum>(
"mu_interp_method",
73 "Switch that can select face interpolation method for the viscosity.");
76 params.addParam<UserObjectName>(
NS::fluid,
"Fluid properties userobject");
77 params.addParam<FunctionName>(
78 "mu_rampdown", 1,
"A function describing a ramp down of viscosity over time");
79 params.addParamNamesToGroup(
NS::fluid +
" mu_rampdown",
"Material properties");
82 params.addParamNamesToGroup(
83 "velocity_variable pressure_variable initial_pressure initial_velocity",
"Variables");
84 params.addParamNamesToGroup(
"density dynamic_viscosity",
"Material properties");
85 params.addParamNamesToGroup(
"inlet_boundaries momentum_inlet_types momentum_inlet_functors",
86 "Inlet boundary conditions");
87 params.addParamNamesToGroup(
"outlet_boundaries momentum_outlet_types pressure_functors",
88 "Outlet boundary conditions");
89 params.addParamNamesToGroup(
"wall_boundaries momentum_wall_types momentum_wall_functors",
90 "Wall boundary conditions");
91 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",
96 params.addParamNamesToGroup(
"thermal_expansion",
"Gravity treatment");
103 _has_flow_equations(getParam<bool>(
"add_flow_equations")),
104 _compressibility(getParam<
MooseEnum>(
"compressibility")),
105 _solve_for_dynamic_pressure(getParam<bool>(
"solve_for_dynamic_pressure")),
106 _porous_medium_treatment(getParam<bool>(
"porous_medium_treatment")),
107 _porosity_name(getParam<MooseFunctorName>(
"porosity")),
108 _flow_porosity_functor_name(_porosity_name),
110 isParamValid(
"velocity_variable")
111 ? getParam<
std::vector<
std::string>>(
"velocity_variable")
112 : (_porous_medium_treatment
116 _pressure_name(isParamValid(
"pressure_variable")
117 ? getParam<NonlinearVariableName>(
"pressure_variable")
119 _fluid_temperature_name(isParamValid(
"fluid_temperature_variable")
120 ? getParam<NonlinearVariableName>(
"fluid_temperature_variable")
122 _density_name(getParam<MooseFunctorName>(
"density")),
123 _density_gravity_name(isParamValid(
"density_gravity")
124 ? getParam<MooseFunctorName>(
"density_gravity")
125 : getParam<MooseFunctorName>(
"density")),
126 _dynamic_viscosity_name(getParam<MooseFunctorName>(
"dynamic_viscosity")),
127 _velocity_interpolation(getParam<
MooseEnum>(
"velocity_interpolation")),
128 _momentum_advection_interpolation(getParam<
MooseEnum>(
"momentum_advection_interpolation")),
129 _momentum_face_interpolation(getParam<
MooseEnum>(
"momentum_face_interpolation")),
130 _friction_blocks(getParam<
std::vector<
std::vector<SubdomainName>>>(
"friction_blocks")),
131 _friction_types(getParam<
std::vector<
std::vector<
std::string>>>(
"friction_types")),
132 _friction_coeffs(getParam<
std::vector<
std::vector<
std::string>>>(
"friction_coeffs")),
133 _inlet_boundaries(getParam<
std::vector<BoundaryName>>(
"inlet_boundaries")),
134 _outlet_boundaries(getParam<
std::vector<BoundaryName>>(
"outlet_boundaries")),
135 _wall_boundaries(getParam<
std::vector<BoundaryName>>(
"wall_boundaries")),
136 _hydraulic_separators(getParam<
std::vector<BoundaryName>>(
"hydraulic_separator_sidesets")),
137 _flux_inlet_pps(getParam<
std::vector<PostprocessorName>>(
"flux_inlet_pps")),
138 _flux_inlet_directions(getParam<
std::vector<Point>>(
"flux_inlet_directions"))
143 checkVectorParamsSameLengthIfSet<PostprocessorName, Point>(
"flux_inlet_pps",
144 "flux_inlet_directions");
153 "Solving for dynamic pressure is only implemented for incompressible flow");
156 checkVectorParamAndMultiMooseEnumLength<BoundaryName>(
"inlet_boundaries",
"momentum_inlet_types");
157 checkVectorParamAndMultiMooseEnumLength<BoundaryName>(
"outlet_boundaries",
158 "momentum_outlet_types");
159 checkVectorParamAndMultiMooseEnumLength<BoundaryName>(
"wall_boundaries",
"momentum_wall_types");
161 std::vector<MooseFunctorName>,
163 "inlet_boundaries",
"momentum_inlet_functors",
"flux_inlet_pps");
164 checkVectorParamsNoOverlap<BoundaryName>(
165 {
"inlet_boundaries",
"outlet_boundaries",
"wall_boundaries"});
176 "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!");
184 "friction_blocks",
"friction_types");
185 checkTwoDVectorParamsSameLength<std::string, std::string>(
"friction_types",
"friction_coeffs");
197 std::vector<BoundaryName> inlet_boundaries_with_functors;
201 inlet_boundaries_with_functors.push_back(boundary);
203 Moose::createMapFromVectors<BoundaryName, std::vector<MooseFunctorName>>(
204 inlet_boundaries_with_functors,
205 getParam<std::vector<std::vector<MooseFunctorName>>>(
"momentum_inlet_functors"));
210 std::vector<BoundaryName> outlet_boundaries_with_functors;
214 outlet_boundaries_with_functors.push_back(boundary);
215 const auto & pressure_functors = getParam<std::vector<MooseFunctorName>>(
"pressure_functors");
216 if (outlet_boundaries_with_functors.size() != pressure_functors.size())
218 "Size (" + std::to_string(pressure_functors.size()) +
219 ") is not the same as the number of pressure outlet boundaries in " 220 "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
221 std::to_string(outlet_boundaries_with_functors.size()) +
")");
223 outlet_boundaries_with_functors, pressure_functors);
229 std::vector<BoundaryName> wall_boundaries_with_functors;
232 wall_boundaries_with_functors.push_back(boundary);
233 const auto & momentum_wall_functors =
234 getParam<std::vector<std::vector<MooseFunctorName>>>(
"momentum_wall_functors");
235 if (wall_boundaries_with_functors.size() != momentum_wall_functors.size())
237 "Size (" + std::to_string(momentum_wall_functors.size()) +
238 ") is not the same as the number of momentum_wall wall boundaries with " 239 "no-slip boundary conditions ' (size " +
240 std::to_string(wall_boundaries_with_functors.size()) +
")");
243 Moose::createMapFromVectors<BoundaryName, std::vector<MooseFunctorName>>(
244 wall_boundaries_with_functors, momentum_wall_functors);
289 for (
unsigned int dim_i = 0; dim_i <
dimension(); ++dim_i)
298 "PINSFVSpeedFunctorMaterial",
prefix() +
"pins_speed_material", params);
304 const std::string class_name =
"ADVectorMagnitudeFunctorMaterial";
308 const std::vector<std::string> param_names{
"x_functor",
"y_functor",
"z_functor"};
309 for (
unsigned int dim_i = 0; dim_i <
dimension(); ++dim_i)
311 params.
set<MooseFunctorName>(
"vector_magnitude_name") =
NS::speed;
321 const std::string class_name =
322 use_ad ?
"GeneralFunctorFluidProps" :
"NonADGeneralFunctorFluidProps";
331 params.
set<
bool>(
"force_define_density") =
true;
335 params.
set<MooseFunctorName>(
"characteristic_length") =
"1";
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");
348 params.
set<Point>(
"reference_pressure_point") = getParam<Point>(
"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 params.
set<
Real>(
"reference_pressure") = getParam<Real>(
"reference_pressure");
355 params.
set<Point>(
"gravity") = getParam<RealVectorValue>(
"gravity");
366 getParam<std::vector<FunctionName>>(
"initial_velocity").size() != 0)
369 "Velocity is defined externally of WCNSFVFlowPhysicsBase, so should the inital " 374 "Pressure is defined externally of WCNSFVFlowPhysicsBase, so should the inital " 378 if (
getParam<std::vector<FunctionName>>(
"initial_velocity").size() !=
dimension() &&
379 getParam<std::vector<FunctionName>>(
"initial_velocity").size() != 3 &&
380 getParam<std::vector<FunctionName>>(
"initial_velocity").size() != 0)
383 "The number of velocity components in the " +
type() +
" initial condition is not " +
388 auto vvalue = getParam<std::vector<FunctionName>>(
"initial_velocity");
393 params.
set<FunctionName>(
"function") = vvalue[
d];
408 params.
set<FunctionName>(
"function") = getParam<FunctionName>(
"initial_pressure");
417 unsigned short ghost_layers = 2;
424 const auto momentum_inlet_types = getParam<MultiMooseEnum>(
"momentum_inlet_types");
426 for (
unsigned int bc_ind = 0; bc_ind < momentum_inlet_types.size(); ++bc_ind)
427 if (momentum_inlet_types[bc_ind] ==
"flux-mass" ||
428 momentum_inlet_types[bc_ind] ==
"flux-velocity")
430 const std::string pp_type =
"AreaPostprocessor";
455 mooseError(
"Short Variable name '", short_name,
"' not recognized.");
472 return getCoupledPhysics<WCNSFVTurbulencePhysics>(
473 getParam<PhysicsName>(
"coupled_flow_physics"));
477 const auto all_turbulence_physics = getCoupledPhysics<const WCNSFVTurbulencePhysics>(
true);
478 for (
const auto physics : all_turbulence_physics)
480 physics->name(), physics->blocks(),
false))
std::string prefix() const
Creates all the objects needed to solve the Navier-Stokes equations with the SIMPLE algorithm using t...
static InputParameters validParams()
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.
void assignBlocks(InputParameters ¶ms, const std::vector< SubdomainName > &blocks) const
Creates all the objects needed to add a turbulence model to an incompressible / weakly-compressible N...
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
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
const WCNSFVTurbulencePhysics * _turbulence_physics
Can be set to a coupled turbulence physics.
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()
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 addInitialCondition(const std::string &ic_name, const std::string &name, InputParameters ¶meters)
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.
static const std::string superficial_velocity_vector[3]
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
const WCNSFVTurbulencePhysics * getCoupledTurbulencePhysics() const
Find the turbulence physics.
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.
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
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
IntRange< T > make_range(T beg, T end)
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]
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 ExecFlagType EXEC_INITIAL
const NonlinearVariableName & getPressureName() const