https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TorqueTempl< is_ad > Class Template Reference

Apply a torque as tractions distributed over a surface. More...

#include <Torque.h>

Inheritance diagram for TorqueTempl< is_ad >:
[legend]

Public Member Functions

 TorqueTempl (const InputParameters &parameters)
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual GenericReal< is_ad > computeQpResidual ()
 
Real componentJacobian (unsigned int component)
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int)
 
template<>
ADReal computeQpResidual ()
 
template<>
Real computeQpResidual ()
 
template<>
Real componentJacobian (unsigned int component)
 
template<>
Real componentJacobian (unsigned int)
 

Protected Attributes

unsigned int _component
 coordinte axis this BC acts on More...
 
const Point _origin
 pivot point for the torque More...
 
const RealVectorValue _torque
 applied torque vector More...
 
const Function_factor
 prefactor function (can only be time dependent) More...
 
const Real_alpha
 alpha parameter required for HHT time integration scheme More...
 
const PostprocessorValue_pmi
 postprocessor that computes the polar moment of inertia More...
 
const unsigned int _ndisp
 number of coupled displacement variables More...
 
std::vector< unsigned int_dvars
 coupled displacement variables More...
 
const Point _dummy_point
 dummy point (zero) used in evaluating the time dependent prefactor More...
 
 usingTransientInterfaceMembers
 

Detailed Description

template<bool is_ad>
class TorqueTempl< is_ad >

Apply a torque as tractions distributed over a surface.

Definition at line 25 of file Torque.h.

Constructor & Destructor Documentation

◆ TorqueTempl()

template<bool is_ad>
TorqueTempl< is_ad >::TorqueTempl ( const InputParameters parameters)

Definition at line 39 of file Torque.C.

40  : TorqueParent<is_ad>(parameters),
42  _origin(this->template getParam<Point>("origin")),
43  _torque(this->template getParam<RealVectorValue>("direction")),
44  _factor(this->getFunction("factor")),
45  _alpha(this->template getParam<Real>("alpha")),
46  _pmi(this->getPostprocessorValue("polar_moment_of_inertia")),
47  _ndisp(this->coupledComponents("displacements")),
48  _dvars(_ndisp),
49  _dummy_point()
50 {
51  for (unsigned int i = 0; i < _ndisp; ++i)
52  {
53  _dvars[i] = this->getVar("displacements", i)->number();
54  if (this->_var.number() == _dvars[i])
55  _component = i;
56  }
57 
59  this->paramError("variable",
60  "The kernel variable needs to be one of the 'displacements' variables");
61  if (this->template getParam<bool>("use_displaced_mesh"))
62  this->paramError("use_displaced_mesh", "This BC is only validated for small strains");
63 }
const Point _origin
pivot point for the torque
Definition: Torque.h:44
const unsigned int invalid_uint
std::vector< unsigned int > _dvars
coupled displacement variables
Definition: Torque.h:58
const Real & _alpha
alpha parameter required for HHT time integration scheme
Definition: Torque.h:51
const unsigned int _ndisp
number of coupled displacement variables
Definition: Torque.h:56
typename std::conditional< is_ad, ADIntegratedBC, IntegratedBC >::type TorqueParent
Definition: Torque.h:19
unsigned int _component
coordinte axis this BC acts on
Definition: Torque.h:41
const RealVectorValue _torque
applied torque vector
Definition: Torque.h:46
const Point _dummy_point
dummy point (zero) used in evaluating the time dependent prefactor
Definition: Torque.h:61
const PostprocessorValue & _pmi
postprocessor that computes the polar moment of inertia
Definition: Torque.h:53
const Function & _factor
prefactor function (can only be time dependent)
Definition: Torque.h:49

Member Function Documentation

◆ componentJacobian() [1/3]

template<bool is_ad>
Real TorqueTempl< is_ad >::componentJacobian ( unsigned int  component)
protected

◆ componentJacobian() [2/3]

template<>
Real TorqueTempl< false >::componentJacobian ( unsigned int  component)
protected

Definition at line 95 of file Torque.C.

