https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADShaftTimeDerivativeScalarKernel.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 "UserObject.h"
13
15
18{
20 params.addRequiredParam<std::vector<UserObjectName>>("uo_names",
21 "Names of shaft-connectable user objects");
22 params.addClassDescription("Adds a time derivative term to the shaft ODE");
23 params.set<MultiMooseEnum>("vector_tags") = "time";
24 params.set<MultiMooseEnum>("matrix_tags") = "system time";
25
26 return params;
27}
28
30 const InputParameters & parameters)
31 : ADScalarTimeDerivative(parameters),
32 _uo_names(getParam<std::vector<UserObjectName>>("uo_names")),
33 _n_components(_uo_names.size())
34{
36 for (unsigned int i = 0; i < _n_components; ++i)
37 {
39 &getUserObjectByName<ADShaftConnectableUserObjectInterface>(_uo_names[i]);
40 }
41}
42
45{
46 ADReal sum_inertias = 0;
47 for (unsigned int i = 0; i < _n_components; ++i)
48 sum_inertias += _shaft_connected_uos[i]->getMomentOfInertia();
49
50 return sum_inertias * _u_dot[0];
51}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", ADShaftTimeDerivativeScalarKernel)
static InputParameters validParams()
const ADVariableValue & _u_dot
Time derivative for angular speed of shaft.
unsigned int _n_components
Number of shaft connected user objects.
const std::vector< UserObjectName > & _uo_names
List of names of shaft connected user objects.
ADShaftTimeDerivativeScalarKernel(const InputParameters &parameters)
std::vector< const ADShaftConnectableUserObjectInterface * > _shaft_connected_uos
List of shaft connected user objects.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)