ElasticIsotropicMaterial.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.21 $                                                              
00022 // $Date: 2006/09/05 21:21:52 $                                                                  
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/nD/ElasticIsotropicMaterial.cpp,v $                                                                
00024                                                                         
00025                                                                         
00026 // File: ~/material/ElasticIsotropicMaterial.C
00027 //
00028 // Written: MHS 
00029 // Created: Feb 2000
00030 // Revision: A
00031 // Boris Jeremic (@ucdavis.edu) 19June2002 added getE, getnu
00032 //
00033 // Description: This file contains the class implementation for ElasticIsotropicMaterial.
00034 //
00035 // What: "@(#) ElasticIsotropicMaterial.C, revA"
00036 
00037 #include <string.h>
00038 
00039 #include <ElasticIsotropicMaterial.h>
00040 #include <ElasticIsotropicPlaneStress2D.h>
00041 #include <ElasticIsotropicPlaneStrain2D.h>
00042 #include <ElasticIsotropicAxiSymm.h>
00043 #include <ElasticIsotropic3D.h>
00044 #include <PressureDependentElastic3D.h>
00045 #include <ElasticIsotropicPlateFiber.h>
00046 #include <ElasticIsotropicBeamFiber.h>
00047 
00048 #include <Tensor.h>
00049 #include <Channel.h>
00050 #include <Information.h>
00051 #include <Parameter.h>
00052 
00053 #include <OPS_Globals.h>
00054 
00055 ElasticIsotropicMaterial::ElasticIsotropicMaterial
00056 (int tag, int classTag, double e, double nu, double r)
00057   :NDMaterial(tag, classTag), E(e), v(nu), rho(r)
00058 {
00059 
00060 }
00061 
00062 ElasticIsotropicMaterial::ElasticIsotropicMaterial
00063 (int tag, double e, double nu, double r)
00064   :NDMaterial(tag, ND_TAG_ElasticIsotropic), E(e), v(nu), rho(r)
00065 {
00066 
00067 }
00068 
00069 ElasticIsotropicMaterial::~ElasticIsotropicMaterial()
00070 {
00071         
00072 }
00073 
00074 double
00075 ElasticIsotropicMaterial::getRho() 
00076 { 
00077   return rho ;
00078 }
00079 
00080 NDMaterial*
00081 ElasticIsotropicMaterial::getCopy (const char *type)
00082 {
00083     if (strcmp(type,"PlaneStress2D") == 0 || strcmp(type,"PlaneStress") == 0)
00084     {
00085         ElasticIsotropicPlaneStress2D *theModel;
00086         theModel = new ElasticIsotropicPlaneStress2D (this->getTag(), E, v, rho);
00087                 // DOES NOT COPY sigma, D, and epsilon ...
00088                 // This function should only be called during element instantiation, so
00089                 // no state determination is performed on the material model object
00090                 // prior to copying the material model (calling this function)
00091         return theModel;
00092     }
00093 
00094     else if (strcmp(type,"PlaneStrain2D") == 0 || strcmp(type,"PlaneStrain") == 0)
00095     {
00096         ElasticIsotropicPlaneStrain2D *theModel;
00097         theModel = new ElasticIsotropicPlaneStrain2D (this->getTag(), E, v, rho);
00098                 // DOES NOT COPY sigma, D, and epsilon ...
00099                 // This function should only be called during element instantiation, so
00100                 // no state determination is performed on the material model object
00101                 // prior to copying the material model (calling this function)
00102         return theModel;
00103     }
00104     else if (strcmp(type,"AxiSymmetric2D") == 0 || strcmp(type,"AxiSymmetric") == 0)
00105     {
00106         ElasticIsotropicAxiSymm *theModel;
00107         theModel = new ElasticIsotropicAxiSymm(this->getTag(), E, v, rho);
00108                 // DOES NOT COPY sigma, D, and epsilon ...
00109                 // This function should only be called during element instantiation, so
00110                 // no state determination is performed on the material model object
00111                 // prior to copying the material model (calling this function)
00112         return theModel;
00113     }
00115     else if (strcmp(type,"ThreeDimensional") == 0 || 
00116              strcmp(type,"3D") == 0)
00117       {
00118         ElasticIsotropic3D *theModel;
00119         theModel = new ElasticIsotropic3D (this->getTag(), E, v, rho);
00120         // DOES NOT COPY sigma, D, and epsilon ...
00121         // This function should only be called during element instantiation, so
00122         // no state determination is performed on the material model object
00123         // prior to copying the material model (calling this function)
00124         return theModel;
00125       }
00127     else if (strcmp(type,"PlateFiber") == 0)
00128     {
00129         ElasticIsotropicPlateFiber *theModel;
00130         theModel = new ElasticIsotropicPlateFiber(this->getTag(), E, v, rho);
00131                 // DOES NOT COPY sigma, D, and epsilon ...
00132                 // This function should only be called during element instantiation, so
00133                 // no state determination is performed on the material model object
00134                 // prior to copying the material model (calling this function)
00135         return theModel;
00136     }
00137     else if (strcmp(type,"BeamFiber") == 0)
00138     {
00139         ElasticIsotropicBeamFiber *theModel;
00140         theModel = new ElasticIsotropicBeamFiber(this->getTag(), E, v, rho);
00141                 // DOES NOT COPY sigma, D, and epsilon ...
00142                 // This function should only be called during element instantiation, so
00143                 // no state determination is performed on the material model object
00144                 // prior to copying the material model (calling this function)
00145         return theModel;
00146     }
00147 
00148     // Handle other cases
00149     else
00150       return NDMaterial::getCopy(type);
00151 }
00152 
00153 int
00154 ElasticIsotropicMaterial::setTrialStrain (const Vector &v)
00155 {
00156     opserr << "ElasticIsotropicMaterial::setTrialStrain -- subclass responsibility\n";
00157     exit(-1);
00158     return -1;
00159 }
00160 
00161 int
00162 ElasticIsotropicMaterial::setTrialStrain (const Vector &v, const Vector &rate)
00163 {
00164     opserr << "ElasticIsotropicMaterial::setTrialStrain -- subclass responsibility\n";
00165     exit(-1);
00166     return -1;
00167 }
00168 
00169 int
00170 ElasticIsotropicMaterial::setTrialStrainIncr (const Vector &v)
00171 {
00172     opserr << "ElasticIsotropicMaterial::setTrialStrainIncr -- subclass responsibility\n";
00173     exit(-1);
00174     return -1;
00175 }
00176 
00177 int
00178 ElasticIsotropicMaterial::setTrialStrainIncr (const Vector &v, const Vector &rate)
00179 {
00180     opserr << "ElasticIsotropicMaterial::setTrialStrainIncr -- subclass responsibility\n";
00181     exit(-1);
00182     return -1;
00183 }
00184 
00185 const Matrix&
00186 ElasticIsotropicMaterial::getTangent (void)
00187 {
00188   opserr << "ElasticIsotropicMaterial::getTangent -- subclass responsibility\n";
00189   exit(-1);
00190 
00191   // Just to make it compile
00192   Matrix *ret = new Matrix();
00193   return *ret;
00194 }
00195 
00196 const Matrix&
00197 ElasticIsotropicMaterial::getInitialTangent (void)
00198 {
00199   opserr << "ElasticIsotropicMaterial::getInitialTangent -- subclass responsibility\n";
00200   exit(-1);
00201 
00202   // Just to make it compile
00203   Matrix *ret = new Matrix();
00204   return *ret;
00205 }
00206 
00207 const Vector&
00208 ElasticIsotropicMaterial::getStress (void)
00209 {
00210   opserr << "ElasticIsotropicMaterial::getStress -- subclass responsibility\n";
00211   exit(-1);
00212     
00213   // Just to make it compile
00214   Vector *ret = new Vector();
00215   return *ret;
00216 }
00217 
00218 const Vector&
00219 ElasticIsotropicMaterial::getStrain (void)
00220 {
00221   opserr << "ElasticIsotropicMaterial::getStrain -- subclass responsibility\n";
00222   exit(-1);
00223 
00224   // Just to make it compile
00225   Vector *ret = new Vector();
00226   return *ret;
00227 }
00228 
00229 int
00230 ElasticIsotropicMaterial::setTrialStrain (const Tensor &v)
00231 {
00232     opserr << "ElasticIsotropicMaterial::setTrialStrain -- subclass responsibility\n";
00233     exit(-1);
00234 
00235     return -1;
00236 }
00237 
00238 int
00239 ElasticIsotropicMaterial::setTrialStrain (const Tensor &v, const Tensor &r)
00240 {
00241     opserr << "ElasticIsotropicMaterial::setTrialStrain -- subclass responsibility\n";
00242     exit(-1);
00243 
00244     return -1;
00245 }
00246 
00247 int
00248 ElasticIsotropicMaterial::setTrialStrainIncr (const Tensor &v)
00249 {
00250     opserr << "ElasticIsotropicMaterial::setTrialStrainIncr -- subclass responsibility\n";
00251     exit(-1);
00252 
00253     return -1;
00254 }
00255 
00256 int
00257 ElasticIsotropicMaterial::setTrialStrainIncr (const Tensor &v, const Tensor &r)
00258 {
00259     opserr << "ElasticIsotropicMaterial::setTrialStrainIncr -- subclass responsibility\n";
00260 
00261     return -1;
00262 }
00263 
00264 const Tensor&
00265 ElasticIsotropicMaterial::getTangentTensor (void)
00266 {
00267   opserr << "ElasticIsotropicMaterial::getTangentTensor -- subclass responsibility\n";
00268   exit(-1);
00269   
00270   // Just to make it compile
00271   Tensor *t = new Tensor;
00272   return *t;
00273 }
00274 
00275 const stresstensor& ElasticIsotropicMaterial::getStressTensor (void)
00276 {
00277   opserr << "ElasticIsotropicMaterial::getStressTensor -- subclass responsibility\n";
00278   exit(-1);
00279 
00280   // Just to make it compile
00281   stresstensor *t = new stresstensor;
00282   return *t;
00283 }
00284 
00285 const straintensor& ElasticIsotropicMaterial::getStrainTensor (void)
00286 {
00287   opserr << "ElasticIsotropicMaterial::getStrainTensor -- subclass responsibility\n";
00288   exit(-1);
00289 
00290   // Just to make it compile
00291   straintensor *t = new straintensor;
00292   return *t;
00293 }
00294 
00295 const straintensor& ElasticIsotropicMaterial::getPlasticStrainTensor (void)
00296 {
00297   opserr << "ElasticIsotropicMaterial::getPlasticStrainTensor -- subclass responsibility\n";
00298   exit(-1);
00299         
00300   // Just to make it compile
00301   straintensor t;
00302   return t;
00303 }
00304 
00305 int
00306 ElasticIsotropicMaterial::commitState (void)
00307 {
00308   opserr << "ElasticIsotropicMaterial::commitState -- subclass responsibility\n";
00309   exit(-1);
00310   return -1;
00311 }
00312 
00313 int
00314 ElasticIsotropicMaterial::revertToLastCommit (void)
00315 {
00316   opserr << "ElasticIsotropicMaterial::revertToLastCommit -- subclass responsibility\n";
00317   exit(-1);
00318     
00319   return -1;
00320 }
00321 
00322 int
00323 ElasticIsotropicMaterial::revertToStart (void)
00324 {
00325   opserr << "ElasticIsotropicMaterial::revertToStart -- subclass responsibility\n";
00326   exit(-1);
00327   return -1;
00328 }
00329 
00330 NDMaterial*
00331 ElasticIsotropicMaterial::getCopy (void)
00332 {
00333   opserr << "ElasticIsotropicMaterial::getCopy -- subclass responsibility\n";
00334   exit(-1);
00335   return 0;
00336 }
00337 
00338 const char*
00339 ElasticIsotropicMaterial::getType (void) const
00340 {
00341   opserr << "ElasticIsotropicMaterial::getType -- subclass responsibility\n";
00342   exit(-1);     
00343 
00344   return 0;
00345 }
00346 
00347 int
00348 ElasticIsotropicMaterial::getOrder (void) const
00349 {
00350   opserr << "ElasticIsotropicMaterial::getOrder -- subclass responsibility\n";
00351   exit(-1);
00352   return -1;
00353 }
00354 
00355 int
00356 ElasticIsotropicMaterial::sendSelf (int commitTag, Channel &theChannel)
00357 {
00358   int res = 0;
00359 
00360   static Vector data(4);
00361   
00362   data(0) = this->getTag();
00363   data(1) = E;
00364   data(2) = v;
00365   data(3) = rho;
00366   
00367  res += theChannel.sendVector(this->getDbTag(), commitTag, data);
00368  if (res < 0) {
00369    opserr << "ElasticIsotropicMaterial::sendSelf -- could not send Vector\n";
00370    return res;
00371  }
00372 
00373  return res;
00374 }
00375 
00376 int
00377 ElasticIsotropicMaterial::recvSelf (int commitTag, Channel &theChannel, 
00378                  FEM_ObjectBroker &theBroker)
00379 {
00380   int res = 0;
00381   
00382   static Vector data(4);
00383   
00384   res += theChannel.recvVector(this->getDbTag(), commitTag, data);
00385   if (res < 0) {
00386    opserr << "ElasticIsotropicMaterial::recvSelf -- could not recv Vector\n";
00387    return res;
00388   }
00389     
00390   this->setTag((int)data(0));
00391   E = data(1);
00392   v = data(2);
00393   rho = data(3);
00394   
00395   return res;
00396 }
00397 
00398 void
00399 ElasticIsotropicMaterial::Print (OPS_Stream &s, int flag)
00400 {
00401         s << "Elastic Isotropic Material Model" << endln;
00402         s << "\tE:  " << E << endln;
00403         s << "\tv:  " << v << endln;
00404         s << "\trho:  " << rho << endln;
00405 
00406         return;
00407 }
00408 
00409 int
00410 ElasticIsotropicMaterial::setParameter(const char **argv, int argc,
00411                                       Parameter &param)
00412 {
00413   if (argc < 1)
00414     return -1;
00415 
00416   if (strcmp(argv[0],"E") == 0)
00417     return param.addObject(1, this);
00418 
00419   else if (strcmp(argv[0],"nu") == 0 || strcmp(argv[0],"v") == 0)
00420     return param.addObject(2, this);
00421 
00422   else if (strcmp(argv[0],"rho") == 0)
00423     return param.addObject(3, this);
00424 
00425   else
00426     return 0;
00427 }
00428 
00429 int 
00430 ElasticIsotropicMaterial::updateParameter(int parameterID, Information &info)
00431 { 
00432   switch(parameterID) {
00433   case 1:
00434     E = info.theDouble;
00435     return 0;
00436   case 2:
00437     v = info.theDouble;
00438     return 0;
00439   case 3:
00440     rho = info.theDouble;
00441     return 0;
00442   default:
00443     return -1;
00444   }
00445 }

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