00001
00002
00003
00004
00005
00006
00007 #include "Teuchos_TestForException.hpp"
00008 #include "Phalanx_DataLayout.hpp"
00009
00010 #include "Intrepid_FunctionSpaceTools.hpp"
00011 #include "Intrepid_RealSpaceTools.hpp"
00012
00013
00014 namespace LCM {
00015
00016
00017 template<typename EvalT, typename Traits>
00018 TLPoroStress<EvalT, Traits>::
00019 TLPoroStress(const Teuchos::ParameterList& p) :
00020 stress (p.get<std::string> ("Stress Name"),
00021 p.get<Teuchos::RCP<PHX::DataLayout> >("QP Tensor Data Layout") ),
00022 defGrad (p.get<std::string> ("DefGrad Name"),
00023 p.get<Teuchos::RCP<PHX::DataLayout> >("QP Tensor Data Layout") ),
00024 J (p.get<std::string> ("DetDefGrad Name"),
00025 p.get<Teuchos::RCP<PHX::DataLayout> >("QP Scalar Data Layout") ),
00026 biotCoefficient (p.get<std::string> ("Biot Coefficient Name"),
00027 p.get<Teuchos::RCP<PHX::DataLayout> >("QP Scalar Data Layout") ),
00028 porePressure (p.get<std::string> ("QP Variable Name"),
00029 p.get<Teuchos::RCP<PHX::DataLayout> >("QP Scalar Data Layout") ),
00030 totstress (p.get<std::string> ("Total Stress Name"),
00031 p.get<Teuchos::RCP<PHX::DataLayout> >("QP Tensor Data Layout") )
00032 {
00033
00034 Teuchos::RCP<PHX::DataLayout> tensor_dl =
00035 p.get< Teuchos::RCP<PHX::DataLayout> >("QP Tensor Data Layout");
00036 std::vector<PHX::DataLayout::size_type> dims;
00037 tensor_dl->dimensions(dims);
00038 numQPs = dims[1];
00039 numDims = dims[2];
00040
00041
00042 int worksetSize = dims[0];
00043 F_inv.resize(worksetSize, numQPs, numDims, numDims);
00044 F_invT.resize(worksetSize, numQPs, numDims, numDims);
00045 JF_invT.resize(worksetSize, numQPs, numDims, numDims);
00046 JpF_invT.resize(worksetSize, numQPs, numDims, numDims);
00047 JBpF_invT.resize(worksetSize, numQPs, numDims, numDims);
00048
00049 this->addDependentField(stress);
00050 this->addDependentField(defGrad);
00051 this->addDependentField(J);
00052 this->addDependentField(biotCoefficient);
00053
00054
00055 this->addEvaluatedField(porePressure);
00056 this->addEvaluatedField(totstress);
00057
00058 this->setName("TLPoroStress"+PHX::TypeString<EvalT>::value);
00059
00060 }
00061
00062
00063 template<typename EvalT, typename Traits>
00064 void TLPoroStress<EvalT, Traits>::
00065 postRegistrationSetup(typename Traits::SetupData d,
00066 PHX::FieldManager<Traits>& fm)
00067 {
00068 this->utils.setFieldData(stress,fm);
00069 this->utils.setFieldData(defGrad,fm);
00070 this->utils.setFieldData(J,fm);
00071 this->utils.setFieldData(biotCoefficient,fm);
00072 this->utils.setFieldData(porePressure,fm);
00073 this->utils.setFieldData(totstress,fm);
00074 }
00075
00076
00077 template<typename EvalT, typename Traits>
00078 void TLPoroStress<EvalT, Traits>::
00079 evaluateFields(typename Traits::EvalData workset)
00080 {
00081
00082 typedef Intrepid::FunctionSpaceTools FST;
00083 typedef Intrepid::RealSpaceTools<ScalarT> RST;
00084
00085 if (numDims == 1) {
00086 Intrepid::FunctionSpaceTools::scalarMultiplyDataData<ScalarT>(totstress, J, stress);
00087 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00088 for (std::size_t qp=0; qp < numQPs; ++qp) {
00089 totstress(cell, qp) = stress(cell, qp) - biotCoefficient(cell,qp)*porePressure(cell,qp);
00090 }
00091 }
00092 }
00093 else
00094 {
00095
00096 RST::inverse(F_inv, defGrad);
00097 RST::transpose(F_invT, F_inv);
00098 FST::scalarMultiplyDataData<ScalarT>(JF_invT, J, F_invT);
00099 FST::scalarMultiplyDataData<ScalarT>(JpF_invT, porePressure,JF_invT);
00100 FST::scalarMultiplyDataData<ScalarT>(JBpF_invT, biotCoefficient, JpF_invT);
00101 FST::tensorMultiplyDataData<ScalarT>(totstress, stress,JF_invT);
00102
00103
00104
00105 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00106 for (std::size_t qp=0; qp < numQPs; ++qp) {
00107 for (std::size_t dim=0; dim<numDims; ++ dim) {
00108 for (std::size_t j=0; j<numDims; ++ j) {
00109 totstress(cell,qp,dim,j) -= JBpF_invT(cell,qp, dim,j);
00110 }
00111 }
00112 }
00113 }
00114
00115
00116 }
00117 }
00118
00119
00120 }
00121