YS_Evolution2D.cpp

Go to the documentation of this file.
00001 // YS_Evolution2D.cpp: implementation of the YS_HardeningModel class.
00002 //
00004 
00005 #include "YS_Evolution2D.h"
00006 #include <YieldSurface_BC.h>
00007 #include <math.h>
00008 #include <MaterialResponse.h>
00009 
00010 #define evolDebug  0
00011 #define modifDebug 0
00012 #define transDebug 0
00013 
00014 Vector YS_Evolution2D::v2(2);
00015 
00017 // Construction/Destruction
00019 
00020 YS_Evolution2D::YS_Evolution2D(int tag, int classtag,
00021                                                            double min_iso_factor,
00022                                double iso_ratio, double kin_ratio)
00023   :YS_Evolution(tag, classtag, iso_ratio, kin_ratio, 2),
00024    minIsoFactor(min_iso_factor), softening(false)
00025 {
00026 //      sumPlasticDeformX = 0;
00027 //      sumPlasticDeformX_hist = 0;
00028 //      sumPlasticDeformY = 0;
00029 //      sumPlasticDeformY_hist = 0;
00030         isotropicFactor(0)   = 1;
00031         isotropicFactor(1)   = 1;
00032     
00033         isotropicFactor_hist(0) = 1;
00034         isotropicFactor_hist(1) = 1;
00035 
00036 }
00037 
00038 YS_Evolution2D::~YS_Evolution2D()
00039 {
00040 
00041 }
00042 
00043 int YS_Evolution2D::commitState()
00044 {
00045         this->YS_Evolution::commitState();
00046         
00047 //      sumPlasticDeformX_hist = sumPlasticDeformX;
00048 //      sumPlasticDeformY_hist = sumPlasticDeformY;
00049         freezeEvolution = false;
00050         return 0;
00051 }
00052 
00053 int YS_Evolution2D::update(int flag)
00054 {       
00055         isotropicFactor   =  isotropicFactor_hist;
00056         translate     =  translate_hist;
00057         
00058         return 0;
00059 }
00060 
00061 int YS_Evolution2D::revertToLastCommit(void)
00062 {
00063         this->YS_Evolution::revertToLastCommit();
00064 //      sumPlasticDeformX =  sumPlasticDeformX_hist;
00065 //      sumPlasticDeformY =  sumPlasticDeformY_hist;
00066         return 0;
00067 }
00068 
00069 /*
00070 void YS_Evolution2D::toDeformedCoord(double &x, double &y)
00071 {
00072 double x1 = x, y1 = y;
00073 double  translateX = translate(0);
00074 double  translateY = translate(1);
00075 
00076         if(transDebug)
00077         {
00078                 opserr << "\nYieldSurfaceBC2D::toDeformedCoord(double &x, double &y)\n";
00079                 opserr << "Original - fx = " << x1 << ",\tfy = " << y1 << "\n";
00080         }
00081 
00082         // isotropic
00083     x1 = x1*isotropicFactor(0);
00084     y1 = y1*isotropicFactor(1);
00085 
00086         // kinmatic
00087     x1 += translateX;
00088     y1 += translateY;
00089 
00090         x = x1;
00091         y = y1;
00092 
00093         if(transDebug)
00094         {
00095                 opserr << "Deformed - fx = " << x << ",\tfy = " << y << "\n";
00096                 opserr << "isotropicFactor =  " <<  isotropicFactor << "\n";
00097                 opserr << "translateX       = " << translateX << ",\ttranslateY = " << translateY << "\n";
00098         }
00099 }
00100 */
00101 
00102 /*
00103 void YS_Evolution2D::toOriginalCoord(double &x, double &y)
00104 {
00105 double  translateX = translate(0);
00106 double  translateY = translate(1);
00107 
00108         if(transDebug)
00109         {
00110                 opserr << "\nYieldSurfaceBC2D::toOriginalCoord(double &x, double &y)\n";
00111                 opserr << "Deformed - fx = " << x << ",\tfy = " << y << "\n";
00112                 opserr << "isotropicFactor =  " <<  isotropicFactor << "\n";
00113                 opserr << "translateX       = " << translateX << ",\ttranslateY = " << translateY << "\n";
00114         }
00115 
00116         // kinematic
00117     x -= translateX;
00118     y -= translateY;
00119 
00120         // isotropic
00121         x = x/isotropicFactor(0);
00122     y = y/isotropicFactor(1);
00123 
00124         if(transDebug)
00125         {
00126                 opserr << "Original - fx = " << x << ",\tfy = " << y << "\n";
00127                 opserr << "\a";
00128         }
00129 }
00130 */
00131 
00132 int YS_Evolution2D::evolveSurface(YieldSurface_BC *ys, double lamda, 
00133                                   Vector &G, Vector &F_Surface, int flag)
00134 {
00135         // first and fore-most:
00136         tmpYSPtr = ys;
00137 //      int loc = ys->ele_Location;
00138 //      opserr << " evolve surface [" << opserr << loc << "]\n";
00139 //      opserr << *ys;
00140 
00141         //freezeEvolution = false; -> have set this in commitState -> don't change
00142         // first save the vlues on stack
00143         // static vectors could get reallocated elsewhere
00144         Vector f_sur(2);
00145                 f_sur(0) = F_Surface(0);
00146                 f_sur(1) = F_Surface(1);
00147         Vector gl(2);
00148                 gl(0) = G(0);
00149                 gl(1) = G(1);
00150         
00151         setTrialPlasticStrains(lamda, f_sur, gl);
00152         if(freezeEvolution)
00153                 return 0;
00154 
00155         //deformable = true;
00156         
00157         double kinX = gl(0)*getKinPlasticStiffness(0)/ys->getCap(0);
00158         double kinY = gl(1)*getKinPlasticStiffness(1)/ys->getCap(1);
00159         double isoX = gl(0)*getIsoPlasticStiffness(0)/ys->getCap(0);
00160         double isoY = gl(1)*getIsoPlasticStiffness(1)/ys->getCap(1);
00161 
00162         // opserr << "isoX = " << isoX << ", isoY = " << isoY << endln;
00163         
00164         // kinematic hardening
00165         double lamda_kin = kinematicRatio*lamda;        
00166         double dfx_kin = lamda_kin*kinX;
00167         double dfy_kin = lamda_kin*kinY;
00168 
00169         // isotropic hardening
00170         double lamda_iso = isotropicRatio*lamda;
00171         double dfx_iso = lamda_iso*isoX;
00172         double dfy_iso = lamda_iso*isoY;
00173 
00174         double dfx_total =  dfx_kin + dfx_iso;
00175         double dfy_total =  dfy_kin + dfy_iso;
00176         
00177         double fx_new = f_sur(0) + dfx_total;
00178         double fy_new = f_sur(1) + dfy_total;
00179 
00180         double fx_iso_new = f_sur(0) + dfx_iso;
00181         double fy_iso_new = f_sur(1) + dfy_iso;
00182 
00183     // check 1: for cross-over -> same as: |F_sur + df| > |F_sur| && Kp < 0
00184         // sign change
00185 
00186         //cout << "f_sur = " << f_sur(0) << ", f new = " << fx_new << endln;
00187         bool ys_harden = true;
00188         toOriginalCoord(fx_new, fy_new);
00189         if(ys->getDrift(fx_new, fy_new) < 0)
00190                 ys_harden = false;
00191 
00192         bool iso_harden = true;
00193         toOriginalCoord(fx_iso_new, fy_iso_new);
00194         if(ys->getDrift(fx_iso_new, fy_iso_new) < 0)
00195                 iso_harden = false;
00196 
00197         
00198         if(!ys_harden && (sign(f_sur(0)) != sign(fx_new))) // risky to use for fy -> P
00199         {
00200           // need to fix this
00201                 dfx_iso = 0.0;
00202                 dfx_kin = 0.0;
00203             opserr << "Condition happened..\n";
00204             opserr << *ys;          
00205                 freezeEvolution = true;
00206             
00207             //cerr << "F_Surface(0) = " << f_sur(0) << ", F_New = " << fx_new << endln;
00208             //cin.get();
00209 
00210                 // if(!deformable) //nothing to do
00211                 // return anyway for now
00212                 {
00213 
00214                         return 0;
00215 //                      dfy_iso = 0.0;
00216 //                      dfy_kin = 0.0;
00217                 }
00218         }
00219                 
00220         if(!ys_harden && (kinematicRatio != kinematicRatio_shrink)
00221                                   && (isotropicRatio != isotropicRatio_shrink)  )
00222         {
00223                 double kinRatio = kinematicRatio_shrink;
00224                 double isoRatio = isotropicRatio_shrink;
00225                 // here it might be a good idea to redo the above step
00226                 // will not make difference for peak-oriented but for
00227                 // others may cause convergence problems  (Kp_iso != Kp_kin)
00228                 // what if its not softening anymore?
00229                 lamda_iso = isoRatio*lamda;
00230                 dfx_iso = lamda_iso*isoX;
00231                 dfy_iso = lamda_iso*isoY;
00232                 lamda_kin = kinRatio*lamda;
00233                 dfx_kin = lamda_kin*kinX;
00234                 dfy_kin = lamda_kin*kinY;
00235 
00236                 dfx_total =  dfx_kin + dfx_iso;
00237                 dfy_total =  dfy_kin + dfy_iso;
00238                 fx_new = f_sur(0) + dfx_total;
00239                 fy_new = f_sur(1) + dfy_total;
00240 
00241                 toOriginalCoord(fx_new, fy_new);
00242                 if(ys->getDrift(fx_new, fy_new) > 0)
00243                 {
00244                         opserr << "oops: YS_Evolution2D::evolveSurface() - softens->hardens\n";
00245                         ys_harden = true;
00246                 }
00247         }
00248 
00249 
00250         // Update the isotropicFactor vector
00251         /*
00252         // This way does not work!
00253         int x_grow = 1;
00254         if(fabs(f_sur(0) + dfx_iso) < fabs(f_sur(0)))
00255         {
00256                 // opserr << "Softening!\n";
00257                 x_grow = -1;
00258         }
00259         
00260         int y_grow = 1;
00261         if(fabs(f_sur(1) + dfy_iso) < fabs(f_sur(1)))
00262                 y_grow = -1;
00263         */
00264 
00265         int x_grow = 1, y_grow = 1;
00266         if(getIsoPlasticStiffness(0) < 0)
00267                 x_grow = -1;
00268         if(getIsoPlasticStiffness(1) < 0)
00269                 y_grow = -1;
00270         
00271         if(evolDebug)
00272         {
00273                 opserr << "F_Surface Vector: " << f_sur;
00274                 opserr << "Fx_new = " << fx_new << ", Fy_new = " << fy_new << endln;
00275                 opserr << "Gradient: " << gl;
00276             opserr << "KpxIso = " << getIsoPlasticStiffness(0) << ", KpyIso = " <<  getIsoPlasticStiffness(1) << endln;
00277             opserr << "F_surf(1) = " << f_sur(1) << ", dfy_iso = " << dfy_iso << endln;
00278             opserr << "x_grow = " <<  x_grow << ", y_grow = " <<  y_grow << endln;
00279             opserr << "---------------------------------------------------------" << endln;
00280      }
00281 
00282         Vector mgnf(2);
00283         mgnf = isotropicFactor_hist;
00284         if(flag==1)
00285                 mgnf = isotropicFactor;
00286         Vector delMag(2);
00287         
00288         if(deformable)
00289         {
00290 
00291                 delMag(0) = x_grow*fabs(dfx_iso);
00292                 delMag(1) = y_grow*fabs(dfy_iso);
00293         }
00294         else
00295         {
00296                 double dR = sqrt(dfx_iso*dfx_iso + dfy_iso*dfy_iso);
00297                 if(!iso_harden)
00298                 dR = -1*dR;
00299                 delMag(0) = dR;
00300                 delMag(1) = dR;
00301         }
00302 
00303         Vector isoFact = mgnf + delMag;
00304 
00305         //check 2: For min isotropic factor
00306          if( (isotropicFactor(0) + delMag(0)) <= minIsoFactor)
00307         {
00308                 delMag(0) = 0.0;
00309                 dfx_kin = 0.0;
00310         freezeEvolution = true;
00311                 if(!deformable)// nothing to do
00312                         return 0;
00313         }
00314         if( (isotropicFactor(1) + delMag(1)) <= minIsoFactor)
00315         {
00316                 delMag(1) = 0.0;
00317                 dfy_kin = 0.0;
00318                 freezeEvolution = true;
00319 
00320                 if(!deformable)
00321                         return 0;
00322         }
00323 
00324         // update the translation vector
00325         double fx_aim = f_sur(0) + dfx_kin;
00326         double fy_aim = f_sur(1) + dfy_kin;
00327 
00328     //cout << "YS_Evolution2D - F_Surface = " << F_Surface;
00329 
00330         toOriginalCoord(fx_aim, fy_aim);
00331         Vector f_aim(2);
00332         f_aim(0) = fx_aim;
00333         f_aim(1) = fy_aim;
00334         v2 = getEvolDirection(f_aim);
00335 
00336         Vector df_kin = ys->translationTo(f_aim, v2);
00337         // correct for isotropic factor
00338         Vector trans(2);
00339         trans = translate_hist;
00340         if(flag==1)
00341                 trans = translate;
00342 
00343     // Update the quantities
00344         translate(0) = trans(0) + df_kin(0)*isotropicFactor(0);
00345         translate(1) = trans(1) + df_kin(1)*isotropicFactor(1);
00346         isotropicFactor = mgnf + delMag;
00347 
00348         return 0;
00349 }
00350 
00351 int YS_Evolution2D::displaySelf(Renderer &theViewer, int displayMode, float fact)
00352 {
00353         return -1;
00354 }
00355         
00356 Response* YS_Evolution2D::setResponse(char **argv, int argc, Information &matInfo)
00357 {
00358         return 0;
00359 /*
00360 UniaxialMaterial *mat;
00361 int id0 = 0;
00362 
00363         if(strcmp(argv[1],"materialX") == 0)
00364         {
00365                 mat = kpMatX;
00366                 id0 = 0;
00367         }
00368         else if (strcmp(argv[1],"materialY") == 0)
00369         {
00370                 mat = kpMatY;
00371                 id0 = 3;
00372         }
00373         else
00374                 return 0; // for now
00375 
00376 
00377         // responseIds from 1 - 3 for matX, 4 - 6 for matY
00378     // stress
00379     if (strcmp(argv[0],"stress") == 0)
00380                 return new MaterialResponse(mat, id0+1, mat->getStress());
00381 
00382     // tangent
00383     else if (strcmp(argv[0],"tangent") == 0)
00384                 return new MaterialResponse(mat, id0+2, mat->getTangent());
00385 
00386     // strain
00387         else if (strcmp(argv[0],"strain") == 0)
00388                 return new MaterialResponse(mat, id0+3, mat->getStrain());
00389 
00390     // otherwise unknown
00391     else
00392                 return 0;
00393         */      
00394 }
00395 
00396 int YS_Evolution2D::getResponse(int responseID, Information &matInfo)
00397 {
00398         return 0;
00399   /*
00400   // each subclass must implement its own stuff
00401   switch (responseID) {
00402     case 1:
00403       matInfo.setDouble(kpMatX->getStress());
00404       break;
00405 
00406     case 2:
00407       matInfo.setDouble(kpMatX->getTangent());
00408       break;
00409 
00410     case 3:
00411       matInfo.setDouble(kpMatX->getStrain());
00412       break;
00413 
00414     case 4:
00415       matInfo.setDouble(kpMatY->getStress());
00416       break;
00417 
00418     case 5:
00419       matInfo.setDouble(kpMatY->getTangent());
00420       break;
00421 
00422     case 6:
00423       matInfo.setDouble(kpMatY->getStrain());
00424       break;
00425 
00426     default:
00427       return -1;
00428   }
00429 
00430   return 0;
00431   */
00432 }
00433 
00434 

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