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");
37 params.
addRequiredParam<Real>(
"speed_cr_fr",
"Turbine speed threshold for friction [-]");
38 params.
addRequiredParam<Real>(
"tau_fr_const",
"Turbine friction constant [N-m]");
39 params.
addRequiredParam<std::vector<Real>>(
"tau_fr_coeff",
"Friction coefficients [N-m]");
40 params.
addRequiredParam<Real>(
"speed_cr_I",
"Turbine speed threshold for inertia [-]");
41 params.
addRequiredParam<Real>(
"inertia_const",
"Turbine inertia constant [kg-m^2]");
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"))
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", ADShaftConnectedTurbine1PhaseUserObject)
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 turbine.
const Real & _tau_fr_const
Turbine friction constant.
const std::vector< Real > & _inertia_coeff
Turbine inertia coefficients.
ADReal _delta_p
Turbine pressure drop.
virtual void finalize() override
virtual void initialSetup() override
ADReal getTurbineDeltaP() const
Turbine head computed in the 1-phase shaft-connected turbine.
ADReal _driving_torque
Turbine driving torque.
ADReal _friction_torque
Turbine friction torque.
virtual void initialize() override
ADReal getFrictionTorque() const
Friction torque computed in the 1-phase shaft-connected turbine.
ADShaftConnectedTurbine1PhaseUserObject(const InputParameters ¶ms)
const ADVariableValue & _omega
Connected shaft speed.
virtual void computeFluxesAndResiduals(const unsigned int &c) override
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
ADReal _flow_coeff
Turbine flow coefficient - independent variable in user supplied head and power functions.
const Function & _power_coefficient
Function to compute data for turbine power.
ADReal getDrivingTorque() const
Driving torque computed in the 1-phase shaft-connected turbine.
const Real & _speed_cr_I
Turbine speed threshold for inertia.
const Real & _speed_cr_fr
Turbine speed threshold for friction.
const Real & _D_wheel
Turbine wheel diameter.
ADReal _power
Turbine power.
Point _di_out
Direction of the turbine outlet.
ADReal getFlowCoefficient() const
Flow coefficient computed in the 1-phase shaft-connected turbine.
ADReal getTurbinePower() const
Turbine power computed in the 1-phase shaft-connected turbine.
static InputParameters validParams()
const Real & _inertia_const
Turbine inertia constant.
virtual void threadJoin(const UserObject &uo) override
virtual void execute() override
const Function & _head_coefficient
Function to compute data for turbine head.
const std::vector< Real > & _tau_fr_coeff
Turbine friction coefficients.
const Real & _omega_rated
Rated turbine speed.
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.
const Real & _volume
Volume of the junction.
std::vector< ADReal > _cached_junction_var_values
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