https://mooseframework.inl.gov
ADShaftConnectableUserObjectInterface.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 "MooseVariableScalar.h"
12 #include "UserObject.h"
13 #include "metaphysicl/parallel_numberarray.h"
14 #include "metaphysicl/parallel_dualnumber.h"
15 #include "metaphysicl/parallel_semidynamicsparsenumberarray.h"
16 #include "libmesh/parallel_algebra.h"
17 
20 {
22  return params;
23 }
24 
26  const MooseObject * moose_object)
27  : _moose_object(moose_object), _n_shaft_eq(1)
28 {
29  _omega_dof.resize(_n_shaft_eq);
30 }
31 
32 void
34 {
35  _torque = 0;
37 }
38 
39 void
41 {
42 }
43 
44 ADReal
46 {
47  return _torque;
48 }
49 
50 ADReal
52 {
53  return _moment_of_inertia;
54 }
55 
56 void
58  unsigned int n_flow_eq)
59 {
60  _n_connections = n_connections;
61  _n_flow_eq = n_flow_eq;
62 }
63 
64 void
66  const std::vector<std::vector<dof_id_type>> & flow_channel_dofs)
67 {
68  _flow_channel_dofs = flow_channel_dofs;
69 }
70 
71 void
73 {
74  auto && dofs = omega_var->dofIndices();
75  mooseAssert(dofs.size() == 1,
76  "There should be exactly 1 coupled DoF index for the variable '" + omega_var->name() +
77  "'.");
78  _omega_dof = dofs;
79 }
80 
81 void
82 ADShaftConnectableUserObjectInterface::setupJunctionData(std::vector<dof_id_type> & scalar_dofs)
83 {
84  _scalar_dofs = scalar_dofs;
85 }
86 
87 void
89 {
92 }
93 
94 void
96 {
98  dynamic_cast<const ADShaftConnectableUserObjectInterface &>(uo);
99  _torque += sctc_uo._torque;
101 }
std::vector< dof_id_type > _scalar_dofs
Degrees of freedom for scalar variables (from junction)
const std::string & name() const override
const Parallel::Communicator & comm() const
DualNumber< Real, DNDerivativeType, true > ADReal
unsigned int _n_shaft_eq
Number of equation in the shaft component.
InputParameters emptyInputParameters()
virtual void setOmegaDofs(const MooseVariableScalar *omega_var)
virtual const std::vector< dof_id_type > & dofIndices() const
ADShaftConnectableUserObjectInterface(const MooseObject *moose_object)
virtual void setupJunctionData(std::vector< dof_id_type > &scalar_dofs)
Stores data associated with a junction component.
std::vector< dof_id_type > _omega_dof
Degrees of freedom for omega variable (from shaft)
Interface class for user objects that are connected to a shaft.
virtual void setConnectionData(const std::vector< std::vector< dof_id_type >> &flow_channel_dofs)
Stores data computed by a volume-junction-like object associated with the conection.
const MooseObject * _moose_object
Associated MOOSE object.
virtual void setupConnections(unsigned int n_connections, unsigned int n_flow_eq)
unsigned int _n_connections
Number of flow channels the shaft connected component is attached to.
unsigned int _n_flow_eq
Number of flow variables in connected flow channels.
std::vector< std::vector< dof_id_type > > _flow_channel_dofs
Degrees of freedom for flow channel variables, for each connection.