Real AuxChemElastic::computeDifferential(const Real & coupled_conserved, const Real & coupled_nonconserved) { // partial derivative of f_chem with respect to conserved variable Real dfchem_dcons(0.0); // partial derivative of f_chem with respect to nonconserved variable Real dfchem_dnoncons(0.0); // partial derivatives of self-elastic energies Real dself_dcons(0.0); Real dself_dnoncons(0.0); // partial derivative of interaction elastic energy Real dint_dcons(0.0); Real dint_dnoncons(0.0); Real first_term(0.0); Real second_term(0.0); dfchem_dcons = computeDfchemDcons(coupled_conserved, coupled_nonconserved); dself_dcons = computeDselfDcons(); dint_dcons = computeDintDcons(); dfchem_dnoncons = computeDfchemDnoncons(coupled_conserved, coupled_nonconserved); dself_dnoncons = computeDselfDnoncons(); dint_dnoncons = computeDintDnoncons(); first_term = (dfchem_dcons + dself_dcons + dint_dcons)*(_precip_conserved - coupled_conserved); second_term = (dfchem_dnoncons + dself_dnoncons + dint_dnoncons)*(_precip_nonconserved - coupled_nonconserved); return first_term + second_term; }
Real AuxChem::computeDifferential(const Real & coupled_conserved, const Real & coupled_nonconserved) { // partial derivative of f_chem with respect to conserved variable Real dfchem_dcons(0.0); // partial derivative of f_chem with respect to nonconserved variable Real dfchem_dnoncons(0.0); Real first_term(0.0); Real second_term(0.0); dfchem_dcons = computeDfchemDcons(coupled_conserved, coupled_nonconserved); dfchem_dnoncons = computeDfchemDnoncons(coupled_conserved, coupled_nonconserved); first_term = (dfchem_dcons)*(_precip_conserved - coupled_conserved); second_term = (dfchem_dnoncons)*(_precip_nonconserved - coupled_nonconserved); return first_term + second_term; }
Real StressDivergenceRZ::calculateJacobian( unsigned int ivar, unsigned int jvar ) { // B^T_i * C * B_j SymmTensor test, phi; if (ivar == 0) { test.xx() = _grad_test[_i][_qp](0); test.xy() = 0.5*_grad_test[_i][_qp](1); test.zz() = _test[_i][_qp] / _q_point[_qp](0); } else { test.xy() = 0.5*_grad_test[_i][_qp](0); test.yy() = _grad_test[_i][_qp](1); } if (jvar == 0) { phi.xx() = _grad_phi[_j][_qp](0); phi.xy() = 0.5*_grad_phi[_j][_qp](1); phi.zz() = _phi[_j][_qp] / _q_point[_qp](0); } else { phi.xy() = 0.5*_grad_phi[_j][_qp](0); phi.yy() = _grad_phi[_j][_qp](1); } SymmTensor tmp( _Jacobian_mult[_qp] * phi ); Real first_term( test.doubleContraction( tmp ) ); Real val = 0.0; // volumetric locking correction // K = Bbar^T_i * C * Bbar^T_j where Bbar = B + Bvol // K = B^T_i * C * B_j + Bvol^T_i * C * Bvol_j + B^T_i * C * Bvol_j + Bvol^T_i * C * B_j if (_volumetric_locking_correction) { RealGradient new_test(2, 0.0); RealGradient new_phi(2, 0.0); new_test(0) = _grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0); new_test(1) = _grad_test[_i][_qp](1); new_phi(0) = _grad_phi[_j][_qp](0) + _phi[_j][_qp] / _q_point[_qp](0); new_phi(1) = _grad_phi[_j][_qp](1); // Bvol^T_i * C * Bvol_j val += _Jacobian_mult[_qp].sum_3x3() * (_avg_grad_test[_i][ivar] - new_test(ivar)) * (_avg_grad_phi[_j][jvar] - new_phi(jvar)) / 3.0; // B^T_i * C * Bvol_j RealGradient sum_3x1 = _Jacobian_mult[_qp].sum_3x1(); if (ivar == 0 && jvar == 0) val += (sum_3x1(0) * test.xx() + sum_3x1(2) * test.zz()) * (_avg_grad_phi[_j][0] - new_phi(0)); else if (ivar == 0 && jvar == 1) val += (sum_3x1(0) * test.xx() + sum_3x1(2) * test.zz()) * (_avg_grad_phi[_j][1] - new_phi(1)); else if (ivar == 1 && jvar == 0) val += sum_3x1(1) * test.yy() * (_avg_grad_phi[_j][0] - new_phi(0)); else val += sum_3x1(1) * test.yy() * (_avg_grad_phi[_j][1] - new_phi(1)); // Bvol^T_i * C * B_j // tmp = C * B_j from above if (ivar == 0) val += (tmp.xx() + tmp.yy() + tmp.zz()) * (_avg_grad_test[_i][0] - new_test(0)); else val += (tmp.xx() + tmp.yy() + tmp.zz()) * (_avg_grad_test[_i][1] - new_test(1)); } return val / 3.0 + first_term; }