LCOV - code coverage report
Current view: top level - src/materials/crystal_plasticity - ComputeUpdatedEulerAngle.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 22 26 84.6 %
Date: 2026-05-29 20:40:07 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       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             : #include "ComputeUpdatedEulerAngle.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", ComputeUpdatedEulerAngle);
      13             : 
      14             : InputParameters
      15          97 : ComputeUpdatedEulerAngle::validParams()
      16             : {
      17          97 :   InputParameters params = Material::validParams();
      18          97 :   params.addClassDescription(
      19             :       "This class computes the updated Euler angle for crystal plasticity simulations. This needs "
      20             :       "to be used together with the  ComputeMultipleCrystalPlasticityStress class, where the "
      21             :       "updated rotation material property is computed. ");
      22         194 :   params.addParam<bool>(
      23         194 :       "degree_to_radian", false, "Whether to convert euler angles from degree to radian.");
      24          97 :   return params;
      25           0 : }
      26             : 
      27          72 : ComputeUpdatedEulerAngle::ComputeUpdatedEulerAngle(const InputParameters & parameters)
      28             :   : Material(parameters),
      29          72 :     _updated_rotation(getMaterialProperty<RankTwoTensor>("updated_rotation")),
      30          72 :     _updated_euler_angle(declareProperty<RealVectorValue>("updated_Euler_angle")),
      31         216 :     _degree_to_radian(getParam<bool>("degree_to_radian"))
      32             : {
      33          72 : }
      34             : 
      35             : void
      36           0 : ComputeUpdatedEulerAngle::initQpStatefulProperties()
      37             : {
      38           0 :   _updated_euler_angle[_qp].zero();
      39           0 : }
      40             : 
      41             : void
      42      168464 : ComputeUpdatedEulerAngle::computeQpProperties()
      43             : {
      44      168464 :   computeEulerAngleFromRotationMatrix(_updated_rotation[_qp], _updated_euler_angle[_qp]);
      45      168464 : }
      46             : 
      47             : void
      48      168464 : ComputeUpdatedEulerAngle::computeEulerAngleFromRotationMatrix(const RankTwoTensor & rot,
      49             :                                                               RealVectorValue & euler_angle)
      50             : {
      51             :   // transform RankTwoTensor to Eigen::Matrix
      52             :   Eigen::Matrix<Real, 3, 3> rot_mat;
      53             : 
      54      673856 :   for (unsigned int i = 0; i < 3; ++i)
      55     2021568 :     for (unsigned int j = 0; j < 3; ++j)
      56     1516176 :       rot_mat(i, j) = rot(i, j);
      57             : 
      58             :   // compute Quaternion from rotation matrix
      59             :   Eigen::Quaternion<Real> q(rot_mat);
      60             :   // construct Euler angle from Quaternion
      61      168464 :   EulerAngles ea(q);
      62             :   // convert EulerAngles to RealVectorValue
      63      168464 :   euler_angle = (RealVectorValue)ea;
      64             : 
      65      168464 :   if (_degree_to_radian)
      66             :     euler_angle *= libMesh::pi / 180.0;
      67      168464 : }

Generated by: LCOV version 1.14