Real stzRHEVPFlowRatePowerLawJ2::computeEqvStress(const RankTwoTensor & pk2_dev, const RankTwoTensor & ce) const { RankTwoTensor sdev = pk2_dev * ce; Real val = sdev.doubleContraction(sdev.transpose()); return std::pow(1.0 * val, 0.5); }
Real AuxElasticEnergy::computeValue() { RankTwoTensor stress = _elasticity_tensor[_qp]*_elastic_strain[_qp]; return 0.5*stress.doubleContraction(_elastic_strain[_qp]); }
RankFourTensor TensorMechanicsPlasticMeanCapTC::consistentTangentOperator(const RankTwoTensor & trial_stress, Real intnl_old, const RankTwoTensor & stress, Real intnl, const RankFourTensor & E_ijkl, const std::vector<Real> & cumulative_pm) const { if (!_use_custom_cto) return TensorMechanicsPlasticModel::consistentTangentOperator(trial_stress, intnl_old, stress, intnl, E_ijkl, cumulative_pm); Real df_dq; Real alpha; if (trial_stress.trace() >= tensile_strength(intnl_old)) { df_dq = -dtensile_strength(intnl); alpha = 1.0; } else { df_dq = dcompressive_strength(intnl); alpha = -1.0; } RankTwoTensor elas; for (unsigned int i = 0; i < 3; ++i) for (unsigned int j = 0; j < 3; ++j) for (unsigned int k = 0; k < 3; ++k) elas(i, j) += E_ijkl(i, j, k, k); const Real hw = -df_dq + alpha * elas.trace(); return E_ijkl - alpha / hw * elas.outerProduct(elas); }
Real FlowRateModel::computeEqvStress(const RankTwoTensor & pk2_dev, const RankTwoTensor & ce) const { RankTwoTensor sdev = pk2_dev * ce; Real val = sdev.doubleContraction(sdev.transpose()); return std::pow(3.0 * val/2.0, 0.5); }
void ComputeRSphericalIncrementalStrain::computeTotalStrainIncrement(RankTwoTensor & total_strain_increment) { // Deformation gradient calculation in cylinderical coordinates RankTwoTensor A; // Deformation gradient RankTwoTensor Fbar; // Old Deformation gradient // Step through calculating the current and old deformation gradients // Only diagonal components are nonzero because this is a 1D material // Note: x_disp is the radial displacement A(0,0) = (*_grad_disp[0])[_qp](0); Fbar(0,0) = (*_grad_disp_old[0])[_qp](0); // The polar and azimuthal strains are functions of radial displacement if (!MooseUtils::relativeFuzzyEqual(_q_point[_qp](0), 0.0)) { A(1,1) = (*_disp[0])[_qp] / _q_point[_qp](0); Fbar(1,1) = _disp_old_0[_qp] / _q_point[_qp](0); } // The polar and azimuthal strains are equalivalent in this 1D problem A(2,2) = A(1,1); Fbar(2,2) = Fbar(1,1); // Gauss point deformation gradient _deformation_gradient[_qp] = A; _deformation_gradient[_qp].addIa(1.0); // very nearly A = gradU - gradUold, adapted to cylinderical coords A -= Fbar; total_strain_increment = 0.5 * (A + A.transpose()); }
Real PorousFlowDispersiveFlux::computeQpResidual() { RealVectorValue flux = 0.0; RealVectorValue velocity; Real velocity_abs; RankTwoTensor v2; RankTwoTensor dispersion; dispersion.zero(); Real diffusion; for (unsigned int ph = 0; ph < _num_phases; ++ph) { // Diffusive component diffusion = _porosity_qp[_qp] * _tortuosity[_qp][ph] * _diffusion_coeff[_qp][ph][_fluid_component]; // Calculate Darcy velocity velocity = (_permeability[_qp] * (_grad_p[_qp][ph] - _fluid_density_qp[_qp][ph] * _gravity) * _relative_permeability[_qp][ph] / _fluid_viscosity[_qp][ph]); velocity_abs = std::sqrt(velocity * velocity); if (velocity_abs > 0.0) { v2.vectorOuterProduct(velocity, velocity); // Add longitudinal dispersion to diffusive component diffusion += _disp_trans[ph] * velocity_abs; dispersion = (_disp_long[ph] - _disp_trans[ph]) * v2 / velocity_abs; } flux += _fluid_density_qp[_qp][ph] * (diffusion * _identity_tensor + dispersion) * _grad_mass_frac[_qp][ph][_fluid_component]; } return _grad_test[_i][_qp] * flux; }
void ComputeSmearedCrackingStress::updateStressTensorForCracking(RankTwoTensor & tensor, const RealVectorValue & sigma) { // Get transformation matrix const RankTwoTensor & R = _crack_rotation[_qp]; // Rotate to crack frame tensor.rotate(R.transpose()); // Reset stress if cracked for (unsigned int i = 0; i < 3; ++i) if (_crack_damage[_qp](i) > 0.0) { const Real stress_correction_ratio = (tensor(i, i) - sigma(i)) / tensor(i, i); if (stress_correction_ratio > _max_stress_correction) tensor(i, i) *= (1.0 - _max_stress_correction); else if (stress_correction_ratio < -_max_stress_correction) tensor(i, i) *= (1.0 + _max_stress_correction); else tensor(i, i) = sigma(i); } // Rotate back to global frame tensor.rotate(R); }
Real RankTwoScalarAux::computeValue() { Real val; RankTwoTensor s; switch (_scalar_type) { case 0: s = _tensor[_qp].deviatoric();//Calculates deviatoric tensor val = std::pow(3.0/2.0 * s.doubleContraction(s), 0.5);//Calculates sqrt(3/2*s:s) break; case 1: ///For plastic strain tensor (ep), tr(ep) = 0 is considered val = std::pow(2.0/3.0 * _tensor[_qp].doubleContraction(_tensor[_qp]), 0.5);//Calculates sqrt(2/3*ep:ep) break; case 2: val = _tensor[_qp].trace()/3.0; break; case 3: val = _tensor[_qp].L2norm(); break; case 4: case 5: case 6: val = calcEigenValues(); break; default: mooseError("RankTwoScalarAux Error: Pass valid scalar type - VonMisesStress, EquivalentPlasticStrain, Hydrostatic, L2norm MaxPrincipal MidPrincipal MinPrincipal"); } return val; }
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; }
void FiniteStrainHyperElasticViscoPlastic::computeElasticStrain() { RankTwoTensor iden; iden.addIa(1.0); _ee = 0.5 * (_ce[_qp]-iden); }
RankTwoTensor FiniteStrainPlasticMaterial::dyieldFunction_dstress(const RankTwoTensor & sig) { RankTwoTensor deriv = sig.dsecondInvariant(); deriv *= std::sqrt(3.0 / sig.secondInvariant()) / 2.0; return deriv; }
void InteractionIntegral::computeTFields(RankTwoTensor & aux_stress, RankTwoTensor & grad_disp) { Real t = _theta; Real st = std::sin(t); Real ct = std::cos(t); Real stsq = Utility::pow<2>(st); Real ctsq = Utility::pow<2>(ct); Real ctcu = Utility::pow<3>(ct); Real oneOverPiR = 1.0 / (libMesh::pi * _r); aux_stress.zero(); aux_stress(0, 0) = -oneOverPiR * ctcu; aux_stress(0, 1) = -oneOverPiR * st * ctsq; aux_stress(1, 0) = -oneOverPiR * st * ctsq; aux_stress(1, 1) = -oneOverPiR * ct * stsq; aux_stress(2, 2) = -oneOverPiR * _poissons_ratio * (ctcu + ct * stsq); grad_disp.zero(); grad_disp(0, 0) = oneOverPiR / (4.0 * _youngs_modulus) * (ct * (4.0 * Utility::pow<2>(_poissons_ratio) - 3.0 + _poissons_ratio) - std::cos(3.0 * t) * (1.0 + _poissons_ratio)); grad_disp(0, 1) = -oneOverPiR / (4.0 * _youngs_modulus) * (st * (4.0 * Utility::pow<2>(_poissons_ratio) - 3.0 + _poissons_ratio) + std::sin(3.0 * t) * (1.0 + _poissons_ratio)); }
void RankTwoTensorTest::ddetTest() { // this derivative is less trivial than dtrace and dsecondInvariant, // so let's check with a finite-difference approximation Real ep = 1E-5; // small finite-difference parameter Real det; // determinant provided by RankTwoTensor RankTwoTensor deriv; // derivative of det provided by RankTwoTensor RankTwoTensor mep; // the RankTwoTensor with successive entries shifted by ep det = _m3.det(); deriv = _m3.ddet(); mep = _m3; for (unsigned i = 0 ; i < 3 ; ++i) for (unsigned j = 0 ; j < 3 ; ++j) { mep(i, j) += ep; CPPUNIT_ASSERT_DOUBLES_EQUAL((mep.det() - det)/ep, deriv(i, j), ep); mep(i, j) -= ep; } det = _unsymmetric1.det(); deriv = _unsymmetric1.ddet(); mep = _unsymmetric1; for (unsigned i = 0 ; i < 3 ; ++i) for (unsigned j = 0 ; j < 3 ; ++j) { mep(i, j) += ep; CPPUNIT_ASSERT_DOUBLES_EQUAL((mep.det() - det)/ep, deriv(i, j), ep); mep(i, j) -= ep; } }
Real TensorMechanicsPlasticDruckerPrager::yieldFunction(const RankTwoTensor & stress, Real intnl) const { Real aaa; Real bbb; bothAB(intnl, aaa, bbb); return std::sqrt(stress.secondInvariant()) + stress.trace() * bbb - aaa; }
RankTwoTensor TensorMechanicsPlasticJ2::dyieldFunction_dstress(const RankTwoTensor & stress, Real /*intnl*/) const { Real sII = stress.secondInvariant(); if (sII == 0.0) return RankTwoTensor(); else return 0.5 * std::sqrt(3.0 / sII) * stress.dsecondInvariant(); }
RankFourTensor TensorMechanicsPlasticDruckerPrager::dflowPotential_dstress(const RankTwoTensor & stress, Real /*intnl*/) const { RankFourTensor dr_dstress; dr_dstress = 0.5 * stress.d2secondInvariant() / std::sqrt(stress.secondInvariant()); dr_dstress += -0.5 * 0.5 * stress.dsecondInvariant().outerProduct(stress.dsecondInvariant()) / std::pow(stress.secondInvariant(), 1.5); return dr_dstress; }
Real TensorMechanicsPlasticOrthotropic::yieldFunction(const RankTwoTensor & stress, Real intnl) const { const RankTwoTensor j2prime = _l1 * stress; const RankTwoTensor j3prime = _l2 * stress; return _b * stress.trace() + std::pow(std::pow(-j2prime.generalSecondInvariant(), 3.0 / 2.0) - j3prime.det(), 1.0 / 3.0) - yieldStrength(intnl); }
void RankTwoTensorTest::d2sin3LodeTest() { // Here i do a finite-difference calculation of the third // derivative and compare with the closed-solution form Real ep = 1E-5; // small finite-difference parameter RankTwoTensor d1; // first derivative of sin3Lode - from RankTwoTensor - do a finite-difference of this RankFourTensor d2; // third derivative of third Invariant - from RankTwoTensor RankTwoTensor mep; // matrix with shifted entries RankTwoTensor d1ep; // first derivative of sin3Lode of mep mep = _m3; d1 = _m3.dsin3Lode(); d2 = _m3.d2sin3Lode(); for (unsigned i = 0; i < 3; i++) for (unsigned j = 0; j < 3; j++) { for (unsigned int k = 0; k < 3; k++) for (unsigned int l = 0; l < 3; l++) { mep(k, l) += ep; d1ep = mep.dsin3Lode(); CPPUNIT_ASSERT_DOUBLES_EQUAL((d1ep(i, j) - d1(i, j))/ep, d2(i, j, k, l), ep); mep(k, l) -= ep; } } mep = _unsymmetric1; d1 = _unsymmetric1.dsin3Lode(); d2 = _unsymmetric1.d2sin3Lode(); for (unsigned i = 0; i < 3; i++) for (unsigned j = 0; j < 3; j++) { for (unsigned int k = 0; k < 3; k++) for (unsigned int l = 0; l < 3; l++) { mep(k, l) += ep; d1ep = mep.dsin3Lode(); CPPUNIT_ASSERT_DOUBLES_EQUAL((d1ep(i, j) - d1(i, j))/ep, d2(i, j, k, l), ep); mep(k, l) -= ep; // note that because d1 and d2 explicitly symmeterise the matrix // the derivative may or may not explicitly symmeterise mep(k, l) += 0.5*ep; mep(l, k) += 0.5*ep; d1ep = mep.dsin3Lode(); CPPUNIT_ASSERT_DOUBLES_EQUAL((d1ep(i, j) - d1(i, j))/ep, d2(i, j, k, l), ep); mep(k, l) -= 0.5*ep; mep(l, k) -= 0.5*ep; } } }
RankFourTensor TensorMechanicsPlasticTensile::dflowPotential_dstress(const RankTwoTensor & stress, const Real & intnl) const { Real mean_stress = stress.trace()/3.0; RankTwoTensor dmean_stress = stress.dtrace()/3.0; Real sin3Lode = stress.sin3Lode(_lode_cutoff, 0); if (sin3Lode <= _sin3tt) { // the non-edge-smoothed version std::vector<Real> eigvals; std::vector<RankTwoTensor> deigvals; std::vector<RankFourTensor> d2eigvals; stress.dsymmetricEigenvalues(eigvals, deigvals); stress.d2symmetricEigenvalues(d2eigvals); Real denom = std::sqrt(_small_smoother2 + std::pow(eigvals[2] - mean_stress, 2)); RankFourTensor dr_dstress = (eigvals[2] - mean_stress)*d2eigvals[2]/denom; for (unsigned i = 0 ; i < 3 ; ++i) for (unsigned j = 0 ; j < 3 ; ++j) for (unsigned k = 0 ; k < 3 ; ++k) for (unsigned l = 0 ; l < 3 ; ++l) dr_dstress(i, j, k, l) += (1 - std::pow((eigvals[2] - mean_stress)/denom, 2))*(deigvals[2](i, j) - dmean_stress(i, j))*(deigvals[2](k, l) - dmean_stress(k, l))/denom; return dr_dstress; } else { // the edge-smoothed version RankTwoTensor dsin3Lode = stress.dsin3Lode(_lode_cutoff); Real kk = _aaa + _bbb*sin3Lode + _ccc*std::pow(sin3Lode, 2); RankTwoTensor dkk = (_bbb + 2*_ccc*sin3Lode)*dsin3Lode; RankFourTensor d2kk = (_bbb + 2*_ccc*sin3Lode)*stress.d2sin3Lode(_lode_cutoff); for (unsigned i = 0 ; i < 3 ; ++i) for (unsigned j = 0 ; j < 3 ; ++j) for (unsigned k = 0 ; k < 3 ; ++k) for (unsigned l = 0 ; l < 3 ; ++l) d2kk(i, j, k, l) += 2*_ccc*dsin3Lode(i, j)*dsin3Lode(k, l); Real sibar2 = stress.secondInvariant(); RankTwoTensor dsibar2 = stress.dsecondInvariant(); RankFourTensor d2sibar2 = stress.d2secondInvariant(); Real denom = std::sqrt(_small_smoother2 + sibar2*std::pow(kk, 2)); RankFourTensor dr_dstress = (0.5*d2sibar2*std::pow(kk, 2) + sibar2*kk*d2kk)/denom; for (unsigned i = 0 ; i < 3 ; ++i) for (unsigned j = 0 ; j < 3 ; ++j) for (unsigned k = 0 ; k < 3 ; ++k) for (unsigned l = 0 ; l < 3 ; ++l) { dr_dstress(i, j, k, l) += (dsibar2(i, j)*dkk(k, l)*kk + dkk(i, j)*dsibar2(k, l)*kk + sibar2*dkk(i, j)*dkk(k, l))/denom; dr_dstress(i, j, k, l) -= (0.5*dsibar2(i, j)*std::pow(kk, 2) + sibar2*kk*dkk(i, j))*(0.5*dsibar2(k, l)*std::pow(kk, 2) + sibar2*kk*dkk(k, l))/std::pow(denom, 3); } return dr_dstress; } }
/** * Get unitary flow tensor in deviatoric direction, modified Cam-Clay */ void RedbackMechMaterialCC::getFlowTensor(const RankTwoTensor & sig, Real q, Real p, Real pc, RankTwoTensor & flow_tensor) { if (pc > 0) pc *= -1; flow_tensor = 3.0 * sig.deviatoric() / (_slope_yield_surface * _slope_yield_surface); flow_tensor.addIa((2.0 * p - pc) / 3.0); //(p > 0 ? 1:-1) // TODO: do we need to normalise? If so, do we need the sqrt(3/2) factor? // flow_tensor /= std::pow(2.0/3.0,0.5)*flow_tensor.L2norm(); }
RankTwoTensor TensorMechanicsPlasticOrthotropic::dyieldFunction_dstress(const RankTwoTensor & stress, Real /*intnl*/) const { const RankTwoTensor j2prime = _l1 * stress; const RankTwoTensor j3prime = _l2 * stress; const Real j2 = -j2prime.generalSecondInvariant(); const Real j3 = j3prime.det(); return _b * dI_sigma() + dphi_dj2(j2, j3) * _l1.innerProductTranspose(dj2_dSkl(j2prime)) + dphi_dj3(j2, j3) * _l2.innerProductTranspose(j3prime.ddet()); }
RankTwoTensor TensorMechanicsPlasticOrthotropic::flowPotential(const RankTwoTensor & stress, Real intnl) const { if (_associative) { const RankTwoTensor a = dyieldFunction_dstress(stress, intnl); return a / a.L2norm(); } else return TensorMechanicsPlasticJ2::dyieldFunction_dstress(stress, intnl); }
RankTwoTensor TensorMechanicsPlasticMeanCapTC::df_dsig(const RankTwoTensor & stress, Real intnl) const { const Real tr = stress.trace(); const Real t_str = tensile_strength(intnl); if (tr >= t_str) return stress.dtrace(); const Real c_str = compressive_strength(intnl); if (tr <= c_str) return -stress.dtrace(); return - std::cos(M_PI * (tr - c_str) / (t_str - c_str)) * stress.dtrace(); }
RankFourTensor TensorMechanicsPlasticMeanCapTC::dflowPotential_dstress(const RankTwoTensor & stress, Real intnl) const { const Real tr = stress.trace(); const Real t_str = tensile_strength(intnl); if (tr >= t_str) return RankFourTensor(); const Real c_str = compressive_strength(intnl); if (tr <= c_str) return RankFourTensor(); return M_PI / (t_str - c_str) * std::sin(M_PI * (tr - c_str) / (t_str - c_str)) * stress.dtrace().outerProduct(stress.dtrace()); }
Real AuxCalphadEnergy::computeMatrixEnergy() { //Joules/meter^3 Real chemical_energy = ( (1 - _H)*_G_alpha[_qp] + _H*_G_delta[_qp] + _W[_qp]*_g) / _Omega[_qp]; RankTwoTensor a = _elasticity_tensor[_qp]*(_elastic_strain[_qp]); Real elastic_energy = 0.5*a.doubleContraction( _elastic_strain[_qp]); //_console<<"matrix elastic energy = "<<elastic_energy<<std::endl; //_console<<"matrix chemical energy = "<<chemical_energy<<std::endl; return chemical_energy + elastic_energy; }
RankTwoTensor TensorMechanicsPlasticMeanCapTC::dflowPotential_dintnl(const RankTwoTensor & stress, Real intnl) const { const Real tr = stress.trace(); const Real t_str = tensile_strength(intnl); if (tr >= t_str) return RankTwoTensor(); const Real c_str = compressive_strength(intnl); if (tr <= c_str) return RankTwoTensor(); const Real dt = dtensile_strength(intnl); const Real dc = dcompressive_strength(intnl); return std::sin(M_PI * (tr - c_str) / (t_str - c_str)) * stress.dtrace() * M_PI / std::pow(t_str - c_str, 2) * ((tr - t_str) * dc - (tr - c_str) * dt); }
Real AuxChemElastic::computeDintDnoncons() { RankTwoTensor d_eigenstrain; RankTwoTensor c; RankFourTensor elasticity; d_eigenstrain = (_precipitate_eigenstrain_rotated[_qp])[_noncons_var_num-1]; elasticity = _precipitate_elasticity[_qp]; c = elasticity*d_eigenstrain; return -2.0*c.doubleContraction(_local_strain[_qp]); }
void FiniteStrainHyperElasticViscoPlastic::computeElasticPlasticDeformGrad() { RankTwoTensor iden; iden.addIa(1.0); RankTwoTensor val; for (unsigned int i = 0; i < _num_flow_rate_uos; ++i) val += _flow_rate(i) * _flow_dirn[i] * _dt_substep; _fp_tmp_inv = _fp_tmp_old_inv * (iden - val); _fp_tmp_inv = std::pow(_fp_tmp_inv.det(), -1.0/3.0) * _fp_tmp_inv; _fe = _dfgrd_tmp * _fp_tmp_inv; }
Real RankTwoTensor::thirdInvariant() const { RankTwoTensor s = 0.5 * deviatoric(); s += s.transpose(); Real result = 0.0; result = s(0, 0) * (s(1, 1) * s(2, 2) - s(2, 1) * s(1, 2)); result -= s(1, 0) * (s(0, 1) * s(2, 2) - s(2, 1) * s(0, 2)); result += s(2, 0) * (s(0, 1) * s(1, 2) - s(1, 1) * s(0, 2)); return result; }
/** * Get flow tensor in deviatoric direction, modified Cam-Clay */ void RedbackMechMaterialCC::getFlowTensor(const RankTwoTensor & sig, Real /*q*/, Real p, Real /*q_y*/, Real /*p_y*/, Real yield_stress, RankTwoTensor & flow_tensor) { Real pc = -yield_stress; flow_tensor = 3.0 * sig.deviatoric() / (_slope_yield_surface * _slope_yield_surface); flow_tensor.addIa((2.0 * p - pc - 2*_shift_ellipse) / 3.0); }