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 "ComputeCrystalPlasticityThermalEigenstrain.h" 11 : 12 : registerMooseObject("TensorMechanicsApp", ComputeCrystalPlasticityThermalEigenstrain); 13 : 14 : InputParameters 15 60 : ComputeCrystalPlasticityThermalEigenstrain::validParams() 16 : { 17 60 : InputParameters params = ComputeCrystalPlasticityEigenstrainBase::validParams(); 18 60 : params.addClassDescription("Computes the deformation gradient associated with the linear thermal " 19 : "expansion in a crystal plasticity simulation"); 20 120 : params.addCoupledVar("temperature", "Coupled temperature variable"); 21 : 22 : // Let's check the range of the parameter here 23 120 : params.addRequiredRangeCheckedParam<std::vector<Real>>( 24 : "thermal_expansion_coefficients", 25 : "thermal_expansion_coefficients_size=1 | thermal_expansion_coefficients_size=3 | " 26 : "thermal_expansion_coefficients_size=6 | thermal_expansion_coefficients_size=9", 27 : "Vector of values defining the constant second order thermal expansion coefficients, " 28 : "depending on the degree of anisotropy, this should be of size 1, 3, 6 or 9"); 29 : 30 60 : return params; 31 0 : } 32 : 33 45 : ComputeCrystalPlasticityThermalEigenstrain::ComputeCrystalPlasticityThermalEigenstrain( 34 45 : const InputParameters & parameters) 35 : : DerivativeMaterialInterface<ComputeCrystalPlasticityEigenstrainBase>(parameters), 36 45 : _temperature(coupledValue("temperature")), 37 45 : _temperature_old(coupledValueOld("temperature")), 38 45 : _ddeformation_gradient_dT(isCoupledConstant("temperature") 39 45 : ? nullptr 40 135 : : &declarePropertyDerivative<RankTwoTensor>( 41 135 : _deformation_gradient_name, coupledName("temperature", 0))), 42 90 : _thermal_expansion_coefficients(getParam<std::vector<Real>>("thermal_expansion_coefficients")), 43 45 : _lattice_thermal_expansion_coefficients(declareProperty<RankTwoTensor>( 44 45 : _eigenstrain_name + 45 45 : "_lattice_thermal_expansion_coefficients")) // avoid duplicated material name by including 46 : // the eigenstrain name this coeff corresponds 47 : // to 48 : { 49 45 : } 50 : 51 : void 52 768 : ComputeCrystalPlasticityThermalEigenstrain::initQpStatefulProperties() 53 : { 54 768 : ComputeCrystalPlasticityEigenstrainBase::initQpStatefulProperties(); 55 : // rotate the thermal deforamtion gradient for crystals based on Euler angles 56 768 : _lattice_thermal_expansion_coefficients[_qp] = 57 768 : _thermal_expansion_coefficients.rotated(_crysrot[_qp]); 58 768 : } 59 : 60 : void 61 254184 : ComputeCrystalPlasticityThermalEigenstrain::computeQpDeformationGradient() 62 : { 63 : // compute the deformation gradient due to thermal expansion 64 254184 : Real dtheta = (_temperature[_qp] - _temperature_old[_qp]) * _substep_dt / _dt; 65 : RankTwoTensor residual_equivalent_thermal_expansion_increment = 66 254184 : RankTwoTensor::Identity() - dtheta * _lattice_thermal_expansion_coefficients[_qp]; 67 254184 : _deformation_gradient[_qp] = 68 254184 : residual_equivalent_thermal_expansion_increment.inverse() * _deformation_gradient_old[_qp]; 69 : 70 : // compute the derivative of deformation gradient w.r.t temperature 71 254184 : if (_ddeformation_gradient_dT) 72 : (*_ddeformation_gradient_dT)[_qp] = 73 254184 : _lattice_thermal_expansion_coefficients[_qp] * _deformation_gradient[_qp]; 74 254184 : }