Go to the documentation of this file.00001
00002
00003
00004
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 LinearElasticModel<EvalT, Traits>::
00017 LinearElasticModel(Teuchos::ParameterList* p,
00018 const Teuchos::RCP<Albany::Layouts>& dl) :
00019 LCM::ConstitutiveModel<EvalT, Traits>(p, dl)
00020 {
00021
00022 this->dep_field_map_.insert(std::make_pair("Strain", dl->qp_tensor));
00023 this->dep_field_map_.insert(std::make_pair("Poissons Ratio", dl->qp_scalar));
00024 this->dep_field_map_.insert(std::make_pair("Elastic Modulus", dl->qp_scalar));
00025
00026
00027 std::string cauchy = (*field_name_map_)["Cauchy_Stress"];
00028 this->eval_field_map_.insert(std::make_pair(cauchy, dl->qp_tensor));
00029
00030
00031 this->num_state_variables_++;
00032 this->state_var_names_.push_back(cauchy);
00033 this->state_var_layouts_.push_back(dl->qp_tensor);
00034 this->state_var_init_types_.push_back("scalar");
00035 this->state_var_init_values_.push_back(0.0);
00036 this->state_var_old_state_flags_.push_back(false);
00037 this->state_var_output_flags_.push_back(true);
00038 }
00039
00040 template<typename EvalT, typename Traits>
00041 void LinearElasticModel<EvalT, Traits>::
00042 computeState(typename Traits::EvalData workset,
00043 std::map<std::string, Teuchos::RCP<PHX::MDField<ScalarT> > > dep_fields,
00044 std::map<std::string, Teuchos::RCP<PHX::MDField<ScalarT> > > eval_fields)
00045 {
00046
00047 PHX::MDField<ScalarT> strain = *dep_fields["Strain"];
00048 PHX::MDField<ScalarT> poissons_ratio = *dep_fields["Poissons Ratio"];
00049 PHX::MDField<ScalarT> elastic_modulus = *dep_fields["Elastic Modulus"];
00050
00051 std::string cauchy = (*field_name_map_)["Cauchy_Stress"];
00052 PHX::MDField<ScalarT> stress = *eval_fields[cauchy];
00053 ScalarT lambda;
00054 ScalarT mu;
00055
00056 Intrepid::Tensor<ScalarT> eps(num_dims_), sigma(num_dims_);
00057 Intrepid::Tensor<ScalarT> I(Intrepid::eye<ScalarT>(num_dims_));
00058
00059 for (std::size_t cell(0); cell < workset.numCells; ++cell) {
00060 for (std::size_t pt(0); pt < num_pts_; ++pt) {
00061 lambda = ( elastic_modulus(cell,pt) * poissons_ratio(cell,pt) )
00062 / ( ( 1 + poissons_ratio(cell,pt) ) * ( 1 - 2 * poissons_ratio(cell,pt) ) );
00063 mu = elastic_modulus(cell,pt) / ( 2 * ( 1 + poissons_ratio(cell,pt) ) );
00064
00065 eps.fill( &strain(cell,pt,0,0) );
00066
00067 sigma = 2.0 * mu * eps + lambda * Intrepid::trace(eps) * I;
00068
00069 for (std::size_t i=0; i < num_dims_; ++i) {
00070 for (std::size_t j=0; j < num_dims_; ++j) {
00071 stress(cell,pt,i,j) = sigma(i,j);
00072 }
00073 }
00074 }
00075 }
00076
00077
00078 if (have_temperature_) {
00079 for (std::size_t cell(0); cell < workset.numCells; ++cell) {
00080 for (std::size_t pt(0); pt < num_pts_; ++pt) {
00081 sigma.fill(&stress(cell,pt,0,0));
00082 sigma -= expansion_coeff_
00083 * (temperature_(cell,pt) - ref_temperature_) * I;
00084
00085 for (std::size_t i = 0; i < num_dims_; ++i) {
00086 for (std::size_t j = 0; j < num_dims_; ++j) {
00087 stress(cell, pt, i, j) = sigma(i, j);
00088 }
00089 }
00090 }
00091 }
00092 }
00093
00094 }
00095
00096 }
00097