13#include "libmesh/mesh_tools.h"
22 "calculating the maximum misorientation within the grain.");
29 _updated_rotation(getMaterialProperty<
RankTwoTensor>(
"updated_rotation")),
30 _misorient(getMaterialProperty<Real>(
"misorientation"))
49 for (
unsigned int _qp = 0; _qp <
_qrule->n_points(); _qp++)
58 Eigen::Matrix<Real, 3, 3> rot_mat;
60 for (
unsigned int i = 0; i < 3; ++i)
61 for (
unsigned int j = 0; j < 3; ++j)
62 rot_mat(i, j) = rot(i, j);
65 Eigen::JacobiSVD<Eigen::Matrix<Real, 3, 3>> svd(rot_mat,
66 Eigen::ComputeFullU | Eigen::ComputeFullV);
68 Eigen::Matrix<Real, 3, 3> U = svd.matrixU();
69 Eigen::Matrix<Real, 3, 3> V = svd.matrixV();
72 Eigen::Matrix<Real, 3, 3>
R = U * V.transpose();
73 if (
R.determinant() < 0.0)
75 Eigen::Matrix<Real, 3, 3> D = Eigen::Matrix<Real, 3, 3>::Identity();
77 R = U * D * V.transpose();
81 Eigen::Quaternion<Real> q(
R);
105 Real max_misorientation = 0.0;
107 bool has_update =
false;
110 if (misorientation > max_misorientation)
112 max_misorientation = misorientation;
registerMooseObject("SolidMechanicsApp", ComputeBlockOrientationByMisorientation)
Computes the average value of a variable on each block.
static InputParameters validParams()
virtual void initialize() override
This is called before execute so you can reset any internal data.
std::map< SubdomainID, EulerAngles > _block_ea_values
Computes the average value of a variable on each block.
ComputeBlockOrientationByMisorientation(const InputParameters ¶meters)
std::unordered_map< SubdomainID, std::vector< std::tuple< Real, Real, Real, Real > > > _grain_misorientation
const MaterialProperty< RankTwoTensor > & _updated_rotation
EulerAngles computeSubdomainEulerAngles(const SubdomainID &sid)
virtual void finalize() override
Sync data from all processors (gather the maximum misorientation and the corresponding EulerAngle fro...
virtual void initialize() override
Clear internal Euler angle and misorientationdata.
const MaterialProperty< Real > & _misorient
virtual void execute() override
Compute the average of the rotation matrix, Euler angles, and misorientation in each element.
static InputParameters validParams()
const QBase *const & _qrule
const Elem *const & _current_elem
const MooseArray< Real > & _coord
const MooseArray< Real > & _JxW
const Real & _current_elem_volume
virtual MooseMesh & mesh() override
const std::set< SubdomainID > & meshSubdomains() const
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
FEProblemBase & _fe_problem
const Parallel::Communicator & _communicator