ElasticShearSection2d.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.1 $
00022 // $Date: 2006/09/06 20:17:34 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/section/ElasticShearSection2d.cpp,v $
00024 
00025 #include <ElasticShearSection2d.h>
00026 #include <Matrix.h>
00027 #include <Vector.h>
00028 #include <Channel.h>
00029 #include <FEM_ObjectBroker.h>
00030 #include <MatrixUtil.h>
00031 #include <stdlib.h>
00032 #include <Information.h>
00033 #include <Parameter.h>
00034 
00035 #include <classTags.h>
00036 
00037 Vector ElasticShearSection2d::s(3);
00038 Matrix ElasticShearSection2d::ks(3,3);
00039 ID ElasticShearSection2d::code(3);
00040 
00041 ElasticShearSection2d::ElasticShearSection2d(void)
00042 :SectionForceDeformation(0, SEC_TAG_Elastic2d),
00043  E(0.0), A(0.0), I(0.0), G(0.0), alpha(0.0),
00044  e(3), eCommit(3)
00045 {
00046     if (code(0) != SECTION_RESPONSE_P)
00047     {
00048         code(0) = SECTION_RESPONSE_P;   // P is the first quantity
00049         code(1) = SECTION_RESPONSE_MZ;  // Mz is the second
00050         code(2) = SECTION_RESPONSE_VY;  // Vy is the third
00051     }    
00052 }
00053 
00054 ElasticShearSection2d::ElasticShearSection2d
00055 (int tag, double E_in, double A_in, double I_in, double G_in, double alpha_in)
00056 :SectionForceDeformation(tag, SEC_TAG_ElasticShear2d),
00057  E(E_in), A(A_in), I(I_in), G(G_in), alpha(alpha_in),
00058  e(3), eCommit(3)
00059 {
00060     if (E <= 0.0)  {
00061                 opserr << "ElasticShearSection2d::ElasticShearSection2d -- Input E <= 0.0 ... setting E to 1.0\n";
00062                 E = 1.0;
00063   }
00064         
00065     if (A <= 0.0)  {
00066                 opserr << "ElasticShearSection2d::ElasticShearSection2d -- Input A <= 0.0 ... setting A to 1.0\n";
00067                 A = 1.0;
00068     }
00069     
00070     if (I <= 0.0)  {
00071                 opserr << "ElasticShearSection2d::ElasticShearSection2d -- Input I <= 0.0 ... setting I to 1.0\n";
00072                 I = 1.0;
00073     }    
00074         
00075     if (code(0) != SECTION_RESPONSE_P)
00076     {
00077         code(0) = SECTION_RESPONSE_P;   // P is the first quantity
00078         code(1) = SECTION_RESPONSE_MZ;  // Mz is the second
00079         code(2) = SECTION_RESPONSE_VY;  // Vy is the third
00080     }
00081 }
00082 
00083 ElasticShearSection2d::~ElasticShearSection2d(void)
00084 {
00085 
00086 }
00087 
00088 int 
00089 ElasticShearSection2d::commitState(void)
00090 {
00091   eCommit = e;
00092 
00093   return 0;
00094 }
00095 
00096 int 
00097 ElasticShearSection2d::revertToLastCommit(void)
00098 {
00099   e = eCommit;
00100 
00101   return 0;
00102 }
00103 
00104 int 
00105 ElasticShearSection2d::revertToStart(void)
00106 {
00107   eCommit.Zero();
00108 
00109   return 0;
00110 }
00111 
00112 int
00113 ElasticShearSection2d::setTrialSectionDeformation (const Vector &def)
00114 {
00115   e = def;
00116 
00117   return 0;
00118 }
00119 
00120 const Vector &
00121 ElasticShearSection2d::getSectionDeformation (void)
00122 {
00123   return e;
00124 }
00125 
00126 const Vector &
00127 ElasticShearSection2d::getStressResultant (void)
00128 {
00129   s(0) = E*A*e(0);
00130   s(1) = E*I*e(1);    
00131   s(2) = G*A*alpha*e(2);
00132 
00133   return s;
00134 }
00135 
00136 const Matrix &
00137 ElasticShearSection2d::getSectionTangent(void)
00138 {
00139   ks(0,0) = E*A;
00140   ks(1,1) = E*I;
00141   ks(2,2) = G*A*alpha;
00142   
00143   return ks;
00144 }
00145 
00146 const Matrix &
00147 ElasticShearSection2d::getInitialTangent(void)
00148 {
00149   ks(0,0) = E*A;
00150   ks(1,1) = E*I;
00151   ks(2,2) = G*A*alpha;
00152   
00153   return ks;
00154 }
00155 
00156 const Matrix &
00157 ElasticShearSection2d::getSectionFlexibility (void)
00158 {
00159   ks(0,0) = 1.0/(E*A);
00160   ks(1,1) = 1.0/(E*I);
00161   ks(2,2) = 1.0/(G*A*alpha);
00162   
00163   return ks;
00164 }
00165 
00166 const Matrix &
00167 ElasticShearSection2d::getInitialFlexibility(void)
00168 {
00169   ks(0,0) = 1.0/(E*A);
00170   ks(1,1) = 1.0/(E*I);
00171   ks(2,2) = 1.0/(G*A*alpha);
00172   
00173   return ks;
00174 }
00175 
00176 SectionForceDeformation*
00177 ElasticShearSection2d::getCopy(void)
00178 {
00179   ElasticShearSection2d *theCopy =
00180     new ElasticShearSection2d (this->getTag(), E, A, I, G, alpha);
00181   
00182   theCopy->eCommit = eCommit;
00183   
00184   return theCopy;
00185 }
00186 
00187 const ID&
00188 ElasticShearSection2d::getType(void)
00189 {
00190   return code;
00191 }
00192 
00193 int
00194 ElasticShearSection2d::getOrder(void) const
00195 {
00196   return 3;
00197 }
00198 
00199 int
00200 ElasticShearSection2d::sendSelf(int commitTag, Channel &theChannel)
00201 {
00202   int res = 0;
00203   
00204   static Vector data(9);
00205   
00206   int dataTag = this->getDbTag();
00207   
00208   data(0) = this->getTag();
00209   data(1) = E;
00210   data(2) = A;
00211   data(3) = I;    
00212   data(4) = G;    
00213   data(5) = alpha;    
00214   data(6) = eCommit(0);
00215   data(7) = eCommit(1);
00216   data(8) = eCommit(2);
00217   
00218   res += theChannel.sendVector(dataTag, commitTag, data);
00219   if (res<0) {
00220     opserr << "ElasticShearSection2d::sendSelf -- failed to send data\n";
00221     return res;
00222   }
00223   
00224   return res;
00225 }
00226 
00227 int
00228 ElasticShearSection2d::recvSelf(int commitTag, Channel &theChannel,
00229                                 FEM_ObjectBroker &theBroker)
00230 {
00231   int res = 0;
00232 
00233   static Vector data(9);
00234   
00235   int dataTag = this->getDbTag();
00236   
00237   res += theChannel.recvVector(dataTag, commitTag, data);
00238   if(res < 0) {
00239     opserr << "ElasticShearSection2d::recvSelf -- failed to receive data\n";
00240     return res;
00241   }
00242   
00243   this->setTag((int)data(0));
00244   E = data(1);
00245   A = data(2);
00246   I = data(3);
00247   G = data(4);
00248   alpha = data(5);
00249   eCommit(0) = data(6);
00250   eCommit(1) = data(7);
00251   eCommit(2) = data(8);
00252   
00253   return res;
00254 }
00255  
00256 void
00257 ElasticShearSection2d::Print(OPS_Stream &s, int flag)
00258 {
00259   s << "ElasticShearSection2d, tag: " << this->getTag() << endln;
00260   s << "\tE: " << E << endln;
00261   s << "\tA: " << A << endln;
00262   s << "\tI: " << I << endln;
00263   s << "\tG: " << G << endln;
00264   s << "\talpha: " << alpha << endln;
00265 }
00266 
00267 int
00268 ElasticShearSection2d::setParameter(const char **argv, int argc,
00269                                     Parameter &param)
00270 {
00271   if (argc < 1)
00272     return -1;
00273 
00274   if (strcmp(argv[0],"E") == 0)
00275     return param.addObject(1, this);
00276 
00277   if (strcmp(argv[0],"A") == 0)
00278     return param.addObject(2, this);
00279 
00280   if (strcmp(argv[0],"I") == 0)
00281     return param.addObject(3, this);
00282 
00283   if (strcmp(argv[0],"G") == 0)
00284     return param.addObject(4, this);
00285 
00286   if (strcmp(argv[0],"alpha") == 0)
00287     return param.addObject(5, this);
00288 
00289   return -1;
00290 }
00291 
00292 int
00293 ElasticShearSection2d::updateParameter(int paramID, Information &info)
00294 {
00295   if (paramID == 1)
00296     E = info.theDouble;
00297   if (paramID == 2)
00298     A = info.theDouble;
00299   if (paramID == 3)
00300     I = info.theDouble;
00301   if (paramID == 4)
00302     G = info.theDouble;
00303   if (paramID == 5)
00304     alpha = info.theDouble;
00305 
00306   return 0;
00307 }
00308 
00309 int
00310 ElasticShearSection2d::activateParameter(int paramID)
00311 {
00312   parameterID = paramID;
00313 
00314   return 0;
00315 }
00316 
00317 const Vector&
00318 ElasticShearSection2d::getStressResultantSensitivity(int gradNumber,
00319                                                      bool conditional)
00320 {
00321   s.Zero();
00322 
00323   if (parameterID == 1) { // E
00324     s(0) = A*e(0);
00325     s(1) = I*e(1);
00326   }
00327   if (parameterID == 2) { // A
00328     s(0) = E*e(0);
00329     s(2) = G*alpha*e(2);
00330   }
00331   if (parameterID == 3) // I
00332     s(1) = E*e(1);
00333   if (parameterID == 4) // G
00334     s(2) = A*alpha*e(2);
00335   if (parameterID == 5) // alpha
00336     s(2) = G*A*e(2);
00337 
00338   return s;
00339 }
00340 
00341 const Vector&
00342 ElasticShearSection2d::getSectionDeformationSensitivity(int gradNumber)
00343 {
00344   s.Zero();
00345 
00346   return s;
00347 }
00348 
00349 const Matrix&
00350 ElasticShearSection2d::getInitialTangentSensitivity(int gradNumber)
00351 {
00352   ks.Zero();
00353 
00354   return ks;
00355 }
00356 
00357 int
00358 ElasticShearSection2d::commitSensitivity(const Vector& sectionDeformationGradient,
00359                                     int gradNumber, int numGrads)
00360 {
00361   // Nothing to commit, path independent
00362   return 0;
00363 }

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