23 "Provide updated euler angles after rigid body rotation of the grains.");
25 "The FeatureFloodCount UserObject to get values from.");
27 "Name of Euler angle provider user object");
29 "Name of Euler angle provider user object");
31 "The feature volume VectorPostprocessorValue.");
32 params.
addParam<Real>(
"rotation_constant", 1.0,
"Constant value characterizing grain rotation");
41 _grain_volumes(getVectorPostprocessorValue(
"grain_volumes",
"feature_volumes")),
42 _mr(getParam<Real>(
"rotation_constant")),
43 _first_time(declareRestartableData<bool>(
"first_time_euler_update", true)),
44 _first_time_recovered(_app.isRecovering()),
45 _t_step_old(declareRestartableData<
int>(
"euler_update_tstep_old", -1)),
46 _angles_old(declareRestartableData<
std::vector<
EulerAngles>>(
"euler_angles_old"))
59 for (
unsigned int i = 0; i < grain_num; ++i)
63 unsigned int angle_size =
_angles.size();
64 for (
unsigned int i = angle_size; i < grain_num; ++i)
67 for (
unsigned int i = 0; i < grain_num; ++i)
78 else if (i > angle_size)
82 RealVectorValue torque_rotated =
84 RealVectorValue omega =
95 RealVectorValue angle_change;
96 angle_change(0) = omega(2) *
_dt;
98 (omega(0) * std::cos(angle_change(0)) + omega(1) * std::sin(angle_change(0))) *
_dt;
99 angle_change(2) = (omega(0) * std::sin(angle_change(0)) * std::sin(angle_change(1)) -
100 omega(1) * std::cos(angle_change(0)) * std::sin(angle_change(1)) +
101 omega(2) * std::cos(angle_change(1))) *
112 RealTensorValue
R = R1 * R0;
114 if (
R(2, 2) != 1.0 &&
R(2, 2) != -1.0)
120 else if (
R(2, 2) == 1.0)
127 _angles[i].phi1 = angle_change(0);
129 if (std::abs(
_angles[i].phi1) > 360.0)
131 int laps =
_angles[i].phi1 / 360.0;
132 _angles[i].phi1 -= laps * 360.0;
142 _angles[i].phi1 = angle_change(0);
144 if (std::abs(
_angles[i].phi1) > 360.0)
146 int laps =
_angles[i].phi1 / 360.0;
147 _angles[i].phi1 -= laps * 360.0;
170 mooseAssert(i <
getGrainNum(),
"Requesting Euler angles for an invalid grain id");
registerMooseObject("PhaseFieldApp", EulerAngleUpdater)
void ErrorVector unsigned int
Abstract base class for user objects that implement the Euler Angle provider interface.
std::vector< EulerAngles > & _angles
virtual const EulerAngles & getEulerAngles(unsigned int i) const
static InputParameters validParams()
virtual unsigned int getGrainNum() const
Update Euler angles of each grains after rigid body rotation This class estimates the rotation of pri...
bool & _first_time
Whether this is the first time updating angles, in which case the initial euler angle provider should...
int & _t_step_old
Used to determine whether a timestep is being repeated.
EulerAngleUpdater(const InputParameters ¶meters)
std::vector< EulerAngles > & _angles_old
bool _first_time_recovered
Whether the simulation has recovered once.
const EulerAngleProvider & _euler
const GrainForceAndTorqueInterface & _grain_torque
virtual const EulerAngles & getEulerAnglesOld(unsigned int) const
virtual void initialize() override
const GrainTrackerInterface & _grain_tracker
static InputParameters validParams()
const VectorPostprocessorValue & _grain_volumes
This class provides interface for extracting the forces and torques computed in other UserObjects.
virtual const std::vector< RealGradient > & getTorqueValues() const =0
This class defines the interface for the GrainTracking objects.
virtual std::size_t getTotalFeatureCount() const =0
Returns a number large enough to contain the largest ID for all grains in use.
void mooseError(Args &&... args) const
This is a RealTensor version of a rotation matrix It is instantiated with the Euler angles,...
virtual bool converged(const unsigned int sys_num)
unsigned int number() const
FEProblemBase & _fe_problem