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";
165 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
173 const auto pressure_type =
"MooseLinearVariableFVReal";
182 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
212 if (getParam<bool>(
"boussinesq_approximation"))
220 std::string kernel_type =
"LinearFVPressureCorrectionDiffusion";
221 std::string kernel_name =
prefix() +
"p_diffusion";
226 params.
set<MooseFunctorName>(
"diffusion_tensor") =
"Ainv";
232 std::string kernel_type =
"LinearFVDivergence";
233 std::string kernel_name =
prefix() +
"HbyA_divergence";
238 params.
set<MooseFunctorName>(
"face_flux") =
"HbyA";
239 params.
set<
bool>(
"force_boundary_execution") =
true;
248 std::string kernel_type =
"LinearFVTimeDerivative";
249 std::string kernel_name =
prefix() +
"ins_momentum_time";
266 const auto momentum_advection_method_name =
267 isParamValid(
"momentum_advection_interpolation_method_name")
268 ? getParam<InterpolationMethodName>(
"momentum_advection_interpolation_method_name")
269 : InterpolationMethodName(
270 std::string(getParam<MooseEnum>(
"momentum_advection_interpolation")));
272 const std::string u_names[3] = {
"u",
"v",
"w"};
273 std::string kernel_type =
"LinearWCNSFVMomentumFlux";
274 std::string kernel_name =
prefix() +
"ins_momentum_flux_";
284 params.
set<InterpolationMethodName>(
"advected_interp_method_name") =
285 momentum_advection_method_name;
289 for (
unsigned int i = 0; i <
dimension(); ++i)
304 std::string kernel_type =
"LinearFVMomentumPressure";
305 std::string kernel_name =
prefix() +
"ins_momentum_pressure_";
323 unsigned int num_used_blocks = num_friction_blocks ? num_friction_blocks : 1;
325 const std::string kernel_type =
"LinearFVMomentumFriction";
328 for (
const auto block_i : make_range(num_used_blocks))
330 std::string block_name =
"";
331 if (num_friction_blocks)
339 block_name = std::to_string(block_i);
346 for (
unsigned int type_i = 0; type_i <
_friction_types[block_i].size(); ++type_i)
349 if (upper_name ==
"DARCY")
358 "' is not implemented");
362 prefix() +
"momentum_friction_" + block_name +
"_" +
374 std::string kernel_type =
"LinearFVSource";
375 std::string kernel_name =
prefix() +
"ins_momentum_gravity_";
379 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
380 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
383 if (gravity_vector(
d) != 0)
385 params.
set<MooseFunctorName>(
"source_density") =
"rho_g_" + comp_axis[
d];
398 "We cannot use boussinesq approximation while running in weakly-compressible mode!");
400 std::string kernel_type =
"LinearFVMomentumBoussinesq";
401 std::string kernel_name =
prefix() +
"ins_momentum_boussinesq_";
407 params.
set<RealVectorValue>(
"gravity") = getParam<RealVectorValue>(
"gravity");
408 params.
set<Real>(
"ref_temperature") = getParam<Real>(
"ref_temperature");
409 params.
set<MooseFunctorName>(
"alpha_name") = getParam<MooseFunctorName>(
"thermal_expansion");
424 unsigned int num_velocity_functor_inlets = 0;
426 if (momentum_inlet_type ==
"fixed-velocity" || momentum_inlet_type ==
"fixed-pressure")
427 num_velocity_functor_inlets++;
432 ") is not the same as the number of entries in the momentum_inlet_types "
433 "subvector for fixed-velocities/pressures functors (size " +
434 std::to_string(num_velocity_functor_inlets) +
")");
436 unsigned int velocity_pressure_counter = 0;
439 if (momentum_inlet_type ==
"fixed-velocity")
441 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
443 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
446 "More non-flux inlets than inlet functors (" +
451 if (momentum_functors.size() <
dimension())
453 "Subvector for boundary '" + inlet_bdy +
"' (size " +
454 std::to_string(momentum_functors.size()) +
455 ") is not the same size as the number of dimensions of the physics (" +
461 params.
set<MooseFunctorName>(
"functor") = momentum_functors[
d];
465 ++velocity_pressure_counter;
468 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
470 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
472 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
474 params.
set<
bool>(
"use_two_term_expansion") =
true;
481 else if (momentum_inlet_type ==
"fixed-pressure")
483 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
488 "More non-flux inlets than inlet functors (" +
491 params.
set<MooseFunctorName>(
"functor") =
493 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
496 ++velocity_pressure_counter;
499 mooseError(
"Unsupported inlet boundary condition type: ", momentum_inlet_type);
507 unsigned int num_pressure_outlets = 0;
509 if (momentum_outlet_type ==
"fixed-pressure" ||
510 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
511 num_pressure_outlets++;
516 ") is not the same as the number of pressure outlet boundaries in "
517 "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
518 std::to_string(num_pressure_outlets) +
")");
520 const std::string u_names[3] = {
"u",
"v",
"w"};
524 if (momentum_outlet_type ==
"zero-gradient" || momentum_outlet_type ==
"fixed-pressure" ||
525 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
527 const std::string bc_type =
"LinearFVAdvectionDiffusionOutflowBC";
529 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
530 params.
set<
bool>(
"use_two_term_expansion") = getParam<bool>(
"momentum_two_term_bc_expansion");
540 if (momentum_outlet_type ==
"fixed-pressure" ||
541 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
543 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
547 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
557 const std::string u_names[3] = {
"u",
"v",
"w"};
558 bool has_symmetry_bc =
false;
562 if (momentum_wall_type ==
"noslip")
564 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
566 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
572 params.
set<MooseFunctorName>(
"functor") =
"0";
579 else if (momentum_wall_type ==
"symmetry")
581 has_symmetry_bc =
true;
583 const std::string bc_type =
"LinearFVVelocitySymmetryBC";
585 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
598 const std::string bc_type =
"LinearFVPressureSymmetryBC";
600 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
602 params.
set<MooseFunctorName>(
"HbyA_flux") =
"HbyA";
607 mooseError(
"Unsupported wall boundary condition type: " + std::string(momentum_wall_type));
610 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
612 if (!has_symmetry_bc)
614 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
618 params.
set<
bool>(
"use_two_term_expansion") =
true;
624 if (momentum_wall_type !=
"symmetry")
626 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
628 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
630 params.
set<
bool>(
"use_two_term_expansion") =
true;
632 bc_type,
_pressure_name +
"_extrapolation_" + boundary_name, params);
648 mooseAssert(
dimension(),
"0-dimension not supported");
656 std::vector<UserObject *> objs;
661 .condition<AttribThread>(0)
663 unsigned int num_rc_uo = 0;
664 for (
const auto & obj : objs)
668 if (rc_obj->blocks() ==
_blocks)
671 else if (rc_obj->blocks().size() == 0 ||
_blocks.size() == 0)
678 const std::string u_names[3] = {
"u",
"v",
"w"};
679 const auto object_type =
"RhieChowMassFlux";
687 params.set<std::string>(
"p_diffusion_kernel") =
prefix() +
"p_diffusion";
689 params.set<
MooseEnum>(
"pressure_projection_method") =
690 getParam<MooseEnum>(
"pressure_projection_method");
691 params.set<
MooseEnum>(
"pressure_diffusion_interpolation") =
692 getParam<MooseEnum>(
"pressure_diffusion_interpolation");
697std::vector<UserObjectName>
708 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
709 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
711 if (gravity_vector(
d) != 0)
717 params.set<std::string>(
"expression") =
721 params.set<std::string>(
"property_name") =
"rho_g_" + comp_axis[
d];
724 "ADParsedFunctorMaterial",
prefix() +
"gravity_helper_" + comp_axis[
d], params);
registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_interpolation_method_physics")
registerWCNSFVFlowPhysicsBaseTasks("NavierStokesApp", WCNSLinearFVFlowPhysics)
void needSolutionState(unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
virtual void addLinearFVKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
virtual void addLinearFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters ¶meters)
TheWarehouse & theWarehouse() const
InputParameters getValidParams(const std::string &name) const
const InputParameters & parameters() const
void paramError(const std::string ¶m, Args... args) const
bool isParamSetByUser(const std::string &name) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
bool _define_variables
Whether to define variables if they do not exist.
void addFVAdvectedInterpolationMethod(const MooseEnum &interpolation_method)
Add the FVInterpolationMethod object for an advected interpolation method if absent.
virtual FEProblemBase & getProblem()
std::vector< SolverSystemName > _system_names
void addUserObject(const std::string &uo_type, const std::string &uo_name, InputParameters ¶ms)
bool shouldCreateTimeDerivative(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_already_defined) const
void assignBlocks(InputParameters ¶ms, const std::vector< SubdomainName > &blocks) const
unsigned int dimension() const
void reportPotentiallyMissedParameters(const std::vector< std::string > ¶m_names, const std::string &object_type, const std::string &object_name="") const
void saveSolverVariableName(const VariableName &var_name)
std::string prefix() const
void addSharedSolverVariable(const std::string &var_type, const VariableName &var_name, InputParameters params)
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
std::vector< SubdomainName > _blocks
void addRequiredPhysicsTask(const std::string &task)
User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segreg...
static InputParameters validParams()
Base class for Physics which create the Navier Stokes flow equations.
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.
std::map< BoundaryName, MooseFunctorName > _pressure_functors
Functors describing the outlet pressure on each boundary.
std::vector< std::vector< std::string > > _friction_types
The friction correlation types used for each block.
const MooseEnum _compressibility
Compressibility type, can be compressible, incompressible or weakly-compressible.
const std::vector< std::string > _velocity_names
Velocity names.
const std::vector< BoundaryName > _wall_boundaries
Boundaries which define a wall (slip/noslip/etc.)
const NonlinearVariableName _pressure_name
Pressure name.
const bool _has_flow_equations
Boolean to keep track of whether the flow equations should be created.
const NonlinearVariableName _fluid_temperature_name
Fluid temperature name.
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 UserObjectName & rhieChowUOName() const
Return the name of the Rhie Chow user object.
const MooseFunctorName _dynamic_viscosity_name
Name of the dynamic viscosity material property.
std::map< BoundaryName, MooseEnum > _momentum_wall_types
Momentum wall boundary types.
const std::vector< BoundaryName > _hydraulic_separators
Hydraulic separator boundaries.
const bool _solve_for_dynamic_pressure
Whether we are solving for the total or dynamic pressure.
const MooseFunctorName _density_name
Name of the density material property.
const WCNSFVTurbulencePhysicsBase * _turbulence_physics
Can be set to a coupled turbulence physics.
std::vector< std::vector< std::string > > _friction_coeffs
The coefficients used for each item if friction type.
bool includeSymmetrizedViscousStress() const
Whether to include the symmetrized contribution in the viscous stress.
const MooseFunctorName _density_gravity_name
Name of the density material property used for gravity and Boussinesq terms.
Creates all the objects needed to solve the Navier-Stokes equations with the SIMPLE algorithm using t...
void addMomentumFluxKernels()
virtual void addUserObjects() override
virtual void addSolverVariables() override
virtual void addMomentumPressureKernels() override
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 ...
virtual void initializePhysicsAdditional() override
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of algebraic ghosting layers needed.
virtual void addMomentumBoussinesqKernels() override
WCNSLinearFVFlowPhysics(const InputParameters ¶meters)
virtual void addInletBC() override
Functions adding boundary conditions for the flow simulation.
virtual void addFVKernels() override
static InputParameters validParams()
virtual void addMomentumFrictionKernels() override
virtual std::vector< UserObjectName > getSuppliedUserObjects() const override
virtual void addOutletBC() override
virtual void addFVInterpolationMethods() override
virtual void addMomentumGravityKernels() override
virtual void addWallsBC() override
void addPressureCorrectionKernels()
Function adding kernels for the incompressible pressure correction equation.
const bool _non_orthogonal_correction
Whether to use the correction term for non-orthogonality.
virtual void addFunctorMaterials() override
std::string toUpper(std::string name)
bool parsesToReal(const std::string &input, Real *parsed_real)
std::string stringify(const T &t)
static const std::string density
static const std::string T_fluid
MooseEnum fvFaceInterpolationMethods()
Enum of the interpolation methods supported by FVInterpolationMethod objects.
static const std::string mu
static const std::string directions[3]
static const std::string mu_eff
MooseEnum fvAdvectedInterpolationMethods()
Enum of the advected interpolation methods supported by FVInterpolationMethod objects.