Line data Source code
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 : 10 : #include "ShaftConnectedMotorUserObject.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("ThermalHydraulicsApp", ShaftConnectedMotorUserObject); 14 : 15 : InputParameters 16 10 : ShaftConnectedMotorUserObject::validParams() 17 : { 18 10 : InputParameters params = GeneralUserObject::validParams(); 19 10 : params += ShaftConnectableUserObjectInterface::validParams(); 20 20 : params.addRequiredParam<FunctionName>("torque", "Torque as a function of shaft speed"); 21 20 : params.addRequiredParam<FunctionName>("inertia", 22 : "Moment of inertia as a function of shaft speed"); 23 20 : params.addRequiredCoupledVar("shaft_speed", "Shaft speed"); 24 10 : params.addClassDescription( 25 : "Computes the torque and moment of inertia of a shaft connected motor"); 26 10 : return params; 27 0 : } 28 : 29 5 : ShaftConnectedMotorUserObject::ShaftConnectedMotorUserObject(const InputParameters & params) 30 : : GeneralUserObject(params), 31 : ShaftConnectableUserObjectInterface(this), 32 5 : _torque_fn(getFunction("torque")), 33 5 : _inertia_fn(getFunction("inertia")), 34 10 : _shaft_speed(coupledScalarValue("shaft_speed")) 35 : { 36 5 : } 37 : 38 : Real 39 25 : ShaftConnectedMotorUserObject::getTorque() const 40 : { 41 25 : return _torque_fn.value(_shaft_speed[0], Point()); 42 : } 43 : 44 : void 45 5 : ShaftConnectedMotorUserObject::getTorqueJacobianData(DenseMatrix<Real> & /*jacobian_block*/, 46 : std::vector<dof_id_type> & /*dofs_j*/) const 47 : { 48 5 : } 49 : 50 : Real 51 30 : ShaftConnectedMotorUserObject::getMomentOfInertia() const 52 : { 53 30 : return _inertia_fn.value(_shaft_speed[0], Point()); 54 : } 55 : 56 : void 57 5 : ShaftConnectedMotorUserObject::getMomentOfInertiaJacobianData( 58 : DenseMatrix<Real> & /*jacobian_block*/, std::vector<dof_id_type> & /*dofs_j*/) const 59 : { 60 5 : } 61 : 62 : void 63 5 : ShaftConnectedMotorUserObject::initialize() 64 : { 65 5 : } 66 : 67 : void 68 5 : ShaftConnectedMotorUserObject::execute() 69 : { 70 5 : } 71 : 72 : void 73 5 : ShaftConnectedMotorUserObject::finalize() 74 : { 75 5 : }