29 "Define the Navier Stokes weakly-compressible equations with the linear " 30 "solver implementation of the SIMPLE scheme");
33 "orthogonality_correction",
false,
"Whether to use orthogonality correction");
34 params.
renameParam(
"orthogonality_correction",
"use_nonorthogonal_correction",
"");
35 params.
set<
unsigned short>(
"ghost_layers") = 1;
38 params.
set<std::vector<SolverSystemName>>(
"system_names") = {
39 "u_system",
"v_system",
"w_system",
"pressure_system"};
48 params.
set<
bool>(
"porous_medium_treatment") =
false;
50 params.
set<MooseFunctorName>(
"porosity") =
"1";
69 _non_orthogonal_correction(getParam<bool>(
"orthogonality_correction"))
72 paramError(
"porous_medium_treatment",
"Porous media unsupported");
78 "Flow separators are not supported yet for linearFV!");
79 if (getParam<bool>(
"pin_pressure"))
81 "Pressure pinning is implemented in the executioner for the linear finite volume " 115 const std::vector<std::string> v_short = {
"u",
"v",
"w"};
120 "The number of velocity variable names supplied to the NSFVAction is not " +
122 ((
dimension() == 3) ?
"" :
" or 3!") +
"\nVelocity variables " +
132 std::string variable_type =
"MooseLinearVariableFVReal";
143 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
151 const auto pressure_type =
"MooseLinearVariableFVReal";
162 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
192 if (getParam<bool>(
"boussinesq_approximation"))
200 std::string kernel_type =
"LinearFVAnisotropicDiffusion";
201 std::string kernel_name =
prefix() +
"p_diffusion";
206 params.
set<MooseFunctorName>(
"diffusion_tensor") =
"Ainv";
212 std::string kernel_type =
"LinearFVDivergence";
213 std::string kernel_name =
prefix() +
"HbyA_divergence";
218 params.
set<MooseFunctorName>(
"face_flux") =
"HbyA";
219 params.
set<
bool>(
"force_boundary_execution") =
true;
228 std::string kernel_type =
"LinearFVTimeDerivative";
229 std::string kernel_name =
prefix() +
"ins_momentum_time";
246 const std::string u_names[3] = {
"u",
"v",
"w"};
247 std::string kernel_type =
"LinearWCNSFVMomentumFlux";
248 std::string kernel_name =
prefix() +
"ins_momentum_flux_";
262 for (
unsigned int i = 0; i <
dimension(); ++i)
277 std::string kernel_type =
"LinearFVMomentumPressure";
278 std::string kernel_name =
prefix() +
"ins_momentum_pressure_";
296 unsigned int num_used_blocks = num_friction_blocks ? num_friction_blocks : 1;
298 const std::string kernel_type =
"LinearFVMomentumFriction";
301 for (
const auto block_i :
make_range(num_used_blocks))
303 std::string block_name =
"";
304 if (num_friction_blocks)
312 block_name = std::to_string(block_i);
319 for (
unsigned int type_i = 0; type_i <
_friction_types[block_i].size(); ++type_i)
322 if (upper_name ==
"DARCY")
331 "' is not implemented");
335 prefix() +
"momentum_friction_" + block_name +
"_" +
347 std::string kernel_type =
"LinearFVSource";
348 std::string kernel_name =
prefix() +
"ins_momentum_gravity_";
352 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
353 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
356 if (gravity_vector(
d) != 0)
358 params.
set<MooseFunctorName>(
"source_density") =
"rho_g_" + comp_axis[
d];
371 "We cannot use boussinesq approximation while running in weakly-compressible mode!");
373 std::string kernel_type =
"LinearFVMomentumBoussinesq";
374 std::string kernel_name =
prefix() +
"ins_momentum_boussinesq_";
381 params.
set<
Real>(
"ref_temperature") = getParam<Real>(
"ref_temperature");
382 params.
set<MooseFunctorName>(
"alpha_name") = getParam<MooseFunctorName>(
"thermal_expansion");
397 unsigned int num_velocity_functor_inlets = 0;
399 if (momentum_inlet_type ==
"fixed-velocity" || momentum_inlet_type ==
"fixed-pressure")
400 num_velocity_functor_inlets++;
405 ") is not the same as the number of entries in the momentum_inlet_types " 406 "subvector for fixed-velocities/pressures functors (size " +
407 std::to_string(num_velocity_functor_inlets) +
")");
409 unsigned int velocity_pressure_counter = 0;
412 if (momentum_inlet_type ==
"fixed-velocity")
414 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
416 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
419 "More non-flux inlets than inlet functors (" +
424 if (momentum_functors.size() <
dimension())
426 "Subvector for boundary '" + inlet_bdy +
"' (size " +
427 std::to_string(momentum_functors.size()) +
428 ") is not the same size as the number of dimensions of the physics (" +
434 params.
set<MooseFunctorName>(
"functor") = momentum_functors[
d];
438 ++velocity_pressure_counter;
441 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
443 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
445 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
447 params.
set<
bool>(
"use_two_term_expansion") =
true;
454 else if (momentum_inlet_type ==
"fixed-pressure")
456 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
461 "More non-flux inlets than inlet functors (" +
464 params.
set<MooseFunctorName>(
"functor") =
466 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
469 ++velocity_pressure_counter;
472 mooseError(
"Unsupported inlet boundary condition type: ", momentum_inlet_type);
480 unsigned int num_pressure_outlets = 0;
482 if (momentum_outlet_type ==
"fixed-pressure" ||
483 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
484 num_pressure_outlets++;
489 ") is not the same as the number of pressure outlet boundaries in " 490 "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
491 std::to_string(num_pressure_outlets) +
")");
493 const std::string u_names[3] = {
"u",
"v",
"w"};
497 if (momentum_outlet_type ==
"zero-gradient" || momentum_outlet_type ==
"fixed-pressure" ||
498 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
500 const std::string bc_type =
"LinearFVAdvectionDiffusionOutflowBC";
502 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
503 params.
set<
bool>(
"use_two_term_expansion") = getParam<bool>(
"momentum_two_term_bc_expansion");
513 if (momentum_outlet_type ==
"fixed-pressure" ||
514 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
516 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
520 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
530 const std::string u_names[3] = {
"u",
"v",
"w"};
531 bool has_symmetry_bc =
false;
535 if (momentum_wall_type ==
"noslip")
537 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
539 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
545 params.
set<MooseFunctorName>(
"functor") =
"0";
552 else if (momentum_wall_type ==
"symmetry")
554 has_symmetry_bc =
true;
556 const std::string bc_type =
"LinearFVVelocitySymmetryBC";
558 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
571 const std::string bc_type =
"LinearFVPressureSymmetryBC";
573 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
575 params.
set<MooseFunctorName>(
"HbyA_flux") =
"HbyA";
580 mooseError(
"Unsupported wall boundary condition type: " + std::string(momentum_wall_type));
583 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
585 if (!has_symmetry_bc)
587 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
591 params.
set<
bool>(
"use_two_term_expansion") =
true;
597 if (momentum_wall_type !=
"symmetry")
599 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
601 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
603 params.
set<
bool>(
"use_two_term_expansion") =
true;
605 bc_type,
_pressure_name +
"_extrapolation_" + boundary_name, params);
621 mooseAssert(
dimension(),
"0-dimension not supported");
629 std::vector<UserObject *> objs;
634 .condition<AttribThread>(0)
636 unsigned int num_rc_uo = 0;
637 for (
const auto & obj : objs)
638 if (dynamic_cast<RhieChowMassFlux *>(obj))
641 if (rc_obj->blocks() ==
_blocks)
644 else if (rc_obj->blocks().size() == 0 ||
_blocks.size() == 0)
651 const std::string u_names[3] = {
"u",
"v",
"w"};
652 const auto object_type =
"RhieChowMassFlux";
660 params.set<std::string>(
"p_diffusion_kernel") =
prefix() +
"p_diffusion";
662 params.set<
MooseEnum>(
"pressure_projection_method") =
663 getParam<MooseEnum>(
"pressure_projection_method");
673 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
674 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
676 if (gravity_vector(
d) != 0)
682 params.set<std::string>(
"expression") =
686 params.set<std::string>(
"property_name") =
"rho_g_" + comp_axis[
d];
689 "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...
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
virtual void initializePhysicsAdditional() override
const MooseFunctorName _density_name
Name of the density material property.
const MooseFunctorName _density_gravity_name
Name of the density material property used for gravity and Boussinesq terms.
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
const MooseEnum _momentum_advection_interpolation
The momentum face interpolation method for being advected.
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)
registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_linear_fv_kernel")
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.
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)
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_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.