00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "Teuchos_TestForException.hpp"
00019 #include "Phalanx_DataLayout.hpp"
00020 #include "Sacado_ParameterRegistration.hpp"
00021
00022 #include "Intrepid_FunctionSpaceTools.hpp"
00023
00024 namespace FELIX {
00025
00026
00027 template<typename EvalT, typename Traits>
00028 EpsilonL1L2<EvalT, Traits>::
00029 EpsilonL1L2(const Teuchos::ParameterList& p,
00030 const Teuchos::RCP<Albany::Layouts>& dl) :
00031 Ugrad (p.get<std::string> ("Gradient QP Variable Name"),dl->qp_vecgradient ),
00032 epsilonXX (p.get<std::string> ("FELIX EpsilonXX QP Variable Name"), dl->qp_scalar ),
00033 epsilonYY (p.get<std::string> ("FELIX EpsilonYY QP Variable Name"), dl->qp_scalar ),
00034 epsilonXY (p.get<std::string> ("FELIX EpsilonXY QP Variable Name"), dl->qp_scalar ),
00035 epsilonB (p.get<std::string> ("FELIX EpsilonB QP Variable Name"), dl->qp_scalar )
00036 {
00037 Teuchos::ParameterList* visc_list =
00038 p.get<Teuchos::ParameterList*>("Parameter List");
00039
00040 this->addDependentField(Ugrad);
00041
00042 this->addEvaluatedField(epsilonXX);
00043 this->addEvaluatedField(epsilonYY);
00044 this->addEvaluatedField(epsilonXY);
00045 this->addEvaluatedField(epsilonB);
00046
00047 std::vector<PHX::DataLayout::size_type> dims;
00048 dl->qp_gradient->dimensions(dims);
00049 numQPs = dims[1];
00050 numDims = dims[2];
00051
00052 Teuchos::RCP<ParamLib> paramLib = p.get< Teuchos::RCP<ParamLib> >("Parameter Library");
00053
00054 new Sacado::ParameterRegistration<EvalT, SPL_Traits>("Glen's Law Homotopy Parameter", this, paramLib);
00055
00056 this->setName("EpsilonL1L2"+PHX::TypeString<EvalT>::value);
00057 }
00058
00059
00060 template<typename EvalT, typename Traits>
00061 void EpsilonL1L2<EvalT, Traits>::
00062 postRegistrationSetup(typename Traits::SetupData d,
00063 PHX::FieldManager<Traits>& fm)
00064 {
00065 this->utils.setFieldData(Ugrad,fm);
00066 this->utils.setFieldData(epsilonXX,fm);
00067 this->utils.setFieldData(epsilonYY,fm);
00068 this->utils.setFieldData(epsilonXY,fm);
00069 this->utils.setFieldData(epsilonB,fm);
00070 }
00071
00072
00073 template<typename EvalT,typename Traits>
00074 typename EpsilonL1L2<EvalT,Traits>::ScalarT&
00075 EpsilonL1L2<EvalT,Traits>::getValue(const std::string &n)
00076 {
00077 return homotopyParam;
00078 }
00079
00080
00081
00082 template<typename EvalT, typename Traits>
00083 void EpsilonL1L2<EvalT, Traits>::
00084 evaluateFields(typename Traits::EvalData workset)
00085 {
00086 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00087 for (std::size_t qp=0; qp < numQPs; ++qp) {
00088 epsilonXX(cell,qp) = Ugrad(cell,qp,0,0);
00089 epsilonYY(cell,qp) = Ugrad(cell,qp,1,1);
00090 epsilonXY(cell,qp) = 0.5*(Ugrad(cell,qp,0,1) + Ugrad(cell,qp,1,0));
00091 epsilonB(cell,qp) = epsilonXX(cell,qp)*epsilonXX(cell,qp) + epsilonYY(cell,qp)*epsilonYY(cell,qp)
00092 + epsilonXX(cell,qp)*epsilonYY(cell,qp) + epsilonXY(cell,qp)*epsilonXY(cell,qp);
00093 }
00094 }
00095 }
00096 }