www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DisplacementAboutAxis Class Reference

Implements a boundary condition that enforces rotational displacement around an axis on a boundary. More...

#include <DisplacementAboutAxis.h>

Inheritance diagram for DisplacementAboutAxis:
[legend]

Public Member Functions

 DisplacementAboutAxis (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpValue ()
 Evaluate the boundary condition at the current quadrature point and timestep. More...
 
virtual void initialSetup ()
 
ColumnMajorMatrix rotateAroundAxis (const ColumnMajorMatrix &p0, const Real angle)
 Calculate the tranformation matrix to rotate in x, y, and z depends on the prescribed BC angle and the rotation about x and y matrices. More...
 
void calculateUnitDirectionVector ()
 Check if the provided axis direction vector is a unit vector and normalizes the vector if necessary during the initialization step. More...
 
void calculateTransformationMatrices ()
 Calculate the rotation about the x and y axes based on the provided axis direction vector at the start of the simulation during the initialization step. More...
 

Protected Attributes

const int _component
 
Function & _func
 
MooseEnum _angle_units
 
const Point _axis_origin
 
Point _axis_direction
 
ColumnMajorMatrix _transformation_matrix
 
ColumnMajorMatrix _transformation_matrix_inv
 

Detailed Description

Implements a boundary condition that enforces rotational displacement around an axis on a boundary.

Definition at line 30 of file DisplacementAboutAxis.h.

Constructor & Destructor Documentation

◆ DisplacementAboutAxis()

DisplacementAboutAxis::DisplacementAboutAxis ( const InputParameters &  parameters)

Definition at line 42 of file DisplacementAboutAxis.C.

43  : PresetNodalBC(parameters),
44  _component(getParam<int>("component")),
45  _func(getFunction("function")),
46  _angle_units(getParam<MooseEnum>("angle_units")),
47  _axis_origin(getParam<RealVectorValue>("axis_origin")),
48  _axis_direction(getParam<RealVectorValue>("axis_direction"))
49 {
50  if (_component < 0 || _component > 2)
51  mooseError("Invalid component given for ", name(), ": ", _component, ".");
52 
53  if (_axis_direction.norm() == 0.)
54  mooseError("Please specify a non-zero direction vector for the axis_direction in ", name());
55 }
const std::string name
Definition: Setup.h:22

Member Function Documentation

◆ calculateTransformationMatrices()

void DisplacementAboutAxis::calculateTransformationMatrices ( )
protected

Calculate the rotation about the x and y axes based on the provided axis direction vector at the start of the simulation during the initialization step.

Definition at line 118 of file DisplacementAboutAxis.C.

Referenced by initialSetup().

119 {
120  // These parts of the transformation matrix only depend on the axis of rotation:
121 
122  Real length = _axis_direction.norm_sq();
124 
125  ColumnMajorMatrix transl(4, 4);
126  transl(0, 0) = 1;
127  transl(0, 1) = 0;
128  transl(0, 2) = 0;
129  transl(0, 3) = -_axis_origin(0);
130  transl(1, 0) = 0;
131  transl(1, 1) = 1;
132  transl(1, 2) = 0;
133  transl(1, 3) = -_axis_origin(1);
134  transl(2, 0) = 0;
135  transl(2, 1) = 0;
136  transl(2, 2) = 1;
137  transl(2, 3) = -_axis_origin(2);
138  transl(3, 0) = 0;
139  transl(3, 1) = 0;
140  transl(3, 2) = 0;
141  transl(3, 3) = 1;
142 
143  ColumnMajorMatrix rotate_about_x(4, 4);
144  rotate_about_x(0, 0) = 1;
145  rotate_about_x(0, 1) = 0;
146  rotate_about_x(0, 2) = 0;
147  rotate_about_x(0, 3) = 0;
148  rotate_about_x(1, 0) = 0;
149  rotate_about_x(1, 1) = _axis_direction(2) / v;
150  rotate_about_x(1, 2) = -_axis_direction(1) / v;
151  rotate_about_x(1, 3) = 0;
152  rotate_about_x(2, 0) = 0;
153  rotate_about_x(2, 1) = _axis_direction(1) / v;
154  rotate_about_x(2, 2) = _axis_direction(2) / v;
155  rotate_about_x(2, 3) = 0;
156  rotate_about_x(3, 0) = 0;
157  rotate_about_x(3, 1) = 0;
158  rotate_about_x(3, 2) = 0;
159  rotate_about_x(3, 3) = 1;
160 
161  ColumnMajorMatrix rotate_about_y(4, 4);
162  rotate_about_y(0, 0) = v / length;
163  rotate_about_y(0, 1) = 0;
164  rotate_about_y(0, 2) = -_axis_direction(0) / length;
165  rotate_about_y(0, 3) = 0;
166  rotate_about_y(1, 0) = 0;
167  rotate_about_y(1, 1) = 1;
168  rotate_about_y(1, 2) = 0;
169  rotate_about_y(1, 3) = 0;
170  rotate_about_y(2, 0) = _axis_direction(0) / length;
171  rotate_about_y(2, 1) = 0;
172  rotate_about_y(2, 2) = v / length;
173  rotate_about_y(2, 3) = 0;
174  rotate_about_y(3, 0) = 0;
175  rotate_about_y(3, 1) = 0;
176  rotate_about_y(3, 2) = 0;
177  rotate_about_y(3, 3) = 1;
178 
179  ColumnMajorMatrix transl_inv(4, 4);
180  transl.inverse(transl_inv);
181  ColumnMajorMatrix rotx_inv(4, 4);
182  rotate_about_x.inverse(rotx_inv);
183  ColumnMajorMatrix roty_inv(4, 4);
184  rotate_about_y.inverse(roty_inv);
185 
186  _transformation_matrix = rotate_about_y * rotate_about_x * transl;
187  _transformation_matrix_inv = transl_inv * rotx_inv * roty_inv;
188 }
ColumnMajorMatrix _transformation_matrix
ColumnMajorMatrix _transformation_matrix_inv

◆ calculateUnitDirectionVector()

void DisplacementAboutAxis::calculateUnitDirectionVector ( )
protected

Check if the provided axis direction vector is a unit vector and normalizes the vector if necessary during the initialization step.

Definition at line 111 of file DisplacementAboutAxis.C.

Referenced by initialSetup().

112 {
113  Real magnitude = _axis_direction.norm();
114  _axis_direction /= magnitude;
115 }

◆ computeQpValue()

Real DisplacementAboutAxis::computeQpValue ( )
protectedvirtual

Evaluate the boundary condition at the current quadrature point and timestep.

Definition at line 65 of file DisplacementAboutAxis.C.

66 {
67  Point p(*_current_node);
68 
69  Real angle(_func.value(_t, *_current_node));
70  if (_angle_units == "degrees")
71  angle = angle * libMesh::pi / 180.0;
72 
73  ColumnMajorMatrix p_old(4, 1);
74  p_old(0, 0) = p(0);
75  p_old(1, 0) = p(1);
76  p_old(2, 0) = p(2);
77  p_old(3, 0) = 1;
78 
79  ColumnMajorMatrix p_new = rotateAroundAxis(p_old, angle);
80 
81  return p_new(_component, 0) - p_old(_component, 0);
82 }
ColumnMajorMatrix rotateAroundAxis(const ColumnMajorMatrix &p0, const Real angle)
Calculate the tranformation matrix to rotate in x, y, and z depends on the prescribed BC angle and th...

◆ initialSetup()

void DisplacementAboutAxis::initialSetup ( )
protectedvirtual

Definition at line 58 of file DisplacementAboutAxis.C.

59 {
62 }
void calculateTransformationMatrices()
Calculate the rotation about the x and y axes based on the provided axis direction vector at the star...
void calculateUnitDirectionVector()
Check if the provided axis direction vector is a unit vector and normalizes the vector if necessary d...

◆ rotateAroundAxis()

ColumnMajorMatrix DisplacementAboutAxis::rotateAroundAxis ( const ColumnMajorMatrix &  p0,
const Real  angle 
)
protected

Calculate the tranformation matrix to rotate in x, y, and z depends on the prescribed BC angle and the rotation about x and y matrices.

Definition at line 85 of file DisplacementAboutAxis.C.

Referenced by computeQpValue().

86 {
87  ColumnMajorMatrix rotate_about_z(4, 4);
88  rotate_about_z(0, 0) = cos(angle);
89  rotate_about_z(0, 1) = -sin(angle);
90  rotate_about_z(0, 2) = 0;
91  rotate_about_z(0, 3) = 0;
92  rotate_about_z(1, 0) = sin(angle);
93  rotate_about_z(1, 1) = cos(angle);
94  rotate_about_z(1, 2) = 0;
95  rotate_about_z(1, 3) = 0;
96  rotate_about_z(2, 0) = 0;
97  rotate_about_z(2, 1) = 0;
98  rotate_about_z(2, 2) = 1;
99  rotate_about_z(2, 3) = 0;
100  rotate_about_z(3, 0) = 0;
101  rotate_about_z(3, 1) = 0;
102  rotate_about_z(3, 2) = 0;
103  rotate_about_z(3, 3) = 1;
104 
105  ColumnMajorMatrix transform =
107  return transform * p0;
108 }
ColumnMajorMatrix _transformation_matrix
ColumnMajorMatrix _transformation_matrix_inv

Member Data Documentation

◆ _angle_units

MooseEnum DisplacementAboutAxis::_angle_units
protected

Definition at line 54 of file DisplacementAboutAxis.h.

Referenced by computeQpValue().

◆ _axis_direction

Point DisplacementAboutAxis::_axis_direction
protected

◆ _axis_origin

const Point DisplacementAboutAxis::_axis_origin
protected

Definition at line 55 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices().

◆ _component

const int DisplacementAboutAxis::_component
protected

Definition at line 52 of file DisplacementAboutAxis.h.

Referenced by computeQpValue(), and DisplacementAboutAxis().

◆ _func

Function& DisplacementAboutAxis::_func
protected

Definition at line 53 of file DisplacementAboutAxis.h.

Referenced by computeQpValue().

◆ _transformation_matrix

ColumnMajorMatrix DisplacementAboutAxis::_transformation_matrix
protected

Definition at line 58 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices(), and rotateAroundAxis().

◆ _transformation_matrix_inv

ColumnMajorMatrix DisplacementAboutAxis::_transformation_matrix_inv
protected

Definition at line 59 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices(), and rotateAroundAxis().


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