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