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.
set<
unsigned short>(
"ghost_layers") = 1;
37 params.
set<std::vector<SolverSystemName>>(
"system_names") = {
38 "u_system",
"v_system",
"w_system",
"pressure_system"};
47 params.
set<
bool>(
"porous_medium_treatment") =
false;
49 params.
set<MooseFunctorName>(
"porosity") =
"1";
65 _non_orthogonal_correction(getParam<bool>(
"orthogonality_correction"))
68 paramError(
"porous_medium_treatment",
"Porous media unsupported");
74 "Flow separators are not supported yet for linearFV!");
75 if (getParam<bool>(
"pin_pressure"))
77 "Pressure pinning is implemented in the executioner for the linear finite volume " 111 const std::vector<std::string> v_short = {
"u",
"v",
"w"};
116 "The number of velocity variable names supplied to the NSFVAction is not " +
118 ((
dimension() == 3) ?
"" :
" or 3!") +
"\nVelocity variables " +
128 std::string variable_type =
"MooseLinearVariableFVReal";
139 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
147 const auto pressure_type =
"MooseLinearVariableFVReal";
158 ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
188 if (getParam<bool>(
"boussinesq_approximation"))
196 std::string kernel_type =
"LinearFVAnisotropicDiffusion";
197 std::string kernel_name =
prefix() +
"p_diffusion";
202 params.
set<MooseFunctorName>(
"diffusion_tensor") =
"Ainv";
208 std::string kernel_type =
"LinearFVDivergence";
209 std::string kernel_name =
prefix() +
"HbyA_divergence";
214 params.
set<MooseFunctorName>(
"face_flux") =
"HbyA";
215 params.
set<
bool>(
"force_boundary_execution") =
true;
224 std::string kernel_type =
"LinearFVTimeDerivative";
225 std::string kernel_name =
prefix() +
"ins_momentum_time";
242 const std::string u_names[3] = {
"u",
"v",
"w"};
243 std::string kernel_type =
"LinearWCNSFVMomentumFlux";
244 std::string kernel_name =
prefix() +
"ins_momentum_flux_";
252 params.
set<
bool>(
"use_deviatoric_terms") = getParam<bool>(
"include_deviatoric_stress");
254 for (
unsigned int i = 0; i <
dimension(); ++i)
269 std::string kernel_type =
"LinearFVMomentumPressure";
270 std::string kernel_name =
prefix() +
"ins_momentum_pressure_";
288 unsigned int num_used_blocks = num_friction_blocks ? num_friction_blocks : 1;
290 const std::string kernel_type =
"LinearFVMomentumFriction";
293 for (
const auto block_i :
make_range(num_used_blocks))
295 std::string block_name =
"";
296 if (num_friction_blocks)
304 block_name = std::to_string(block_i);
311 for (
unsigned int type_i = 0; type_i <
_friction_types[block_i].size(); ++type_i)
314 if (upper_name ==
"DARCY")
323 "' is not implemented");
327 prefix() +
"momentum_friction_" + block_name +
"_" +
339 std::string kernel_type =
"LinearFVSource";
340 std::string kernel_name =
prefix() +
"ins_momentum_gravity_";
344 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
345 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
348 if (gravity_vector(
d) != 0)
350 params.
set<MooseFunctorName>(
"source_density") =
"rho_g_" + comp_axis[
d];
363 "We cannot use boussinesq approximation while running in weakly-compressible mode!");
365 std::string kernel_type =
"LinearFVMomentumBoussinesq";
366 std::string kernel_name =
prefix() +
"ins_momentum_boussinesq_";
373 params.
set<
Real>(
"ref_temperature") = getParam<Real>(
"ref_temperature");
374 params.
set<MooseFunctorName>(
"alpha_name") = getParam<MooseFunctorName>(
"thermal_expansion");
389 unsigned int num_velocity_functor_inlets = 0;
391 if (momentum_inlet_type ==
"fixed-velocity" || momentum_inlet_type ==
"fixed-pressure")
392 num_velocity_functor_inlets++;
397 ") is not the same as the number of entries in the momentum_inlet_types " 398 "subvector for fixed-velocities/pressures functors (size " +
399 std::to_string(num_velocity_functor_inlets) +
")");
401 unsigned int velocity_pressure_counter = 0;
404 if (momentum_inlet_type ==
"fixed-velocity")
406 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
408 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
411 "More non-flux inlets than inlet functors (" +
416 if (momentum_functors.size() <
dimension())
418 "Subvector for boundary '" + inlet_bdy +
"' (size " +
419 std::to_string(momentum_functors.size()) +
420 ") is not the same size as the number of dimensions of the physics (" +
426 params.
set<MooseFunctorName>(
"functor") = momentum_functors[
d];
430 ++velocity_pressure_counter;
433 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
435 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
437 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
439 params.
set<
bool>(
"use_two_term_expansion") =
true;
446 else if (momentum_inlet_type ==
"fixed-pressure")
448 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
453 "More non-flux inlets than inlet functors (" +
456 params.
set<MooseFunctorName>(
"functor") =
458 params.
set<std::vector<BoundaryName>>(
"boundary") = {inlet_bdy};
461 ++velocity_pressure_counter;
464 mooseError(
"Unsupported inlet boundary condition type: ", momentum_inlet_type);
472 unsigned int num_pressure_outlets = 0;
474 if (momentum_outlet_type ==
"fixed-pressure" ||
475 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
476 num_pressure_outlets++;
481 ") is not the same as the number of pressure outlet boundaries in " 482 "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
483 std::to_string(num_pressure_outlets) +
")");
485 const std::string u_names[3] = {
"u",
"v",
"w"};
489 if (momentum_outlet_type ==
"zero-gradient" || momentum_outlet_type ==
"fixed-pressure" ||
490 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
492 const std::string bc_type =
"LinearFVAdvectionDiffusionOutflowBC";
494 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
495 params.
set<
bool>(
"use_two_term_expansion") = getParam<bool>(
"momentum_two_term_bc_expansion");
505 if (momentum_outlet_type ==
"fixed-pressure" ||
506 momentum_outlet_type ==
"fixed-pressure-zero-gradient")
508 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
512 params.
set<std::vector<BoundaryName>>(
"boundary") = {outlet_bdy};
522 const std::string u_names[3] = {
"u",
"v",
"w"};
526 if (momentum_wall_type ==
"noslip")
528 const std::string bc_type =
"LinearFVAdvectionDiffusionFunctorDirichletBC";
530 params.
set<std::vector<BoundaryName>>(
"boundary") = {boundary_name};
536 params.
set<MooseFunctorName>(
"functor") =
"0";
544 mooseError(
"Unsupported wall boundary condition type: " + std::string(momentum_wall_type));
547 if (getParam<bool>(
"pressure_two_term_bc_expansion"))
549 const std::string bc_type =
"LinearFVExtrapolatedPressureBC";
553 params.
set<
bool>(
"use_two_term_expansion") =
true;
569 mooseAssert(
dimension(),
"0-dimension not supported");
577 std::vector<UserObject *> objs;
582 .condition<AttribThread>(0)
584 unsigned int num_rc_uo = 0;
585 for (
const auto & obj : objs)
586 if (dynamic_cast<RhieChowMassFlux *>(obj))
589 if (rc_obj->blocks() ==
_blocks)
592 else if (rc_obj->blocks().size() == 0 ||
_blocks.size() == 0)
599 const std::string u_names[3] = {
"u",
"v",
"w"};
600 const auto object_type =
"RhieChowMassFlux";
608 params.set<std::string>(
"p_diffusion_kernel") =
prefix() +
"p_diffusion";
619 const auto gravity_vector = getParam<RealVectorValue>(
"gravity");
620 const std::vector<std::string> comp_axis({
"x",
"y",
"z"});
622 if (gravity_vector(
d) != 0)
628 params.set<std::string>(
"expression") =
632 params.set<std::string>(
"property_name") =
"rho_g_" + comp_axis[
d];
635 "ADParsedFunctorMaterial",
prefix() +
"gravity_helper_" + comp_axis[
d], params);
644 return "ins_rhie_chow_interpolator";
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...
bool parsesToReal(const std::string &input)
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.
std::string toUpper(const std::string &name)
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
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
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
static const std::string directions[3]
bool isParamValid(const std::string &name) const
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.
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)
void paramError(const std::string ¶m, Args... args) const
const MooseFunctorName _dynamic_viscosity_name
Name of the dynamic viscosity material property.
std::string stringify(const T &t)
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)
bool isParamSetByUser(const std::string &nm) const
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)
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()
const InputParameters & parameters() const
UserObjectName rhieChowUOName() const override
Return the name of the Rhie Chow user object.
virtual void addOutletBC() override
void reportPotentiallyMissedParameters(const std::vector< std::string > ¶m_names, const std::string &object_type) 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.