15#include "metaphysicl/parallel_numberarray.h"
16#include "metaphysicl/parallel_dualnumber.h"
17#include "metaphysicl/parallel_semidynamicsparsenumberarray.h"
18#include "libmesh/parallel_algebra.h"
28 params.
addParam<BoundaryName>(
"inlet",
"Pump inlet");
29 params.
addParam<BoundaryName>(
"outlet",
"Pump outlet");
31 params.
addRequiredParam<Real>(
"gravity_magnitude",
"Gravity constant, [m/s^2]");
33 params.
addRequiredParam<Real>(
"volumetric_rated",
"Rated pump volumetric flow rate [m^3/s]");
36 params.
addRequiredParam<Real>(
"density_rated",
"Rated pump fluid density [kg/m^3]");
37 params.
addRequiredParam<Real>(
"speed_cr_fr",
"Pump speed threshold for friction [-]");
38 params.
addRequiredParam<Real>(
"tau_fr_const",
"Pump friction constant [N-m]");
39 params.
addRequiredParam<std::vector<Real>>(
"tau_fr_coeff",
"Friction coefficients [N-m]");
40 params.
addRequiredParam<Real>(
"speed_cr_I",
"Pump speed threshold for inertia [-]");
41 params.
addRequiredParam<Real>(
"inertia_const",
"Pump inertia constant [kg-m^2]");
42 params.
addRequiredParam<std::vector<Real>>(
"inertia_coeff",
"Pump inertia coefficients [kg-m^2]");
43 params.
addRequiredParam<FunctionName>(
"head",
"Function to compute data for pump head [-]");
45 "Function to compute data for pump torque [-]");
46 params.
addRequiredParam<std::string>(
"pump_name",
"Name of the instance of this pump component");
50 "Transition width for sign of the frictional torque at 0 speed over rated speed ratio.");
54 "Computes and caches flux and residual vectors for a 1-phase pump. Also computes pump torque "
55 "and head which is passed to the connected shaft");
65 _di_out(getParam<Point>(
"di_out")),
66 _g(getParam<Real>(
"gravity_magnitude")),
67 _omega_rated(getParam<Real>(
"omega_rated")),
68 _volumetric_rated(getParam<Real>(
"volumetric_rated")),
69 _head_rated(getParam<Real>(
"head_rated")),
70 _torque_rated(getParam<Real>(
"torque_rated")),
71 _density_rated(getParam<Real>(
"density_rated")),
72 _speed_cr_fr(getParam<Real>(
"speed_cr_fr")),
73 _tau_fr_const(getParam<Real>(
"tau_fr_const")),
74 _tau_fr_coeff(getParam<
std::vector<Real>>(
"tau_fr_coeff")),
75 _speed_cr_I(getParam<Real>(
"speed_cr_I")),
76 _inertia_const(getParam<Real>(
"inertia_const")),
77 _inertia_coeff(getParam<
std::vector<Real>>(
"inertia_coeff")),
78 _head(getFunction(
"head")),
79 _torque_hydraulic(getFunction(
"torque_hydraulic")),
80 _pump_name(getParam<
std::string>(
"pump_name")),
81 _omega(adCoupledScalarValue(
"omega")),
82 _transition_width(getParam<Real>(
"transition_width")),
83 _transition_friction(0, _transition_width)
124 using std::abs, std::atan2;
136 ADReal x_p = atan2(alpha, nu);
140 const ADReal y = alpha * alpha + nu * nu;
145 const ADReal homologous_torque = -
y * zt;
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", ADShaftConnectedPump1PhaseUserObject)
const std::vector< double > y
unsigned int getBoundaryIDIndex()
Gets the index of the currently executing boundary within the vector of boundary IDs given to this Si...
const unsigned int _n_connections
Number of connected flow channels.
Interface class for user objects that are connected to a shaft.
virtual void initialize()
ADReal _moment_of_inertia
Moment of inertia.
virtual void setOmegaDofs(const MooseVariableScalar *omega_var)
static InputParameters validParams()
virtual void setupJunctionData(std::vector< dof_id_type > &scalar_dofs)
Stores data associated with a junction component.
virtual void setConnectionData(const std::vector< std::vector< dof_id_type > > &flow_channel_dofs)
Stores data computed by a volume-junction-like object associated with the conection.
ADReal _torque
Total torque.
virtual void threadJoin(const UserObject &uo)
virtual void setupConnections(unsigned int n_connections, unsigned int n_flow_eq)
Computes and caches flux and residual vectors for a 1-phase pump.
const Real & _inertia_const
Pump inertia constant.
ADReal getHydraulicTorque() const
Hydraulic torque computed in the 1-phase shaft-connected pump.
static InputParameters validParams()
const ADWeightedTransition _transition_friction
Transition for the sign of the frictional torque when speed is 0.
virtual void initialSetup() override
const Real & _omega_rated
Rated pump speed.
const Real & _tau_fr_const
Pump friction constant.
ADReal getFrictionTorque() const
Friction torque computed in the 1-phase shaft-connected pump.
virtual void initialize() override
const Real & _density_rated
Rated pump density.
ADReal _hydraulic_torque
Pump hydraulic torque.
virtual void execute() override
const std::vector< Real > & _inertia_coeff
Pump inertia coefficients.
const Real & _head_rated
Rated pump head.
const Real & _g
Gravity constant.
virtual void threadJoin(const UserObject &uo) override
ADReal _friction_torque
Pump friction torque.
const Real & _volumetric_rated
Rated pump volumetric flow rate.
ADReal getPumpHead() const
Pump head computed in the 1-phase shaft-connected pump.
const Function & _head
Function to compute data for pump head.
const Real & _torque_rated
Rated pump torque.
virtual void finalize() override
const Real & _speed_cr_fr
Pump speed threshold for friction.
const ADVariableValue & _omega
Shaft speed.
const Real & _speed_cr_I
Pump speed threshold for inertia.
virtual void computeFluxesAndResiduals(const unsigned int &c) override
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
ADReal _pump_head
Pump head.
Point _di_out
Direction of the pump outlet.
ADShaftConnectedPump1PhaseUserObject(const InputParameters ¶ms)
const Function & _torque_hydraulic
Function to compute data for pump torque.
const std::vector< Real > & _tau_fr_coeff
Pump friction coefficients.
const ADReal & leftEnd() const
Returns the coordinate of the left end of the transition.
const ADReal & rightEnd() const
Returns the coordinate of the right end of the transition.
Computes and caches flux and residual vectors for a 1-phase volume junction.
virtual void finalize() override
virtual void computeFluxesAndResiduals(const unsigned int &c) override
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
const ADVariableValue & _rhouA
rho*u*A of the connected flow channels
const ADVariableValue & _rhoA
rho*A of the connected flow channels
const Real & _A_ref
Reference area.
static InputParameters validParams()
const ADVariableValue & _A
Cross-sectional area of connected flow channels.
std::vector< std::vector< dof_id_type > > _flow_channel_dofs
Degrees of freedom for flow channel variables, for each connection.
virtual void storeConnectionData()
Stores data (connection index, face shape functions, DoFs associated with flow channel variables) rel...
std::vector< dof_id_type > _scalar_dofs
Degrees of freedom for scalar variables.
unsigned int _n_flux_eq
Number of flow channel flux components.
std::vector< ADReal > _residual
Cached scalar residual vector.
virtual ADReal value(const ADReal &x, const ADReal &f1, const ADReal &f2) const override
Computes the transition value.
virtual Real value(Real t, const Point &p) const
const MooseVariableScalar * getScalarVar(const std::string &var_name, unsigned int comp) const
virtual void initialSetup()
virtual void initialize()=0
virtual void threadJoin(const UserObject &uo)=0
const Parallel::Communicator & comm() const