96 {
97  // vector phi
98  RealGradient phi;
99  phi(component) = this->_phi[_j][_qp];
100 
101  // force calculation
102  auto d_local_force = _factor.value(_t + _alpha * _dt, _dummy_point) * _torque.cross(phi) / _pmi;
103  return -d_local_force(_component) * _test[_i][_qp];
104 }
static const std::string component
Definition: NS.h:153
const Real & _alpha
alpha parameter required for HHT time integration scheme
Definition: Torque.h:51
unsigned int _component
coordinte axis this BC acts on
Definition: Torque.h:41
const RealVectorValue _torque
applied torque vector
Definition: Torque.h:46
const Point _dummy_point
dummy point (zero) used in evaluating the time dependent prefactor
Definition: Torque.h:61
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
const PostprocessorValue & _pmi
postprocessor that computes the polar moment of inertia
Definition: Torque.h:53
virtual Real value(Real t, const Point &p) const
const Function & _factor
prefactor function (can only be time dependent)
Definition: Torque.h:49

◆ componentJacobian() [3/3]

template<>
Real TorqueTempl< true >::componentJacobian ( unsigned  int)
protected

Definition at line 108 of file Torque.C.

109 {
110  mooseError("This should never get called");
111 }
void mooseError(Args &&... args)

◆ computeQpJacobian()

template<bool is_ad>
Real TorqueTempl< is_ad >::computeQpJacobian ( )
protectedvirtual

Definition at line 115 of file Torque.C.

116 {
118 }
Real componentJacobian(unsigned int component)
unsigned int _component
coordinte axis this BC acts on
Definition: Torque.h:41

◆ computeQpOffDiagJacobian()

template<bool is_ad>
Real TorqueTempl< is_ad >::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 122 of file Torque.C.

123 {
124  for (unsigned int i = 0; i < _ndisp; ++i)
125  if (jvar == _dvars[i])
126  return componentJacobian(i);
127 
128  return 0.0;
129 }
Real componentJacobian(unsigned int component)
std::vector< unsigned int > _dvars
coupled displacement variables
Definition: Torque.h:58
const unsigned int _ndisp
number of coupled displacement variables
Definition: Torque.h:56

◆ computeQpResidual() [1/3]

template<bool is_ad>
virtual GenericReal<is_ad> TorqueTempl< is_ad >::computeQpResidual ( )
protectedvirtual

◆ computeQpResidual() [2/3]

template<>
ADReal TorqueTempl< true >::computeQpResidual ( )
protected

Definition at line 67 of file Torque.C.

68 {
69  // local lever (distance to the origin)
70  auto local_lever = this->_ad_q_points[_qp] - _origin;
71 
72  // force calculation
73  auto local_force =
74  _factor.value(_t + _alpha * _dt, _dummy_point) * _torque.cross(local_lever) / _pmi;
75 
76  return -local_force(_component) * _test[_i][_qp];
77 }
const Point _origin
pivot point for the torque
Definition: Torque.h:44
const Real & _alpha
alpha parameter required for HHT time integration scheme
Definition: Torque.h:51
unsigned int _component
coordinte axis this BC acts on
Definition: Torque.h:41
const RealVectorValue _torque
applied torque vector
Definition: Torque.h:46
const Point _dummy_point
dummy point (zero) used in evaluating the time dependent prefactor
Definition: Torque.h:61
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
const PostprocessorValue & _pmi
postprocessor that computes the polar moment of inertia
Definition: Torque.h:53
virtual Real value(Real t, const Point &p) const
const Function & _factor
prefactor function (can only be time dependent)
Definition: Torque.h:49

◆ computeQpResidual() [3/3]

template<>
Real TorqueTempl< false >::computeQpResidual ( )
protected

Definition at line 81 of file Torque.C.

