Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "ComputeBlockOrientationBase.h" 13 : 14 : #include "libmesh/mesh_tools.h" 15 : #include "EulerAngles.h" 16 : 17 : /** 18 : * Computes the average value of a variable on each block 19 : */ 20 : class ComputeBlockOrientationByMisorientation : public ComputeBlockOrientationBase 21 : { 22 : public: 23 : ComputeBlockOrientationByMisorientation(const InputParameters & parameters); 24 : 25 : static InputParameters validParams(); 26 : 27 : /** 28 : * Clear internal Euler angle and misorientationdata. 29 : */ 30 : virtual void initialize() override; 31 : 32 : /** 33 : * Compute the average of the rotation matrix, Euler angles, and 34 : * misorientation in each element 35 : */ 36 : virtual void execute() override; 37 : 38 0 : virtual void threadJoin(const UserObject & /*y*/) override {}; 39 : 40 : /** 41 : * Sync data from all processors (gather the maximum misorientation and the corresponding 42 : * EulerAngle from every processor) 43 : */ 44 : virtual void finalize() override; 45 : 46 : EulerAngles computeSubdomainEulerAngles(const SubdomainID & sid); 47 : 48 : protected: 49 : // updated quaternion 50 : const MaterialProperty<RankTwoTensor> & _updated_rotation; 51 : 52 : // misorientation angle values 53 : const MaterialProperty<Real> & _misorient; 54 : 55 : // Array of vectors to store block ID, maximum misorientation angle and corresponding EulerAngle 56 : std::unordered_map<SubdomainID, std::vector<std::tuple<Real, Real, Real, Real>>> 57 : _grain_misorientation; 58 : };