void BulkModulus<EvalT, Traits>:: evaluateFields(typename Traits::EvalData workset) { if (is_constant) { for (unsigned int cell=0; cell < workset.numCells; ++cell) { for (unsigned int qp=0; qp < numQPs; ++qp) { bulkModulus(cell,qp) = constant_value; } } } else { for (unsigned int cell=0; cell < workset.numCells; ++cell) { for (unsigned int qp=0; qp < numQPs; ++qp) { Teuchos::Array<MeshScalarT> point(numDims); for (unsigned int i=0; i<numDims; i++) point[i] = Sacado::ScalarValue<MeshScalarT>::eval(coordVec(cell,qp,i)); bulkModulus(cell,qp) = exp_rf_kl->evaluate(point, rv); } } } if (isThermoElastic) { for (int cell=0; cell < workset.numCells; ++cell) { for (int qp=0; qp < numQPs; ++qp) { bulkModulus(cell,qp) -= dKdT_value * (Temperature(cell,qp) - refTemp); } } } }
void DamageSource<EvalT, Traits>:: evaluateFields(typename Traits::EvalData workset) { bool print = false; //if (typeid(ScalarT) == typeid(RealType)) print = true; // Albany::StateVariables oldState = *workset.oldState; // Intrepid2::FieldContainer_Kokkos<RealType, PHX::Layout, PHX::Device>& source_old_FC = *oldState[sourceName]; // Intrepid2::FieldContainer_Kokkos<RealType, PHX::Layout, PHX::Device>& damage_old_FC = *oldState[damageName]; Albany::MDArray source_old_FC = (*workset.stateArrayPtr)[sourceName]; Albany::MDArray damage_old_FC = (*workset.stateArrayPtr)[damageName]; ScalarT p, triax, source_new, term; RealType damage_old, source_old; for (int cell=0; cell < workset.numCells; ++cell) { for (int qp=0; qp < numQPs; ++qp) { source_old = source_old_FC(cell,qp); damage_old = damage_old_FC(cell,qp); ScalarT fac = 1.0 / ( 1.0 - damage(cell,qp) ); p = 0.5 * bulkModulus(cell,qp) * (J(cell,qp) - (1.0/J(cell,qp))); triax = 0.0; if (seff(cell,qp) > 0.0) triax = p/seff(cell,qp); //source(cell,qp) = p * Je + expz * triax * dp(cell,qp); source_new = - (damage(cell,qp) * gc) / damageLS(cell,qp) + 2.0 * (1.0 - damage(cell,qp)) * energy(cell,qp) + fac * triax * dp(cell,qp); term = 1.0*(std::abs(damage(cell,qp)-damage_old) - (damage(cell,qp)-damage_old) ); source_new += term; if (print) { std::cout << "!*********!" << std::endl; std::cout << "damage : " << damage(cell,qp) << std::endl; std::cout << "damage_old: " << damage_old << std::endl; std::cout << "energy : " << energy(cell,qp) << std::endl; std::cout << "J : " << J(cell,qp) << std::endl; std::cout << "seff : " << seff(cell,qp) << std::endl; std::cout << "p : " << p << std::endl; std::cout << "triax : " << triax << std::endl; std::cout << "dp : " << dp(cell,qp) << std::endl; std::cout << "term : " << term << std::endl; std::cout << "source_old: " << source_old << std::endl; std::cout << "source_new: " << source_new << std::endl; } //source(cell,qp) = std::max(source_old, source_new); source(cell,qp) = source_new; } } }