82 {
83  // local lever (distance to the origin)
84  auto local_lever = this->_q_point[_qp] - _origin;
85 
86  // force calculation
87  auto local_force =
88  _factor.value(_t + _alpha * _dt, _dummy_point) * _torque.cross(local_lever) / _pmi;
89 
90  return -local_force(_component) * _test[_i][_qp];
91 }
const Point _origin
pivot point for the torque
Definition: Torque.h:44
const Real & _alpha
alpha parameter required for HHT time integration scheme
Definition: Torque.h:51
unsigned int _component
coordinte axis this BC acts on
Definition: Torque.h:41
const RealVectorValue _torque
applied torque vector
Definition: Torque.h:46
const Point _dummy_point
dummy point (zero) used in evaluating the time dependent prefactor
Definition: Torque.h:61
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
const PostprocessorValue & _pmi
postprocessor that computes the polar moment of inertia
Definition: Torque.h:53
virtual Real value(Real t, const Point &p) const
const Function & _factor
prefactor function (can only be time dependent)
Definition: Torque.h:49

◆ validParams()

template<bool is_ad>
InputParameters TorqueTempl< is_ad >::validParams ( )
static

Definition at line 18 of file Torque.C.

19 {
21  params.addClassDescription(
22  "Apply a moment as tractions distributed over a surface around a "
23  "pivot point. This should operate on the displaced mesh for large deformations.");
24  MooseEnum component("x=0 y=1 z=2");
25  params.addRequiredParam<Point>(
26  "origin", "Reference point defining the location for the axis the torque is applied to");
27  params.addRequiredParam<RealVectorValue>("direction", "Torque vector");
28  params.addParam<FunctionName>(
29  "factor", "1", "Prefactor for the force (can only be time dependent)");
30  params.addRequiredParam<PostprocessorName>(
31  "polar_moment_of_inertia", "Postprocessor that computes the polar moment of inertia");
32  params.addParam<Real>("alpha", 0.0, "alpha parameter required for HHT time integration scheme");
33  params.addParamNamesToGroup("alpha factor", "Advanced");
34  params.addCoupledVar("displacements", "The displacements");
35  return params;
36 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static const std::string component
Definition: NS.h:153
void addRequiredParam(const std::string &name, const std::string &doc_string)
InputParameters validParams()
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)

Member Data Documentation

◆ _alpha

template<bool is_ad>
const Real& TorqueTempl< is_ad >::_alpha
protected

alpha parameter required for HHT time integration scheme

Definition at line 51 of file Torque.h.

◆ _component

template<bool is_ad>
unsigned int TorqueTempl< is_ad >::_component
protected

coordinte axis this BC acts on

Definition at line 41 of file Torque.h.

Referenced by TorqueTempl< is_ad >::TorqueTempl().

◆ _dummy_point

template<bool is_ad>
const Point TorqueTempl< is_ad >::_dummy_point
protected

dummy point (zero) used in evaluating the time dependent prefactor

Definition at line 61 of file Torque.h.

◆ _dvars

template<bool is_ad>
std::vector<unsigned int> TorqueTempl< is_ad >::_dvars
protected

coupled displacement variables

Definition at line 58 of file Torque.h.

Referenced by TorqueTempl< is_ad >::TorqueTempl().

◆ _factor

template<bool is_ad>
const Function& TorqueTempl< is_ad >::_factor
protected

prefactor function (can only be time dependent)

Definition at line 49 of file Torque.h.

◆ _ndisp

template<bool is_ad>
const unsigned int TorqueTempl< is_ad >::_ndisp
protected

number of coupled displacement variables

Definition at line 56 of file Torque.h.

Referenced by TorqueTempl< is_ad >::TorqueTempl().

◆ _origin

template<bool is_ad>
const Point TorqueTempl< is_ad >::_origin
protected

pivot point for the torque

Definition at line 44 of file Torque.h.

◆ _pmi

template<bool is_ad>
const PostprocessorValue& TorqueTempl< is_ad >::_pmi
protected

postprocessor that computes the polar moment of inertia

Definition at line 53 of file Torque.h.

◆ _torque

template<bool is_ad>
const RealVectorValue TorqueTempl< is_ad >::_torque
protected

applied torque vector

Definition at line 46 of file Torque.h.

◆ usingTransientInterfaceMembers

template<bool is_ad>
TorqueTempl< is_ad >::usingTransientInterfaceMembers
protected

Definition at line 63 of file Torque.h.


The documentation for this class was generated from the following files: