Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Steel01.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.4 $
00022 // $Date: 2001/06/14 05:48:28 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/uniaxial/Steel01.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/material/Steel01.C
00027 //
00028 // Written: MHS 
00029 // Created: 06/99
00030 // Revision: A
00031 //
00032 // Description: This file contains the class implementation for 
00033 // Steel01. 
00034 //
00035 // What: "@(#) Steel01.C, revA"
00036 
00037 
00038 #include <Steel01.h>
00039 #include <Vector.h>
00040 #include <Channel.h>
00041 #include <Information.h>
00042 #include <math.h>
00043 #include <float.h>
00044 
00045 Steel01::Steel01
00046 (int tag, double FY, double E, double B,
00047  double A1, double A2, double A3, double A4,
00048  double min, double max) :
00049    UniaxialMaterial(tag,MAT_TAG_Steel01),
00050    fy(FY), E0(E), b(B), a1(A1), a2(A2), a3(A3), a4(A4),
00051    epsmin(min), epsmax(max)
00052 {
00053    // Calculated material parameters
00054    epsy = fy/E0;         // Yield strain
00055    Esh = b*E0;           // Hardening modulus
00056 
00057    // Sets all history and state variables to initial values
00058    revertToStart ();
00059 
00060    // Initial stiffness
00061    Ttangent = E0;
00062 }
00063 
00064 Steel01::Steel01():UniaxialMaterial(0,MAT_TAG_Steel01),
00065  fy(0.0), E0(0.0), b(0.0), a1(0.0), a2(0.0), a3(0.0), a4(0.0),
00066  epsmin(0.0), epsmax(0.0)
00067 {
00068 
00069 }
00070 
00071 Steel01::~Steel01 ()
00072 {
00073    // Does nothing
00074 }
00075 
00076 void Steel01::setHistoryVariables ()
00077 {
00078    TminStrain = CminStrain;
00079    TmaxStrain = CmaxStrain;
00080    TshiftP = CshiftP;
00081    TshiftN = CshiftN;
00082    Tloading = Cloading;
00083    Tfailed = Cfailed;
00084 }
00085 
00086 int Steel01::setTrialStrain (double strain, double strainRate)
00087 {
00088    // Reset history variables to last converged state
00089    setHistoryVariables ();
00090 
00091    // Set trial strain
00092    Tstrain = strain;
00093 
00094    // Determine change in strain from last converged state
00095    double dStrain = Tstrain - Cstrain;
00096 
00097    // Calculate the trial state given the trial strain
00098    if (fabs(dStrain) > DBL_EPSILON)   
00099       determineTrialState (dStrain);
00100 
00101    return 0;
00102 }
00103 
00104 int Steel01::setTrial (double strain, double &stress, double &tangent, double strainRate)
00105 {
00106    // Reset history variables to last converged state
00107    setHistoryVariables ();
00108 
00109    // Set trial strain
00110    Tstrain = strain;
00111 
00112    // Determine change in strain from last converged state
00113    double dStrain = Tstrain - Cstrain;
00114 
00115    // Calculate the trial state given the trial strain
00116    if (fabs(dStrain) > DBL_EPSILON)   
00117       determineTrialState (dStrain);
00118 
00119    stress = Tstress;
00120    tangent = Ttangent;
00121 
00122    return 0;
00123 }
00124 
00125 void Steel01::determineTrialState (double dStrain)
00126 {
00127    if (Tstrain <= epsmin || Tstrain >= epsmax)
00128       Tfailed = 1;
00129 
00130    if (Tfailed) {
00131       Tstress = 0.0;
00132       Ttangent = 0.0;
00133    } else {
00134 
00135      double c, c1, c2, c3;
00136 
00137       c = Cstress + E0*dStrain;
00138 
00139       double fyOneMinusB = fy * (1.0 - b);
00140 
00141       c1 = Esh*Tstrain;
00142 
00143       c2 = TshiftN*fyOneMinusB;
00144 
00145       c3 = TshiftP*fyOneMinusB;
00146 
00147       double c1c3 = c1+c3;
00148 
00149       if (c1c3 < c) 
00150          Tstress = c1c3;
00151       else
00152  Tstress = c;
00153 
00154       double c1c2=c1-c2;
00155       if (c1c2 > Tstress) 
00156          Tstress = c1c2;
00157 
00158       if (fabs(Tstress-c) < 1.0e-15)
00159          Ttangent = E0;
00160       else
00161          Ttangent = Esh;
00162 
00163       // Determine if a load reversal has occurred due to the trial strain
00164       detectLoadReversal (dStrain);
00165 
00166    }
00167 }
00168 
00169 void Steel01::detectLoadReversal (double dStrain)
00170 {
00171    // Determine initial loading condition
00172    if (Tloading == 0 && dStrain != 0.0)
00173    {
00174       if (dStrain > 0.0)
00175          Tloading = 1;
00176       else
00177          Tloading = -1;
00178    }
00179 
00180    // Transition from loading to unloading, i.e. positive strain increment
00181    // to negative strain increment
00182    if (Tloading == 1 && dStrain < 0.0)
00183    {
00184       Tloading = -1;
00185       if (Cstrain > TmaxStrain)
00186          TmaxStrain = Cstrain;
00187       TshiftN = 1 + a1*pow((TmaxStrain-TminStrain)/(2.0*a2*epsy),0.8);
00188    }
00189 
00190    // Transition from unloading to loading, i.e. negative strain increment
00191    // to positive strain increment
00192    if (Tloading == -1 && dStrain > 0.0)
00193    {
00194       Tloading = 1;
00195       if (Cstrain < TminStrain)
00196          TminStrain = Cstrain;
00197       TshiftP = 1 + a3*pow((TmaxStrain-TminStrain)/(2.0*a4*epsy),0.8);
00198    }
00199 }
00200 
00201 double Steel01::getStrain ()
00202 {
00203    return Tstrain;
00204 }
00205 
00206 double Steel01::getStress ()
00207 {
00208    return Tstress;
00209 }
00210 
00211 double Steel01::getTangent ()
00212 {
00213    return Ttangent;
00214 }
00215 
00216 double Steel01::getSecant ()
00217 {
00218  if (fabs(Tstrain) > DBL_EPSILON)
00219   return Tstress/Tstrain;
00220  else
00221   return Ttangent; 
00222 }
00223 
00224 int Steel01::commitState ()
00225 {
00226    // History variables
00227    CminStrain = TminStrain;
00228    CmaxStrain = TmaxStrain;
00229    CshiftP = TshiftP;
00230    CshiftN = TshiftN;
00231    Cloading = Tloading;
00232    Cfailed = Tfailed;
00233 
00234    // State variables
00235    Cstrain = Tstrain;
00236    Cstress = Tstress;
00237    Ctangent = Ttangent;
00238 
00239    return 0;
00240 }
00241 
00242 int Steel01::revertToLastCommit ()
00243 {
00244    // Reset trial history variables to last committed state
00245    setHistoryVariables();
00246 
00247    // Reset trial state variables to last committed state
00248    Tstrain = Cstrain;
00249    Tstress = Cstress;
00250    Ttangent = Ctangent;
00251 
00252    return 0;
00253 }
00254 
00255 int Steel01::revertToStart ()
00256 {
00257    // History variables
00258    CminStrain = 0.0;
00259    CmaxStrain = 0.0;
00260    CshiftP = 1.0;
00261    CshiftN = 1.0;
00262    Cloading = 0;
00263    Cfailed = 0;
00264 
00265    setHistoryVariables ();
00266 
00267    // State variables
00268    Cstrain = 0.0;
00269    Cstress = 0.0;
00270    Ctangent = E0;
00271 
00272    Tstrain = 0.0;
00273    Tstress = 0.0;
00274    Ttangent = E0;
00275 
00276    return 0;
00277 }
00278 
00279 UniaxialMaterial* Steel01::getCopy ()
00280 {
00281    Steel01* theCopy = new Steel01(this->getTag(), fy, E0, b,
00282                                                a1, a2, a3, a4, epsmin, epsmax);
00283 
00284    // Calculated material properties
00285    theCopy->epsy = epsy;
00286    theCopy->Esh = Esh;
00287 
00288    // Converged history variables
00289    theCopy->CminStrain = CminStrain;
00290    theCopy->CmaxStrain = CmaxStrain;
00291    theCopy->CshiftP = CshiftP;
00292    theCopy->CshiftN = CshiftN;
00293    theCopy->Cloading = Cloading;
00294    theCopy->Cfailed = Cfailed;
00295 
00296    // Trial history variables
00297    theCopy->setHistoryVariables();
00298 
00299    // Converged state variables
00300    theCopy->Cstrain = Cstrain;
00301    theCopy->Cstress = Cstress;
00302    theCopy->Ctangent = Ctangent;
00303 
00304    // Trial state variables
00305    theCopy->Tstrain = Tstrain;
00306    theCopy->Tstress = Tstress;
00307    theCopy->Ttangent = Ttangent;
00308 
00309    return theCopy;
00310 }
00311 
00312 int Steel01::sendSelf (int commitTag, Channel& theChannel)
00313 {
00314    int res = 0;
00315    static Vector data(19);
00316    data(0) = this->getTag();
00317 
00318    // Material properties
00319    data(1) = fy;
00320    data(2) = E0;
00321    data(3) = b;
00322    data(4) = a1;
00323    data(5) = a2;
00324    data(6) = a3;
00325    data(7) = a4;
00326    data(8) = epsmin;
00327    data(9) = epsmax;
00328 
00329    // History variables from last converged state
00330    data(10) = CminStrain;
00331    data(11) = CmaxStrain;
00332    data(12) = CshiftP;
00333    data(13) = CshiftN;
00334    data(14) = Cloading;
00335    data(15) = Cfailed;
00336 
00337    // State variables from last converged state
00338    data(16) = Cstrain;
00339    data(17) = Cstress;
00340    data(18) = Ctangent;
00341 
00342    // Data is only sent after convergence, so no trial variables
00343    // need to be sent through data vector
00344 
00345    res = theChannel.sendVector(this->getDbTag(), commitTag, data);
00346    if (res < 0) 
00347       cerr << "Steel01::sendSelf() - failed to send data\n";
00348 
00349    return res;
00350 }
00351 
00352 int Steel01::recvSelf (int commitTag, Channel& theChannel,
00353                                 FEM_ObjectBroker& theBroker)
00354 {
00355    int res = 0;
00356    static Vector data(19);
00357    res = theChannel.recvVector(this->getDbTag(), commitTag, data);
00358   
00359    if (res < 0) {
00360       cerr << "Steel01::recvSelf() - failed to receive data\n";
00361       this->setTag(0);      
00362    }
00363    else {
00364       this->setTag(int(data(0)));
00365 
00366       // Material properties
00367       fy = data(1);
00368       E0 = data(2);
00369       b = data(3);
00370       a1 = data(4);
00371       a2 = data(5);
00372       a3 = data(6);
00373       a4 = data(7);
00374       epsmin = data(8);
00375       epsmax = data(9);
00376 
00377       epsy = fy/E0;
00378       Esh = b*E0;
00379 
00380       // History variables from last converged state
00381       CminStrain = data(10);
00382       CmaxStrain = data(11);
00383       CshiftP = data(12);
00384       CshiftN = data(13);
00385       Cloading = int(data(14));
00386       Cfailed = int(data(15));
00387 
00388       // Copy converged history values into trial values since data is only
00389       // sent (received) after convergence
00390       setHistoryVariables ();
00391 
00392       // State variables from last converged state
00393       Cstrain = data(16);
00394       Cstress = data(17);
00395       Ctangent = data(18);      
00396 
00397       // Copy converged state values into trial values
00398       Tstrain = Cstrain;
00399       Tstress = Cstress;
00400       Ttangent = Ctangent;
00401    }
00402     
00403    return res;
00404 }
00405 
00406 void Steel01::Print (ostream& s, int flag)
00407 {
00408    s << "Steel01 tag: " << this->getTag() << endl;
00409    s << "  fy: " << fy << endl;
00410    s << "  E0: " << E0 << endl;
00411    s << "  b:  " << b << endl;
00412    s << "  a1: " << a1 << endl;
00413    s << "  a2: " << a2 << endl;
00414    s << "  a3: " << a3 << endl;
00415    s << "  a4: " << a4 << endl;
00416    if (epsmin != NEG_INF_STRAIN)
00417       s << "  epsmin: " << epsmin << endl;
00418    if (epsmax != POS_INF_STRAIN)
00419       s << "  epsmax: " << epsmax << endl;
00420 }
00421 
00422 int
00423 Steel01::setParameter(char **argv, int argc, Information &info)
00424 {
00425  if (argc < 1)
00426   return -1;
00427 
00428  if (strcmp(argv[0],"fy") == 0) {
00429   info.theType = DoubleType;
00430   return 1;
00431  }
00432  if (strcmp(argv[0],"E0") == 0) {
00433   info.theType = DoubleType;
00434   return 2;
00435  }
00436  if (strcmp(argv[0],"b") == 0) {
00437   info.theType = DoubleType;
00438   return 3;
00439  }
00440  if (strcmp(argv[0],"a1") == 0) {
00441   info.theType = DoubleType;
00442   return 4;
00443  }
00444  if (strcmp(argv[0],"a2") == 0) {
00445   info.theType = DoubleType;
00446   return 5;
00447  }
00448  if (strcmp(argv[0],"a3") == 0) {
00449   info.theType = DoubleType;
00450   return 6;
00451  }
00452  if (strcmp(argv[0],"a4") == 0) {
00453   info.theType = DoubleType;
00454   return 7;
00455  }
00456  if (strcmp(argv[0],"epsmin") == 0) {
00457   info.theType = DoubleType;
00458   return 8;
00459  }
00460  if (strcmp(argv[0],"epsmax") == 0) {
00461   info.theType = DoubleType;
00462   return 9;
00463  }
00464  else
00465   cerr << "WARNING: Could not set parameter in Steel01. " << endl;
00466                 
00467  return -1;
00468 }
00469 
00470 int
00471 Steel01::updateParameter(int parameterID, Information &info)
00472 {
00473  switch (parameterID) {
00474  case -1:
00475   return -1;
00476  case 1:
00477   this->fy = info.theDouble;
00478   break;
00479  case 2:
00480   this->E0 = info.theDouble;
00481   break;
00482  case 3:
00483   this->b = info.theDouble;
00484   break;
00485  case 4:
00486   this->a1 = info.theDouble;
00487   break;
00488  case 5:
00489   this->a2 = info.theDouble;
00490   break;
00491  case 6:
00492   this->a3 = info.theDouble;
00493   break;
00494  case 7:
00495   this->a4 = info.theDouble;
00496   break;
00497  case 8:
00498   this->epsmin = info.theDouble;
00499   break;
00500  case 9:
00501   this->epsmax = info.theDouble;
00502   break;
00503  default:
00504   return -1;
00505  }
00506 
00507  epsy = fy/E0;           // Yield strain
00508  Esh = b*E0;             // Hardening modulus
00509  Ttangent = E0;          // Initial stiffness
00510 
00511  return 0;
00512 }
Copyright Contact Us