ElasticPPMaterial.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.6 $
00022 // $Date: 2003/02/14 23:01:38 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/uniaxial/ElasticPPMaterial.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/material/ElasticPPMaterial.C
00027 //
00028 // Written: fmk 
00029 // Created: 07/98
00030 // Revision: A
00031 //
00032 // Description: This file contains the class implementation for 
00033 // ElasticMaterial. 
00034 //
00035 // What: "@(#) ElasticPPMaterial.C, revA"
00036 
00037 
00038 #include <ElasticPPMaterial.h>
00039 #include <Vector.h>
00040 #include <Channel.h>
00041 #include <math.h>
00042 #include <float.h>
00043 
00044 
00045 ElasticPPMaterial::ElasticPPMaterial(int tag, double e, double eyp)
00046 :UniaxialMaterial(tag,MAT_TAG_ElasticPPMaterial),
00047  ezero(0.0), E(e), trialStrain(0.0), ep(0.0),
00048  trialStress(0.0), trialTangent(E)
00049 {
00050   fyp = E*eyp;
00051   fyn = -fyp;
00052 }
00053 
00054 ElasticPPMaterial::ElasticPPMaterial(int tag, double e, double eyp,
00055                                      double eyn, double ez )
00056 :UniaxialMaterial(tag,MAT_TAG_ElasticPPMaterial),
00057  ezero(ez), E(e), trialStrain(0.0), ep(0.0),
00058  trialStress(0.0), trialTangent(E)
00059 {
00060     if (eyp < 0) {
00061         opserr << "ElasticPPMaterial::ElasticPPMaterial() - eyp < 0, setting > 0\n";
00062         eyp *= -1.;
00063     }
00064     if (eyn > 0) {
00065         opserr << "ElasticPPMaterial::ElasticPPMaterial() - eyn > 0, setting < 0\n";
00066         eyn *= -1.;
00067     }    
00068     
00069     fyp = E*eyp;
00070     fyn = E*eyn;
00071 }
00072 
00073 ElasticPPMaterial::ElasticPPMaterial()
00074 :UniaxialMaterial(0,MAT_TAG_ElasticPPMaterial),
00075  fyp(0.0), fyn(0.0), ezero(0.0), E(0.0), trialStrain(0.0), ep(0.0),
00076  trialStress(0.0), trialTangent(0.0)
00077 {
00078 
00079 }
00080 
00081 ElasticPPMaterial::~ElasticPPMaterial()
00082 {
00083   // does nothing
00084 }
00085 
00086 int 
00087 ElasticPPMaterial::setTrialStrain(double strain, double strainRate)
00088 {
00089   /*
00090     if (fabs(trialStrain - strain) < DBL_EPSILON)
00091       return 0;
00092   */
00093     trialStrain = strain;
00094 
00095     double sigtrial;    // trial stress
00096     double f;           // yield function
00097 
00098     // compute trial stress
00099     sigtrial = E * ( trialStrain - ezero - ep );
00100 
00101     //sigtrial  = E * trialStrain;
00102     //sigtrial -= E * ezero;
00103     //sigtrial -= E *  ep;
00104 
00105     // evaluate yield function
00106     if ( sigtrial >= 0.0 )
00107         f =  sigtrial - fyp;
00108     else
00109         f = -sigtrial + fyn;
00110 
00111     double fYieldSurface = - E * DBL_EPSILON;
00112     if ( f <= fYieldSurface ) {
00113 
00114       // elastic
00115       trialStress = sigtrial;
00116       trialTangent = E;
00117 
00118     } else {
00119 
00120       // plastic
00121       if ( sigtrial > 0.0 ) {
00122         trialStress = fyp;
00123       } else {
00124         trialStress = fyn;
00125       }
00126 
00127       trialTangent = 0.0;
00128     }
00129 
00130     return 0;
00131 }
00132 
00133 double 
00134 ElasticPPMaterial::getStrain(void)
00135 {
00136   return trialStrain;
00137 }
00138 
00139 double 
00140 ElasticPPMaterial::getStress(void)
00141 {
00142   return trialStress;
00143 }
00144 
00145 
00146 double 
00147 ElasticPPMaterial::getTangent(void)
00148 {
00149   return trialTangent;
00150 }
00151 
00152 int 
00153 ElasticPPMaterial::commitState(void)
00154 {
00155     double sigtrial;    // trial stress
00156     double f;           // yield function
00157 
00158     // compute trial stress
00159     sigtrial = E * ( trialStrain - ezero - ep );
00160 
00161     // evaluate yield function
00162     if ( sigtrial >= 0.0 )
00163         f =  sigtrial - fyp;
00164     else
00165         f = -sigtrial + fyn;
00166 
00167     double fYieldSurface = - E * DBL_EPSILON;
00168     if ( f > fYieldSurface ) {
00169       // plastic
00170       if ( sigtrial > 0.0 ) {
00171         ep += f / E;
00172       } else {
00173         ep -= f / E;
00174       }
00175     }
00176 
00177     return 0;
00178 }       
00179 
00180 
00181 int 
00182 ElasticPPMaterial::revertToLastCommit(void)
00183 {
00184     return 0;
00185 }
00186 
00187 
00188 int 
00189 ElasticPPMaterial::revertToStart(void)
00190 {
00191     ep = 0.0;
00192 
00193     return 0;
00194 }
00195 
00196 
00197 UniaxialMaterial *
00198 ElasticPPMaterial::getCopy(void)
00199 {
00200   ElasticPPMaterial *theCopy =
00201     new ElasticPPMaterial(this->getTag(),E,fyp/E,fyn/E,ezero);
00202   theCopy->ep = this->ep;
00203   
00204   return theCopy;
00205 }
00206 
00207 
00208 int 
00209 ElasticPPMaterial::sendSelf(int cTag, Channel &theChannel)
00210 {
00211   int res = 0;
00212   static Vector data(6);
00213   data(0) = this->getTag();
00214   data(1) = ep;
00215   data(2) = E;
00216   data(3) = ezero;
00217   data(4) = fyp;
00218   data(5) = fyn;
00219 
00220   res = theChannel.sendVector(this->getDbTag(), cTag, data);
00221   if (res < 0) 
00222     opserr << "ElasticPPMaterial::sendSelf() - failed to send data\n";
00223 
00224   return res;
00225 }
00226 
00227 int 
00228 ElasticPPMaterial::recvSelf(int cTag, Channel &theChannel, 
00229                                  FEM_ObjectBroker &theBroker)
00230 {
00231   int res = 0;
00232   static Vector data(6);
00233   res = theChannel.recvVector(this->getDbTag(), cTag, data);
00234   if (res < 0) 
00235     opserr << "ElasticPPMaterial::recvSelf() - failed to recv data\n";
00236   else {
00237     this->setTag(data(0));
00238     ep    = data(1);
00239     E     = data(2);
00240     ezero = data(3);
00241     fyp   = data(4);
00242     fyn   = data(5);  
00243   }
00244 
00245   return res;
00246 }
00247 
00248 void 
00249 ElasticPPMaterial::Print(OPS_Stream &s, int flag)
00250 {
00251     s << "ElasticPP tag: " << this->getTag() << endln;
00252     s << "  E: " << E << endln;
00253     s << "  ep: " << ep << endln;
00254     s << "  Otress: " << trialStress << " tangent: " << trialTangent << endln;
00255 }
00256 
00257 

Generated on Mon Oct 23 15:05:19 2006 for OpenSees by doxygen 1.5.0