bool stznewHEVPFlowRatePowerLawJ2::computeValue(unsigned int qp, Real & val) const { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); // Real s_xx = _tensor[qp](0,0); // Real s_yy = _tensor[qp](1,1); // Real tau_xy= _tensor[qp](0,1); // Real s_mean = 1.0/3.0*(s_xx+s_yy); // Real PI = 3.1415926; // Real tau_max = std::pow((s_xx-s_yy)/2*(s_xx-s_yy)/2+tau_xy*tau_xy,0.5); // Real eqv_stress = tau_max; Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); // Sbar= .5 (sigma_max-sigma_min) cos (phi), right ? So (sigma_max-sigma_min)/2=sqrt[((sigma_x-sigma_y)/2)^2+tau_xy^2)=tau_max Real _pressure_eff=_grain_pressure-_biot*_pf[qp]; // Real _t_taunew = _agrain[qp]/std::sqrt(_grain_pressure/_rho); Real _t_taunew = _agrain[qp]/std::sqrt(_pressure_eff/_rho); Real _strengthnew; if (_t== _dt) _strengthnew=100e6; else _strengthnew=_strength[qp]; if (eqv_stress>=_strengthnew) val = 1.0/_t_taunew*std::exp(-1.0/_chiv[qp])*std::exp(eqv_stress/_pressure_eff/_chiv[qp])*(1.0-_strength[qp]/eqv_stress); else val = 0.0; // std::cout<<"haha"<<val<<"\n"; return true; }
bool stzRHEVPFlowRatePowerLawJ2::computeValue(unsigned int qp, Real & val) const { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); Real qfunc; if (eqv_stress>1.0) { qfunc = 1.0/eqv_stress*(eqv_stress-1.0)*(eqv_stress-1.0); } else { qfunc=0.0; } val = _v*std::exp(-1.0/_chiv[qp])*qfunc; if (val > _flow_rate_tol) { #ifdef DEBUG mooseWarning("Flow rate greater than " , _flow_rate_tol ," " , val , " " ,eqv_stress ," " , _strength[qp]); #endif return false; } return true; }
bool stznewHEVPFlowRatePowerLawJ2::computeDirection(unsigned int qp, RankTwoTensor & val) const { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); // Real s_xx = _tensor[qp](0,0); // Real s_yy = _tensor[qp](1,1); // Real tau_xy= _tensor[qp](0,1); // Real s_mean = 1.0/3.0*(s_xx+s_yy); // Real PI = 3.1415926; // Real tau_max = std::pow((s_xx-s_yy)/2*(s_xx-s_yy)/2+tau_xy*tau_xy,0.5); // Real eqv_stress = tau_max; // RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); RankTwoTensor dirnew ; Real anglec; Real angles; Real PI= 3.1415926; Real theta= 0.25*PI+0.5*(_phiangle/180.0*PI); anglec = std::cos(theta); angles = std::sin(theta); dirnew.zero(); dirnew(0,0)=2.0*anglec*angles; dirnew(1,1)=-2.0*anglec*angles; val.zero(); if (eqv_stress > _strength[qp]) { val = 1.5/eqv_stress * _ce[qp] * pk2_dev * _ce[qp]; //val = 1.5/eqv_stress*pk2_dev*_ce[qp]; // val = dirnew; // // } return true; }
bool HEVPFlowRatePowerLawJ2::computeDirection(unsigned int qp, RankTwoTensor & val) const { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); val.zero(); if (eqv_stress > 0.0) val = 1.5 / eqv_stress * _ce[qp] * pk2_dev * _ce[qp]; return true; }
bool HEVPFlowRatePowerLawJ2::computeDerivative(unsigned int qp, const std::string & coupled_var_name, Real & val) const { val = 0.0; if (_strength_prop_name == coupled_var_name) { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); val = -_ref_flow_rate * _flow_rate_exponent * std::pow(eqv_stress / _strength[qp], _flow_rate_exponent) / _strength[qp]; } return true; }
bool HEVPFlowRatePowerLawJ2::computeValue(unsigned int qp, Real & val) const { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); val = std::pow(eqv_stress / _strength[qp], _flow_rate_exponent) * _ref_flow_rate; if (val > _flow_rate_tol) { #ifdef DEBUG mooseWarning( "Flow rate greater than ", _flow_rate_tol, " ", val, " ", eqv_stress, " ", _strength[qp]); #endif return false; } return true; }
bool FlowRateModel::computeFlowDirection(RankTwoTensor & flow_dirn, const RankTwoTensor & pk2, const RankTwoTensor & ce, const std::vector<Real> & /*internal_var*/, const unsigned int /*start_index*/, const unsigned int /*size*/) const { RankTwoTensor pk2_dev = computePK2Deviatoric(pk2, ce); Real eqv_stress = computeEqvStress(pk2_dev, ce); flow_dirn.zero(); if (eqv_stress > 0.0) flow_dirn = 3.0/(2.0 * eqv_stress) * ce * pk2_dev * ce; return true; }
bool FlowRateModel::computeDflowrateDinternalvar(std::vector<Real> & dflowrate_dq, const RankTwoTensor & pk2, const RankTwoTensor & ce, const std::vector<Real> & internal_var, const unsigned int start_index, const unsigned int size) const { if (size != 1) mooseError("FlowRateModel Error: This user object is for J2 Plasticity and requires one internal variable"); RankTwoTensor pk2_dev = computePK2Deviatoric(pk2, ce); Real eqv_stress = computeEqvStress(pk2_dev, ce); Real sigy = _flow_stress_uo.value(internal_var[start_index]); Real dsigy_dint = _flow_stress_uo.derivative(internal_var[start_index]); Real dflowrate_dsigy = - _ref_flow_rate * _flow_rate_exponent * std::pow(eqv_stress/sigy,_flow_rate_exponent) * 1/sigy; dflowrate_dq[start_index] = dflowrate_dsigy * dsigy_dint; return true; }
bool FlowRateModel::computeDflowrateDstress(RankTwoTensor & dflowrate_dstress, const RankTwoTensor & pk2, const RankTwoTensor & ce, const std::vector<Real> & internal_var, const unsigned int start_index, const unsigned int /*size*/) const { RankTwoTensor pk2_dev = computePK2Deviatoric(pk2, ce); Real eqv_stress = computeEqvStress(pk2_dev, ce); Real sigy = _flow_stress_uo.value(internal_var[start_index]); Real dflowrate_dseqv = _ref_flow_rate * _flow_rate_exponent * std::pow(eqv_stress/sigy,_flow_rate_exponent-1) * 1/sigy; if (dflowrate_dseqv > _flow_rate_tol) { #ifdef DEBUG mooseWarning("dflowrate_dseqv greater than " << _flow_rate_tol << " " << dflowrate_dseqv << " " << eqv_stress << " " << sigy ); #endif return false; } RankTwoTensor tau = pk2_dev * ce; RankTwoTensor dseqv_dpk2dev; dseqv_dpk2dev.zero(); if (eqv_stress > 0) dseqv_dpk2dev = 3/(2 * eqv_stress) * tau * ce; RankTwoTensor ce_inv = ce.inverse(); RankFourTensor dpk2dev_dpk2; for (unsigned int i = 0; i < LIBMESH_DIM; ++i) for (unsigned int j = 0; j < LIBMESH_DIM; ++j) for (unsigned int k = 0; k < LIBMESH_DIM; ++k) for (unsigned int l = 0; l < LIBMESH_DIM; ++l) { dpk2dev_dpk2(i, j, k, l) = 0.0; if (i==k && j==l) dpk2dev_dpk2(i, j, k, l) = 1.0; dpk2dev_dpk2(i, j, k, l) -= ce_inv(i, j) * ce(k, l)/3.0; } dflowrate_dstress = dflowrate_dseqv * dpk2dev_dpk2.transposeMajor() * dseqv_dpk2dev; return true; }
void testnewExampleMaterial::computeQpProperties() { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[_qp], _ce[_qp]); RankTwoTensor s_dev = computeSdev(pk2_dev, _ce[_qp]); RankTwoTensor s_devia = _stensor[_qp].deviatoric(); Real s_hydro =1.0/3.0*_stensor[_qp].trace(); RankTwoTensor fp_dot=computefpdot(_fp[_qp],_fp_old[_qp]); RankTwoTensor lp=computeLp(fp_dot,_fp[_qp]); RankTwoTensor dpl=0.5*(lp+lp.transpose()); Real sdpl=s_dev.doubleContraction(dpl.transpose()); Real dpldb= dpl.doubleContraction(dpl.transpose()); Real eqv_ps= std::pow(1.5 * dpldb, 0.5); _sourcet[_qp] =sdpl; _diffusivity[_qp]=eqv_ps; _dpl[_qp] = dpl; _chihat[_qp]=_chihatst; // std::cout <<"haha"<<sdpl/25e6<<"\n"; }
bool stznewHEVPFlowRatePowerLawJ2::computeDerivative(unsigned int qp, const std::string & coupled_var_name, Real & val) const { val = 0.0; if (_strength_prop_name == coupled_var_name) { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); // Real s_xx = _tensor[qp](0,0); // Real s_yy = _tensor[qp](1,1); // Real tau_xy= _tensor[qp](0,1); // Real s_mean = 1.0/3.0*(s_xx+s_yy); // Real PI = 3.1415926; // Real tau_max = std::pow((s_xx-s_yy)/2*(s_xx-s_yy)/2+tau_xy*tau_xy,0.5); // Real eqv_stress = tau_max; Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); Real _pressure_eff=_grain_pressure-_biot*_pf[qp]; // Real _t_taunew = _agrain[qp]/std::sqrt(_grain_pressure/_rho); Real _t_taunew = _agrain[qp]/std::sqrt(_pressure_eff/_rho); // Real _t_taunew = _agrain[qp]/std::sqrt(_grain_pressure/_rho); // std::cout<<eqv_stress<<"\n"; // val = - _ref_flow_rate * _flow_rate_exponent * std::pow(eqv_stress/_strength[qp],_flow_rate_exponent)/_strength[qp]; //stz if (eqv_stress>=_strength[qp]) // val=1.0/_t_tau*std::exp(-1.0/_chiv[qp])*std::exp(eqv_stress/_grain_pressure/_chiv[qp])*(-1.0/eqv_stress); // val=1.0/_t_taunew*std::exp(-1.0/_chiv[qp])*std::exp(eqv_stress/_grain_pressure/_chiv[qp])*(-1.0/eqv_stress); //Original //val=1.0/_t_taunew*std::exp(-1.0/_chiv[qp])*std::exp(eqv_stress/_pressure_eff/_chiv[qp])*(-1.0/eqv_stress); // Modified val = 0.0; // val=1.0/_t_tau*std::exp(-1.0/_chi)*std::exp(eqv_stress/_grain_pressure/_chi)*(-1.0/eqv_stress); // // val=1/_t_tau*std::exp(-1/_chiv[qp])*std::exp(eqv_stress/_grain_pressure/_chiv[qp])*(-1/(eqv_stress+1))*(eqv_stress>_strength[qp]); // out put // std::cout <<"dirVal\t"<< val<<"\n"<<"*******************\n" ; } return true; }
bool stzRHEVPFlowRatePowerLawJ2::computeDerivative(unsigned int qp, const std::string & coupled_var_name, Real & val) const { val = 0.0; RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); if (_strength_prop_name == coupled_var_name) { if(eqv_stress>=1.0) { val=0.0; } } return true; }
bool stzRHEVPFlowRatePowerLawJ2::computeTensorDerivative(unsigned int qp, const std::string & coupled_var_name, RankTwoTensor & val) const { val.zero(); if (_pk2_prop_name == coupled_var_name) { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); Real dflowrate_dseqv; if (eqv_stress>_strength[qp]) // dflowrate_dseqv = 1/_t_tau*std::exp(-1/_chiv[qp])*std::exp(eqv_stress/_grain_pressure/_chiv[qp])* \ (1.0/(_grain_pressure*_chiv[qp])*(1.0-_strength[qp]/eqv_stress)+_strength[qp]/(eqv_stress*eqv_stress)); dflowrate_dseqv = _v*std::exp(-1/_chiv[qp])*(1.0-1.0/(eqv_stress*eqv_stress)); RankTwoTensor tau = pk2_dev * _ce[qp]; RankTwoTensor dseqv_dpk2dev; dseqv_dpk2dev.zero(); if (eqv_stress > _strength[qp]) dseqv_dpk2dev = 1.5/eqv_stress * tau * _ce[qp]; RankTwoTensor ce_inv = _ce[qp].inverse(); RankFourTensor dpk2dev_dpk2; for (unsigned int i = 0; i < LIBMESH_DIM; ++i) for (unsigned int j = 0; j < LIBMESH_DIM; ++j) for (unsigned int k = 0; k < LIBMESH_DIM; ++k) for (unsigned int l = 0; l < LIBMESH_DIM; ++l) { dpk2dev_dpk2(i, j, k, l) = 0.0; if (i==k && j==l) dpk2dev_dpk2(i, j, k, l) = 1.0; dpk2dev_dpk2(i, j, k, l) -= ce_inv(i, j) * _ce[qp](k, l)/3.0; } val = dflowrate_dseqv * dpk2dev_dpk2.transposeMajor() * dseqv_dpk2dev; } return true; }
bool HEVPFlowRatePowerLawJ2::computeTensorDerivative(unsigned int qp, const std::string & coupled_var_name, RankTwoTensor & val) const { val.zero(); if (_pk2_prop_name == coupled_var_name) { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); Real dflowrate_dseqv = _ref_flow_rate * _flow_rate_exponent * std::pow(eqv_stress / _strength[qp], _flow_rate_exponent - 1.0) / _strength[qp]; RankTwoTensor tau = pk2_dev * _ce[qp]; RankTwoTensor dseqv_dpk2dev; dseqv_dpk2dev.zero(); if (eqv_stress > 0.0) dseqv_dpk2dev = 1.5 / eqv_stress * tau * _ce[qp]; RankTwoTensor ce_inv = _ce[qp].inverse(); RankFourTensor dpk2dev_dpk2; for (unsigned int i = 0; i < LIBMESH_DIM; ++i) for (unsigned int j = 0; j < LIBMESH_DIM; ++j) for (unsigned int k = 0; k < LIBMESH_DIM; ++k) for (unsigned int l = 0; l < LIBMESH_DIM; ++l) { dpk2dev_dpk2(i, j, k, l) = 0.0; if (i == k && j == l) dpk2dev_dpk2(i, j, k, l) = 1.0; dpk2dev_dpk2(i, j, k, l) -= ce_inv(i, j) * _ce[qp](k, l) / 3.0; } val = dflowrate_dseqv * dpk2dev_dpk2.transposeMajor() * dseqv_dpk2dev; } return true; }
bool FlowRateModel::computeFlowRate(Real & flow_rate, const RankTwoTensor & pk2, const RankTwoTensor & ce, const std::vector<Real> & internal_var, const unsigned int start_index, const unsigned int size) const { if (size != 1) mooseError("FlowRateModel Error: This user object is for J2 Plasticity and requires one internal variable"); RankTwoTensor pk2_dev = computePK2Deviatoric(pk2, ce); Real eqv_stress = computeEqvStress(pk2_dev, ce); Real sigy = _flow_stress_uo.value(internal_var[start_index]); flow_rate = std::pow(eqv_stress/sigy, _flow_rate_exponent) * _ref_flow_rate; if (flow_rate > _flow_rate_tol) { #ifdef DEBUG mooseWarning("Flow rate greater than " << _flow_rate_tol << " " << flow_rate << " " << eqv_stress << " " << sigy ); #endif return false; } return true; }
bool stznewHEVPFlowRatePowerLawJ2::computeTensorDerivative(unsigned int qp, const std::string & coupled_var_name, RankTwoTensor & val) const { val.zero(); if (_pk2_prop_name == coupled_var_name) { RankTwoTensor pk2_dev = computePK2Deviatoric(_pk2[qp], _ce[qp]); // Real s_xx = _tensor[qp](0,0); // Real s_yy = _tensor[qp](1,1); // Real tau_xy= _tensor[qp](0,1); // Real s_mean = 1.0/3.0*(s_xx+s_yy); // Real PI = 3.1415926; // Real tau_max = std::pow((s_xx-s_yy)/2*(s_xx-s_yy)/2+tau_xy*tau_xy,0.5); // Real eqv_stress = tau_max ; Real eqv_stress = computeEqvStress(pk2_dev, _ce[qp]); Real _pressure_eff=_grain_pressure-_biot*_pf[qp]; // Real _t_taunew = _agrain[qp]/std::sqrt(_grain_pressure/_rho); Real _t_taunew = _agrain[qp]/std::sqrt(_pressure_eff/_rho); // Real dflowrate_dseqv = _ref_flow_rate * _flow_rate_exponent * std::pow(eqv_stress/_strength[qp],_flow_rate_exponent-1.0)/_strength[qp]; // stz // Real dflowrate_dseqv = 1/_t_tau*std::exp(-1/_chiv[qp])*std::exp(eqv_stress/_grain_pressure/_chiv[qp])* \ // (1/(_grain_pressure*_chiv[qp])*(1-_strength[qp]/eqv_stress)+_strength[qp]/(eqv_stress*eqv_stress))*(eqv_stress>_strength[qp]); // Real dflowrate_dseqv; if (eqv_stress>_strength[qp]) // dflowrate_dseqv = 1/_t_tau*std::exp(-1/_chiv[qp])*std::exp(eqv_stress/_grain_pressure/_chiv[qp])* \ (1.0/(_grain_pressure*_chiv[qp])*(1.0-_strength[qp]/eqv_stress)+_strength[qp]/(eqv_stress*eqv_stress)); // Original Stuff { dflowrate_dseqv = 1/_t_taunew*std::exp(-1/_chiv[qp])*std::exp(eqv_stress/_pressure_eff/_chiv[qp])* \ (1.0/(_pressure_eff*_chiv[qp])*(1.0-_strength[qp]/eqv_stress)+_strength[qp]/(eqv_stress*eqv_stress)); } // Modified // { //dflowrate_dseqv = 1.0/_t_taunew*std::exp(-1.0/_chiv[qp])*(-1.0*_strength[qp])/(eqv_stress*eqv_stress); // } // dflowrate_dseqv = 1/_t_tau*std::exp(-1/_chi)*std::exp(eqv_stress/_grain_pressure/_chi)* \ // (1.0/(_grain_pressure*_chi)*(1.0-_strength[qp]/eqv_stress)+_strength[qp]/(eqv_stress*eqv_stress)); RankTwoTensor tau = pk2_dev * _ce[qp]; RankTwoTensor dseqv_dpk2dev; dseqv_dpk2dev.zero(); if (eqv_stress > _strength[qp]) dseqv_dpk2dev = 1.5/eqv_stress * tau * _ce[qp]; RankTwoTensor ce_inv = _ce[qp].inverse(); RankFourTensor dpk2dev_dpk2; for (unsigned int i = 0; i < LIBMESH_DIM; ++i) for (unsigned int j = 0; j < LIBMESH_DIM; ++j) for (unsigned int k = 0; k < LIBMESH_DIM; ++k) for (unsigned int l = 0; l < LIBMESH_DIM; ++l) { dpk2dev_dpk2(i, j, k, l) = 0.0; if (i==k && j==l) dpk2dev_dpk2(i, j, k, l) = 1.0; dpk2dev_dpk2(i, j, k, l) -= ce_inv(i, j) * _ce[qp](k, l)/3.0; } val = dflowrate_dseqv * dpk2dev_dpk2.transposeMajor() * dseqv_dpk2dev; } return true; }