https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADShaftConnectedMotorUserObject.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
11#include "Function.h"
12
14
17{
20 params.addRequiredParam<FunctionName>("torque", "Torque as a function of shaft speed");
21 params.addRequiredParam<FunctionName>("inertia",
22 "Moment of inertia as a function of shaft speed");
23 params.addRequiredCoupledVar("shaft_speed", "Shaft speed");
25 "Computes the torque and moment of inertia of a shaft connected motor");
26 return params;
27}
28
30 : GeneralUserObject(params),
32 _torque_fn(getFunction("torque")),
33 _inertia_fn(getFunction("inertia")),
34 _shaft_speed(adCoupledScalarValue("shaft_speed"))
35{
36}
37
40{
41 const ADReal & shaft_speed = _shaft_speed[0];
42 ADReal torque = _torque_fn.value(MetaPhysicL::raw_value(shaft_speed), Point());
43 torque.derivatives() = _torque_fn.timeDerivative(MetaPhysicL::raw_value(shaft_speed), Point()) *
44 shaft_speed.derivatives();
45 return torque;
46}
47
50{
51 const ADReal & shaft_speed = _shaft_speed[0];
52 ADReal inertia = _inertia_fn.value(MetaPhysicL::raw_value(shaft_speed), Point());
53 inertia.derivatives() = _inertia_fn.timeDerivative(MetaPhysicL::raw_value(shaft_speed), Point()) *
54 shaft_speed.derivatives();
55 return inertia;
56}
57
58void
62
63void
67
68void
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", ADShaftConnectedMotorUserObject)
Interface class for user objects that are connected to a shaft.
User object to provide data for a shaft-connected motor.
virtual ADReal getMomentOfInertia() const override
const Function & _torque_fn
Torque as a function of shaft speed.
ADShaftConnectedMotorUserObject(const InputParameters &params)
const ADVariableValue & _shaft_speed
Shaft speed.
virtual ADReal getTorque() const override
const Function & _inertia_fn
Moment of inertia as a function of shaft speed.
virtual Real value(Real t, const Point &p) const
virtual Real timeDerivative(Real t, const Point &p) const
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
auto raw_value(const Eigen::Map< T > &in)