00001
00002
00003
00004
00005
00006
00007 #include "Teuchos_TestForException.hpp"
00008 #include "Phalanx_DataLayout.hpp"
00009
00010 namespace LCM {
00011
00012
00013 template<typename EvalT, typename Traits>
00014 SurfaceDiffusionResidual<EvalT, Traits>::
00015 SurfaceDiffusionResidual(const Teuchos::ParameterList& p,
00016 const Teuchos::RCP<Albany::Layouts>& dl) :
00017 thickness (p.get<double>("thickness")),
00018 cubature (p.get<Teuchos::RCP<Intrepid::Cubature<RealType> > >("Cubature")),
00019 intrepidBasis (p.get<Teuchos::RCP<Intrepid::Basis<RealType, Intrepid::FieldContainer<RealType> > > >("Intrepid Basis")),
00020 scalarGrad (p.get<std::string>("Scalar Gradient Name"),dl->qp_vector),
00021 scalarJump (p.get<std::string>("Scalar Jump Name"),dl->qp_scalar),
00022 currentBasis (p.get<std::string>("Current Basis Name"),dl->qp_tensor),
00023 refDualBasis (p.get<std::string>("Reference Dual Basis Name"),dl->qp_tensor),
00024 refNormal (p.get<std::string>("Reference Normal Name"),dl->qp_vector),
00025 refArea (p.get<std::string>("Reference Area Name"),dl->qp_scalar),
00026 scalarResidual (p.get<std::string>("Surface Scalar Residual Name"),dl->node_scalar)
00027 {
00028 this->addDependentField(scalarGrad);
00029 this->addDependentField(scalarJump);
00030 this->addDependentField(currentBasis);
00031 this->addDependentField(refDualBasis);
00032 this->addDependentField(refNormal);
00033 this->addDependentField(refArea);
00034
00035 this->addEvaluatedField(scalarResidual);
00036
00037 this->setName("Surface Scalar Residual"+PHX::TypeString<EvalT>::value);
00038
00039 std::vector<PHX::DataLayout::size_type> dims;
00040 dl->node_vector->dimensions(dims);
00041 worksetSize = dims[0];
00042 numNodes = dims[1];
00043 numDims = dims[2];
00044
00045 numQPs = cubature->getNumPoints();
00046
00047 numPlaneNodes = numNodes / 2;
00048 numPlaneDims = numDims - 1;
00049
00050
00051 refValues.resize(numPlaneNodes, numQPs);
00052 refGrads.resize(numPlaneNodes, numQPs, numPlaneDims);
00053 refPoints.resize(numQPs, numPlaneDims);
00054 refWeights.resize(numQPs);
00055
00056
00057 cubature->getCubature(refPoints, refWeights);
00058 intrepidBasis->getValues(refValues, refPoints, Intrepid::OPERATOR_VALUE);
00059 intrepidBasis->getValues(refGrads, refPoints, Intrepid::OPERATOR_GRAD);
00060 }
00061
00062
00063 template<typename EvalT, typename Traits>
00064 void SurfaceDiffusionResidual<EvalT, Traits>::
00065 postRegistrationSetup(typename Traits::SetupData d,
00066 PHX::FieldManager<Traits>& fm)
00067 {
00068 this->utils.setFieldData(scalarGrad,fm);
00069 this->utils.setFieldData(scalarJump,fm);
00070 this->utils.setFieldData(currentBasis,fm);
00071 this->utils.setFieldData(refDualBasis,fm);
00072 this->utils.setFieldData(refNormal,fm);
00073 this->utils.setFieldData(refArea,fm);
00074 this->utils.setFieldData(scalarResidual,fm);
00075 }
00076
00077
00078 template<typename EvalT, typename Traits>
00079 void SurfaceDiffusionResidual<EvalT, Traits>::
00080 evaluateFields(typename Traits::EvalData workset)
00081 {
00082 for (std::size_t cell(0); cell < workset.numCells; ++cell) {
00083 for (std::size_t node(0); node < numPlaneNodes; ++node) {
00084 scalarResidual(cell, node) = 0;
00085 for (std::size_t pt=0; pt < numQPs; ++pt) {
00086 scalarResidual(cell, node) += refValues(node, pt)*scalarJump(cell,pt)*thickness*refArea(cell,pt);
00087 }
00088 }
00089 }
00090
00091
00092
00093 }
00094
00095 }