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 : #include "ComputeElasticityTensorCP.h" 11 : #include "RotationTensor.h" 12 : 13 : registerMooseObject("TensorMechanicsApp", ComputeElasticityTensorCP); 14 : 15 : InputParameters 16 905 : ComputeElasticityTensorCP::validParams() 17 : { 18 905 : InputParameters params = ComputeElasticityTensor::validParams(); 19 905 : params.addClassDescription("Compute an elasticity tensor for crystal plasticity."); 20 1810 : params.addParam<UserObjectName>("read_prop_user_object", 21 : "The ElementReadPropertyFile " 22 : "GeneralUserObject to read element " 23 : "specific property values from file"); 24 905 : return params; 25 0 : } 26 : 27 679 : ComputeElasticityTensorCP::ComputeElasticityTensorCP(const InputParameters & parameters) 28 : : ComputeElasticityTensor(parameters), 29 2037 : _read_prop_user_object(isParamValid("read_prop_user_object") 30 751 : ? &getUserObject<PropertyReadFile>("read_prop_user_object") 31 : : nullptr), 32 679 : _Euler_angles_mat_prop(declareProperty<RealVectorValue>("Euler_angles")), 33 679 : _crysrot(declareProperty<RankTwoTensor>(_base_name + "crysrot")), 34 1358 : _R(_Euler_angles) 35 : { 36 : // the base class guarantees constant in time, but in this derived class the 37 : // tensor will rotate over time once plastic deformation sets in 38 679 : revokeGuarantee(_elasticity_tensor_name, Guarantee::CONSTANT_IN_TIME); 39 : 40 : // the base class performs a passive rotation, but the crystal plasticity 41 : // materials use active rotation: recover unrotated _Cijkl here 42 1358 : if (parameters.isParamValid("rotation_matrix")) 43 : { 44 28 : _user_provided_rotation_matrix = true; 45 28 : _Cijkl.rotate(_rotation_matrix.transpose()); 46 : } 47 : else 48 : { 49 651 : _user_provided_rotation_matrix = false; 50 651 : _Cijkl.rotate(_R.transpose()); 51 : } 52 : 53 679 : if (_user_provided_rotation_matrix && 54 735 : (_read_prop_user_object || (parameters.isParamSetByUser("euler_angle_1")) || 55 707 : (parameters.isParamSetByUser("euler_angle_2")) || 56 706 : (parameters.isParamSetByUser("euler_angle_3")))) 57 1 : mooseError("Bunge Euler angle information and the rotation_matrix cannot both be specified. " 58 : "Provide only one type of orientation information in the input file."); 59 678 : } 60 : 61 : void 62 1062518 : ComputeElasticityTensorCP::assignEulerAngles() 63 : { 64 1062518 : if (_read_prop_user_object) 65 : { 66 89920 : _Euler_angles_mat_prop[_qp](0) = _read_prop_user_object->getData(_current_elem, 0); 67 89920 : _Euler_angles_mat_prop[_qp](1) = _read_prop_user_object->getData(_current_elem, 1); 68 89920 : _Euler_angles_mat_prop[_qp](2) = _read_prop_user_object->getData(_current_elem, 2); 69 : } 70 : else 71 972598 : _Euler_angles_mat_prop[_qp] = _Euler_angles; 72 : 73 1062518 : _R.update(_Euler_angles_mat_prop[_qp]); 74 1062518 : } 75 : 76 : void 77 16608 : ComputeElasticityTensorCP::initQpStatefulProperties() 78 : { 79 16608 : if (!_user_provided_rotation_matrix) 80 : { 81 16512 : assignEulerAngles(); 82 16512 : _crysrot[_qp] = _R.transpose(); 83 : } 84 : else 85 96 : _crysrot[_qp] = _rotation_matrix.transpose(); 86 16608 : } 87 : 88 : void 89 1103766 : ComputeElasticityTensorCP::computeQpElasticityTensor() 90 : { 91 : // Properties assigned at the beginning of every call to material calculation 92 : // is required by the monolithic and user object versions. If those classes 93 : // are deprecated, these update can be removed and save time 94 1103766 : if (!_user_provided_rotation_matrix) 95 : { 96 1046006 : assignEulerAngles(); 97 1046006 : _crysrot[_qp] = _R.transpose(); 98 : } 99 : else 100 57760 : _crysrot[_qp] = _rotation_matrix.transpose(); 101 : 102 1103766 : _elasticity_tensor[_qp] = _Cijkl; 103 1103766 : _elasticity_tensor[_qp].rotate(_crysrot[_qp]); 104 1103766 : }