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 31 of file EulerAngleUpdaterCheck.h.

Constructor & Destructor Documentation

◆ EulerAngleUpdaterCheck()

EulerAngleUpdaterCheck::EulerAngleUpdaterCheck ( const InputParameters &  parameters)

Definition at line 38 of file EulerAngleUpdaterCheck.C.

39  : GeneralVectorPostprocessor(params),
40  _diff(declareVector("vec_diff")),
41  _grain_tracker(getUserObject<GrainTrackerInterface>("grain_tracker_object")),
42  _euler(getUserObject<EulerAngleUpdater>("euler_angle_updater")),
43  _grain_torque(getUserObject<GrainForceAndTorqueInterface>("grain_torques_object")),
44  _grain_volumes(getVectorPostprocessorValue("grain_volumes", "feature_volumes")),
45  _mr(getParam<Real>("rotation_constant"))
46 {
47 }
const VectorPostprocessorValue & _grain_volumes
const GrainTrackerInterface & _grain_tracker
VectorPostprocessorValue & _diff
const EulerAngleUpdater & _euler
const GrainForceAndTorqueInterface & _grain_torque

Member Function Documentation

◆ execute()

virtual void EulerAngleUpdaterCheck::execute ( )
inlineoverridevirtual

Definition at line 37 of file EulerAngleUpdaterCheck.h.

37 {}

◆ finalize()

virtual void EulerAngleUpdaterCheck::finalize ( )
inlineoverridevirtual

Definition at line 38 of file EulerAngleUpdaterCheck.h.

38 {}

◆ initialize()

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 50 of file EulerAngleUpdaterCheck.C.

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

Member Data Documentation

◆ _angles

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

Definition at line 50 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

◆ _angles_old

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

Definition at line 51 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

◆ _diff

VectorPostprocessorValue& EulerAngleUpdaterCheck::_diff

Definition at line 40 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

◆ _euler

const EulerAngleUpdater& EulerAngleUpdaterCheck::_euler
protected

Definition at line 44 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

◆ _grain_torque

const GrainForceAndTorqueInterface& EulerAngleUpdaterCheck::_grain_torque
protected

Definition at line 45 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

◆ _grain_tracker

const GrainTrackerInterface& EulerAngleUpdaterCheck::_grain_tracker
protected

Definition at line 43 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

◆ _grain_volumes

const VectorPostprocessorValue& EulerAngleUpdaterCheck::_grain_volumes
protected

Definition at line 46 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().

◆ _mr

const Real EulerAngleUpdaterCheck::_mr
protected

Definition at line 48 of file EulerAngleUpdaterCheck.h.

Referenced by initialize().


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