31 "Define the Navier Stokes weakly-compressible equations with the linear " 32 "solver implementation of the SIMPLE scheme");
34 params.
addParam<InterpolationMethodName>(
35 "momentum_advection_interpolation_method_name",
36 "Name of an externally defined FVInterpolationMethod to use for momentum advection. When " 37 "provided, this overrides 'momentum_advection_interpolation'.");
40 "orthogonality_correction",
false,
"Whether to use orthogonality correction");
41 params.
renameParam(
"orthogonality_correction",
"use_nonorthogonal_correction",
"");
43 "pressure_diffusion_interpolation",
45 "The face interpolation method for Ainv in the pressure correction diffusion term.");
47 params.
set<
unsigned short>(
"ghost_layers") = 1;
50 params.
set<std::vector<SolverSystemName>>(
"system_names") = {
51 "u_system",
"v_system",
"w_system",
"pressure_system"};
60 params.
set<
bool>(
"porous_medium_treatment") =
false;
62 params.
set<MooseFunctorName>(
"porosity") =
"1";
82 _non_orthogonal_correction(getParam<bool>(
"orthogonality_correction"))
87 paramError(
"porous_medium_treatment",
"Porous media unsupported");
93 "Flow separators are not supported yet for linearFV!");
94 if (getParam<bool>(
"pin_pressure"))
96 "Pressure pinning is implemented in the executioner for the linear finite volume " 139 const std::vector<std::string> v_short = {
"u",
"v",
"w"};
144 "The number of velocity variable names supplied to the NSFVAction is not " +
146 ((
dimension() == 3) ?
"" :
" or 3!") +
"\nVelocity variables " +
156 std::string variable_type =
"MooseLinearVariableFVReal";
167 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
175 const auto pressure_type =
"MooseLinearVariableFVReal";
186 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
216 if (getParam<bool>(
"boussinesq_approximation"))
224 std::string kernel_type =
"LinearFVPressureCorrectionDiffusion";
225 std::string kernel_name =
prefix() +
"p_diffusion";
230 params.
set<MooseFunctorName>(
"diffusion_tensor") =
"Ainv";
236 std::string kernel_type =
"LinearFVDivergence";
237 std::string kernel_name =
prefix() +
"HbyA_divergence";
242 params.
set<MooseFunctorName>(
"face_flux") =
"HbyA";
243 params.
set<
bool>(
"force_boundary_execution") =
true;
252 std::string kernel_type =
"LinearFVTimeDerivative";
253 std::string kernel_name =
prefix() +
"ins_momentum_time";
270 const auto momentum_advection_method_name =
271 isParamValid(
"momentum_advection_interpolation_method_name")
272 ? getParam<InterpolationMethodName>(
"momentum_advection_interpolation_method_name")
273 : InterpolationMethodName(
274 std::string(getParam<MooseEnum>(
"momentum_advection_interpolation")));
276 const std::string u_names[3] = {
"u",
"v",
"w"};
277 std::string kernel_type =
"LinearWCNSFVMomentumFlux";
278 std::string kernel_name =
prefix() +
"ins_momentum_flux_";
288 params.
set<InterpolationMethodName>(
"advected_interp_method_name") =
289 momentum_advection_method_name;
293 for (
unsigned int i = 0; i <
dimension(); ++i)
308 std::string kernel_type =
"LinearFVMomentumPressure";
309 std::string kernel_name =
prefix() +
"ins_momentum_pressure_";
327 unsigned int num_used_blocks = num_friction_blocks ? num_friction_blocks : 1;
329 const std::string kernel_type =
"LinearFVMomentumFriction";
332 for (
const auto block_i :
make_range(num_used_blocks))
334 std::string block_name =
"";
335 if (num_friction_blocks)
343 block_name = std::to_string(block_i);
350 for (
unsigned int type_i = 0; type_i <
_friction_types[block_i].size(); ++type_i)
353 if (upper_name ==
"DARCY")
362 "' is not implemented");
366 prefix() +
"momentum_friction_" + block_name +
"_" +
378 std::string kernel_type =
"LinearFVSource";
379 std::string kernel_name =
prefix() +
"ins_momentum_gravity_";
383 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
384 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
387 if (gravity_vector(
d) != 0)
389 params.
set<MooseFunctorName>(
"source_density") =
"rho_g_" + comp_axis[
d];
402 "We cannot use boussinesq approximation while running in weakly-compressible mode!");
404 std::string kernel_type =
"LinearFVMomentumBoussinesq";
405 std::string kernel_name =
prefix() +
"ins_momentum_boussinesq_";
412 params.
set<
Real>(
"ref_temperature") = getParam<Real>(
"ref_temperature");
413 params.
set<MooseFunctorName>(
"alpha_name") = getParam<MooseFunctorName>(
"thermal_expansion");
428 unsigned int num_velocity_functor_inlets = 0;
430 if (momentum_inlet_type ==
"fixed-velocity" || momentum_inlet_type ==
"fixed-pressure")
431 num_velocity_functor_inlets++;
436 ") is not the same as the number of entries in the momentum_inlet_types " 437 "subvector for fixed-velocities/pressures functors (size " +
438 std::to_string(num_velocity_functor_inlets) +
")");
440 unsigned int velocity_pressure_counter = 0;
443 if (momentum_inlet_type ==
"fixed-velocity")
445 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
447 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
450 "More non-flux inlets than inlet functors (" +
455 if (momentum_functors.size() <
dimension())
457 "Subvector for boundary '" + inlet_bdy +
"' (size " +
458 std::to_string(momentum_functors.size()) +
459 ") is not the same size as the number of dimensions of the physics (" +
465 params.
set<MooseFunctorName>(
"functor") = momentum_functors[
d];
469 ++velocity_pressure_counter;
472 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
474 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
476 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
478 params.
set<
bool>(
"use_two_term_expansion") =
true;
485 else if (momentum_inlet_type ==
"fixed-pressure")
487 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
492 "More non-flux inlets than inlet functors (" +
495 params.
set<MooseFunctorName>(
"functor") =
497 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
500 ++velocity_pressure_counter;
503 mooseError(
"Unsupported inlet boundary condition type: ", momentum_inlet_type);
511 unsigned int num_pressure_outlets = 0;
513 if (momentum_outlet_type ==
"fixed-pressure" ||
514 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
515 num_pressure_outlets++;
520 ") is not the same as the number of pressure outlet boundaries in " 521 "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
522 std::to_string(num_pressure_outlets) +
")");
524 const std::string u_names[3] = {
"u",
"v",
"w"};
528 if (momentum_outlet_type ==
"zero-gradient" || momentum_outlet_type ==
"fixed-pressure" ||
529 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
531 const std::string bc_type =
"LinearFVAdvectionDiffusionOutflowBC";
533 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
534 params.
set<
bool>(
"use_two_term_expansion") = getParam<bool>(
"momentum_two_term_bc_expansion");
544 if (momentum_outlet_type ==
"fixed-pressure" ||
545 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
547 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
551 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
561 const std::string u_names[3] = {
"u",
"v",
"w"};
562 bool has_symmetry_bc =
false;
566 if (momentum_wall_type ==
"noslip")
568 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
570 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
576 params.
set<MooseFunctorName>(
"functor") =
"0";
583 else if (momentum_wall_type ==
"symmetry")
585 has_symmetry_bc =
true;
587 const std::string bc_type =
"LinearFVVelocitySymmetryBC";
589 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
602 const std::string bc_type =
"LinearFVPressureSymmetryBC";
604 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
606 params.
set<MooseFunctorName>(
"HbyA_flux") =
"HbyA";
611 mooseError(
"Unsupported wall boundary condition type: " + std::string(momentum_wall_type));
614 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
616 if (!has_symmetry_bc)
618 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
622 params.
set<
bool>(
"use_two_term_expansion") =
true;
628 if (momentum_wall_type !=
"symmetry")
630 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
632 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
634 params.
set<
bool>(
"use_two_term_expansion") =
true;
636 bc_type,
_pressure_name +
"_extrapolation_" + boundary_name, params);
652 mooseAssert(
dimension(),
"0-dimension not supported");
660 std::vector<UserObject *> objs;
665 .condition<AttribThread>(0)
667 unsigned int num_rc_uo = 0;
668 for (
const auto & obj : objs)
669 if (dynamic_cast<RhieChowMassFlux *>(obj))
672 if (rc_obj->blocks() ==
_blocks)
675 else if (rc_obj->blocks().size() == 0 ||
_blocks.size() == 0)
682 const std::string u_names[3] = {
"u",
"v",
"w"};
683 const auto object_type =
"RhieChowMassFlux";
691 params.set<std::string>(
"p_diffusion_kernel") =
prefix() +
"p_diffusion";
693 params.set<
MooseEnum>(
"pressure_projection_method") =
694 getParam<MooseEnum>(
"pressure_projection_method");
695 params.set<
MooseEnum>(
"pressure_diffusion_interpolation") =
696 getParam<MooseEnum>(
"pressure_diffusion_interpolation");
701 std::vector<UserObjectName>
712 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
713 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
715 if (gravity_vector(
d) != 0)
721 params.set<std::string>(
"expression") =
725 params.set<std::string>(
"property_name") =
"rho_g_" + comp_axis[
d];
728 "ADParsedFunctorMaterial",
prefix() +
"gravity_helper_" + comp_axis[
d], params);
virtual void addFVKernels() override
std::string prefix() const
Creates all the objects needed to solve the Navier-Stokes equations with the SIMPLE algorithm using t...
virtual void addFVInterpolationMethods() override
void addUserObject(const std::string &uo_type, const std::string &uo_name, InputParameters ¶ms)
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of algebraic ghosting layers needed.
const bool _has_flow_equations
Boolean to keep track of whether the flow equations should be created.
void assignBlocks(InputParameters ¶ms, const std::vector< SubdomainName > &blocks) const
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
virtual void addInletBC() override
Functions adding boundary conditions for the flow simulation.
User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segreg...
std::vector< std::vector< std::string > > _friction_types
The friction correlation types used for each block.
std::map< BoundaryName, MooseEnum > _momentum_inlet_types
Momentum inlet boundary types.
void paramError(const std::string ¶m, Args... args) const
virtual void addMomentumPressureKernels() override
void addRequiredPhysicsTask(const std::string &task)
virtual void initializePhysicsAdditional() override
virtual std::vector< UserObjectName > getSuppliedUserObjects() const override
const MooseFunctorName _density_name
Name of the density material property.
MooseEnum fvFaceInterpolationMethods()
Enum of the interpolation methods supported by FVInterpolationMethod objects.
const MooseFunctorName _density_gravity_name
Name of the density material property used for gravity and Boussinesq terms.
void addFVAdvectedInterpolationMethod(const MooseEnum &interpolation_method)
Add the FVInterpolationMethod object for an advected interpolation method if absent.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
virtual void addFunctorMaterials() override
const InputParameters & parameters() const
virtual void addRhieChowUserObjects() override
Function which adds the RhieChow interpolator user objects for weakly and incompressible formulations...
void addMomentumTimeKernels() override
Functions adding kernels for the incompressible momentum equation If the material properties are not ...
static const std::string density
InputParameters getValidParams(const std::string &name) const
void reportPotentiallyMissedParameters(const std::vector< std::string > ¶m_names, const std::string &object_type, const std::string &object_name="") const
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_inlet_functors
Functors describing the momentum inlet for each boundary.
virtual void initializePhysicsAdditional() override
registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_interpolation_method_physics")
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_wall_functors
Functors describing the momentum for each wall boundary.
void addMomentumFluxKernels()
const NonlinearVariableName _pressure_name
Pressure name.
void addPressureCorrectionKernels()
Function adding kernels for the incompressible pressure correction equation.
bool shouldCreateTimeDerivative(const VariableName &var_name, const std::vector< SubdomainName > &blocks, 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.)
unsigned int dimension() const
bool includeSymmetrizedViscousStress() const
Whether to include the symmetrized contribution in the viscous stress.
static const std::string directions[3]
std::string toUpper(std::string name)
virtual void addWallsBC() override
virtual FEProblemBase & getProblem()
const SolverSystemName & getSolverSystem(unsigned int variable_index) const
static const std::string T_fluid
std::vector< std::vector< SubdomainName > > _friction_blocks
Subdomains where we want to have volumetric friction.
TheWarehouse & theWarehouse() const
virtual void addMomentumGravityKernels() override
std::map< BoundaryName, MooseEnum > _momentum_outlet_types
Momentum outlet boundary types.
static const std::string mu
const std::vector< std::string > _velocity_names
Velocity names.
static InputParameters validParams()
Base class for Physics which create the Navier Stokes flow equations.
WCNSLinearFVFlowPhysics(const InputParameters ¶meters)
virtual void addUserObjects() override
void needSolutionState(unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
const MooseFunctorName _dynamic_viscosity_name
Name of the dynamic viscosity material property.
std::string stringify(const T &t)
static const std::string mu_eff
const bool _solve_for_dynamic_pressure
Whether we are solving for the total or dynamic pressure.
const bool _non_orthogonal_correction
Whether to use the correction term for non-orthogonality.
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶ms)
const MooseEnum _compressibility
Compressibility type, can be compressible, incompressible or weakly-compressible. ...
bool _define_variables
Whether to define variables if they do not exist.
virtual void addLinearFVKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
registerWCNSFVFlowPhysicsBaseTasks("NavierStokesApp", WCNSLinearFVFlowPhysics)
std::map< BoundaryName, MooseEnum > _momentum_wall_types
Momentum wall boundary types.
const NonlinearVariableName _fluid_temperature_name
Fluid temperature name.
MooseEnum fvAdvectedInterpolationMethods()
Enum of the advected interpolation methods supported by FVInterpolationMethod objects.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void addMomentumFrictionKernels() override
virtual void addMomentumBoussinesqKernels() override
std::map< BoundaryName, MooseFunctorName > _pressure_functors
Functors describing the outlet pressure on each boundary.
virtual void addLinearFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters ¶meters)
const UserObjectName & rhieChowUOName() const
Return the name of the Rhie Chow user object.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
const std::vector< BoundaryName > _hydraulic_separators
Hydraulic separator boundaries.
static InputParameters validParams()
bool isParamValid(const std::string &name) const
virtual void addOutletBC() override
bool parsesToReal(const std::string &input, Real *parsed_real)
bool isParamSetByUser(const std::string &name) const
void saveSolverVariableName(const VariableName &var_name)
virtual void addSolverVariables() override
std::vector< SolverSystemName > _system_names
std::vector< std::vector< std::string > > _friction_coeffs
The coefficients used for each item if friction type.
const WCNSFVTurbulencePhysicsBase * _turbulence_physics
Can be set to a coupled turbulence physics.