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);
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];
registerMooseObject("ThermalHydraulicsApp", Shaft)
Base class for THM components.
virtual void init()
Initializes the component.
void logError(Args &&... args) const
Logs an error.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
THMProblem & getTHMProblem() const
Gets the THM problem.
Factory & _factory
The Factory associated with the MooseApp.
static InputParameters validParams()
virtual void addScalarKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
InputParameters getValidParams(const std::string &name) const
bool isRestarting() const
const std::string & name() const
bool isParamValid(const std::string &name) const
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.
virtual UserObjectName getShaftConnectedUserObjectName() const
virtual void setShaftName(const std::string &name) const
Component that connects torque of turbomachinery components.
const VariableName _omega_var_name
Name of the omega variable.
virtual VariableName getOmegaVariableName() const
Shaft(const InputParameters ¶ms)
virtual void check() const override
Check the component integrity.
virtual void addVariables() override
virtual void init() override
Initializes the component.
const std::vector< std::string > & _connected_components
Components connected to this shaft.
virtual void addMooseObjects() override
static InputParameters validParams()
const Real & _scaling_factor_omega
scaling factor for scalar variable omega
bool hasInitialConditionsFromFile() const
Are initial conditions specified from a file.
void addConstantScalarIC(const VariableName &var_name, Real value)
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.