void PoissonsRatio<EvalT, Traits>:: evaluateFields(typename Traits::EvalData workset) { int numCells = workset.numCells; if (is_constant) { for (int cell=0; cell < numCells; ++cell) { for (int qp=0; qp < numQPs; ++qp) { poissonsRatio(cell,qp) = constant_value; } } } else { for (int cell=0; cell < numCells; ++cell) { for (int qp=0; qp < numQPs; ++qp) { Teuchos::Array<MeshScalarT> point(numDims); for (int i=0; i<numDims; i++) point[i] = Sacado::ScalarValue<MeshScalarT>::eval(coordVec(cell,qp,i)); poissonsRatio(cell,qp) = exp_rf_kl->evaluate(point, rv); } } } if (isThermoElastic) { for (int cell=0; cell < numCells; ++cell) { for (int qp=0; qp < numQPs; ++qp) { poissonsRatio(cell,qp) += dnudT_value * (Temperature(cell,qp) - refTemp);; } } } }
void PisdWdF<EvalT, Traits>:: evaluateFields(typename Traits::EvalData workset) { ScalarT kappa; ScalarT mu; // Leading dimension of 1 added so we can use Intrepid::det Intrepid::FieldContainer<EnergyFadType> F(1,numDims,numDims); // Allocate F ( = defgrad of derivative types) and seed with identity derivs for (std::size_t i=0; i < numDims; ++i) { for (std::size_t j=0; j < numDims; ++j) { F(0,i,j) = EnergyFadType(numDims*numDims, 0.0); // 0.0 will be overwriten below F(0,i,j).fastAccessDx(i*numDims + j) = 1.0; } } for (std::size_t cell=0; cell < workset.numCells; ++cell) { for (std::size_t qp=0; qp < numQPs; ++qp) { kappa = elasticModulus(cell,qp) / ( 3. * ( 1. - 2. * poissonsRatio(cell,qp) ) ); mu = elasticModulus(cell,qp) / ( 2. * ( 1. + poissonsRatio(cell,qp) ) ); // Fill F with defgrad for value. Derivs already seeded with identity. for (std::size_t i=0; i < numDims; ++i) for (std::size_t j=0; j < numDims; ++j) F(0,i,j).val() = defgrad(cell, qp, i, j); // Call energy funtional (can make a library of these) EnergyFadType W = computeEnergy(kappa, mu, F); // Extract stress from derivs of energy for (std::size_t i=0; i < numDims; ++i) for (std::size_t j=0; j < numDims; ++j) P(cell, qp, i, j) = W.fastAccessDx(i*numDims + j); } } }
void MultiScaleStressBase<EvalT, Traits>:: calcStress(typename Traits::EvalData workset) { ScalarT lambda, mu; // Calculate stresses switch(numDims) { case 1: Intrepid::FunctionSpaceTools::tensorMultiplyDataData<ScalarT>(stress, elasticModulus, strain); break; case 2: // Compute Stress (with the plane strain assumption for now) for(std::size_t cell = 0; cell < workset.numCells; ++cell) { for(std::size_t qp = 0; qp < numQPs; ++qp) { lambda = (elasticModulus(cell, qp) * poissonsRatio(cell, qp)) / ((1 + poissonsRatio(cell, qp)) * (1 - 2 * poissonsRatio(cell, qp))); mu = elasticModulus(cell, qp) / (2 * (1 + poissonsRatio(cell, qp))); stress(cell, qp, 0, 0) = 2.0 * mu * (strain(cell, qp, 0, 0)) + lambda * (strain(cell, qp, 0, 0) + strain(cell, qp, 1, 1)); stress(cell, qp, 1, 1) = 2.0 * mu * (strain(cell, qp, 1, 1)) + lambda * (strain(cell, qp, 0, 0) + strain(cell, qp, 1, 1)); stress(cell, qp, 0, 1) = 2.0 * mu * (strain(cell, qp, 0, 1)); stress(cell, qp, 1, 0) = stress(cell, qp, 0, 1); } } break; case 3: // Compute Stress for(std::size_t cell = 0; cell < workset.numCells; ++cell) { for(std::size_t qp = 0; qp < numQPs; ++qp) { lambda = (elasticModulus(cell, qp) * poissonsRatio(cell, qp)) / ((1 + poissonsRatio(cell, qp)) * (1 - 2 * poissonsRatio(cell, qp))); mu = elasticModulus(cell, qp) / (2 * (1 + poissonsRatio(cell, qp))); stress(cell, qp, 0, 0) = 2.0 * mu * (strain(cell, qp, 0, 0)) + lambda * (strain(cell, qp, 0, 0) + strain(cell, qp, 1, 1) + strain(cell, qp, 2, 2)); stress(cell, qp, 1, 1) = 2.0 * mu * (strain(cell, qp, 1, 1)) + lambda * (strain(cell, qp, 0, 0) + strain(cell, qp, 1, 1) + strain(cell, qp, 2, 2)); stress(cell, qp, 2, 2) = 2.0 * mu * (strain(cell, qp, 2, 2)) + lambda * (strain(cell, qp, 0, 0) + strain(cell, qp, 1, 1) + strain(cell, qp, 2, 2)); stress(cell, qp, 0, 1) = 2.0 * mu * (strain(cell, qp, 0, 1)); stress(cell, qp, 1, 2) = 2.0 * mu * (strain(cell, qp, 1, 2)); stress(cell, qp, 2, 0) = 2.0 * mu * (strain(cell, qp, 2, 0)); stress(cell, qp, 1, 0) = stress(cell, qp, 0, 1); stress(cell, qp, 2, 1) = stress(cell, qp, 1, 2); stress(cell, qp, 0, 2) = stress(cell, qp, 2, 0); } } break; } return; }