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

This is a unit test to check the correctness of the updated euler angles An unit vector is rotated as per old euler angles first and then due to the applied torque The final rotated vector is cross checked with the rotated vector as per updated euler angles. More...

#include <EulerAngleUpdaterCheck.h>

Inheritance diagram for EulerAngleUpdaterCheck:
[legend]

Public Member Functions

 EulerAngleUpdaterCheck (const InputParameters &parameters)
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void finalize () override
 

Public Attributes

VectorPostprocessorValue & _diff
 

Protected Attributes

const GrainTrackerInterface_grain_tracker
 
const EulerAngleUpdater_euler
 
const GrainForceAndTorqueInterface_grain_torque
 
const VectorPostprocessorValue & _grain_volumes
 
const Real _mr
 
std::vector< RealVectorValue > _angles
 
std::vector< RealVectorValue > _angles_old
 

Detailed Description

This is a unit test to check the correctness of the updated euler angles An unit vector is rotated as per old euler angles first and then due to the applied torque The final rotated vector is cross checked with the rotated vector as per updated euler angles.

Definition at line 28 of file EulerAngleUpdaterCheck.h.

Constructor & Destructor Documentation

EulerAngleUpdaterCheck::EulerAngleUpdaterCheck ( const InputParameters &  parameters)

Definition at line 33 of file EulerAngleUpdaterCheck.C.

34  : GeneralVectorPostprocessor(params),
35  _diff(declareVector("vec_diff")),
36  _grain_tracker(getUserObject<GrainTrackerInterface>("grain_tracker_object")),
37  _euler(getUserObject<EulerAngleUpdater>("euler_angle_updater")),
38  _grain_torque(getUserObject<GrainForceAndTorqueInterface>("grain_torques_object")),
39  _grain_volumes(getVectorPostprocessorValue("grain_volumes", "feature_volumes")),
40  _mr(getParam<Real>("rotation_constant"))
41 {
42 }
const VectorPostprocessorValue & _grain_volumes
const GrainTrackerInterface & _grain_tracker
VectorPostprocessorValue & _diff
const EulerAngleUpdater & _euler
const GrainForceAndTorqueInterface & _grain_torque

Member Function Documentation

virtual void EulerAngleUpdaterCheck::execute ( )
inlineoverridevirtual

Definition at line 34 of file EulerAngleUpdaterCheck.h.

34 {}
virtual void EulerAngleUpdaterCheck::finalize ( )
inlineoverridevirtual

Definition at line 35 of file EulerAngleUpdaterCheck.h.

35 {}
void EulerAngleUpdaterCheck::initialize ( )
overridevirtual

Change in euler angles are obtained from the torque & angular velocities about the material axes. Change in phi1, Phi and phi2 are caused by rotation about z axis, x' axis & z'' axis, respectively. Components of the angular velocities across z, x' and z'' axes are obtained from the torque values. This yields change in euler angles due to grain rotation.

Definition at line 45 of file EulerAngleUpdaterCheck.C.

46 {
47  const auto grain_num = _grain_tracker.getTotalFeatureCount();
48  _angles.resize(grain_num);
49  _angles_old.resize(grain_num);
50  _diff.assign(3 * grain_num, 0.0);
51 
52  for (unsigned int i = 0; i < grain_num; ++i)
53  {
56  RealGradient torque = _grain_torque.getTorqueValues()[i];
57 
58  RealVectorValue a(1, 1, 1);
59  RotationTensor R(_angles[i]); // Final rotation tensor
60  RealVectorValue a_rot = R * a; // final rotated vector
61 
62  RotationTensor R0(_angles_old[i]); // RotationTensor as per old euler angles
63  RealVectorValue torque_rot = R0 * torque; // Rotated torque
64  RealVectorValue a_rot0 = R0 * a; // Rotated unit vector as per old euler angles
65 
75  RealVectorValue torque_rot1;
76  RealVectorValue angle_rot;
77  torque_rot1(0) =
78  torque_rot(2); // Tourque about z changed to torque responsible for chaneg in angle phi1
79  angle_rot(0) = _mr / _grain_volumes[i] * torque_rot1(0) * _dt; // change in phi1
80  // Tourque about x' changed to torque responsible for chaneg in angle Phi
81  torque_rot1(1) =
82  (torque_rot(0) * std::cos(angle_rot(0)) + torque_rot(1) * std::sin(angle_rot(0)));
83  angle_rot(1) = _mr / _grain_volumes[i] * torque_rot1(1) * _dt; // change in Phi
84  // Tourque about z'' changed to torque responsible for chaneg in angle phi2
85  torque_rot1(2) = (torque_rot(0) * std::sin(angle_rot(0)) * std::sin(angle_rot(1)) -
86  torque_rot(1) * std::cos(angle_rot(0)) * std::sin(angle_rot(1)) +
87  torque_rot(2) * std::cos(angle_rot(1)));
88  angle_rot(2) = _mr / _grain_volumes[i] * torque_rot1(2) * _dt; // change in phi2
89  angle_rot *= (180.0 / libMesh::pi);
90 
91  RotationTensor R4(angle_rot); // RotationTensor due to grain rotation
92  RealVectorValue a_rot1 = R4 * a_rot0; // Final rotated vector obtained in two step rotation
93 
94  // Difference between the final positions of the rotated vector obtained in two different ways,
95  // should be 0.0
96  _diff[3 * i + 0] = a_rot(0) - a_rot1(0);
97  _diff[3 * i + 1] = a_rot(1) - a_rot1(1);
98  _diff[3 * i + 2] = a_rot(2) - a_rot1(2);
99  }
100 }
virtual const EulerAngles & getEulerAnglesOld(unsigned int) const
std::vector< RealVectorValue > _angles
virtual std::size_t getTotalFeatureCount() const =0
Returns a number large enough to contain the largest ID for all grains in use.
const VectorPostprocessorValue & _grain_volumes
const GrainTrackerInterface & _grain_tracker
VectorPostprocessorValue & _diff
std::vector< RealVectorValue > _angles_old
This is a RealTensor version of a rotation matrix It is instantiated with the Euler angles...
const EulerAngleUpdater & _euler
const GrainForceAndTorqueInterface & _grain_torque
virtual const std::vector< RealGradient > & getTorqueValues() const =0
virtual const EulerAngles & getEulerAngles(unsigned int) const override

Member Data Documentation

std::vector<RealVectorValue> EulerAngleUpdaterCheck::_angles
protected

Definition at line 47 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

std::vector<RealVectorValue> EulerAngleUpdaterCheck::_angles_old
protected

Definition at line 48 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

VectorPostprocessorValue& EulerAngleUpdaterCheck::_diff

Definition at line 37 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

const EulerAngleUpdater& EulerAngleUpdaterCheck::_euler
protected

Definition at line 41 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

const GrainForceAndTorqueInterface& EulerAngleUpdaterCheck::_grain_torque
protected

Definition at line 42 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

const GrainTrackerInterface& EulerAngleUpdaterCheck::_grain_tracker
protected

Definition at line 40 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

const VectorPostprocessorValue& EulerAngleUpdaterCheck::_grain_volumes
protected

Definition at line 43 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

const Real EulerAngleUpdaterCheck::_mr
protected

Definition at line 45 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().


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