Real StressDivergence::computeQpJacobian() { Real sum_C3x3 = _Jacobian_mult[_qp].sum_3x3(); RealGradient sum_C3x1 = _Jacobian_mult[_qp].sum_3x1(); Real jacobian = 0.0; // B^T_i * C * B_j jacobian += _Jacobian_mult[_qp].stiffness( _component, _component, _grad_test[_i][_qp], _grad_phi[_j][_qp]); // B^T_i * C *B_j if (_volumetric_locking_correction) { // jacobian = Bbar^T_i * C * Bbar_j where Bbar = B + Bvol // jacobian = B^T_i * C * B_j + Bvol^T_i * C * Bvol_j + Bvol^T_i * C * B_j + B^T_i * C * Bvol_j // Bvol^T_i * C * Bvol_j jacobian += sum_C3x3 * (_avg_grad_test[_i][_component] - _grad_test[_i][_qp](_component)) * (_avg_grad_phi[_j][_component] - _grad_phi[_j][_qp](_component)) / 9.0; // B^T_i * C * Bvol_j jacobian += sum_C3x1(_component) * _grad_test[_i][_qp](_component) * (_avg_grad_phi[_j][_component] - _grad_phi[_j][_qp](_component)) / 3.0; // Bvol^T_i * C * B_j SymmTensor phi; if (_component == 0) { phi.xx() = _grad_phi[_j][_qp](0); phi.xy() = _grad_phi[_j][_qp](1); phi.xz() = _grad_phi[_j][_qp](2); } else if (_component == 1) { phi.yy() = _grad_phi[_j][_qp](1); phi.xy() = _grad_phi[_j][_qp](0); phi.yz() = _grad_phi[_j][_qp](2); } else if (_component == 2) { phi.zz() = _grad_phi[_j][_qp](2); phi.xz() = _grad_phi[_j][_qp](0); phi.yz() = _grad_phi[_j][_qp](1); } SymmTensor tmp(_Jacobian_mult[_qp] * phi); jacobian += (tmp.xx() + tmp.yy() + tmp.zz()) * (_avg_grad_test[_i][_component] - _grad_test[_i][_qp](_component)) / 3.0; } if (_dt > 0) return jacobian * (1 + _alpha + _zeta / _dt); else return jacobian; }
ColumnMajorMatrix CrackFrontDefinition::rotateToCrackFrontCoords(const SymmTensor tensor, const unsigned int node_index) const { ColumnMajorMatrix tensor_CMM; tensor_CMM(0,0) = tensor.xx(); tensor_CMM(0,1) = tensor.xy(); tensor_CMM(0,2) = tensor.xz(); tensor_CMM(1,0) = tensor.xy(); tensor_CMM(1,1) = tensor.yy(); tensor_CMM(1,2) = tensor.yz(); tensor_CMM(2,0) = tensor.xz(); tensor_CMM(2,1) = tensor.yz(); tensor_CMM(2,2) = tensor.zz(); ColumnMajorMatrix tmp = _rot_matrix[node_index] * tensor_CMM; ColumnMajorMatrix rotT = _rot_matrix[node_index].transpose(); ColumnMajorMatrix rotated_tensor = tmp * rotT; return rotated_tensor; }
Real StressDivergence::computeQpOffDiagJacobian(unsigned int jvar) { unsigned int coupled_component = 0; bool active = false; if (_xdisp_coupled && jvar == _xdisp_var) { coupled_component = 0; active = true; } else if (_ydisp_coupled && jvar == _ydisp_var) { coupled_component = 1; active = true; } else if (_zdisp_coupled && jvar == _zdisp_var) { coupled_component = 2; active = true; } if (active) { Real sum_C3x3 = _Jacobian_mult[_qp].sum_3x3(); RealGradient sum_C3x1 = _Jacobian_mult[_qp].sum_3x1(); Real jacobian = 0.0; jacobian += _Jacobian_mult[_qp].stiffness( _component, coupled_component, _grad_test[_i][_qp], _grad_phi[_j][_qp]); // B^T_i * C *B_j if (_volumetric_locking_correction) { // jacobian = Bbar^T_i * C * Bbar_j where Bbar = B + Bvol // jacobian = B^T_i * C * B_j + Bvol^T_i * C * Bvol_j + Bvol^T_i * C * B_j + B^T_i * C * // Bvol_j // Bvol^T_i * C * Bvol_j jacobian += sum_C3x3 * (_avg_grad_test[_i][_component] - _grad_test[_i][_qp](_component)) * (_avg_grad_phi[_j][coupled_component] - _grad_phi[_j][_qp](coupled_component)) / 9.0; // B^T_i * C * Bvol_j jacobian += sum_C3x1(_component) * _grad_test[_i][_qp](_component) * (_avg_grad_phi[_j][coupled_component] - _grad_phi[_j][_qp](coupled_component)) / 3.0; // Bvol^T_i * C * B_i SymmTensor phi; if (coupled_component == 0) { phi.xx() = _grad_phi[_j][_qp](0); phi.xy() = _grad_phi[_j][_qp](1); phi.xz() = _grad_phi[_j][_qp](2); } else if (coupled_component == 1) { phi.yy() = _grad_phi[_j][_qp](1); phi.xy() = _grad_phi[_j][_qp](0); phi.yz() = _grad_phi[_j][_qp](2); } else if (coupled_component == 2) { phi.zz() = _grad_phi[_j][_qp](2); phi.xz() = _grad_phi[_j][_qp](0); phi.yz() = _grad_phi[_j][_qp](1); } SymmTensor tmp(_Jacobian_mult[_qp] * phi); jacobian += (tmp.xx() + tmp.yy() + tmp.zz()) * (_avg_grad_test[_i][_component] - _grad_test[_i][_qp](_component)) / 3.0; } if (_dt > 0) return jacobian * (1 + _alpha + _zeta / _dt); else return jacobian; } if (_temp_coupled && jvar == _temp_var) return _d_stress_dT[_qp].rowDot(_component, _grad_test[_i][_qp]) * _phi[_j][_qp]; return 0; }