https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ShaftConnectedPump1Phase.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
12#include "Numerics.h"
13#include "Shaft.h"
14#include "MooseVariableScalar.h"
15#include "Assembly.h"
16#include "ScalarKernel.h"
17
19
22{
25 params.makeParamRequired<Real>("A_ref");
26 params.addRequiredParam<BoundaryName>("inlet", "Pump inlet");
27 params.addRequiredParam<BoundaryName>("outlet", "Pump outlet");
28 params.set<std::vector<BoundaryName>>("connections") = {};
29 params.suppressParameter<std::vector<BoundaryName>>("connections");
30 params.addRequiredParam<Real>("omega_rated", "Rated pump speed [rad/s]");
31 params.addRequiredParam<Real>("volumetric_rated", "Rated pump volumetric flow rate [m^3/s]");
32 params.addRequiredParam<Real>("head_rated", "Rated pump head [m]");
33 params.addRequiredParam<Real>("torque_rated", "Rated pump torque [N-m]");
34 params.addRequiredParam<Real>("density_rated", "Rated pump fluid density [kg/m^3]");
35 params.addRequiredParam<Real>("speed_cr_fr", "Pump speed threshold for friction [-]");
36 params.addRequiredParam<Real>("tau_fr_const", "Pump friction constant [N-m]");
37 params.addRequiredParam<std::vector<Real>>("tau_fr_coeff", "Pump friction coefficients [N-m]");
38 params.addRequiredParam<Real>("speed_cr_I", "Pump speed threshold for inertia [-]");
39 params.addRequiredParam<Real>("inertia_const", "Pump inertia constant [kg-m^2]");
40 params.addRequiredParam<std::vector<Real>>("inertia_coeff", "Pump inertia coefficients [kg-m^2]");
41 params.addRequiredParam<FunctionName>("head", "Function to compute data for pump head [-]");
42 params.addRequiredParam<FunctionName>("torque_hydraulic",
43 "Function to compute data for pump torque [-]");
44 params.addParam<Real>(
45 "transition_width",
46 1e-3,
47 "Transition width for sign of the frictional torque at 0 speed over rated speed ratio.");
48
49 params.addClassDescription("1-phase pump that must be connected to a Shaft component. Pump speed "
50 "is controlled by the connected shaft; Hydraulic torque and head are "
51 "computed by user input functions of inlet flow rate and shaft speed");
52
53 return params;
54}
55
57 : VolumeJunction1Phase(parameters),
58 ShaftConnectable(this),
59 _inlet(getParam<BoundaryName>("inlet")),
60 _outlet(getParam<BoundaryName>("outlet")),
61 _omega_rated(getParam<Real>("omega_rated")),
62 _volumetric_rated(getParam<Real>("volumetric_rated")),
63 _head_rated(getParam<Real>("head_rated")),
64 _torque_rated(getParam<Real>("torque_rated")),
65 _density_rated(getParam<Real>("density_rated")),
66 _speed_cr_fr(getParam<Real>("speed_cr_fr")),
67 _tau_fr_const(getParam<Real>("tau_fr_const")),
68 _tau_fr_coeff(getParam<std::vector<Real>>("tau_fr_coeff")),
69 _speed_cr_I(getParam<Real>("speed_cr_I")),
70 _inertia_const(getParam<Real>("inertia_const")),
71 _inertia_coeff(getParam<std::vector<Real>>("inertia_coeff")),
72 _head(getParam<FunctionName>("head")),
73 _torque_hydraulic(getParam<FunctionName>("torque_hydraulic")),
74 _head_var_name(junctionVariableName("head")),
75 _hydraulic_torque_var_name(junctionVariableName("hydraulic_torque")),
76 _friction_torque_var_name(junctionVariableName("friction_torque")),
77 _moi_var_name(junctionVariableName("moment_of_inertia")),
78 _transition_width(getParam<Real>("transition_width"))
79{
80 // this determines connection ordering
83
84 checkSizeEqualsValue<Real>("tau_fr_coeff", 4);
85 checkSizeEqualsValue<Real>("inertia_coeff", 4);
86}
87
88void
94
95void
97{
98 const Component & c = getComponentByName<Component>(_shaft_name);
99 const Shaft & scc = dynamic_cast<const Shaft &>(c);
100 const VariableName omega_var_name = scc.getOmegaVariableName();
101
103 execute_on = {EXEC_INITIAL, EXEC_LINEAR, EXEC_NONLINEAR};
104
105 {
106 const std::string class_name = "ADShaftConnectedPump1PhaseUserObject";
107 InputParameters params = _factory.getValidParams(class_name);
108 params.set<bool>("use_scalar_variables") = false;
109 params.set<subdomain_id_type>("junction_subdomain_id") = _junction_subdomain_id;
110 params.set<std::vector<BoundaryName>>("boundary") = _boundary_names;
111 params.set<std::vector<Real>>("normals") = _normals;
112 params.set<std::vector<processor_id_type>>("processor_ids") = getConnectedProcessorIDs();
113 params.set<std::vector<UserObjectName>>("numerical_flux_names") = _numerical_flux_names;
114 params.set<Real>("volume") = _volume;
115 params.set<std::vector<VariableName>>("A") = {FlowModel::AREA};
116 params.set<std::vector<VariableName>>("rhoA") = {FlowModelSinglePhase::RHOA};
117 params.set<std::vector<VariableName>>("rhouA") = {FlowModelSinglePhase::RHOUA};
118 params.set<std::vector<VariableName>>("rhoEA") = {FlowModelSinglePhase::RHOEA};
119 params.set<std::vector<VariableName>>("rhoV") = {_rhoV_var_name};
120 params.set<std::vector<VariableName>>("rhouV") = {_rhouV_var_name};
121 params.set<std::vector<VariableName>>("rhovV") = {_rhovV_var_name};
122 params.set<std::vector<VariableName>>("rhowV") = {_rhowV_var_name};
123 params.set<std::vector<VariableName>>("rhoEV") = {_rhoEV_var_name};
124 // the direction of the outlet channel
125 params.set<Point>("di_out") = _directions[1].unit();
126 params.set<Real>("gravity_magnitude") = THM::gravity_const;
127 params.set<Real>("omega_rated") = _omega_rated;
128 params.set<Real>("volumetric_rated") = _volumetric_rated;
129 params.set<Real>("head_rated") = _head_rated;
130 params.set<Real>("torque_rated") = _torque_rated;
131 params.set<Real>("density_rated") = _density_rated;
132 params.set<Real>("speed_cr_fr") = _speed_cr_fr;
133 params.set<Real>("tau_fr_const") = _tau_fr_const;
134 params.set<std::vector<Real>>("tau_fr_coeff") = _tau_fr_coeff;
135 params.set<Real>("speed_cr_I") = _speed_cr_I;
136 params.set<Real>("inertia_const") = _inertia_const;
137 params.set<Real>("transition_width") = _transition_width;
138 params.set<std::vector<Real>>("inertia_coeff") = _inertia_coeff;
139 params.set<FunctionName>("head") = _head;
140 params.set<FunctionName>("torque_hydraulic") = _torque_hydraulic;
141 params.set<std::vector<VariableName>>("omega") = {omega_var_name};
142 params.set<Real>("A_ref") = getParam<Real>("A_ref");
143 params.set<Real>("K") = getParam<Real>("K");
144 params.set<UserObjectName>("fp") = _fp_name;
145 params.set<std::string>("pump_name") = cname();
146 params.set<bool>("apply_velocity_scaling") = getParam<bool>("apply_velocity_scaling");
147 params.set<ExecFlagEnum>("execute_on") = execute_on;
149 connectObject(params, _junction_uo_name, "K");
150 }
151}
152
153void
171
172void
174{
176
177 const std::vector<std::pair<std::string, VariableName>> quantities = {
178 {"pump_head", _head_var_name},
179 {"hydraulic_torque", _hydraulic_torque_var_name},
180 {"friction_torque", _friction_torque_var_name},
181 {"moment_of_inertia", _moment_of_inertia_var_name}};
182 for (const auto & quantity_and_name : quantities)
183 {
184 const std::string class_name = "ShaftConnectedPump1PhaseAux";
185 InputParameters params = _factory.getValidParams(class_name);
186 params.set<AuxVariableName>("variable") = quantity_and_name.second;
187 params.set<MooseEnum>("quantity") = quantity_and_name.first;
188 params.set<UserObjectName>("pump_uo") = getShaftConnectedUserObjectName();
189 const std::string obj_name = genName(name(), quantity_and_name.first + "_aux");
190 params.set<std::vector<SubdomainName>>("block") = getSubdomainNames();
191 getTHMProblem().addAuxKernel(class_name, obj_name, params);
192 }
193}
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
const std::string name
Definition Setup.h:21
registerMooseObject("ThermalHydraulicsApp", ShaftConnectedPump1Phase)
std::vector< Real > _normals
Outward normals associated with connected components.
std::vector< RealVectorValue > _directions
Directions of connected components.
std::vector< BoundaryName > _boundary_names
Boundary names of connected components.
void addConnection(const BoundaryName &boundary_name)
Adds a connection for this component.
const std::vector< processor_id_type > & getConnectedProcessorIDs()
Gets the processor IDs of the connected 1D components.
subdomain_id_type _junction_subdomain_id
Junction subdomain ID.
Base class for THM components.
Definition Component.h:32
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition Component.C:345
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
Factory & _factory
The Factory associated with the MooseApp.
Definition Component.h:497
const std::string & cname() const
Get the component name.
Definition Component.C:51
void connectObject(const InputParameters &obj_params, const std::string &obj_name, const std::string &param) const
Connects a controllable parameter of the component to a controllable parameter of a constituent objec...
Definition Component.C:98
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
std::vector< UserObjectName > _numerical_flux_names
const std::string _junction_uo_name
Name of junction user object name, if any.
UserObjectName _fp_name
Fluid property user object name.
static const std::string RHOUA
static const std::string RHOA
static const std::string RHOEA
static const std::string AREA
Definition FlowModel.h:102
void suppressParameter(const std::string &name)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void makeParamRequired(const std::string &name)
bool isRestarting() const
MooseApp & _app
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
Interface class for components that connect to a shaft.
std::string _shaft_name
Name of the shaft component.
virtual void checkShaftConnection(const Component *const component) const
static InputParameters validParams()
VariableName _moment_of_inertia_var_name
Moment of inertia variable name.
1-phase pump that must be connected to a Shaft component
static InputParameters validParams()
const BoundaryName & _outlet
Pump outlet.
const VariableName _hydraulic_torque_var_name
Name of pump hydraulic torque variable.
const Real & _density_rated
Rated pump density.
virtual void buildVolumeJunctionUserObject() override
Builds user object for computing and storing the fluxes.
const std::vector< Real > & _tau_fr_coeff
Pump friction coefficients.
const VariableName _friction_torque_var_name
Name of pump friction torque variable.
const std::vector< Real > & _inertia_coeff
Pump inertia coefficients.
const Real & _speed_cr_fr
Pump speed threshold for friction.
const Real & _tau_fr_const
Pump friction constant.
const Real & _torque_rated
Rated pump torque.
const Real & _inertia_const
Pump inertia constant.
const Real & _transition_width
Transition width for the sign of the frictional torque when speed is 0.
virtual void check() const override
Check the component integrity.
ShaftConnectedPump1Phase(const InputParameters &params)
const Real & _head_rated
Rated pump head.
const Real & _volumetric_rated
Rated pump volumetric flow rate.
const BoundaryName & _inlet
Pump inlet.
virtual void addMooseObjects() override
const Real & _speed_cr_I
Pump speed threshold for inertia.
const Real & _omega_rated
Rated pump speed.
const VariableName _head_var_name
Name of pump head variable.
virtual void addVariables() override
const FunctionName & _torque_hydraulic
Name of function to compute data for pump torque.
const FunctionName & _head
Name of function to compute data for pump head.
virtual UserObjectName getShaftConnectedUserObjectName() const override
Component that connects torque of turbomachinery components.
Definition Shaft.h:18
virtual VariableName getOmegaVariableName() const
Definition Shaft.C:129
Junction between 1-phase flow channels that has a non-zero volume.
const VariableName _rhovV_var_name
rho*v*V variable name for junction
const Real _volume
Volume of the junction.
void addJunctionVariable(bool is_nonlinear, const VariableName &var, Real scaling_factor=1.0)
Adds a junction variable to the problem, as a scalar or field variable.
virtual void addVariables() override
const VariableName _rhoEV_var_name
rho*E*V variable name for junction
virtual void check() const override
Check the component integrity.
const VariableName _rhoV_var_name
rho*V variable name for junction
virtual void addMooseObjects() override
void addJunctionIC(const VariableName &var, Real value)
Adds a junction IC to the problem, as a scalar or field variable.
static InputParameters validParams()
const VariableName _rhowV_var_name
rho*w*V variable name for junction
const VariableName _rhouV_var_name
rho*u*V variable name for junction
ExecFlagEnum getDefaultExecFlagEnum()
static const Real gravity_const
Definition Numerics.h:26