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 : /** 15 : * Computes the average value of a variable on each block 16 : */ 17 : class ComputeBlockOrientationByRotation : public ComputeBlockOrientationBase 18 : { 19 : public: 20 : ComputeBlockOrientationByRotation(const InputParameters & parameters); 21 : 22 : static InputParameters validParams(); 23 : 24 : /** 25 : * Clear internal Euler angle and misorientationdata. 26 : */ 27 : virtual void initialize() override; 28 : 29 : /** 30 : * Compute the average of the rotation matrix in this element 31 : */ 32 : virtual void execute() override; 33 : 34 0 : virtual void threadJoin(const UserObject & /*y*/) override {}; 35 : 36 : /** 37 : * Gather all Euler angles from this block 38 : */ 39 : virtual void finalize() override; 40 : 41 : protected: 42 : /** 43 : * Compute Quaternion for each subdomain (block), following 44 : * Markley, F. Landis, Yang Cheng, John Lucas Crassidis, and Yaakov Oshman. 45 : * "Averaging quaternions." Journal of Guidance, Control, and Dynamics 30, 46 : * no. 4 (2007): 1193-1197. 47 : */ 48 : EulerAngles computeSubdomainEulerAngles(const SubdomainID & sid); 49 : 50 : // updated quaternion 51 : const MaterialProperty<RankTwoTensor> & _updated_rotation; 52 : 53 : /// number of bins for each quaternion component 54 : unsigned int _bins; 55 : 56 : /// parameter used to compute the weighting function for the average quaternion calculation 57 : Real _L_norm; 58 : 59 : // Array of vectors to store quaternions of each grain 60 : std::unordered_map<SubdomainID, std::vector<std::tuple<Real, Real, Real, Real>>> _quat; 61 : };