ReinforcingSteel.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: 2006/08/28 17:40:32 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/material/uniaxial/ReinforcingSteel.cpp,v $
00024 
00025 /* ****************************************************************** **
00026 ** THIS FILE WAS DEVELOPED AT UC DAVIS                                **
00027 **                                                                    **
00028 ** Programmed by: Jon Mohle (jfmohle@ucdavis.edu)                     **
00029 ** Supervisor: Sashi Kunnath (skkunnath@ucdavis.edu)                  **
00030 **                                                                    **
00031 ********************************************************************* */
00032 // Written: Jon Mohle
00033 // Created: October 2003
00034 // Updated: January 2006
00035 //
00036 // Description: This file contains the class definition for 
00037 // ReinforcingSteel
00038 
00039 #include "ReinforcingSteel.h"
00040 #include <Vector.h>
00041 #include <Channel.h>
00042 #include <math.h>
00043 #include <float.h>
00044 
00045 #ifdef HelpDebugMat
00046   int ReinforcingSteel::classCount = 0;
00047 #endif
00048 
00049 ReinforcingSteel::ReinforcingSteel(int tag, double fy, double fsu, double Es, double Esh_, double esh_, double esu, 
00050                                    int buckModel, double slenderness, double alpha, double r, double gama, 
00051                                    double Fatigue1, double Fatigue2, double Degrade, double rc1, double rc2, double rc3, 
00052                                    double A1, double HardLim)
00053   :UniaxialMaterial(tag,MAT_TAG_ReinforcingSteel), esh(esh_), Esh(Esh_), a1(A1), hardLim(HardLim),
00054   BuckleModel(buckModel),LDratio(slenderness),beta(alpha),fsu_fraction(gama),Fat1(Fatigue1),RC1(rc1),RC2(rc2),RC3(rc3)
00055 { 
00056   if((r>=0.0) & (r<=1.0)) 
00057     reduction=r;
00058   else
00059     if(r<=0)
00060       reduction = 0.0;
00061     else
00062       reduction = 1.0;
00063 
00064         if((Fatigue1==0) || (Fatigue2==0)) {
00065                 Fat1=9.9e30;
00066                 Fat2=1.0;
00067                 Deg1=0.0;
00068   } else {
00069     Fat2=1.0/Fatigue2;
00070     if(Degrade != 0.0) 
00071       Deg1=pow(Fat1/Degrade,Fat2);
00072     else
00073       Deg1=0.0;
00074   }
00075         
00076   //initial yield point in natural stress-strain
00077         eyp=log(1.0+fy/Es);
00078         fyp=fy*(1.0+fy/Es);
00079         Esp=fyp/eyp;
00080 
00081   // ultimate strain and slope in natural stress-strain
00082         esup=log(1.0+esu);
00083   Esup=fsu*(1.0+esu);
00084   
00085   //updateHardeningLoaction(1.0);  done in revert to start
00086   
00087   ZeroTol=1.0E-14;
00088   this->revertToStart();
00089 }
00090 
00091 void
00092 ReinforcingSteel::updateHardeningLoaction(double PlasticStrain)
00093 {
00094   double ep;
00095   double pBranchStrain_t = Temax - Backbone_f(Temax)/Esp;
00096   double pBranchStrain_c = Temin + Backbone_f(Temin)/Esp;
00097   if (pBranchStrain_t > -pBranchStrain_c)
00098     ep = PlasticStrain - pBranchStrain_t;   
00099   else
00100     ep = PlasticStrain + pBranchStrain_c;
00101   THardFact = 1.0 - a1*ep;
00102   if (THardFact<hardLim) THardFact = hardLim;
00103   if (THardFact>1.0) THardFact = 1.0;
00104   updateHardeningLoactionParams();
00105 }
00106 
00107 void
00108 ReinforcingSteel::updateHardeningLoactionParams()
00109 {
00110   double ey = exp(eyp)-1.0;
00111   double fy = fyp/(1.0+ey);
00112   double eshLoc = THardFact*(esh-ey)+ey;
00113   
00114   // strain hardened point in natural stress-strain
00115   eshp=log(1.0+eshLoc);
00116   fshp=fy*(1.0+eshLoc);
00117   
00118   // ultimate stress in natural stress-strain
00119   fsup=Esup-(esup-eshp)*Esup; 
00120   
00121   // strain hardedned slope, yield plateu slope, and intersect
00122   Eshp=Esh*pow(1.0+eshLoc,2.0)+fshp - Esup;
00123   Eypp=(fshp-fyp)/(eshp-eyp);
00124   fint = fyp-Eypp*eyp;
00125   
00126   p = Eshp*(esup-eshp)/(fsup-fshp);
00127   // Set backbone transition variables
00128   double fTemp = Backbone_fNat(eshp+0.0002);
00129   Eshpb = Eshp*pow((fsup-fTemp)/(fsup-fshp),1.0-1.0/p);
00130   eshpa = eshp + 0.0002 - 2.0*(fTemp-fshp)/Eshpb;
00131 }
00132 
00133 ReinforcingSteel::ReinforcingSteel(int tag)
00134   :UniaxialMaterial(tag,MAT_TAG_ReinforcingSteel)
00135 {
00136 #ifdef HelpDebugMat
00137   thisClassNumber = ++classCount;
00138   thisClassCommit = 0;
00139 #endif
00140   ZeroTol=1.0E-14;
00141 }
00142 
00143 ReinforcingSteel::~ReinforcingSteel(){
00144 
00145 }
00146 
00147 /***************** material state determination methods ***********/
00148 int 
00149 ReinforcingSteel::setTrialStrain(double strain, double strainRate) {
00150 
00151   // need to reset values to last committed
00152   this->revertToLastCommit();
00153 
00154   int res = 0;
00155   #ifdef HelpDebugMat
00156   thisClassStep++;
00157   if (thisClassCommit == 4000 && thisClassStep == 1)
00158     if (scalefactor()<1.0)
00159       opserr << scalefactor() << "\n";
00160 #endif
00161   // Reset Trial History Variables to Last Converged State
00162   revertToLastCommit();
00163   
00164 #ifdef _WIN32  
00165   if(_fpclass(strain)< 8 || _fpclass(strain)==512) {
00166     opserr << "bad trial strain\n";
00167     return -1;
00168   }
00169 #endif
00170   
00171   if(strain< -0.95) {
00172     opserr << "Large trial compressive strain\n";
00173     return -1;
00174   } else 
00175     TStrain = log(1.0 + strain);
00176   
00177   if (TStrain == CStrain) return 0;
00178   
00179   if (TBranchNum==0){
00180     if (TStrain>0.0) TBranchNum = 1;
00181     if (TStrain<0.0) TBranchNum = 2;
00182   }
00183   
00184 #ifdef _WIN32
00185   if(_fpclass(Tfch)< 8 || _fpclass(Tfch)==512 || _fpclass(Tfch)< 8 || _fpclass(Tfch)==512) {
00186     opserr << "bad stress or tangent\n";
00187     return -1;
00188   }
00189 #endif
00190   if(thisClassNumber==51 && thisClassCommit==781) {
00191     thisClassCommit = thisClassCommit;
00192   }
00193   res = BranchDriver(res);
00194   
00195 #ifdef _WIN32
00196   if(_fpclass(TStress)< 8 || _fpclass(TStress)==512 || _fpclass(TTangent)< 8 || _fpclass(TTangent)==512) {
00197     opserr << "bad stress or tangent\n";
00198     return -1;
00199   }
00200 #endif
00201   
00202   if (res==0)
00203     return 0;
00204   else
00205     return -1;
00206 }
00207 
00208 double 
00209 ReinforcingSteel::getStrain(void) {
00210   return exp(TStrain)-1.0;
00211 }
00212 
00213 double 
00214 ReinforcingSteel::getStress(void) {
00215   if (theBarFailed) return 0.0;
00216   double tempstr=TStress;
00217   switch(BuckleModel) {
00218   case  1:  tempstr = Buckled_stress_Gomes(TStrain,TStress);
00219     break;
00220   case  2:  tempstr = Buckled_stress_Dhakal(TStrain,TStress);
00221     break;
00222   }
00223   double tempOut = tempstr*scalefactor()/exp(TStrain);
00224   
00225 #ifdef _WIN32
00226   if(_fpclass(tempOut)< 8 || _fpclass(tempOut)==512)
00227     opserr << "bad Stress in ReinforcingSteel::getStress\n";
00228 #endif
00229   
00230   return tempOut;
00231 }
00232 
00233 double 
00234 ReinforcingSteel::getTangent(void) {
00235   double taTan = TTangent;
00236   switch(BuckleModel) {
00237   case  1:  taTan = Buckled_mod_Gomes(TStrain,TStress,TTangent);
00238     break;
00239   case  2:  taTan = Buckled_mod_Dhakal(TStrain,TStress,TTangent);
00240     break;
00241   }
00242   double scfact = scalefactor();
00243   double tempOut = (taTan-TStress)*scfact/pow(exp(TStrain),2.0);
00244   
00245 #ifdef _WIN32
00246   if(_fpclass(tempOut)< 8 || _fpclass(tempOut)==512)
00247     opserr << "bad tangent in ReinforcingSteel::getTangentat\n";
00248 #endif
00249   
00250   return tempOut;
00251 }
00252 
00253 double 
00254 ReinforcingSteel::getInitialTangent(void) {
00255   return Esp;
00256 }
00257 
00258 /***************** path dependent bahavior methods ***********/
00259 int 
00260 ReinforcingSteel::commitState(void) {
00261 #ifdef HelpDebugMat
00262   thisClassCommit++;
00263   thisClassStep = 0;
00264 #endif
00265   
00266   if(TBranchNum <= 1)
00267     TBranchMem=0;
00268   else
00269     TBranchMem = (TBranchNum+1)/2;
00270   
00271   for(int i=0; i<=LastRule_RS/2; i++)
00272     C_ePlastic[i]=T_ePlastic[i];
00273   
00274   CFatDamage       = TFatDamage;
00275   
00276   // commit trial history variables
00277   CBranchNum    = TBranchNum;
00278   Ceo_p         = Teo_p;
00279   Ceo_n         = Teo_n;
00280   Cemax         = Temax;
00281   Cemin         = Temin;
00282   CeAbsMax      = TeAbsMax;
00283   CeAbsMin      = TeAbsMin;
00284   CeCumPlastic  = TeCumPlastic;
00285   CHardFact     = THardFact;
00286 
00287   if(TBranchNum > 2) {
00288     CR[TBranchMem]    = TR;
00289     Cfch[TBranchMem]  = Tfch;
00290     CQ[TBranchMem]    = TQ;
00291     CEsec[TBranchMem] = TEsec;
00292     Cea[TBranchMem]   = Tea;
00293     Cfa[TBranchMem]   = Tfa;
00294     CEa[TBranchMem]   = TEa;
00295     Ceb[TBranchMem]   = Teb;
00296     Cfb[TBranchMem]   = Tfb;
00297     CEb[TBranchMem]   = TEb;
00298   }
00299   
00300   // commit trial state variables
00301   CStrain    = TStrain;  
00302   CStress    = TStress;
00303   CTangent   = TTangent;
00304   return 0;
00305 }
00306 
00307 int 
00308 ReinforcingSteel::revertToLastCommit(void) {
00309   for(int i=0; i<=LastRule_RS/2; i++)
00310     T_ePlastic[i]=C_ePlastic[i];
00311   
00312   TFatDamage = CFatDamage;
00313   
00314   // Reset trial history variables to last committed state
00315   TBranchNum    = CBranchNum;
00316   Teo_p         = Ceo_p;
00317   Teo_n         = Ceo_n;
00318   Temax         = Cemax;
00319   Temin         = Cemin;
00320   TeAbsMax      = CeAbsMax;
00321   TeAbsMin      = CeAbsMin;
00322   TeCumPlastic  = CeCumPlastic;
00323   THardFact     = CHardFact;
00324   updateHardeningLoactionParams();
00325   
00326   if(TBranchNum > 2) SetPastCurve(TBranchNum);
00327   
00328   // Reset trial state variables to last committed state
00329   TStress    = CStress;
00330   TTangent   = CTangent;
00331 
00332   return 0;
00333 }
00334 
00335 int 
00336 ReinforcingSteel::revertToStart(void)
00337 {
00338   theBarFailed = 0;
00339   
00340   THardFact = 1.0;
00341   CHardFact = 1.0;
00342   updateHardeningLoactionParams();
00343 
00344   CFatDamage = TFatDamage;
00345   for(int i=0; i<=LastRule_RS/2; i++) {
00346     C_ePlastic[i]  = 0.0;
00347     T_ePlastic[i]  = 0.0;
00348     CR[i]         = 0.0;
00349     Cfch[i]       = 0.0;
00350     CQ[i]         = 0.0;
00351     CEsec[i]      = 0.0;
00352     Cea[i]        = 0.0;
00353     Cfa[i]        = 0.0;
00354     CEa[i]        = 0.0;
00355     Ceb[i]        = 0.0;
00356     Cfb[i]        = 0.0;
00357     CEb[i]        = 0.0;
00358   }
00359   TR            = 0.0;
00360   Tfch          = 0.0;
00361   TQ            = 0.0;
00362   TEsec         = 0.0;
00363   Tea           = 0.0;
00364   Tfa           = 0.0;
00365   TEa           = 0.0;
00366   Teb           = 0.0;
00367   Tfb           = 0.0;
00368   TEb           = 0.0;
00369 
00370   // reset trial history variables
00371   CBranchNum    = 0;
00372   TBranchNum    = 0;
00373   Ceo_p         = 0.0;
00374   Teo_p         = 0.0;
00375   Ceo_n         = 0.0;
00376   Teo_n         = 0.0;
00377   Cemax         = 0.0;
00378   Temax         = 0.0;
00379   Cemin         = 0.0;
00380   Temin         = 0.0;
00381   CeAbsMax      = 0.0;
00382   TeAbsMax      = 0.0;
00383   CeAbsMin      = 0.0;
00384   TeAbsMin      = 0.0;
00385   TeCumPlastic  = 0.0;
00386   CeCumPlastic  = 0.0;
00387 
00388   // reset trial state variables
00389   CStrain       = 0.0; 
00390   TStrain       = 0.0;  
00391   CStrain       = 0.0;
00392   CStress       = 0.0; 
00393   TStress       = 0.0;
00394   CStress       = 0.0;  
00395   CTangent      = Esp; 
00396   TTangent      = Esp;
00397 
00398   CFatDamage    = 0.0;
00399   TFatDamage    = 0.0;
00400 
00401   return 0;
00402 }
00403 
00404 UniaxialMaterial *
00405 ReinforcingSteel::getCopy(void)
00406 {
00407   ReinforcingSteel *theCopy =
00408   new ReinforcingSteel(this->getTag());
00409   
00410   theCopy->reduction    = reduction;
00411   theCopy->fsu_fraction = fsu_fraction;
00412   theCopy->beta       = beta;
00413   theCopy->theBarFailed = theBarFailed;
00414 
00415   // natural stress-strain variables
00416         theCopy->p            = p;
00417   theCopy->Esp          = Esp;   // Natural Elastic Modulus
00418   theCopy->eshp         = eshp;  // Natural Hardening Strain
00419   theCopy->fshp         = fshp;  // Natural Hardening Stress
00420   theCopy->Eshp         = Eshp;  // Natural Hardening Modulus
00421   theCopy->esup         = esup;  // Natural Strain at Peak Stress
00422   theCopy->fsup         = fsup;  // Natural Peak Stress
00423   theCopy->Esup         = Esup;  // Natural Peak Stress Moduus
00424   theCopy->Eypp         = Eypp;  // Natural Yield Plateu Modulus
00425   theCopy->fint         = fint;  // Natural yield plateu intersect
00426   theCopy->eyp          = eyp;   // Natural yield strain
00427   theCopy->fyp          = fyp;   // Natural yield stress
00428 
00429   theCopy->esh          = esh;   // Engineering hardening strain (user input)
00430   theCopy->Esh          = Esh;   // Engineering hardening stress (user input)
00431 
00432   theCopy->eshpa        = eshpa; // Curve smoothing Parameters (at SH transition)
00433   theCopy->Eshpb        = Eshpb; // These are used to eliminate a sudden discontinuity in stiffness
00434 
00435   theCopy->a1           = a1;
00436   theCopy->hardLim      = hardLim;
00437   theCopy->THardFact    = THardFact;
00438   theCopy->CHardFact    = CHardFact;
00439 
00440   theCopy->TFatDamage   = TFatDamage;
00441   theCopy->CFatDamage   = CFatDamage;
00442   theCopy->LDratio      = LDratio;
00443         theCopy->Fat1         = Fat1;
00444   theCopy->Fat2         = Fat2;
00445         theCopy->Deg1         = Deg1;
00446   theCopy->BuckleModel  = BuckleModel;
00447   theCopy->BackStress   = BackStress;
00448 
00449   theCopy->TBranchMem   = TBranchMem;
00450   theCopy->TBranchNum   = TBranchNum;
00451   theCopy->Teo_p        = Teo_p;
00452   theCopy->Teo_n        = Teo_n;
00453   theCopy->Temax        = Temax;
00454   theCopy->Temin        = Temin;
00455   theCopy->TeAbsMax     = TeAbsMax;
00456   theCopy->TeAbsMin     = TeAbsMin;
00457   theCopy->TeCumPlastic = TeCumPlastic;
00458 
00459   theCopy->CBranchNum   = CBranchNum;
00460   theCopy->Ceo_p        = Ceo_p;
00461   theCopy->Ceo_n        = Ceo_n;
00462   theCopy->Cemax        = Cemax;
00463   theCopy->Cemin        = Cemin;
00464   theCopy->CeAbsMax     = CeAbsMax;
00465   theCopy->CeAbsMin     = CeAbsMin;
00466   theCopy->CeCumPlastic = CeCumPlastic;
00467 
00468   for(int i=0; i<=LastRule_RS/2; i++) {
00469           theCopy->C_ePlastic[i] = C_ePlastic[i];
00470     theCopy->T_ePlastic[i] = T_ePlastic[i];
00471           theCopy->CR[i]        = CR[i];
00472           theCopy->Cfch[i]      = Cfch[i];
00473           theCopy->CQ[i]        = CQ[i];
00474           theCopy->CEsec[i]     = CEsec[i];
00475           theCopy->Cea[i]       = Cea[i];
00476           theCopy->Cfa[i]       = Cfa[i];
00477           theCopy->CEa[i]       = CEa[i];
00478           theCopy->Ceb[i]       = Ceb[i];
00479           theCopy->Cfb[i]       = Cfb[i];
00480           theCopy->CEb[i]       = CEb[i];
00481   }
00482   theCopy->TR           = TR;
00483   theCopy->Tfch         = Tfch;
00484   theCopy->TQ           = TQ;
00485   theCopy->TEsec        = TEsec;
00486   theCopy->Tea          = Tea;
00487   theCopy->Tfa          = Tfa;
00488   theCopy->TEa          = TEa;
00489   theCopy->Teb          = Teb;
00490   theCopy->Tfb          = Tfb;
00491   theCopy->TEb          = TEb;
00492 
00493   theCopy->re           = re;
00494   theCopy->rE1          = rE1;
00495   theCopy->rE2          = rE2;
00496 
00497   theCopy->CStrain      = CStrain;  
00498   theCopy->CStress      = CStress;
00499   theCopy->CTangent     = CTangent;
00500   theCopy->TStrain      = TStrain;  
00501   theCopy->TStress      = TStress;
00502   theCopy->TTangent     = TTangent;
00503 
00504   theCopy->RC1          = RC1;
00505   theCopy->RC2          = RC2;
00506   theCopy->RC3          = RC3;
00507 
00508   return theCopy;
00509 }
00510 
00511 int 
00512 ReinforcingSteel::sendSelf(int cTag, Channel &theChannel)
00513 {
00514   int res = 0;
00515   int index =0;
00516   static Vector data(71+12*LastRule_RS/2);
00517   
00518   data(index++) = this->getTag();
00519   data(index++) = reduction;
00520   data(index++) = fsu_fraction;
00521   data(index++) = beta;
00522   data(index++) = theBarFailed;
00523         data(index++) = p;
00524   data(index++) = Esp;
00525   data(index++) = eshp;
00526   data(index++) = fshp;
00527   data(index++) = Eshp;
00528   data(index++) = esup;
00529   data(index++) = fsup;
00530   data(index++) = Esup;
00531   data(index++) = Eypp;
00532   data(index++) = fint;
00533   data(index++) = eyp;
00534   data(index++) = fyp;
00535   data(index++) = esh;
00536   data(index++) = CeCumPlastic;
00537   data(index++) = TeCumPlastic;
00538   data(index++) = a1;
00539   data(index++) = hardLim;
00540   data(index++) = THardFact;
00541   data(index++) = CHardFact;
00542   data(index++) = Esh;
00543   data(index++) = eshpa;
00544   data(index++) = Eshpb;
00545   data(index++) = TFatDamage;
00546   data(index++) = CFatDamage;
00547   data(index++) = LDratio;
00548         data(index++) = Fat1;
00549   data(index++) = Fat2;
00550         data(index++) = Deg1;
00551   data(index++) = BuckleModel;
00552   data(index++) = TBranchMem;
00553   data(index++) = TBranchNum;
00554   data(index++) = Teo_p;
00555   data(index++) = Teo_n;
00556   data(index++) = Temax;
00557   data(index++) = Temin;
00558   data(index++) = TeAbsMax;
00559   data(index++) = TeAbsMin;
00560   data(index++) = CBranchNum;
00561   data(index++) = Ceo_p;
00562   data(index++) = Ceo_n;
00563   data(index++) = Cemax;
00564   data(index++) = Cemin;
00565   data(index++) = CeAbsMax;
00566   data(index++) = CeAbsMin;
00567   data(index++) = TR;
00568   data(index++) = Tfch;
00569   data(index++) = TQ;
00570   data(index++) = TEsec;
00571   data(index++) = Tea;
00572   data(index++) = Tfa;
00573   data(index++) = TEa;
00574   data(index++) = Teb;
00575   data(index++) = Tfb;
00576   data(index++) = TEb;
00577 
00578   data(index++) = re;
00579   data(index++) = rE1;
00580   data(index++) = rE2;
00581   data(index++) = CStrain;  
00582   data(index++) = CStress;
00583   data(index++) = CTangent;
00584   data(index++) = TStrain;  
00585   data(index++) = TStress;
00586   data(index++) = TTangent;
00587   data(index++) = BackStress;
00588 
00589   data(index++) = RC1;
00590   data(index++) = RC2;
00591   data(index++) = RC3;
00592 
00593   for(int i=0; i<=LastRule_RS/2; i++) {
00594           data(index++) = C_ePlastic[i];
00595     data(index++) = T_ePlastic[i];
00596           data(index++) = CR[i];
00597           data(index++) = Cfch[i];
00598           data(index++) = CQ[i];
00599           data(index++) = CEsec[i];
00600           data(index++) = Cea[i];
00601           data(index++) = Cfa[i];
00602           data(index++) = CEa[i];
00603           data(index++) = Ceb[i];
00604           data(index++) = Cfb[i];
00605           data(index++) = CEb[i];
00606   }
00607   #ifdef _NDEBUG
00608     if (--index != data.Size())
00609       opserr << "ReinforcingSteel::sendSelf() wrong vector size\n";
00610   #endif
00611   res = theChannel.sendVector(this->getDbTag(), cTag, data);
00612   if (res < 0) 
00613     opserr << "ReinforcingSteel::sendSelf() - failed to send data\n";
00614 
00615   return res;
00616 }
00617 
00618 int 
00619 ReinforcingSteel::recvSelf(int cTag, Channel &theChannel, 
00620                                FEM_ObjectBroker &theBroker)
00621 {
00622   int res = 0;
00623   int index =0;
00624   static Vector data(71+12*LastRule_RS/2);
00625   res = theChannel.recvVector(this->getDbTag(), cTag, data);
00626   
00627   if (res < 0) {
00628       opserr << "ReinforcingSteel::recvSelf() - failed to receive data\n";
00629       this->setTag(0);      
00630   }
00631   else {
00632     this->setTag((int)data(index++));
00633     reduction = data(index++);
00634     fsu_fraction = data(index++);
00635     beta = data(index++);
00636     theBarFailed = static_cast<int>(data(index++));
00637           p     = data(index++);
00638     Esp   = data(index++);
00639     eshp  = data(index++);
00640     fshp  = data(index++);
00641     Eshp  = data(index++);
00642     esup  = data(index++);
00643     fsup  = data(index++);
00644     Esup  = data(index++);
00645     Eypp  = data(index++);
00646     fint  = data(index++);
00647     eyp   = data(index++);
00648     fyp   = data(index++);
00649     esh   = data(index++);
00650     CeCumPlastic = data(index++);
00651     TeCumPlastic = data(index++);
00652     a1 = data(index++);
00653     hardLim = data(index++);
00654     THardFact = data(index++);
00655     CHardFact = data(index++);
00656     Esh   = data(index++);
00657     eshpa = data(index++);
00658     Eshpb = data(index++);
00659     TFatDamage  = data(index++);
00660     CFatDamage  = data(index++);
00661     LDratio     = data(index++);
00662           Fat1        = data(index++);
00663     Fat2        = data(index++);
00664           Deg1        = data(index++);
00665     BuckleModel = static_cast<int>(data(index++));
00666     TBranchMem  = static_cast<int>(data(index++));
00667     TBranchNum  = static_cast<int>(data(index++));
00668     Teo_p       = data(index++);
00669     Teo_n       = data(index++);
00670     Temax       = data(index++);
00671     Temin       = data(index++);
00672     TeAbsMax    = data(index++);
00673     TeAbsMin    = data(index++);
00674     CBranchNum  = static_cast<int>(data(index++));
00675     Ceo_p       = data(index++);
00676     Ceo_n       = data(index++);
00677     Cemax       = data(index++);
00678     Cemin       = data(index++);
00679     CeAbsMax    = data(index++);
00680     CeAbsMin    = data(index++);
00681     TR          = data(index++);
00682     Tfch        = data(index++);
00683     TQ          = data(index++);
00684     TEsec       = data(index++);
00685     Tea         = data(index++);
00686     Tfa         = data(index++);
00687     TEa         = data(index++);
00688     Teb         = data(index++);
00689     Tfb         = data(index++);
00690     TEb         = data(index++);
00691     re          = data(index++);
00692     rE1         = data(index++);
00693     rE2         = data(index++);
00694     CStrain     = data(index++);  
00695     CStress     = data(index++);
00696     CTangent    = data(index++);
00697     TStrain     = data(index++);  
00698     TStress     = data(index++);
00699     TTangent    = data(index++);
00700     BackStress  = data(index++);
00701 
00702     RC1         = data(index++);
00703     RC2         = data(index++);
00704     RC3         = data(index++);
00705     for(int i=0; i<=LastRule_RS/2; i++) {
00706             C_ePlastic[i] = data(index++);
00707       T_ePlastic[i] = data(index++);
00708             CR[i]         = data(index++);
00709             Cfch[i]       = data(index++);
00710             CQ[i]         = data(index++);
00711             CEsec[i]      = data(index++);
00712             Cea[i]        = data(index++);
00713             Cfa[i]        = data(index++);
00714             CEa[i]        = data(index++);
00715             Ceb[i]        = data(index++);
00716             Cfb[i]        = data(index++);
00717             CEb[i]        = data(index++);
00718     }
00719     #ifdef _NDEBUG
00720       if (--index != data.Size())
00721         opserr << "ReinforcingSteel::sendSelf() wrong vector size\n";
00722     #endif
00723   }
00724   return res;
00725 }
00726 
00727 void 
00728 ReinforcingSteel::Print(OPS_Stream &s, int flag)
00729 {
00730   if(flag == 3) {
00731         s << CStrain << "  " << CStress << "  " << CTangent << endln;
00732   } else {
00733     s << "ReinforcingSteel, tag: " << this->getTag() << endln;
00734     s << "  N2p: " << CFatDamage << endln;
00735     //s << "  sigmaY: " << sigmaY << endln;
00736     //s << "  Hiso: " << Hiso << endln;
00737     //s << "  Hkin: " << Hkin << endln;
00738     //s << "  eta: " << eta << endln;
00739   }
00740 }
00741 
00742 int
00743 ReinforcingSteel::Sign(double x) {
00744   if(x<0.0)
00745         return -1;
00746   else
00747         return 1;
00748 }
00749 
00750 /*****************************************************************************************/
00751 /*************************     Base Menegotto-Pinto Equation       ***********************/
00752 /*****************************************************************************************/
00753 double
00754 ReinforcingSteel::MPfunc(double a)
00755 {                
00756   if(a>=1.0)
00757     opserr << "a is one in ReinforcingSteel::MPfunc()\n";
00758   //double temp1 = pow(a,TR+1);
00759   //double temp2 = pow(a,TR);
00760   //double temp3 = TEa*a*(1-temp2)/(1-a);
00761   //double temp4 = TEsec*(1-temp1)/(1-a);
00762   //return TEb-temp4+temp3;
00763   return TEb-TEsec*(1-pow(a,TR+1))/(1-a)+TEa*a*(1-pow(a,TR))/(1-a);
00764 }
00765 
00766 int
00767 ReinforcingSteel::SetMP()
00768 {
00769   double Rmin;
00770   double a=0.01;
00771   double ao;
00772   double da;
00773   bool notConverge(true);
00774 
00775   
00776         if (TEb-TEsec == 0.0) {
00777           TQ=1.0;
00778           Tfch=Tfb;
00779   } else {
00780     if (TEsec!=TEa) {
00781       Rmin = (TEb-TEsec)/(TEsec-TEa);
00782             if (Rmin < 0.0) {
00783                     opserr << "R is negative in ReinforcingSteel::SetMP()\n";
00784                     Rmin = 0.0;
00785             }
00786             if (TR <= Rmin) TR=Rmin + 0.01;
00787             while(notConverge) {
00788       if (1.0-a != 1.0) {
00789               if (MPfunc(a)*MPfunc(1.0-a)>0.0) 
00790                       a=a/2.0;
00791               else
00792                       notConverge=false;
00793       } else
00794                     notConverge=false;
00795           }
00796         
00797             ao= Rmin/TR;
00798       if (ao >= 1.0) ao=0.999999; 
00799             notConverge=true;
00800             while(notConverge) {
00801       if (1.0-a != 1.0) {
00802               if (MPfunc(ao)*MPfunc(1.0-a)<0.0) 
00803                       ao=sqrt(ao);
00804               else
00805                       notConverge=false;
00806       } else
00807         notConverge=false;
00808       if(ao > 0.999999) notConverge=false;
00809           }
00810 
00811             notConverge=true;
00812             if (ao >= 1.0) ao=0.999999;
00813             while(notConverge) {
00814       double ao_last=ao;
00815 
00816             da=0.49*(1-ao);
00817       if (da>ao/10.0) da=ao/10.0;
00818       if (ao+da>=1.0) da = (1.0-ao)/10.0;
00819           
00820       double tempdenom = MPfunc(ao+da)-MPfunc(ao-da);
00821       if (tempdenom != 0.0){
00822               ao=ao-2*MPfunc(ao)*da/tempdenom;
00823         if (ao>0.99999999999) ao=0.99999999999;
00824         if (ao < 0.0) {
00825           ao = 0.0;
00826           notConverge=false;
00827         }
00828       }
00829   #ifdef _WIN32
00830       if(_fpclass(ao)< 8 || _fpclass(ao)==512) {
00831         opserr << "Stuck in infinite loop, return error, ReinforcingSteel::SetMP()\n";
00832         da=da/100.0;
00833         ao=ao_last;
00834         ao=ao-2*MPfunc(ao)*da/(MPfunc(ao+da)-MPfunc(ao-da));
00835         return -1;
00836       }
00837   #endif
00838       if(fabs(ao_last-ao)<0.0001) notConverge=false;
00839           }
00840             if (ao>0.99999999) ao=0.99999999;
00841     } else
00842       ao=0.99999999;
00843     TQ=(TEsec/TEa-ao)/(1-ao);
00844           double temp1 = pow(ao,TR);
00845     double temp2 = pow(1.0-temp1,1.0/TR);
00846           double b=temp2/ao;
00847           Tfch=Tfa+TEa/b*(Teb-Tea);
00848   }
00849   if(fabs(Teb-Tea)<1.0e-7)
00850     TQ = 1.0;
00851   return 0;
00852 }
00853 
00854 double
00855 ReinforcingSteel::MP_f(double e) {
00856   return Tfa+TEa*(e-Tea)*(TQ-(TQ-1.0)/pow(pow(fabs(TEa*(e-Tea)/(Tfch-Tfa)),TR)+1.0,1/TR));
00857 }
00858 
00859 double
00860 ReinforcingSteel::MP_E(double e) {
00861   if(TR>100.0 || e==Tea) {
00862     return TEa;
00863   } else {
00864     double Esec=(MP_f(e)-Tfa)/(e-Tea);
00865     return Esec-(Esec-TQ*TEa)/(pow(fabs(TEa*(e-Tea)/(Tfch-Tfa)),-TR)+1.0); 
00866   }
00867 }
00868 
00869 void 
00870 ReinforcingSteel::SetTRp(void)
00871 {
00872   TR=pow(fyp/Esp,RC1)*RC2*(1.0-RC3*(Teb-Tea));
00873 }
00874 
00875 void
00876 ReinforcingSteel::SetTRn(void)
00877 {
00878   TR=pow(fyp/Esp,RC1)*RC2*(1.0-RC3*(Tea-Teb));
00879 }
00880 
00881 void 
00882 ReinforcingSteel::SetTRp1(void)
00883 {
00884   TR=pow(fyp/Esp,RC1)*RC2*(1.0-RC3*(Teb-Tea));
00885 }
00886 
00887 void
00888 ReinforcingSteel::SetTRn1(void)
00889 {
00890   TR=pow(fyp/Esp,RC1)*RC2*(1.0-RC3*(Tea-Teb));
00891 }
00892 
00893 void
00894 ReinforcingSteel::SetPastCurve(int branch)
00895 {
00896         if(branch == 1)
00897                 TBranchMem=0;
00898         else
00899                 TBranchMem = (branch+1)/2;
00900   
00901         Tea   = Cea[TBranchMem];
00902   Teb   = Ceb[TBranchMem];
00903   Tfa   = Cfa[TBranchMem];
00904   Tfb   = Cfb[TBranchMem];
00905   TEa   = CEa[TBranchMem];
00906   TEb   = CEb[TBranchMem];
00907   TR    = CR [TBranchMem];
00908   Tfch  = Cfch[TBranchMem];
00909   TQ    = CQ [TBranchMem];
00910   TEsec = CEsec[TBranchMem];
00911 }
00912 /*****************************************************************************************/
00913 /***********************        Base Stress-Strain Relations         *********************/
00914 /*****************************************************************************************/
00915 double
00916 ReinforcingSteel::Backbone_f(double e) {
00917                 if(e<0.0)
00918                         return -Backbone_fNat(fabs(e));
00919                 else
00920                         return  Backbone_fNat(fabs(e));
00921 }
00922 
00923 double
00924 ReinforcingSteel::Backbone_fNat(double essp) {
00925         if(essp>eshpa) {
00926                 if(essp>esup)
00927                         return fsup + (essp-eshp)*Esup;
00928                 else {
00929       if (essp < eshp+0.0002)
00930                                 return (Eshpb-Eypp)*pow(essp-eshpa,2.0)/(2*(eshp+0.0002-eshpa))+ essp*Eypp + fint;
00931       else 
00932                                 return fshp + (essp-eshp)*Esup + (fsup-fshp)*(1.0-pow((esup-essp)/(esup-eshp),p));
00933                 }
00934   } else
00935     return essp * ((Esp - Eypp) / pow(1 + pow((Esp - Eypp) * essp / fint,10.0),0.1) + Eypp);
00936 }
00937 
00938 double
00939 ReinforcingSteel::Backbone_E(double e)
00940 {
00941         double essp  = fabs(e);
00942         
00943         if(essp<=eshpa)
00944                 return (Esp - Eypp) / pow(1.0 + pow((Esp - Eypp) * essp / fint,10.0),1.1) + Eypp;
00945         else {
00946                 if(essp>esup)
00947                         return Esup;
00948                 else {
00949       if (essp < eshp+0.0002)
00950                                 return (Eshpb-Eypp)*(essp-eshpa)/(eshp+0.0002-eshpa) + Eypp;
00951       else {
00952         //double temp1 = (fsup-fshp-(fsup-fshp)*(1.0-pow((esup-essp)/(esup-eshp),p)));
00953                                 return Eshp*pow((fsup-fshp-(fsup-fshp)*(1.0-pow((esup-essp)/(esup-eshp),p)))/(fsup-fshp),1.0-1.0/p)+Esup;
00954       }
00955                 }
00956         } 
00957 }
00958 
00959 /*****************************************************************************************/
00960 /***********************       Buckled Stress-Strain Relations       *********************/
00961 /*****************************************************************************************/
00962 
00963 double 
00964 ReinforcingSteel::Buckled_stress_Dhakal(double ess, double fss)
00965 {
00966   if (LDratio <= 0.0) return fss;
00967 
00968   double aveStress;
00969   double e_cross = Temax - fsup/Esp;
00970   double e=ess-e_cross;
00971 
00972   if(e < -eyp) {
00973             
00974                 double eStar=55.0-2.3*sqrt(fyp/Esp*2000)*LDratio;
00975                 if (eStar < 7.0) eStar=7.0;
00976                 eStar= -eStar*eyp;
00977           
00978                 double fStarL=Backbone_f(eStar);
00979                 double fStar=fStarL*beta*(1.1 - 0.016*sqrt(fyp/Esp*2000)*LDratio);
00980                 if (fStar > -0.2*fyp) fStar= -0.2*fyp;
00981     if (TBranchNum%4 > 1) {
00982                   if ((e< -eyp) && (e>=eStar)) {
00983                           aveStress = fss*(1.0-(1.0-fStar/fStarL)*(e+eyp)/(eStar+eyp));
00984                   } else if (e<eStar) {
00985                           aveStress = fss*(fStar-0.02*Esp*(e-eStar))/fStarL;
00986                           if (aveStress>-0.2*fyp) aveStress=-0.2*fyp;
00987                   }
00988                   return aveStress;
00989     } else {
00990       if (TBranchNum == 4 || TBranchNum == 5)
00991         BackStress = MP_f(e_cross-eyp);
00992 
00993       if ((e< -eyp) && (e>=eStar)) {
00994                           aveStress = Tfa*(1.0-(1.0-fStar/fStarL)*(e+eyp)/(eStar+eyp));
00995                   } else if (e<eStar) {
00996                           aveStress = Tfa*(fStar-0.02*Esp*(e-eStar))/fStarL;
00997                           if (aveStress>-0.2*fyp) aveStress=-0.2*fyp;
00998                   }
00999                   return BackStress - (BackStress-fss)*(BackStress-aveStress)/(BackStress-Tfa);
01000       //return Cfa[0]-aveStress/(BackStress-Cfa[0])*(fss-Cfa[0]);
01001     }
01002   } else {
01003           return fss;
01004   }     
01005 }
01006 
01007 double
01008 ReinforcingSteel::Buckled_stress_Gomes(double ess, double fss)
01009 {
01010         if (LDratio <= 0.0) return fss;
01011         
01012         double e_cross = Temax - fsup/Esp;
01013         if (ess>=e_cross) return fss;
01014 
01015         double beta=1.0;
01016         double gama = 0.1;
01017         double Dft = 0.25;
01018                 
01019         double fs_buck = beta*sqrt(32.0/(e_cross-ess))/(9.42477796076938*LDratio);
01020         double stress_diff=fabs(fs_buck-1.0);
01021         if (stress_diff <= Dft) beta = 1-gama*(Dft-stress_diff)/Dft;
01022 
01023         //double factor = ((1.0>fs_buck)?fs_buck:1.0)*beta + reduction)/(1.0+reduction);
01024         double factor = ((1.0>fs_buck)?fs_buck:1.0)*beta*(1-reduction)+reduction;
01025 
01026         double t_s_out = fsup*fsu_fraction-(factor+fsu_fraction)*(fsup*fsu_fraction-fss)/(1.0+fsu_fraction);
01027         return t_s_out;
01028 }
01029 
01030 double
01031 ReinforcingSteel::Buckled_mod_Gomes(double ess, double fss, double Ess)
01032 {
01033         double Etmp = Ess + (Buckled_stress_Gomes(ess+0.00005, fss)-Buckled_stress_Gomes(ess-0.00005, fss))/0.0001;
01034         return Etmp;
01035 }
01036 double
01037 ReinforcingSteel::Buckled_mod_Dhakal(double ess, double fss, double Ess)
01038 {
01039         double Etmp = Ess + (Buckled_stress_Dhakal(ess+0.00005, fss)-Buckled_stress_Dhakal(ess-0.00005, fss))/0.0001;
01040         return Etmp;
01041 }
01042 /*****************************************************************************************/
01043 /*************************        Branch Rule Definitions          ***********************/
01044 /*****************************************************************************************/
01045 
01046 int
01047 ReinforcingSteel::BranchDriver(int res)
01048 {
01049   switch(TBranchNum) {
01050   case  1:      res += Rule1(res);
01051                         break;
01052   case  2:      res += Rule2(res);
01053                         break;
01054   case  3:      res += Rule3(res);
01055                         break;
01056   case  4:      res += Rule4(res);
01057                         break;
01058   case  5:      res += Rule5(res);
01059                         break;
01060   case  6:      res += Rule6(res);
01061                         break;
01062   case  7:      res += Rule7(res);
01063                         break;
01064   case  8:      res += Rule8(res);
01065                         break;
01066   case -1:  TStress = 0.0;
01067                         TTangent = Esp/1000000.0;
01068                         break;
01069   case  0:  TStress = 0.0;
01070                         TTangent = Esp;
01071                         break;
01072   default:      switch(TBranchNum%4) {
01073                         case 0: res += Rule12(res);
01074                                 break;
01075                         case 1: res += Rule9(res);
01076                                 break;
01077                         case 2: res += Rule10(res);
01078                                 break;
01079                         case 3: res += Rule11(res);
01080                                         break;
01081                         }
01082                         break;
01083   }
01084   return res;
01085 }
01086 
01087 // Rule 1: Tension Envelope Branch
01088 int
01089 ReinforcingSteel::Rule1(int res)
01090 {
01091   double strain=TStrain-Teo_p;
01092   // check for load reversal
01093   if (TStrain-CStrain<0.0) {
01094           if (strain - eshp > -ZeroTol) {
01095             double emin;
01096             // reversal from strain hardening range
01097             Tea=CStrain;
01098             Temax=Tea-Teo_p;
01099             if (CStrain > TeAbsMax) TeAbsMax = CStrain;
01100 
01101             if(Temin>-eshp)
01102                     emin=-eshp-1.0E-14;
01103             else
01104                     emin=Temin;
01105 
01106             double ea   = Teo_p + eshp - fshp/Esp;
01107             double eb   = Teo_p + Temax - CStress/Esp;
01108             double krev = exp(-Temax/(5000*eyp*eyp));
01109             double eon = ea*krev+eb*(1.0-krev);
01110       if (eon > Teo_n) {
01111         emin-=(eon-Teo_n);
01112         Teo_n=eon;
01113       }
01114             Teb=Teo_n+emin;
01115 
01116             // set stress dependent curve parameters
01117             Tfa=CStress;
01118       Cfa[0]=CStress;
01119             TEa=ReturnSlope(Tea-Teo_n-Temin);
01120 
01121           updateHardeningLoaction(TeCumPlastic+Tea-emin-(Tfa-Backbone_f(emin))/Esp);
01122             Tfb= Backbone_f(emin);
01123             TEb= Backbone_E(emin);
01124                   TEsec = (Tfb-Tfa)/(Teb-Tea);
01125 
01126                   if(TEsec < TEb) {
01127                           Teo_n = (Tfb-Tfa)/TEb+Tea - emin;
01128                           Teb=Teo_n+emin;
01129                           TEsec = (Tfb-Tfa)/(Teb-Tea);
01130                           opserr << "Adjusted Compressive Curve anchor in ReinforcingSteel::Rule1()\n";
01131                   }
01132 
01133             SetTRn();
01134             res += SetMP();
01135           
01136             T_ePlastic[2]=0.0;
01137             TBranchNum=3;
01138             Rule3(res);   
01139           } else if (strain - eyp > -ZeroTol) {
01140             double emin;
01141             // Reversal from Yield Plateau
01142             Tea=CStrain;
01143             Temax=Tea-Teo_p;
01144             if (CStrain > TeAbsMax) TeAbsMax = CStrain;
01145 
01146             Tfa=CStress;
01147       Cfa[0]=CStress;
01148             TEa=ReturnSlope(Tea-Teo_n-Temin);
01149 
01150             double pr=(Temax-eyp)/(eshp-eyp);
01151             emin=pr*(eyp-eshp)-eyp;
01152             Teo_n=Tea-Tfa/Esp;
01153             Teb=Teo_n+emin;
01154           
01155             // set stress dependent curve parameters
01156       updateHardeningLoaction(TeCumPlastic+Tea-emin-(Tfa-Backbone_f(emin))/Esp);
01157             Tfb=Backbone_f(emin);
01158             TEb=(1.0/(1.0/Esp+pr*(1.0/Eshp - 1.0/Esp)));
01159           
01160             SetTRn();
01161             TEsec = (Tfb-Tfa)/(Teb-Tea);
01162             if (TEsec<TEb) TEb=TEsec*0.999;
01163             if (TEsec>TEa) TEa=TEsec*1.001;
01164             res += SetMP();
01165           
01166             T_ePlastic[2]=0.0;
01167             TBranchNum=3;
01168             Rule3(res);
01169           } else if (strain > -ZeroTol) {
01170             //if(Temax < strain) Temax=strain;
01171             TStress  = Backbone_f(strain);
01172             TTangent = Backbone_E(strain);
01173           } else {
01174             TBranchNum=2;
01175             Rule2(res);
01176           }
01177   } else {
01178     TStress  = Backbone_f(strain);
01179           TTangent = Backbone_E(strain);
01180           //if(Temin<0.0) {
01181             TFatDamage-=damage(T_ePlastic[0]);
01182       TeCumPlastic -= T_ePlastic[0];
01183             T_ePlastic[0]=getPlasticStrain(TStrain-TeAbsMin,TStress-Cfa[1]);
01184             TFatDamage+=damage(T_ePlastic[0]);
01185       TeCumPlastic += T_ePlastic[0];
01186           //}
01187   }
01188   return res;
01189 }
01190 
01191 // Rule 2: Compresion Envelope Branch
01192 int
01193 ReinforcingSteel::Rule2(int res)
01194 {
01195   double strain = TStrain-Teo_n;
01196  
01197   // check for load reversal
01198   if (TStrain-CStrain>0.0) {
01199         if (strain+eshp< ZeroTol) {
01200           double emax;
01201           // reversal from strain hardening range
01202           Tea=CStrain;
01203           Temin=Tea-Teo_n;
01204           if (CStrain < TeAbsMin) TeAbsMin = CStrain;
01205           
01206           if(Temax<eshp) 
01207                 emax=eshp+1.0E-14;
01208           else
01209                 emax=Temax;
01210 
01211           double ea   = Teo_n - eshp + fshp/Esp;
01212           double eb   = Teo_n + Temin - CStress/Esp;
01213           double krev = exp(Temin/(5000*eyp*eyp));
01214           double eop=ea*krev+eb*(1.0-krev);
01215     if (eop<Teo_p) {
01216       emax+=(Teo_p-eop);
01217       Teo_p=eop;
01218     }
01219       Teb=Teo_p+emax;
01220           
01221           // set stress dependent curve parameters 
01222           Tfa=CStress;
01223     Cfa[1]=CStress;
01224           TEa=ReturnSlope(Temax + Teo_p -Tea);
01225 
01226     updateHardeningLoaction(TeCumPlastic+emax-Tea-(Backbone_f(emax)-Tfa)/Esp);
01227           Tfb= Backbone_f(emax);
01228           TEb= Backbone_E(emax);
01229           
01230           SetTRp();
01231           TEsec = (Tfb-Tfa)/(Teb-Tea);
01232           res += SetMP();
01233                 
01234           T_ePlastic[2]=0.0;
01235           TBranchNum=4;
01236           Rule4(res);
01237 
01238         } else if (strain+eyp < ZeroTol) {
01239           double emax;
01240           // reversal form yield plateau
01241           Tea=CStrain;
01242           Temin=Tea-Teo_n;
01243           if (CStrain < TeAbsMin) TeAbsMin = CStrain;
01244 
01245           Tfa=CStress;
01246     Cfa[1]=CStress;
01247           TEa=ReturnSlope(Temax + Teo_p -Tea);
01248 
01249           double pr=(Temin+eyp)/(eyp-eshp);
01250           emax=eyp+pr*(eshp-eyp);
01251           Teo_p=Tea-Tfa/Esp;
01252           Teb=Teo_p+emax;
01253           
01254           // stress dependent curve parameters
01255     updateHardeningLoaction(TeCumPlastic+emax-Tea-(Backbone_f(emax)-Tfa)/Esp);
01256           Tfb= Backbone_f(emax);
01257           TEb=1.0/(1.0/Esp+pr*(1.0/Eshp - 1.0/Esp));
01258           
01259           SetTRp();
01260           TEsec = (Tfb-Tfa)/(Teb-Tea);
01261           if (TEsec<TEb) TEb=TEsec*0.999;
01262           if (TEsec>TEa) TEa=TEsec*1.001;
01263           res += SetMP();
01264           
01265           T_ePlastic[2]=0.0;
01266           TBranchNum=4;
01267           Rule4(res);
01268 
01269         } else if (strain<ZeroTol) {
01270           //if(Temin>strain) Temin=strain;
01271           TStress  = Backbone_f(strain);
01272           TTangent = Backbone_E(strain);
01273         } else {
01274           TBranchNum=1;
01275           Rule1(res);
01276         }
01277   } else {
01278     TStress  = Backbone_f(strain);
01279     TTangent = Backbone_E(strain);
01280           //if(Temax>0.0) {
01281             TFatDamage-=damage(T_ePlastic[1]);
01282       TeCumPlastic -= T_ePlastic[1];
01283             T_ePlastic[1]=getPlasticStrain(TeAbsMax-TStrain,Cfa[0]-TStress);
01284             TFatDamage+=damage(T_ePlastic[1]);
01285       TeCumPlastic += T_ePlastic[1];
01286           //}
01287   }
01288   return res;
01289 }
01290 
01291 // Rule 3: Unloading Reversal Branch
01292 int
01293 ReinforcingSteel::Rule3(int res)
01294 {
01295   if (TStrain-CStrain > 0.0) {  // reversal from brance 
01296         if(Temin > CStrain-Teo_n) Temin=CStrain-Teo_n;
01297 
01298         Tea=CStrain;
01299         double dere = Cea[2]-Tea-fyp/(1.2*Esp);
01300     if (dere<0.0)
01301           dere=0.0;
01302         else if (dere>fyp/3/Esp)
01303           dere=fyp/3/Esp;
01304         Teb=Teo_p+Temax+dere;
01305 
01306         Tfa=CStress;
01307         TEa=ReturnSlope(Cea[2]-CStrain);
01308 
01309   updateHardeningLoaction(TeCumPlastic+Teb-Tea-(Backbone_f(Teb-Teo_p)-Tfa)/Esp);
01310         Tfb= Backbone_f(Teb-Teo_p);
01311         TEb= Backbone_E(Teb-Teo_p);
01312 
01313         SetTRp();
01314         TEsec = (Tfb-Tfa)/(Teb-Tea);
01315         if (TEsec<TEb) TEb=TEsec*0.999;
01316         if (TEsec>TEa) TEa=TEsec*1.001;
01317         res += SetMP();
01318         #ifdef _WIN32
01319   if(_fpclass(TStress)< 8 || _fpclass(TStress)==512 || _fpclass(TTangent)< 8 || _fpclass(TTangent)==512) {
01320     opserr << "bad stress or tangent\n";
01321     return -1;
01322   }
01323 #endif
01324         T_ePlastic[3]=0.0;
01325         TBranchNum=5;
01326         Rule5(res);
01327   } else {
01328           if (TStrain - Teb <= ZeroTol) {
01329             T_ePlastic[1]=T_ePlastic[2];
01330             TBranchNum=2;
01331             Rule2(res);
01332           } else {
01333       TStress  = MP_f(TStrain);
01334             TTangent = MP_E(TStrain);
01335             TFatDamage -=damage(T_ePlastic[2]);
01336       TeCumPlastic -= T_ePlastic[2];
01337             T_ePlastic[2]=getPlasticStrain(TeAbsMax-TStrain,Tfa-TStress);
01338             TFatDamage +=damage(T_ePlastic[2]);
01339       TeCumPlastic += T_ePlastic[2];
01340           }
01341   }
01342   return res;
01343 }
01344 
01345 // Rule 4: Loading Reversal Branch
01346 int
01347 ReinforcingSteel::Rule4(int res)
01348 {
01349   if (TStrain-CStrain < 0.0) {
01350         if(Temax<CStrain-Teo_p) Temax=CStrain-Teo_p;
01351 
01352         Tea=CStrain;
01353         double dere = Cea[2]-Tea+fyp/(1.2*Esp);
01354     if (dere>0.0)
01355           dere=0.0;
01356         else if (dere<-fyp/3/Esp)
01357           dere=-fyp/3/Esp;
01358         Teb=Teo_n+Temin+dere;
01359 
01360         Tfa=CStress;
01361         TEa=ReturnSlope(CStrain-Cea[2]); 
01362 
01363   updateHardeningLoaction(TeCumPlastic+Tea-Teb-(Tfa-Backbone_f(Teb-Teo_n))/Esp);
01364         Tfb= Backbone_f(Teb-Teo_n);
01365         TEb= Backbone_E(Teb-Teo_n);
01366         
01367         SetTRn();
01368         TEsec = (Tfb-Tfa)/(Teb-Tea); 
01369         if (TEsec<TEb) TEb=TEsec*0.999;
01370         if (TEsec>TEa) TEa=TEsec*1.001;
01371         res += SetMP();
01372         
01373         T_ePlastic[3]=0.0;
01374         TBranchNum=6;
01375         Rule6(res);
01376   } else {
01377           if (TStrain - Teb >= -ZeroTol) {
01378             T_ePlastic[0]=T_ePlastic[2];
01379             TBranchNum=1;
01380             Rule1(res);
01381           } else {
01382             TStress  = MP_f(TStrain);
01383             TTangent = MP_E(TStrain);
01384             TFatDamage-=damage(T_ePlastic[2]);
01385       TeCumPlastic -= T_ePlastic[2];
01386             T_ePlastic[2]=getPlasticStrain(TStrain-TeAbsMin,TStress-Tfa);
01387             TFatDamage+=damage(T_ePlastic[2]);
01388       TeCumPlastic += T_ePlastic[2];
01389           }
01390   }
01391   return res;
01392 }
01393 
01394 // Rule 5: Loading Returning Branch
01395 int
01396 ReinforcingSteel::Rule5(int res)
01397 {
01398   if (TStrain-CStrain < 0.0) {
01399         rE1=0.0;
01400         rE2=0.0;
01401         
01402         Tea   = Ceb[3]*(CStrain-Cea[3])/(Ceb[3]-Cea[3]) + Cea[2]*(Ceb[3]-CStrain)/(Ceb[3]-Cea[3]);
01403         Teb   = Ceb[2];
01404         
01405   updateHardeningLoaction(TeCumPlastic+CStrain-Tea+(Backbone_f(Tea-Teo_p)-CStress)/Esp);
01406         Tfa   = Backbone_f(Tea-Teo_p);
01407         TEa   = CEa[2];
01408         
01409   updateHardeningLoaction(TeCumPlastic+CStrain-Teb-(CStress-Backbone_f(Teb-Teo_n))/Esp);
01410         Tfb   = Backbone_f(Teb-Teo_n);
01411         TEb   = Backbone_E(Teb-Teo_n);
01412 
01413         SetTRn();
01414         TEsec = (Tfb-Tfa)/(Teb-Tea);
01415         res += SetMP();
01416 
01417         double fb=MP_f(Cea[3]);
01418         double Eb=MP_E(Cea[3]);
01419         
01420         Tea=CStrain;
01421         Tfa=CStress;
01422         TEa=ReturnSlope(CStrain-Cea[3]);
01423         Teb=Cea[3];
01424         Tfb=fb;
01425         TEb=Eb;
01426 
01427         SetTRn();
01428         TEsec = (Tfb-Tfa)/(Teb-Tea);
01429         if (TEsec<TEb) TEb=TEsec*0.999;
01430         if (TEsec>TEa) TEa=TEsec*1.001;
01431         res += SetMP();
01432   
01433         T_ePlastic[4]=0.0;
01434         TBranchNum=7;
01435         Rule7(res);     
01436   } else {
01437           if (TStrain - Teb >= -ZeroTol) {
01438             TFatDamage-=damage(T_ePlastic[3]);
01439       TeCumPlastic -= T_ePlastic[3];
01440       double TempPStrain = getPlasticStrain(Teb-Tea,Tfb-Tfa);
01441             TFatDamage+=damage(TempPStrain);
01442       TeCumPlastic += TempPStrain;
01443             TBranchNum=1;
01444             Rule1(res);
01445           } else {
01446             TStress  = MP_f(TStrain);
01447             TTangent = MP_E(TStrain);
01448             TFatDamage-=damage(T_ePlastic[3]);
01449       TeCumPlastic -= T_ePlastic[3];
01450             T_ePlastic[3]=getPlasticStrain(TStrain-Tea,TStress-Tfa);
01451             TFatDamage+=damage(T_ePlastic[3]);
01452       TeCumPlastic += T_ePlastic[3];
01453           }
01454   }
01455   return res;
01456 }
01457 
01458 // Rule 6: Unloading Returning Branch
01459 int
01460 ReinforcingSteel::Rule6(int res)
01461 {
01462   if (TStrain-CStrain > 0.0) {  
01463         rE1=0.0;
01464         rE2=0.0;
01465 
01466         Tea   = Ceb[3]*(CStrain-Cea[3])/(Ceb[3]-Cea[3]) + Cea[2]*(Ceb[3]-CStrain)/(Ceb[3]-Cea[3]);
01467         Teb   = Ceb[2];
01468         
01469   updateHardeningLoaction(TeCumPlastic+Tea-CStrain+(CStress-Backbone_f(Tea-Teo_n))/Esp);
01470         Tfa   = Backbone_f(Tea-Teo_n);
01471         TEa   = CEa[2];
01472 
01473   updateHardeningLoaction(TeCumPlastic+Teb-CStrain-(Backbone_f(Teb-Teo_p)-CStress)/Esp);
01474         Tfb   = Backbone_f(Teb-Teo_p);
01475         TEb   = Backbone_E(Teb-Teo_p);
01476 
01477         SetTRp();
01478         TEsec = (Tfb-Tfa)/(Teb-Tea);
01479         res += SetMP();
01480 
01481         double fb=MP_f(Cea[3]);
01482         double Eb=MP_E(Cea[3]);
01483 
01484         Tea=CStrain;
01485         Tfa=CStress;
01486         TEa=ReturnSlope(Cea[3]-CStrain);
01487         Teb=Cea[3];
01488         Tfb=fb;
01489         TEb=Eb;  
01490 
01491         SetTRp();
01492         TEsec = (Tfb-Tfa)/(Teb-Tea);
01493         if (TEsec<TEb) TEb=TEsec*0.999;
01494         if (TEsec>TEa) TEa=TEsec*1.001;
01495         res += SetMP();
01496         
01497         T_ePlastic[4]=0.0;
01498         TBranchNum=8;
01499         Rule8(res);
01500   } else {
01501           if (TStrain - Teb <= ZeroTol) {
01502             TFatDamage-=damage(T_ePlastic[3]);
01503       TeCumPlastic -= T_ePlastic[3];
01504       double TempPStrain = getPlasticStrain(Tea-Teb,Tfa-Tfb);
01505             TFatDamage+=damage(TempPStrain);
01506       TeCumPlastic += TempPStrain;
01507             TBranchNum=2;
01508             Rule2(res);
01509           } else {
01510             TStress  = MP_f(TStrain);
01511             TTangent = MP_E(TStrain);
01512             TFatDamage-=damage(T_ePlastic[3]);
01513       TeCumPlastic -= T_ePlastic[3];
01514             T_ePlastic[3]=getPlasticStrain(Tea-TStrain,Tfa-TStress);
01515             TFatDamage+=damage(T_ePlastic[3]);
01516       TeCumPlastic += T_ePlastic[3];
01517           }
01518   }
01519   return res;
01520 }
01521 
01522 // Rule 7: Unloading First Transition Branch
01523 int
01524 ReinforcingSteel::Rule7(int res)
01525 {
01526   if (TStrain-CStrain > 0.0) {  
01527         SetPastCurve(TBranchNum-2);
01528         
01529         double fb=MP_f(Cea[4]);
01530         double Eb=MP_E(Cea[4]);
01531         
01532         Tea=CStrain;
01533         Tfa=CStress;
01534         TEa=ReturnSlope(Cea[4]-CStrain);
01535         Teb=Cea[4];
01536         Tfb=fb;
01537         TEb=Eb;
01538 
01539         SetTRp1();
01540         TEsec = (Tfb-Tfa)/(Teb-Tea);
01541         if (TEsec<TEb) TEb=TEsec*0.999;
01542         if (TEsec>TEa) TEa=TEsec*1.001;
01543         res += SetMP();
01544 
01545         re=Tea;
01546 
01547         T_ePlastic[5]=0.0;
01548         TBranchNum=9;
01549         Rule9(res);     
01550   } else {
01551           if (TStrain - Teb <= ZeroTol) {
01552             TFatDamage-=damage(T_ePlastic[4]);
01553       TeCumPlastic -= T_ePlastic[4];
01554       double TempPStrain = getPlasticStrain(Tea-Teb,Tfa-Tfb);
01555             TFatDamage+=damage(TempPStrain);
01556       TeCumPlastic += TempPStrain;
01557       double tempTeb = Teb;
01558 
01559             Tea   = Ceb[3]*(Tea-Cea[3])/(Ceb[3]-Cea[3]) + Cea[2]*(Ceb[3]-Tea)/(Ceb[3]-Cea[3]);
01560       Teb   = Ceb[2];
01561 
01562       updateHardeningLoaction(TeCumPlastic+tempTeb-Tea+(Backbone_f(Tea-Teo_p)-Tfb)/Esp);
01563             Tfa   = Backbone_f(Tea-Teo_p);
01564             TEa   = CEa[2];
01565 
01566       updateHardeningLoaction(TeCumPlastic+tempTeb-Teb-(Tfb-Backbone_f(Teb-Teo_n))/Esp);
01567             Tfb   = Backbone_f(Teb-Teo_n);
01568             TEb   = Backbone_E(Teb-Teo_n);
01569 
01570             SetTRn();
01571             TEsec = (Tfb-Tfa)/(Teb-Tea);
01572             res += SetMP();
01573 
01574             TBranchNum=3;
01575             Rule3(res);
01576           } else {
01577             TStress  = MP_f(TStrain);
01578             TTangent = MP_E(TStrain);
01579             TFatDamage-=damage(T_ePlastic[4]);
01580       TeCumPlastic -= T_ePlastic[4];
01581             T_ePlastic[4]=getPlasticStrain(Tea-TStrain,Tfa-TStress);
01582             TFatDamage+=damage(T_ePlastic[4]);
01583       TeCumPlastic += T_ePlastic[4];
01584           }
01585   }
01586   return res;
01587 }
01588 
01589 // Rule 8: Loading First Transition Branch
01590 int
01591 ReinforcingSteel::Rule8(int res)
01592 {
01593   if (TStrain-CStrain < 0.0) {
01594         SetPastCurve(TBranchNum-2);
01595         
01596         double fb=MP_f(Cea[4]);
01597         double Eb=MP_E(Cea[4]);
01598 
01599         Tea=CStrain;
01600         Tfa=CStress;
01601         TEa=ReturnSlope(CStrain-Cea[4]);
01602         Teb=Cea[4];
01603         Tfb=fb;
01604         TEb=Eb;  
01605 
01606         SetTRn1();
01607         TEsec = (Tfb-Tfa)/(Teb-Tea);
01608         if (TEsec<TEb) TEb=TEsec*0.999;
01609         if (TEsec>TEa) TEa=TEsec*1.001;
01610         res += SetMP();
01611         
01612         re=Tea;
01613 
01614         T_ePlastic[5]=0.0;
01615         TBranchNum=10;
01616         Rule10(res);
01617   } else {
01618           if (TStrain - Teb >= -ZeroTol) {
01619             TFatDamage-=damage(T_ePlastic[4]);
01620       TeCumPlastic -= T_ePlastic[4];
01621       double TempPStrain = getPlasticStrain(Teb-Tea,Tfb-Tfa);
01622             TFatDamage+=damage(TempPStrain);
01623       TeCumPlastic += TempPStrain;
01624           double tempTeb = Teb;
01625 
01626             Tea   = Ceb[3]*(Tea-Cea[3])/(Ceb[3]-Cea[3]) + Cea[2]*(Ceb[3]-Tea)/(Ceb[3]-Cea[3]);
01627             Teb   = Ceb[2];
01628 
01629       updateHardeningLoaction(TeCumPlastic+Tea-tempTeb+(Tfb-Backbone_f(Tea-Teo_n))/Esp);
01630             Tfa   = Backbone_f(Tea-Teo_n);
01631             TEa   = CEa[2];
01632 
01633       updateHardeningLoaction(TeCumPlastic+Teb-tempTeb-(Backbone_f(Teb-Teo_p)-Tfb)/Esp);
01634             Tfb   = Backbone_f(Teb-Teo_p);
01635             TEb   = Backbone_E(Teb-Teo_p);
01636 
01637             SetTRp();
01638             TEsec = (Tfb-Tfa)/(Teb-Tea);
01639             res += SetMP();
01640           
01641             TBranchNum=4;
01642             Rule4(res);
01643           } else {
01644             TStress  = MP_f(TStrain);
01645             TTangent = MP_E(TStrain);
01646             TFatDamage-=damage(T_ePlastic[4]);
01647       TeCumPlastic -= T_ePlastic[4];
01648             T_ePlastic[4]=getPlasticStrain(TStrain-Tea,TStress-Tfa);
01649             TFatDamage+=damage(T_ePlastic[4]);
01650       TeCumPlastic += T_ePlastic[4];
01651           }
01652   }
01653   return res;
01654 }
01655 
01656 // Rule 9: Loading Second Transition Branch
01657 int
01658 ReinforcingSteel::Rule9(int res)
01659 {
01660   if (TStrain-CStrain < 0.0) {
01661         double eb = Tea;
01662         if (TBranchNum+4<=LastRule_RS) re=Tea;
01663         SetPastCurve(TBranchNum-2);
01664         
01665         // set new curve 
01666         double fb=MP_f(re);
01667         double Eb=MP_E(re);
01668         Tea=CStrain;
01669         Tfa=CStress;
01670         TEa=ReturnSlope(CStrain-eb);;
01671         Teb=re;
01672         Tfb=fb;
01673         TEb=Eb;
01674         SetTRn1();
01675         TEsec = (Tfb-Tfa)/(Teb-Tea);
01676         if (TEsec<TEb) TEb=TEsec*0.999;
01677         if (TEsec>TEa) TEa=TEsec*1.001;
01678         res += SetMP();
01679 
01680         TBranchNum+=2;
01681         TBranchMem = (TBranchNum+1)/2;
01682         T_ePlastic[TBranchMem]=0.0;
01683         Rule11(res);
01684   } else {
01685           if (TStrain - Teb >= -ZeroTol) {
01686                   TBranchMem = (TBranchNum+1)/2;
01687             TFatDamage -=damage(T_ePlastic[TBranchMem]);
01688       TeCumPlastic -= T_ePlastic[TBranchMem];
01689       double TempPStrain = getPlasticStrain(Teb-Tea,Tfb-Tfa);
01690             TFatDamage +=damage(TempPStrain);
01691       TeCumPlastic += TempPStrain;
01692                   TBranchNum-=4;
01693             SetPastCurve(TBranchNum);
01694             if (TBranchNum==5)
01695                   Rule5(res);
01696             else
01697                   Rule9(res);
01698           } else {
01699       TStress  = MP_f(TStrain);
01700             TTangent = MP_E(TStrain);
01701                   TBranchMem = (TBranchNum+1)/2;
01702             TFatDamage -=damage(T_ePlastic[TBranchMem]);
01703       TeCumPlastic -= T_ePlastic[TBranchMem];
01704             T_ePlastic[TBranchMem]=getPlasticStrain(TStrain-Tea,TStress-Tfa);
01705             TFatDamage +=damage(T_ePlastic[TBranchMem]);
01706       TeCumPlastic += T_ePlastic[TBranchMem];
01707           }
01708   }
01709   return res;
01710 }
01711 
01712 // Rule 10: Unloading Second Transition Branch
01713 int
01714 ReinforcingSteel::Rule10(int res)
01715 {
01716   if (TStrain-CStrain > 0.0) {  
01717         double eb = Tea;
01718         if (TBranchNum+4<=LastRule_RS)
01719           re=Tea;
01720         
01721         SetPastCurve(TBranchNum-2);
01722 
01723         // set new curve
01724         double fb=MP_f(re);
01725         double Eb=MP_E(re);
01726         Tea=CStrain;
01727         Tfa=CStress;
01728         TEa=ReturnSlope(eb-CStrain); 
01729         Teb=re;
01730         Tfb=fb;
01731         TEb=Eb;  
01732         SetTRp1();
01733         TEsec = (Tfb-Tfa)/(Teb-Tea);
01734         if (TEsec<TEb) TEb=TEsec*0.999;
01735         if (TEsec>TEa) TEa=TEsec*1.001;
01736         res += SetMP();
01737 
01738         TBranchNum+=2;
01739         TBranchMem = (TBranchNum+1)/2;
01740         T_ePlastic[TBranchMem]=0.0;
01741         Rule12(res);
01742   } else {
01743           if (TStrain - Teb <= ZeroTol) {
01744                   TBranchMem = (TBranchNum+1)/2;
01745             TFatDamage-=damage(T_ePlastic[TBranchMem]);
01746       TeCumPlastic -= T_ePlastic[TBranchMem];
01747       double TempPStrain = getPlasticStrain(Tea-Teb,Tfa-Tfb);
01748             TFatDamage+=damage(TempPStrain);
01749       TeCumPlastic += TempPStrain;
01750 
01751                   TBranchNum-=4;
01752             SetPastCurve(TBranchNum);
01753             if (TBranchNum==6)
01754                   Rule6(res);
01755             else
01756                   Rule10(res);
01757           } else {
01758             TStress  = MP_f(TStrain);
01759             TTangent = MP_E(TStrain);
01760                   TBranchMem = (TBranchNum+1)/2;
01761             TFatDamage  -=damage(T_ePlastic[TBranchMem]);
01762       TeCumPlastic -= T_ePlastic[TBranchMem];
01763             T_ePlastic[TBranchMem]=getPlasticStrain(Tea-TStrain,Tfa-TStress);
01764             TFatDamage  +=damage(T_ePlastic[TBranchMem]);
01765       TeCumPlastic += T_ePlastic[TBranchMem];
01766           }
01767   }
01768   return res;
01769 }
01770 
01771 // Rule 11: Unloading Third Transition Branch
01772 int
01773 ReinforcingSteel::Rule11(int res)
01774 {
01775   if (TStrain-CStrain > 0.0) {  
01776         // reset past curve
01777         double eb=Tea;
01778         if(TBranchNum+2>LastRule_RS) {
01779                 TBranchMem = (TBranchNum+1)/2;
01780           eb=Cea[TBranchMem-2];
01781           SetPastCurve(TBranchNum-6);
01782         } else {
01783           SetPastCurve(TBranchNum-2);
01784         }
01785         double fb=MP_f(eb);
01786         double Eb=MP_E(eb);
01787         Tea=CStrain;
01788         Tfa=CStress;
01789         TEa=ReturnSlope(eb-CStrain);
01790         Teb=eb;
01791         Tfb=fb;
01792         TEb=Eb;
01793         SetTRp1();
01794         TEsec = (Tfb-Tfa)/(Teb-Tea);
01795         if (TEsec<TEb) TEb=TEsec*0.999;
01796         if (TEsec>TEa) TEa=TEsec*1.001;
01797         res += SetMP();
01798         
01799         if(TBranchNum+2>LastRule_RS)
01800           TBranchNum-=2;
01801         else
01802           TBranchNum+=2;
01803 
01804         TBranchMem = (TBranchNum+1)/2;
01805         T_ePlastic[TBranchMem]=0.0;
01806         Rule9(res);     
01807   } else {
01808           if (TStrain - Teb <= ZeroTol) {
01809                   TBranchMem = (TBranchNum+1)/2;
01810             TFatDamage-=damage(T_ePlastic[TBranchMem-2]);
01811       TeCumPlastic -= T_ePlastic[TBranchMem-2];
01812       double TempPStrain = getPlasticStrain(Tea-Teb,Tfa-Tfb);
01813             TFatDamage+=damage(TempPStrain);
01814       TeCumPlastic += TempPStrain;
01815                   TBranchNum-=4;
01816             SetPastCurve(TBranchNum);
01817             if (TBranchNum==7)
01818                   Rule7(res);
01819             else
01820                   Rule11(res);
01821           } else {
01822             TStress  = MP_f(TStrain);
01823             TTangent = MP_E(TStrain);
01824                   TBranchMem = (TBranchNum+1)/2;
01825             TFatDamage-=damage(T_ePlastic[TBranchMem]);
01826       TeCumPlastic -= T_ePlastic[TBranchMem];
01827             T_ePlastic[TBranchMem]=getPlasticStrain(Tea-TStrain,Tfa-TStress);
01828             TFatDamage+=damage(T_ePlastic[TBranchMem]);
01829       TeCumPlastic += T_ePlastic[TBranchMem];
01830           }
01831   }
01832   return res;
01833 }
01834 
01835 // Rule 12: Loading Third Transition Branch
01836 int
01837 ReinforcingSteel::Rule12(int res)
01838 {
01839   if (TStrain-CStrain < 0.0) {
01840         // reset past curve
01841         double eb=Tea;
01842         if(TBranchNum+2>LastRule_RS) {
01843                 TBranchMem = (TBranchNum+1)/2;
01844           eb=Cea[TBranchMem-2];
01845           SetPastCurve(TBranchNum-6);
01846         } else {
01847           SetPastCurve(TBranchNum-2);
01848         }
01849 
01850         double fb=MP_f(eb);
01851         double Eb=MP_E(eb);
01852         Tea=CStrain;
01853         Tfa=CStress;
01854         TEa=ReturnSlope(CStrain-eb);
01855         Teb=eb;
01856         Tfb=fb;
01857         TEb=Eb; 
01858         SetTRn1();
01859         TEsec = (Tfb-Tfa)/(Teb-Tea);
01860         if (TEsec<TEb) TEb=TEsec*0.999;
01861         if (TEsec>TEa) TEa=TEsec*1.001;
01862         res += SetMP();
01863 
01864         if(TBranchNum+2>LastRule_RS)
01865           TBranchNum-=2;
01866         else
01867           TBranchNum+=2;
01868 
01869         TBranchMem = (TBranchNum+1)/2;
01870         T_ePlastic[TBranchMem]=0.0;
01871         Rule10(res);
01872   } else {
01873           if (TStrain - Teb >= -ZeroTol) {
01874                   TBranchMem = (TBranchNum+1)/2;
01875             TFatDamage-=damage(T_ePlastic[TBranchMem-2]);
01876       TeCumPlastic -= T_ePlastic[TBranchMem-2];
01877       double TempPStrain = getPlasticStrain(Teb-Tea,Tfb-Tfa);
01878             TFatDamage+=damage(TempPStrain);
01879       TeCumPlastic += TempPStrain;
01880                   TBranchNum-=4;
01881             SetPastCurve(TBranchNum);
01882             if (TBranchNum==8)
01883                   Rule8(res);
01884             else
01885                   Rule12(res);
01886           } else {
01887       TStress  = MP_f(TStrain);
01888             TTangent = MP_E(TStrain);
01889                   TBranchMem = (TBranchNum+1)/2;
01890             TFatDamage-=damage(T_ePlastic[TBranchMem]);
01891       TeCumPlastic -= T_ePlastic[TBranchMem];
01892             T_ePlastic[TBranchMem]=getPlasticStrain(TStrain-Tea,TStress-Tfa);
01893             TFatDamage+=damage(T_ePlastic[TBranchMem]);
01894       TeCumPlastic += T_ePlastic[TBranchMem];
01895           }
01896   }
01897   return res;
01898 }
01899 
01900 
01901 
01902 /*****************************************************************************************/
01903 /********        Strength and stiffness degradation including buckling         ***********/
01904 /*****************************************************************************************/
01905 double
01906 ReinforcingSteel::getPlasticStrain(double ehalf, double stressAmp){
01907   double ehalfPlastic = fabs(ehalf)-fabs(stressAmp/Esp);
01908   if(ehalfPlastic>0.0)
01909     return ehalfPlastic;
01910   else
01911     return 0.0;
01912 }
01913 double
01914 ReinforcingSteel::damage(double ehalfPlastic){
01915     return pow(ehalfPlastic/Fat1,Fat2);
01916 }
01917 
01918 double
01919 ReinforcingSteel::scalefactor()
01920 {
01921   if(theBarFailed) return 0.0;
01922 
01923   double sf=1.0-Deg1*TFatDamage;
01924   if(TFatDamage>1.0) sf-= (TFatDamage-1.0)/0.04;
01925 
01926   if(sf<0.0) {
01927     theBarFailed=1;
01928     TBranchNum = -1;
01929     opserr << "-------------------------Bar failed---------------------------\n";
01930                 return 0.0;
01931   }     else {
01932                 return sf;
01933   }
01934 }
01935 
01936 double
01937 ReinforcingSteel::ReturnSlope(double dea)
01938 {
01939   if (TeAbsMax > -TeAbsMin) //Dodd and Cooke
01940     return Esp*(0.82+1.0/(5.55+1000.0*TeAbsMax));
01941   else
01942     return Esp*(0.82+1.0/(5.55-1000.0*TeAbsMin));
01943   //return Esp;
01944 
01945 }

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