34 "Define the Navier Stokes weakly-compressible equations with the linear "
35 "solver implementation of the SIMPLE scheme");
37 params.
addParam<InterpolationMethodName>(
38 "momentum_advection_interpolation_method_name",
39 "Name of an externally defined FVInterpolationMethod to use for momentum advection. When "
40 "provided, this overrides 'momentum_advection_interpolation'.");
43 "orthogonality_correction",
false,
"Whether to use orthogonality correction");
44 params.
renameParam(
"orthogonality_correction",
"use_nonorthogonal_correction",
"");
46 "pressure_diffusion_interpolation",
48 "The face interpolation method for Ainv in the pressure correction diffusion term.");
50 params.
set<
unsigned short>(
"ghost_layers") = 1;
53 params.
set<std::vector<SolverSystemName>>(
"system_names") = {
54 "u_system",
"v_system",
"w_system",
"pressure_system"};
63 params.
addParam<std::vector<BoundaryName>>(
64 "pressure_drop_sidesets",
66 "Internal sidesets carrying a pressure-jump baffle with the Bernoulli pressure jump and an "
67 "optional irreversible form loss. Used when 'porosity_interface_pressure_treatment' is "
71 "reference_velocity_side",
72 "pressure_drop_reference_velocity_side");
75 "use_reconstructed_pressure_gradient",
77 "Whether the momentum pressure kernels use the FVReconstructedPressureGradient built on the "
78 "jump-aware pressure gradient when pressure-jump baffles are present.");
81 "pressure_gradient_relaxation",
83 "0.0<pressure_gradient_relaxation<=1.0",
84 "Relaxation factor applied when updating the reconstructed pressure-coupling gradient.");
86 "porosity_interface_pressure_treatment pressure_drop_sidesets pressure_drop_form_factors "
87 "pressure_drop_reference_velocity_side pressure_jump_relaxation "
88 "use_reconstructed_pressure_gradient pressure_gradient_relaxation",
89 "Flow medium discontinuity treatment");
104 params.
addParamNamesToGroup(
"momentum_advection_interpolation_method_name",
"Numerical scheme");
111 _non_orthogonal_correction(getParam<bool>(
"orthogonality_correction")),
112 _baffle_sidesets(getParam<
std::vector<BoundaryName>>(
"pressure_drop_sidesets")),
113 _has_baffles(!_baffle_sidesets.empty()),
114 _use_reconstructed_pressure_gradient(_has_baffles &&
115 getParam<bool>(
"use_reconstructed_pressure_gradient"))
121 "porosity_interface_pressure_treatment");
122 const bool bernoulli =
123 getParam<MooseEnum>(
"porosity_interface_pressure_treatment") ==
"bernoulli";
127 {
"pressure_drop_sidesets",
128 "pressure_drop_form_factors",
129 "pressure_drop_reference_velocity_side",
130 "pressure_jump_relaxation",
131 "use_reconstructed_pressure_gradient",
132 "pressure_gradient_relaxation"});
135 "The Bernoulli porosity interface treatment requires the sidesets of the pressure "
137 if (!getParam<bool>(
"use_reconstructed_pressure_gradient"))
139 "use_reconstructed_pressure_gradient",
"true", {
"pressure_gradient_relaxation"});
145 "Flow separators are not supported yet for linearFV!");
146 if (getParam<bool>(
"pin_pressure"))
148 "Pressure pinning is implemented in the executioner for the linear finite volume "
149 "segregated solves");
156 if (
_current_task ==
"add_gradient_method" && !getParam<bool>(
"dont_create_kernels"))
171 "FVPressureJumpGreenGaussGradient",
prefix() +
"pressure_jump_gradient", params);
176 "FVVelocityJumpGreenGaussGradient",
prefix() +
"velocity_jump_gradient", params);
181 params.
set<GradientMethodName>(
"base_gradient_method") =
prefix() +
"pressure_jump_gradient";
182 params.
set<Real>(
"gradient_relaxation") = getParam<Real>(
"pressure_gradient_relaxation");
184 "FVReconstructedPressureGradient",
prefix() +
"reconstructed_pressure_gradient", params);
227 const std::vector<std::string> v_short = {
"u",
"v",
"w"};
232 "The number of velocity variable names supplied to the NSFVAction is not " +
234 ((
dimension() == 3) ?
"" :
" or 3!") +
"\nVelocity variables " +
244 std::string variable_type =
"MooseLinearVariableFVReal";
248 params.
set<GradientMethodName>(
"gradient_method") =
prefix() +
"velocity_jump_gradient";
255 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
263 const auto pressure_type =
"MooseLinearVariableFVReal";
267 params.
set<GradientMethodName>(
"gradient_method") =
prefix() +
"pressure_jump_gradient";
274 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
304 if (getParam<bool>(
"boussinesq_approximation"))
313 std::string kernel_type =
_has_baffles ?
"LinearFVPressureCorrectionDiffusionJump"
314 :
"LinearFVPressureCorrectionDiffusion";
315 std::string kernel_name =
prefix() +
"p_diffusion";
323 params.
set<MooseFunctorName>(
"diffusion_tensor") =
"Ainv";
329 std::string kernel_type =
"LinearFVDivergence";
330 std::string kernel_name =
prefix() +
"HbyA_divergence";
335 params.
set<MooseFunctorName>(
"face_flux") =
"HbyA";
336 params.
set<
bool>(
"force_boundary_execution") =
true;
345 std::string kernel_type =
"LinearFVTimeDerivative";
346 std::string kernel_name =
prefix() +
"ins_momentum_time";
363 const auto momentum_advection_method_name =
364 isParamValid(
"momentum_advection_interpolation_method_name")
365 ? getParam<InterpolationMethodName>(
"momentum_advection_interpolation_method_name")
366 : InterpolationMethodName(
367 std::string(getParam<MooseEnum>(
"momentum_advection_interpolation")));
369 const std::string u_names[3] = {
"u",
"v",
"w"};
370 std::string kernel_type =
372 std::string kernel_name =
383 params.
set<InterpolationMethodName>(
"advected_interp_method_name") =
384 momentum_advection_method_name;
388 for (
unsigned int i = 0; i <
dimension(); ++i)
403 std::string kernel_type =
405 std::string kernel_name =
414 params.
set<GradientMethodName>(
"gradient_method") =
415 prefix() +
"reconstructed_pressure_gradient";
429 unsigned int num_used_blocks = num_friction_blocks ? num_friction_blocks : 1;
431 const std::string kernel_type =
"LinearFVMomentumFriction";
432 const std::string u_names[3] = {
"u",
"v",
"w"};
434 for (
const auto block_i : make_range(num_used_blocks))
440 std::string block_name =
"";
441 if (num_friction_blocks)
449 block_name = std::to_string(block_i);
456 for (
unsigned int type_i = 0; type_i <
_friction_types[block_i].size(); ++type_i)
459 if (upper_name ==
"DARCY")
464 else if (upper_name ==
"FORCHHEIMER")
468 for (
const auto j : make_range(
dimension()))
475 "' is not implemented");
479 prefix() +
"momentum_friction_" + block_name +
"_" +
491 std::string kernel_type =
"LinearFVSource";
492 std::string kernel_name =
prefix() +
"ins_momentum_gravity_";
496 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
497 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
500 if (gravity_vector(
d) != 0)
502 params.
set<MooseFunctorName>(
"source_density") =
"rho_g_" + comp_axis[
d];
518 "We cannot use boussinesq approximation while running in weakly-compressible mode!");
520 std::string kernel_type =
"LinearFVMomentumBoussinesq";
521 std::string kernel_name =
prefix() +
"ins_momentum_boussinesq_";
527 params.
set<RealVectorValue>(
"gravity") = getParam<RealVectorValue>(
"gravity");
528 params.
set<Real>(
"ref_temperature") = getParam<Real>(
"ref_temperature");
529 params.
set<MooseFunctorName>(
"alpha_name") = getParam<MooseFunctorName>(
"thermal_expansion");
546 unsigned int num_velocity_functor_inlets = 0;
548 if (momentum_inlet_type ==
"fixed-velocity" || momentum_inlet_type ==
"fixed-pressure")
549 num_velocity_functor_inlets++;
554 ") is not the same as the number of entries in the momentum_inlet_types "
555 "subvector for fixed-velocities/pressures functors (size " +
556 std::to_string(num_velocity_functor_inlets) +
")");
558 unsigned int velocity_pressure_counter = 0;
561 if (momentum_inlet_type ==
"fixed-velocity")
563 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
565 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
568 "More non-flux inlets than inlet functors (" +
573 if (momentum_functors.size() <
dimension())
575 "Subvector for boundary '" + inlet_bdy +
"' (size " +
576 std::to_string(momentum_functors.size()) +
577 ") is not the same size as the number of dimensions of the physics (" +
583 params.
set<MooseFunctorName>(
"functor") = momentum_functors[
d];
587 ++velocity_pressure_counter;
590 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
592 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
594 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
596 params.
set<
bool>(
"use_two_term_expansion") =
true;
603 else if (momentum_inlet_type ==
"fixed-pressure")
605 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
610 "More non-flux inlets than inlet functors (" +
613 params.
set<MooseFunctorName>(
"functor") =
615 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
618 ++velocity_pressure_counter;
621 mooseError(
"Unsupported inlet boundary condition type: ", momentum_inlet_type);
629 unsigned int num_pressure_outlets = 0;
631 if (momentum_outlet_type ==
"fixed-pressure" ||
632 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
633 num_pressure_outlets++;
638 ") is not the same as the number of pressure outlet boundaries in "
639 "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
640 std::to_string(num_pressure_outlets) +
")");
642 const std::string u_names[3] = {
"u",
"v",
"w"};
646 if (momentum_outlet_type ==
"zero-gradient" || momentum_outlet_type ==
"fixed-pressure" ||
647 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
649 const std::string bc_type =
"LinearFVAdvectionDiffusionOutflowBC";
651 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
652 params.
set<
bool>(
"use_two_term_expansion") = getParam<bool>(
"momentum_two_term_bc_expansion");
662 if (momentum_outlet_type ==
"fixed-pressure" ||
663 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
665 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
669 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
679 const std::string u_names[3] = {
"u",
"v",
"w"};
680 bool has_symmetry_bc =
false;
684 if (momentum_wall_type ==
"noslip")
686 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
688 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
694 params.
set<MooseFunctorName>(
"functor") =
"0";
701 else if (momentum_wall_type ==
"symmetry")
703 has_symmetry_bc =
true;
705 const std::string bc_type =
"LinearFVVelocitySymmetryBC";
707 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
722 const std::string bc_type =
"LinearFVPressureSymmetryBC";
724 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
726 params.
set<MooseFunctorName>(
"HbyA_flux") =
"HbyA";
731 mooseError(
"Unsupported wall boundary condition type: " + std::string(momentum_wall_type));
740 const std::string bc_type =
"LinearFVPressureFluxBC";
744 params.
set<MooseFunctorName>(
"HbyA_flux") =
"HbyA";
745 params.
set<MooseFunctorName>(
"Ainv") =
"Ainv";
749 params.
set<
bool>(
"use_two_term_expansion") = getParam<bool>(
"pressure_two_term_bc_expansion");
752 else if (getParam<bool>(
"pressure_two_term_bc_expansion"))
754 if (!has_symmetry_bc)
756 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
760 params.
set<
bool>(
"use_two_term_expansion") =
true;
766 if (momentum_wall_type !=
"symmetry")
768 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
770 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
772 params.
set<
bool>(
"use_two_term_expansion") =
true;
774 bc_type,
_pressure_name +
"_extrapolation_" + boundary_name, params);
792 const std::string object_type =
"BernoulliFormLossPressureJump";
797 params.set<std::vector<Real>>(
"form_loss") =
798 getParam<std::vector<Real>>(
"pressure_drop_form_factors");
802 getParam<MultiMooseEnum>(
"pressure_drop_reference_velocity_side");
810 mooseAssert(
dimension(),
"0-dimension not supported");
818 std::vector<UserObject *> objs;
823 .condition<AttribThread>(0)
825 unsigned int num_rc_uo = 0;
826 for (
const auto & obj : objs)
830 if (rc_obj->blocks() ==
_blocks)
833 else if (rc_obj->blocks().size() == 0 ||
_blocks.size() == 0)
840 const std::string u_names[3] = {
"u",
"v",
"w"};
849 params.set<std::vector<UserObjectName>>(
"pressure_jump_models") = {
prefix() +
851 params.set<Real>(
"pressure_jump_relaxation") = getParam<Real>(
"pressure_jump_relaxation");
859 params.set<std::string>(
"p_diffusion_kernel") =
prefix() +
"p_diffusion";
861 params.set<
MooseEnum>(
"pressure_projection_method") =
862 getParam<MooseEnum>(
"pressure_projection_method");
863 params.set<
MooseEnum>(
"pressure_diffusion_interpolation") =
864 getParam<MooseEnum>(
"pressure_diffusion_interpolation");
869std::vector<UserObjectName>
874 supplied.push_back(
prefix() +
"pressure_jump");
883 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
884 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
886 if (gravity_vector(
d) != 0)
892 params.set<std::string>(
"expression") =
896 params.set<std::string>(
"property_name") =
"rho_g_" + comp_axis[
d];
899 "ADParsedFunctorMaterial",
prefix() +
"gravity_helper_" + comp_axis[
d], params);
908 for (
const auto &
type : block_types)
registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_interpolation_method_physics")
registerWCNSFVFlowPhysicsBaseTasks("NavierStokesApp", WCNSLinearFVFlowPhysics)
const std::string & _current_task
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 addFVGradientMethod(const std::string &method_type, 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
const std::string & type() const
void paramError(const std::string ¶m, 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
static InputParameters validParams()
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)
static InputParameters validParams()
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.)
MooseFunctorName _flow_porosity_functor_name
Name of the porosity functor for the flow equations (if smoothed)
virtual void actOnAdditionalTasks() override
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
const bool _has_baffles
Whether pressure-jump baffles are present.
const bool _use_reconstructed_pressure_gradient
Whether the momentum pressure kernels use the reconstructed pressure gradient.
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...
virtual void actOnAdditionalTasks() override
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)
void addFVGradientMethods()
Add the jump-aware and reconstructed gradient methods required by pressure baffles.
virtual void addInletBC() override
Functions adding boundary conditions for the flow simulation.
virtual void addFVKernels() override
virtual bool hasForchheimerFriction() const override
Return whether a Forchheimer friction model is in use.
static InputParameters validParams()
void addPressureJumpModel()
Add the pressure-jump model acting on the baffle sidesets.
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.
const std::vector< BoundaryName > _baffle_sidesets
Sidesets carrying Bernoulli pressure-jump baffles (porous medium treatment only)
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 porosity
static const std::string directions[3]
static const std::string mu_eff
MooseEnum fvAdvectedInterpolationMethods()
Enum of the advected interpolation methods supported by FVInterpolationMethod objects.