22 params.
addClassDescription(
"Computes the residual of advective term using finite volume method.");
24 MooseEnum eqn(
"mass momentum energy scalar");
26 MooseEnum momentum_component(
"x=0 y=1 z=2");
29 "The component of the momentum equation that this kernel applies to.");
30 params.
addParam<
bool>(
"velocity_function_includes_rho",
32 "Whether the provided superficial velocity function actually includes " 33 "multiplication by rho (e.g. the function is representative of momentum.");
36 "An optional name of a vector function for the velocity. If not provided then the " 37 "superficial velocity will be treated implicitly (e.g. we will use the interior value");
40 "An optional name of a function for the pressure. If not provided then the pressure will be " 41 "treated implicitly (e.g. we will use the interior value");
44 "An optional name of a function for the fluid temperature. If not provided then the fluid " 45 "temperature will be treated implicitly (e.g. we will use the interior value");
48 "A function describing the value of the scalar at the boundary. If this function is not " 49 "provided, then the interior value will be used.");
50 params.
addParam<UserObjectName>(
"mfr_postprocessor",
51 "A postprocessor used for outputting mass flow rates on the same " 52 "boundary this object acts on");
59 _dim(_mesh.dimension()),
64 _grad_sup_vel_x_neighbor(
70 _grad_sup_vel_y_neighbor(
76 _grad_sup_vel_z_neighbor(
79 _T_fluid_neighbor(getNeighborADMaterialProperty<
Real>(
NS::
T_fluid)),
83 _pressure_neighbor(getNeighborADMaterialProperty<
Real>(
NS::
pressure)),
89 _index(getParam<
MooseEnum>(
"momentum_component")),
91 _pressure_provided(isParamValid(
NS::
pressure)),
92 _T_fluid_provided(isParamValid(
NS::
T_fluid)),
94 _pressure_function(_pressure_provided ? &getFunction(
NS::
pressure) : nullptr),
95 _T_fluid_function(_T_fluid_provided ? &getFunction(
NS::
T_fluid) : nullptr),
97 _scalar_neighbor(_u_neighbor),
98 _grad_scalar_elem((_eqn ==
"scalar") ? &_var.adGradSln() : nullptr),
99 _grad_scalar_neighbor((_eqn ==
"scalar") ? &_var.adGradSlnNeighbor() : nullptr),
100 _scalar_function_provided(isParamValid(
"scalar")),
101 _scalar_function(_scalar_function_provided ? &getFunction(
"scalar") : nullptr),
102 _velocity_function_includes_rho(getParam<bool>(
"velocity_function_includes_rho")),
104 isParamValid(
"mfr_postprocessor")
110 "If 'momentum' is specified for 'eqn', then you must provide a parameter " 111 "value for 'momentum_component'");
114 "'momentum_component' should not be specified when the 'eqn' is not 'momentum'");
130 const auto & grad_sup_vel_x_interior =
132 const auto & grad_sup_vel_y_interior =
134 const auto & grad_sup_vel_z_interior =
136 const auto & grad_pressure_interior =
138 const auto & grad_T_fluid_interior =
140 const auto & interior_centroid =
145 const auto pressure_boundary =
147 : pressure_interior + grad_pressure_interior * dCf;
148 const auto T_fluid_boundary =
150 : T_fluid_interior + grad_T_fluid_interior * dCf;
151 const auto rho_boundary =
_fluid.rho_from_p_T(pressure_boundary, T_fluid_boundary);
153 ADReal sup_vel_x_boundary;
158 sup_vel_x_boundary /= rho_boundary;
161 sup_vel_x_boundary = sup_vel_x_interior + grad_sup_vel_x_interior * dCf;
163 ADReal sup_vel_y_boundary = 0;
170 sup_vel_y_boundary /= rho_boundary;
173 sup_vel_y_boundary = sup_vel_y_interior + grad_sup_vel_y_interior * dCf;
176 ADReal sup_vel_z_boundary = 0;
183 sup_vel_z_boundary /= rho_boundary;
186 sup_vel_z_boundary = sup_vel_z_interior + grad_sup_vel_z_interior * dCf;
189 const VectorValue<ADReal> sup_vel_boundary(
190 sup_vel_x_boundary, sup_vel_y_boundary, sup_vel_z_boundary);
191 const auto eps_boundary = eps_interior;
192 const auto u_boundary = sup_vel_boundary / eps_boundary;
193 const auto e_boundary =
_fluid.e_from_p_T(pressure_boundary, T_fluid_boundary);
197 const ADReal mfr = rho_boundary * sup_vel_boundary *
normal;
202 else if (
_eqn ==
"momentum")
204 const auto rhou_boundary = u_boundary(
_index) * rho_boundary;
205 return rhou_boundary * sup_vel_boundary *
normal +
208 else if (
_eqn ==
"energy")
210 const auto ht_boundary =
211 e_boundary + 0.5 * u_boundary * u_boundary + pressure_boundary / rho_boundary;
212 const auto rho_ht_boundary = rho_boundary * ht_boundary;
213 return rho_ht_boundary * sup_vel_boundary *
normal;
215 else if (
_eqn ==
"scalar")
218 const auto & grad_scalar_interior =
219 out_of_elem ? (*_grad_scalar_elem)[
_qp] : (*_grad_scalar_neighbor)[
_qp];
220 const auto scalar_boundary =
222 : scalar_interior + grad_scalar_interior * dCf;
223 return rho_boundary * scalar_boundary * sup_vel_boundary *
normal;
const ADMaterialProperty< RealVectorValue > & _grad_T_fluid_elem
static const std::string superficial_velocity
const FaceInfo * _face_info
const MaterialProperty< Real > & _eps_elem
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_x_elem
const ADMaterialProperty< Real > & _sup_vel_z_neighbor
static InputParameters validParams()
unsigned int number() const
This postprocessor computes the volumetric flow rate through a boundary.
const Point & faceCentroid() const
const ADMaterialProperty< Real > & _T_fluid_neighbor
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_y_elem
static const std::string fluid
const Function *const _pressure_function
const ADMaterialProperty< Real > & _sup_vel_y_elem
const ADMaterialProperty< Real > & _sup_vel_x_elem
const SinglePhaseFluidProperties & _fluid
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_z_elem
MooseVariableFV< Real > & _var
const Point & neighborCentroid() const
DualNumber< Real, DNDerivativeType, true > ADReal
const ADMaterialProperty< Real > & _pressure_elem
const Function *const _sup_vel_function
const ADMaterialProperty< RealVectorValue > & _grad_T_fluid_neighbor
const Function *const _scalar_function
bool isParamValid(const std::string &name) const
const ADMaterialProperty< Real > & _sup_vel_x_neighbor
virtual ADReal computeQpResidual() override
const bool _pressure_provided
static const std::string porosity
const ADMaterialProperty< RealVectorValue > & _grad_pressure_elem
const bool _sup_vel_provided
static const std::string T_fluid
const Point & elemCentroid() const
static InputParameters validParams()
const ADMaterialProperty< Real > & _sup_vel_z_elem
static const std::string superficial_velocity_y
const MaterialProperty< Real > & _eps_neighbor
Common class for single phase fluid properties.
const Point & normal() const
void paramError(const std::string ¶m, Args... args) const
unsigned int number() const
const ADMaterialProperty< Real > & _pressure_neighbor
std::string grad(const std::string &var)
const Function *const _T_fluid_function
void setMfr(const FaceInfo *fi, Real mfr, bool includes_area=true)
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_z_neighbor
PCNSFVStrongBC(const InputParameters ¶ms)
registerMooseObject("NavierStokesApp", PCNSFVStrongBC)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MfrPostprocessor *const _mfr_pp
static const std::string pressure
virtual RealVectorValue vectorValue(Real t, const Point &p) const
void mooseError(Args &&... args) const
const ADMaterialProperty< RealVectorValue > & _grad_pressure_neighbor
const ADRealVectorValue & normal() const
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_y_neighbor
const bool _velocity_function_includes_rho
const ADVariableValue & _scalar_elem
const ADVariableValue & _scalar_neighbor
virtual Real value(Real t, const Point &p) const
const unsigned int _index
const bool _scalar_function_provided
const ADMaterialProperty< Real > & _T_fluid_elem
static const std::string superficial_velocity_z
const bool _T_fluid_provided
const ADMaterialProperty< Real > & _sup_vel_y_neighbor
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_x_neighbor
static const std::string superficial_velocity_x