• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Strain_Def.hpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 #include "Teuchos_TestForException.hpp"
00008 #include "Phalanx_DataLayout.hpp"
00009 
00010 #include "Intrepid_FunctionSpaceTools.hpp"
00011 
00012 namespace LCM {
00013 
00014   //----------------------------------------------------------------------------
00015   template<typename EvalT, typename Traits>
00016   Strain<EvalT, Traits>::
00017   Strain(const Teuchos::ParameterList& p,
00018          const Teuchos::RCP<Albany::Layouts>& dl) :
00019     GradU(p.get<std::string>("Gradient QP Variable Name"),dl->qp_tensor),
00020     strain(p.get<std::string>("Strain Name"),dl->qp_tensor)
00021   {
00022     this->addDependentField(GradU);
00023     
00024     this->addEvaluatedField(strain);
00025     
00026     this->setName("Strain"+PHX::TypeString<EvalT>::value);
00027     
00028     std::vector<PHX::DataLayout::size_type> dims;
00029     dl->qp_tensor->dimensions(dims);
00030     numQPs  = dims[1];
00031     numDims = dims[2];
00032   }
00033 
00034   //----------------------------------------------------------------------------
00035   template<typename EvalT, typename Traits>
00036   void Strain<EvalT, Traits>::
00037   postRegistrationSetup(typename Traits::SetupData d,
00038                         PHX::FieldManager<Traits>& fm)
00039   {
00040     this->utils.setFieldData(strain,fm);
00041     this->utils.setFieldData(GradU,fm);
00042   }
00043 
00044   //----------------------------------------------------------------------------
00045   template<typename EvalT, typename Traits>
00046   void Strain<EvalT, Traits>::
00047   evaluateFields(typename Traits::EvalData workset)
00048   {
00049     // Compute Strain tensor from displacement gradient
00050     for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00051       for (std::size_t qp=0; qp < numQPs; ++qp) {
00052         for (std::size_t i=0; i < numDims; ++i) {
00053           for (std::size_t j=0; j < numDims; ++j) {
00054             strain(cell,qp,i,j) = 0.5*(GradU(cell,qp,i,j) + GradU(cell,qp,j,i));
00055           }
00056         }
00057       }
00058     }
00059   }
00060   //----------------------------------------------------------------------------
00061 }
00062 

Generated on Wed Mar 26 2014 18:36:44 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1