20 params.
addParam<
Real>(
"scaling_factor_omega", 1.0,
"Scaling factor for omega [-]");
21 params.
addParam<
Real>(
"initial_speed",
"Initial shaft speed");
22 params.
addParam<
bool>(
"ad",
true,
"Use AD version or not");
24 "Names of the connected components");
31 _scaling_factor_omega(getParam<
Real>(
"scaling_factor_omega")),
32 _omega_var_name(genName(
name(),
"omega")),
33 _connected_components(getParam<
std::vector<
std::string>>(
"connected_components"))
46 if (hasComponentByName<Component>(comp_name))
48 const Component &
c = getComponentByName<Component>(comp_name);
59 logError(
"No components are connected to the shaft.");
63 logError(
"The `initial_speed` parameter is missing.");
79 std::vector<UserObjectName> uo_names;
83 const Component &
c = getComponentByName<Component>(comp_name);
85 uo_names.push_back(scc.getShaftConnectedUserObjectName());
88 if (getParam<bool>(
"ad"))
91 std::string class_name =
"ADShaftTimeDerivativeScalarKernel";
94 params.
set<std::vector<UserObjectName>>(
"uo_names") = {uo_names};
98 for (std::size_t i = 0; i < uo_names.size(); i++)
100 std::string class_name =
"ADShaftComponentTorqueScalarKernel";
103 params.
set<UserObjectName>(
"shaft_connected_component_uo") = uo_names[i];
110 std::string class_name =
"ShaftTimeDerivativeScalarKernel";
113 params.
set<std::vector<UserObjectName>>(
"uo_names") = {uo_names};
117 for (std::size_t i = 0; i < uo_names.size(); i++)
119 std::string class_name =
"ShaftComponentTorqueScalarKernel";
122 params.
set<UserObjectName>(
"shaft_connected_component_uo") = uo_names[i];
virtual void addVariables() override
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.
const VariableName _omega_var_name
Name of the omega variable.
THMProblem & getTHMProblem() const
Gets the THM problem.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
const Real & _scaling_factor_omega
scaling factor for scalar variable omega
InputParameters getValidParams(const std::string &name) const
registerMooseObject("ThermalHydraulicsApp", Shaft)
bool isRestarting() const
static InputParameters validParams()
virtual const std::string & name() const
void logError(Args &&... args) const
Logs an error.
bool isParamValid(const std::string &name) const
static InputParameters validParams()
Component that connects torque of turbomachinery components.
void addSimVariable(bool nl, const VariableName &name, libMesh::FEType fe_type, Real scaling_factor=1.0)
Queues a variable of type MooseVariableScalar to be added to the nonlinear or aux system...
virtual void check() const override
Check the component integrity.
virtual void init()
Initializes the component.
const std::vector< std::string > & _connected_components
Components connected to this shaft.
Base class for THM components.
void addConstantScalarIC(const VariableName &var_name, Real value)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Shaft(const InputParameters ¶ms)
virtual VariableName getOmegaVariableName() const
Factory & _factory
The Factory associated with the MooseApp.
Interface class for components that connect to a shaft.
virtual void setShaftName(const std::string &name) const
virtual void addScalarKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void addMooseObjects() override
virtual void init() override
Initializes the component.
bool hasInitialConditionsFromFile() const
Are initial conditions specified from a file.