Real CHPrecipMatrixElasticity::computeQpOffDiagJacobian(unsigned int jvar) { for (unsigned int i=0; i<_n_OP_vars; i++) { if (jvar == _n_var[i]) { RankTwoTensor a = _elasticity_tensor[_qp]*_elastic_strain[_qp]; RankTwoTensor b = _elasticity_tensor[_qp]*(_dn_misfit_strain[_qp])[i]*(-1); RankTwoTensor c = (_dn_elasticity_tensor[_qp])[i]*_elastic_strain[_qp]; Real Jaa = a.doubleContraction( ( (_dcdn_misfit_strain[_qp])[i])*(-1) ); Real Jab = b.doubleContraction( (_dc_misfit_strain[_qp])*(-1) ); Real Jac = c.doubleContraction( (_dc_misfit_strain[_qp])*(-1) ); return _scaling_factor*_phi[_j][_qp]*_test[_i][_qp]*(Jaa + Jab + Jac); } } if (jvar == _w_var) return -_phi[_j][_qp] * _test[_i][_qp]; else if (jvar == _T_var) return 0; else mooseError("Screwed up CHCoupledCalphadSplit::computeQpOffDiagJacobian()"); }
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]); }
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); }
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; }
Real CHPrecipMatrixElasticity::computeDFDC(PFFunctionType type) { RankTwoTensor a = _elasticity_tensor[_qp]*(_elastic_strain[_qp]); RankTwoTensor b = _elasticity_tensor[_qp]*_dc_misfit_strain[_qp]*(-1); //in this case, dc_elasticity_tensor = 0 Real first = a.doubleContraction( (_dc_misfit_strain[_qp])*(-1) ); Real second = b.doubleContraction( _elastic_strain[_qp] ); switch(type) { case Residual: return _scaling_factor*0.5*(first + second); case Jacobian: return _scaling_factor*_phi[_j][_qp]*b.doubleContraction( (_dc_misfit_strain[_qp])*(-1) ); //return 0; } mooseError("invalid type passed in"); }
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]); }
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; }
Real AuxCalphadEnergy::computeDifferential() { //Joules/meter^3 Real dfchem_dOP = ( (_G_delta[_qp] - _G_alpha[_qp])*_dH_dOP + _W[_qp]*_dg_dOP ) / _Omega[_qp]; Real dfchem_dX = ( (1-_H)*_dG_alpha[_qp] + _H*_dG_delta[_qp] ) / _Omega[_qp]; RankTwoTensor a = _Cijkl_MP[_qp]*_elastic_strain[_qp]; RankTwoTensor b = _Cijkl_MP[_qp]*(_dc_misfit_strain[_qp])*(-1); Real e1 = a.doubleContraction( (_dc_misfit_strain[_qp])*(-1) ); Real e2 = b.doubleContraction( _elastic_strain[_qp] ); Real e3 = 0; Real dfel_dX = 0.5*(e1 + e2 + e3); // _console<<"dfel_dX = "<<dfel_dX<<std::endl; RankFourTensor dCijkl = (_Cijkl_precipitate_MP[_qp] - _Cijkl_MP[_qp])*(-1*_dH_dOP); b = _Cijkl_MP[_qp]*( (_dn_misfit_strain[_qp])[_OP_number-1]) *(-1); RankTwoTensor c = dCijkl*_elastic_strain[_qp]; e1 = a.doubleContraction( ( (_dn_misfit_strain[_qp])[_OP_number-1] )*(-1) ); e2 = b.doubleContraction( _elastic_strain[_qp]); e3 = c.doubleContraction( _elastic_strain[_qp]); Real dfel_dOP = 0.5*(e1 + e2 + e3); // _console<<"dfel_dOP = "<<dfel_dOP<<std::endl; Real dfdc = (dfchem_dX + dfel_dX)*(_precip_cons - _X[_qp]); Real dfdOP = (dfchem_dOP + dfel_dOP)*(_precip_noncons - (*_OP[_OP_number-1])[_qp]); return dfdc + dfdOP; }
Real AuxChemElastic::computeDselfDnoncons() { RankTwoTensor eigenstrain; RankTwoTensor d_eigenstrain; RankTwoTensor c; RankFourTensor elasticity; eigenstrain = (_eigenstrains_rotated_MP[_qp])[_noncons_var_num-1]; d_eigenstrain =( _d_eigenstrains_rotated_MP[_qp])[_noncons_var_num-1]; elasticity = _elasticity_tensor[_qp]; c = elasticity*eigenstrain; return 2.0*c.doubleContraction(d_eigenstrain); }
Real AuxCalphadEnergy::computePrecipEnergy() { //this needs to be computed FOR the precipitate if it were this point... //joules/meter^3 Real chemical_energy = _G_delta_precip[_qp] / _Omega[_qp]; RankTwoTensor elastic_precip_strain = _local_strain[_qp] - (_precipitate_eigenstrain[_qp])[_OP_number-1]; RankTwoTensor a = _Cijkl_precipitate_MP[_qp]*elastic_precip_strain; Real elastic_energy = 0.5*a.doubleContraction( elastic_precip_strain); //_console<<"precip elastic energy = "<<elastic_energy<<std::endl; //_console<<"precip chemical energy = "<<chemical_energy<<std::endl; return chemical_energy + elastic_energy; }
Real AuxChemElastic::computeInteractionElasticEnergy(bool matrix) { RankTwoTensor eigenstrain; RankTwoTensor c; RankFourTensor elasticity; if(matrix) { eigenstrain = (_eigenstrains_rotated_MP[_qp])[_noncons_var_num-1]; elasticity = _elasticity_tensor[_qp]; } else { eigenstrain = (_precipitate_eigenstrain_rotated[_qp])[_noncons_var_num-1]; elasticity = _precipitate_elasticity[_qp]; } c = elasticity*eigenstrain; return c.doubleContraction(_local_strain[_qp]); }
RankTwoTensor HEVPFlowRatePowerLawJ2::computePK2Deviatoric(const RankTwoTensor & pk2, const RankTwoTensor & ce) const { return pk2 - (pk2.doubleContraction(ce) * ce.inverse()) / 3.0; }
RankTwoTensor testnewExampleMaterial::computePK2Deviatoric(const RankTwoTensor & pk2, const RankTwoTensor & ce) const { return pk2 - (pk2.doubleContraction(ce) * ce.inverse())/3.0; }