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

MooneyRivlinModel_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 <Intrepid_MiniTensor.h>
00008 #include "Teuchos_TestForException.hpp"
00009 #include "Phalanx_DataLayout.hpp"
00010 
00011 namespace LCM
00012 {
00013 
00014 //------------------------------------------------------------------------------
00015 template<typename EvalT, typename Traits>
00016 MooneyRivlinModel<EvalT, Traits>::
00017 MooneyRivlinModel(Teuchos::ParameterList* p,
00018     const Teuchos::RCP<Albany::Layouts>& dl) :
00019     LCM::ConstitutiveModel<EvalT, Traits>(p, dl),
00020         c1_(p->get<RealType>("c1", 0.0)),
00021         c2_(p->get<RealType>("c2", 0.0)),
00022         c_(p->get<RealType>("c", 0.0))
00023 {
00024   // define the dependent fields
00025   this->dep_field_map_.insert(std::make_pair("F", dl->qp_tensor));
00026   this->dep_field_map_.insert(std::make_pair("J", dl->qp_scalar));
00027 
00028   // define the evaluated fields
00029   std::string cauchy = (*field_name_map_)["Cauchy_Stress"];
00030   this->eval_field_map_.insert(std::make_pair(cauchy, dl->qp_tensor));
00031 
00032   // define the state variables
00033   this->num_state_variables_++;
00034   this->state_var_names_.push_back(cauchy);
00035   this->state_var_layouts_.push_back(dl->qp_tensor);
00036   this->state_var_init_types_.push_back("scalar");
00037   this->state_var_init_values_.push_back(0.0);
00038   this->state_var_old_state_flags_.push_back(false);
00039   this->state_var_output_flags_.push_back(true);
00040 }
00041 //------------------------------------------------------------------------------
00042 template<typename EvalT, typename Traits>
00043 void MooneyRivlinModel<EvalT, Traits>::
00044 computeState(typename Traits::EvalData workset,
00045     std::map<std::string, Teuchos::RCP<PHX::MDField<ScalarT> > > dep_fields,
00046     std::map<std::string, Teuchos::RCP<PHX::MDField<ScalarT> > > eval_fields)
00047 {
00048   // extract dependent MDFields
00049   PHX::MDField<ScalarT> defGrad = *dep_fields["F"];
00050   PHX::MDField<ScalarT> J = *dep_fields["J"];
00051   // extract evaluated MDFields
00052   std::string cauchy = (*field_name_map_)["Cauchy_Stress"];
00053   PHX::MDField<ScalarT> stress = *eval_fields[cauchy];
00054 
00055   Intrepid::Tensor<ScalarT> F(num_dims_), C(num_dims_);
00056   Intrepid::Tensor<ScalarT> S(num_dims_), sigma(num_dims_);
00057   Intrepid::Tensor<ScalarT> I(Intrepid::eye<ScalarT>(num_dims_));
00058 
00059   ScalarT d = 2.0 * (c1_ + 2 * c2_);
00060 
00061   for (std::size_t cell(0); cell < workset.numCells; ++cell) {
00062     for (std::size_t pt(0); pt < num_pts_; ++pt) {
00063       F.fill(&defGrad(cell, pt, 0, 0));
00064       C = transpose(F) * F;
00065       S = 2.0 * (c1_ + c2_ * Intrepid::I1(C)) * I - 2.0 * c2_ * C
00066           + (2.0 * c_ * J(cell, pt) * (J(cell, pt) - 1.0) - d)
00067               * Intrepid::inverse(C);
00068       sigma = (1. / J(cell, pt)) * F * S * Intrepid::transpose(F);
00069 
00070       for (std::size_t i(0); i < num_dims_; ++i)
00071         for (std::size_t j(0); j < num_dims_; ++j)
00072           stress(cell, pt, i, j) = sigma(i, j);
00073     }
00074   }
00075 }
00076 //------------------------------------------------------------------------------
00077 }
00078 

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