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 28 of file DisplacementAboutAxis.h.

Constructor & Destructor Documentation

DisplacementAboutAxis::DisplacementAboutAxis ( const InputParameters &  parameters)

Definition at line 36 of file DisplacementAboutAxis.C.

37  : PresetNodalBC(parameters),
38  _component(getParam<int>("component")),
39  _func(getFunction("function")),
40  _angle_units(getParam<MooseEnum>("angle_units")),
41  _axis_origin(getParam<RealVectorValue>("axis_origin")),
42  _axis_direction(getParam<RealVectorValue>("axis_direction"))
43 {
44  if (_component < 0 || _component > 2)
45  mooseError("Invalid component given for ", name(), ": ", _component, ".");
46 
47  if (_axis_direction.norm() == 0.)
48  mooseError("Please specify a non-zero direction vector for the axis_direction in ", name());
49 }

Member Function Documentation

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 112 of file DisplacementAboutAxis.C.

Referenced by initialSetup().

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

Referenced by initialSetup().

106 {
107  Real magnitude = _axis_direction.norm();
108  _axis_direction /= magnitude;
109 }
Real DisplacementAboutAxis::computeQpValue ( )
protectedvirtual

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

Definition at line 59 of file DisplacementAboutAxis.C.

60 {
61  Point p(*_current_node);
62 
63  Real angle(_func.value(_t, *_current_node));
64  if (_angle_units == "degrees")
65  angle = angle * libMesh::pi / 180.0;
66 
67  ColumnMajorMatrix p_old(4, 1);
68  p_old(0, 0) = p(0);
69  p_old(1, 0) = p(1);
70  p_old(2, 0) = p(2);
71  p_old(3, 0) = 1;
72 
73  ColumnMajorMatrix p_new = rotateAroundAxis(p_old, angle);
74 
75  return p_new(_component, 0) - p_old(_component, 0);
76 }
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...
void DisplacementAboutAxis::initialSetup ( )
protectedvirtual

Definition at line 52 of file DisplacementAboutAxis.C.

53 {
56 }
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...
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 79 of file DisplacementAboutAxis.C.

Referenced by computeQpValue().

80 {
81  ColumnMajorMatrix rotate_about_z(4, 4);
82  rotate_about_z(0, 0) = cos(angle);
83  rotate_about_z(0, 1) = -sin(angle);
84  rotate_about_z(0, 2) = 0;
85  rotate_about_z(0, 3) = 0;
86  rotate_about_z(1, 0) = sin(angle);
87  rotate_about_z(1, 1) = cos(angle);
88  rotate_about_z(1, 2) = 0;
89  rotate_about_z(1, 3) = 0;
90  rotate_about_z(2, 0) = 0;
91  rotate_about_z(2, 1) = 0;
92  rotate_about_z(2, 2) = 1;
93  rotate_about_z(2, 3) = 0;
94  rotate_about_z(3, 0) = 0;
95  rotate_about_z(3, 1) = 0;
96  rotate_about_z(3, 2) = 0;
97  rotate_about_z(3, 3) = 1;
98 
99  ColumnMajorMatrix transform =
101  return transform * p0;
102 }
ColumnMajorMatrix _transformation_matrix
ColumnMajorMatrix _transformation_matrix_inv

Member Data Documentation

MooseEnum DisplacementAboutAxis::_angle_units
protected

Definition at line 52 of file DisplacementAboutAxis.h.

Referenced by computeQpValue().

Point DisplacementAboutAxis::_axis_direction
protected
const Point DisplacementAboutAxis::_axis_origin
protected

Definition at line 53 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices().

const int DisplacementAboutAxis::_component
protected

Definition at line 50 of file DisplacementAboutAxis.h.

Referenced by computeQpValue(), and DisplacementAboutAxis().

Function& DisplacementAboutAxis::_func
protected

Definition at line 51 of file DisplacementAboutAxis.h.

Referenced by computeQpValue().

ColumnMajorMatrix DisplacementAboutAxis::_transformation_matrix
protected

Definition at line 56 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices(), and rotateAroundAxis().

ColumnMajorMatrix DisplacementAboutAxis::_transformation_matrix_inv
protected

Definition at line 57 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices(), and rotateAroundAxis().


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