www.mooseframework.org
Public Member Functions | Static 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)
 

Static Public Member Functions

static InputParameters validParams ()
 

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

Constructor & Destructor Documentation

◆ DisplacementAboutAxis()

DisplacementAboutAxis::DisplacementAboutAxis ( const InputParameters &  parameters)

Definition at line 44 of file DisplacementAboutAxis.C.

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

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

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

Referenced by initialSetup().

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

114 {
115  Real magnitude = _axis_direction.norm();
116  _axis_direction /= magnitude;
117 }

Referenced by initialSetup().

◆ computeQpValue()

Real DisplacementAboutAxis::computeQpValue ( )
protectedvirtual

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

Definition at line 67 of file DisplacementAboutAxis.C.

68 {
69  Point p(*_current_node);
70 
71  Real angle(_func.value(_t, *_current_node));
72  if (_angle_units == "degrees")
73  angle = angle * libMesh::pi / 180.0;
74 
75  ColumnMajorMatrix p_old(4, 1);
76  p_old(0, 0) = p(0);
77  p_old(1, 0) = p(1);
78  p_old(2, 0) = p(2);
79  p_old(3, 0) = 1;
80 
81  ColumnMajorMatrix p_new = rotateAroundAxis(p_old, angle);
82 
83  return p_new(_component, 0) - p_old(_component, 0);
84 }

◆ initialSetup()

void DisplacementAboutAxis::initialSetup ( )
protectedvirtual

Definition at line 60 of file DisplacementAboutAxis.C.

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

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

Referenced by computeQpValue().

◆ validParams()

InputParameters DisplacementAboutAxis::validParams ( )
static

Definition at line 18 of file DisplacementAboutAxis.C.

19 {
20  InputParameters params = DirichletBCBase::validParams();
21  params.addClassDescription("Implements a boundary condition that enforces rotational"
22  "displacement around an axis on a boundary");
24  params.addRequiredParam<int>("component", "The component for the rotational displacement");
25  params.set<bool>("use_displaced_mesh") = true;
26  params.set<bool>("preset") = true;
27  return params;
28 }

Member Data Documentation

◆ _angle_units

MooseEnum DisplacementAboutAxis::_angle_units
protected

Definition at line 55 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 56 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices().

◆ _component

const int DisplacementAboutAxis::_component
protected

Definition at line 53 of file DisplacementAboutAxis.h.

Referenced by computeQpValue(), and DisplacementAboutAxis().

◆ _func

const Function& DisplacementAboutAxis::_func
protected

Definition at line 54 of file DisplacementAboutAxis.h.

Referenced by computeQpValue().

◆ _transformation_matrix

ColumnMajorMatrix DisplacementAboutAxis::_transformation_matrix
protected

Definition at line 59 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices(), and rotateAroundAxis().

◆ _transformation_matrix_inv

ColumnMajorMatrix DisplacementAboutAxis::_transformation_matrix_inv
protected

Definition at line 60 of file DisplacementAboutAxis.h.

Referenced by calculateTransformationMatrices(), and rotateAroundAxis().


The documentation for this class was generated from the following files:
DisplacementAboutAxis::_component
const int _component
Definition: DisplacementAboutAxis.h:53
DisplacementAboutAxis::_angle_units
MooseEnum _angle_units
Definition: DisplacementAboutAxis.h:55
DisplacementAboutAxis::_axis_origin
const Point _axis_origin
Definition: DisplacementAboutAxis.h:56
addDisplacementAboutAxisParams
void addDisplacementAboutAxisParams(InputParameters &params)
Definition: DisplacementAboutAxis.C:31
validParams
InputParameters validParams()
name
const std::string name
Definition: Setup.h:21
DisplacementAboutAxis::_axis_direction
Point _axis_direction
Definition: DisplacementAboutAxis.h:57
DisplacementAboutAxis::_transformation_matrix
ColumnMajorMatrix _transformation_matrix
Definition: DisplacementAboutAxis.h:59
DisplacementAboutAxis::_transformation_matrix_inv
ColumnMajorMatrix _transformation_matrix_inv
Definition: DisplacementAboutAxis.h:60
DisplacementAboutAxis::_func
const Function & _func
Definition: DisplacementAboutAxis.h:54
DisplacementAboutAxis::calculateTransformationMatrices
void calculateTransformationMatrices()
Calculate the rotation about the x and y axes based on the provided axis direction vector at the star...
Definition: DisplacementAboutAxis.C:120
DisplacementAboutAxis::rotateAroundAxis
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...
Definition: DisplacementAboutAxis.C:87
DisplacementAboutAxis::calculateUnitDirectionVector
void calculateUnitDirectionVector()
Check if the provided axis direction vector is a unit vector and normalizes the vector if necessary d...
Definition: DisplacementAboutAxis.C:113