18 #include "metaphysicl/parallel_numberarray.h" 19 #include "metaphysicl/parallel_dualnumber.h" 20 #include "metaphysicl/parallel_semidynamicsparsenumberarray.h" 21 #include "libmesh/parallel_algebra.h" 22 #include "libmesh/utility.h" 32 params.
addParam<BoundaryName>(
"inlet",
"Turbine inlet");
33 params.
addParam<BoundaryName>(
"outlet",
"Turbine outlet");
39 params.
addRequiredParam<std::vector<Real>>(
"tau_fr_coeff",
"Friction coefficients [N-m]");
43 "Turbine inertia coefficients [kg-m^2]");
45 "Function to compute data for turbine head [-]");
47 "Function to compute data for turbine power [-]");
49 "Name of the instance of this turbine component");
53 "turbine. Also computes turbine torque " 54 "and delta_p which is passed to the connected shaft");
64 _di_out(getParam<Point>(
"di_out")),
65 _omega_rated(getParam<
Real>(
"omega_rated")),
66 _D_wheel(getParam<
Real>(
"D_wheel")),
67 _speed_cr_fr(getParam<
Real>(
"speed_cr_fr")),
68 _tau_fr_const(getParam<
Real>(
"tau_fr_const")),
69 _tau_fr_coeff(getParam<
std::vector<
Real>>(
"tau_fr_coeff")),
70 _speed_cr_I(getParam<
Real>(
"speed_cr_I")),
71 _inertia_const(getParam<
Real>(
"inertia_const")),
72 _inertia_coeff(getParam<
std::vector<
Real>>(
"inertia_coeff")),
73 _head_coefficient(getFunction(
"head_coefficient")),
74 _power_coefficient(getFunction(
"power_coefficient")),
75 _turbine_name(getParam<
std::string>(
"turbine_name")),
77 _omega(adCoupledScalarValue(
"omega"))
const ADVariableValue & _rhoA
rho*A of the connected flow channels
virtual void initialize()
std::vector< std::vector< dof_id_type > > _flow_channel_dofs
Degrees of freedom for flow channel variables, for each connection.
const Real & _speed_cr_I
Turbine speed threshold for inertia.
const std::vector< Real > & _tau_fr_coeff
Turbine friction coefficients.
const Real & _tau_fr_const
Turbine friction constant.
Point _di_out
Direction of the turbine outlet.
ADReal _flow_coeff
Turbine flow coefficient - independent variable in user supplied head and power functions.
std::vector< ADReal > _cached_junction_var_values
ADReal getTurbinePower() const
Turbine power computed in the 1-phase shaft-connected turbine.
virtual void initialize() override
static InputParameters validParams()
unsigned int getBoundaryIDIndex()
Gets the index of the currently executing boundary within the vector of boundary IDs given to this Si...
const Real & _omega_rated
Rated turbine speed.
const ADVariableValue & _omega
Connected shaft speed.
static InputParameters validParams()
const Parallel::Communicator & comm() const
virtual void computeFluxesAndResiduals(const unsigned int &c) override
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
unsigned int _n_flux_eq
Number of flow channel flux components.
registerMooseObject("ThermalHydraulicsApp", ADShaftConnectedTurbine1PhaseUserObject)
const unsigned int _n_connections
Number of connected flow channels.
DualNumber< Real, DNDerivativeType, true > ADReal
virtual void threadJoin(const UserObject &uo) override
virtual void initialize() override
std::vector< ADReal > _residual
Cached scalar residual vector.
const Real & _volume
Volume of the junction.
virtual void setOmegaDofs(const MooseVariableScalar *omega_var)
const Real & _speed_cr_fr
Turbine speed threshold for friction.
virtual void finalize() override
virtual void threadJoin(const UserObject &uo) override
const std::vector< Real > & _inertia_coeff
Turbine inertia coefficients.
ADReal getFlowCoefficient() const
Flow coefficient computed in the 1-phase shaft-connected turbine.
ADReal _driving_torque
Turbine driving torque.
const Real & _A_ref
Reference area.
virtual void storeConnectionData()
Stores data (connection index, face shape functions, DoFs associated with flow channel variables) rel...
ADReal _delta_p
Turbine pressure drop.
const Real & _inertia_const
Turbine inertia constant.
const MooseVariableScalar * getScalarVar(const std::string &var_name, unsigned int comp) const
ADReal getTurbineDeltaP() const
Turbine head computed in the 1-phase shaft-connected turbine.
virtual void setupJunctionData(std::vector< dof_id_type > &scalar_dofs)
Stores data associated with a junction component.
virtual void computeFluxesAndResiduals(const unsigned int &c) override
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
virtual void initialSetup() override
Computes and caches flux and residual vectors for a 1-phase volume junction.
virtual void threadJoin(const UserObject &uo)
virtual void finalize() override
ADShaftConnectedTurbine1PhaseUserObject(const InputParameters ¶ms)
std::vector< dof_id_type > _scalar_dofs
Degrees of freedom for scalar variables.
ADReal _moment_of_inertia
Moment of inertia.
Interface class for user objects that are connected to a shaft.
const ADVariableValue & _A
Cross-sectional area of connected flow channels.
const Real & _D_wheel
Turbine wheel diameter.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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.
static const std::string alpha
ADReal _power
Turbine power.
virtual void initialSetup() override
ADReal _friction_torque
Turbine friction torque.
ADReal getFrictionTorque() const
Friction torque computed in the 1-phase shaft-connected turbine.
virtual void setupConnections(unsigned int n_connections, unsigned int n_flow_eq)
ADReal _torque
Total torque.
Computes and caches flux and residual vectors for a 1-phase turbine.
static InputParameters validParams()
ADReal getDrivingTorque() const
Driving torque computed in the 1-phase shaft-connected turbine.
virtual Real value(Real t, const Point &p) const
const Function & _power_coefficient
Function to compute data for turbine power.
const Function & _head_coefficient
Function to compute data for turbine head.
const ADVariableValue & _rhouA
rho*u*A of the connected flow channels
virtual void execute() override