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

J2Plasticity.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 ** ****************************************************************** */
00015                                                                         
00016 // $Revision: 1.2 $
00017 // $Date: 2001/05/18 05:33:18 $
00018 // $Source: /usr/local/cvs/OpenSees/SRC/material/nD/J2Plasticity.cpp,v $
00019 
00020 // Written: Ed "C++" Love
00021 //
00022 // J2 isotropic hardening material class
00023 // 
00024 //  Elastic Model
00025 //  sigma = K*trace(epsilion_elastic) + (2*G)*dev(epsilon_elastic)
00026 //
00027 //  Yield Function
00028 //  phi(sigma,q) = || dev(sigma) ||  - sqrt(2/3)*q(xi) 
00029 //
00030 //  Saturation Isotropic Hardening with linear term
00031 //  q(xi) = simga_infty + (sigma_0 - sigma_infty)*exp(-delta*xi) + H*xi 
00032 //
00033 //  Flow Rules
00034 //  \dot{epsilon_p} =  gamma * d_phi/d_sigma
00035 //  \dot{xi}        = -gamma * d_phi/d_q 
00036 //
00037 //  Linear Viscosity 
00038 //  gamma = phi / eta  ( if phi > 0 ) 
00039 //
00040 //  Backward Euler Integration Routine 
00041 //  Yield condition enforced at time n+1 
00042 //
00043 //  set eta := 0 for rate independent case
00044 //
00045 
00046 #include <J2Plasticity.h>
00047 #include <J2PlaneStress.h>
00048 #include <J2PlaneStrain.h>
00049 #include <J2AxiSymm.h>
00050 #include <J2PlateFiber.h>
00051 #include <J2ThreeDimensional.h> 
00052 
00053 //this is mike's problem
00054 Tensor J2Plasticity :: rank2(2, def_dim_2, 0.0 ) ;
00055 Tensor J2Plasticity :: rank4(2, def_dim_2, 0.0 ) ;
00056 
00057 //parameters
00058 const double J2Plasticity :: one3   = 1.0 / 3.0 ;
00059 const double J2Plasticity :: two3   = 2.0 / 3.0 ;
00060 const double J2Plasticity :: four3  = 4.0 / 3.0 ;
00061 const double J2Plasticity :: root23 = sqrt( 2.0 / 3.0 ) ;
00062 
00063 
00064 //zero internal variables
00065 void J2Plasticity :: zero ( ) 
00066 {
00067   xi_n = 0.0 ;
00068   xi_nplus1 = 0.0 ;
00069   
00070   epsilon_p_n.Zero( ) ;
00071   epsilon_p_nplus1.Zero( ) ;
00072 }
00073 
00074 
00075 //null constructor
00076 J2Plasticity ::  J2Plasticity( ) : 
00077 NDMaterial( ),
00078 epsilon_p_n(3,3),
00079 epsilon_p_nplus1(3,3),
00080 stress(3,3),
00081 strain(3,3)
00082 { 
00083   bulk        = 0.0 ;
00084   shear       = 0.0 ;
00085   sigma_0     = 0.0 ;
00086   sigma_infty = 0.0 ;
00087   delta       = 0.0 ;
00088   Hard        = 0.0 ;
00089   eta         = 0.0 ;
00090   this->zero( ) ;     // or (*this).zero( ) 
00091 }
00092 
00093 
00094 //full constructor
00095 J2Plasticity :: J2Plasticity(int    tag,
00096         int classTag,
00097         double K,
00098         double G,
00099         double yield0,
00100         double yield_infty,
00101         double d,
00102         double H,
00103         double viscosity) 
00104 : 
00105   NDMaterial(tag, classTag),
00106   epsilon_p_n(3,3),
00107   epsilon_p_nplus1(3,3),
00108   stress(3,3),
00109   strain(3,3)
00110 {
00111   bulk        = K ;
00112   shear       = G ;
00113   sigma_0     = yield0 ;
00114   sigma_infty = yield_infty ;
00115   delta       = d ;
00116   Hard        = H ;
00117   eta         = viscosity ;
00118   this->zero( ) ;
00119 }
00120 
00121 
00122 //elastic constructor
00123 
00124 J2Plasticity :: J2Plasticity(   int    tag, 
00125                 int  classTag,
00126                 double K, 
00127                 double G ) :
00128 NDMaterial(tag, classTag),
00129 epsilon_p_n(3,3),
00130 epsilon_p_nplus1(3,3),
00131 stress(3,3),
00132 strain(3,3)
00133 {
00134   bulk        = K ;
00135   shear       = G ; 
00136   sigma_0     = 1.0e16*shear ;
00137   sigma_infty = sigma_0 ;
00138   delta       = 0.0 ;
00139   Hard        = 0.0 ;
00140   eta         = 0.0 ;
00141   this->zero( ) ;
00142 }
00143 
00144 
00145 //destructor
00146 J2Plasticity :: ~J2Plasticity( ) 
00147 {  } 
00148 
00149 
00150 
00151 NDMaterial*
00152 J2Plasticity :: getCopy (const char *type)
00153 {
00154     if (strcmp(type,"PlaneStress2D") == 0)
00155     {
00156  J2PlaneStress  *clone ;
00157  clone = new J2PlaneStress(this->getTag(), bulk, shear, sigma_0,
00158       sigma_infty, delta, Hard, eta) ;
00159  return clone ;
00160     }
00161     else if (strcmp(type,"PlaneStrain2D") == 0)
00162     {
00163  J2PlaneStrain  *clone ;
00164  clone = new J2PlaneStrain(this->getTag(), bulk, shear, sigma_0,
00165       sigma_infty, delta, Hard, eta) ;
00166  return clone ;
00167     }
00168     else if (strcmp(type,"AxiSymmetric2D") == 0)
00169     {
00170  J2AxiSymm  *clone ;
00171  clone = new J2AxiSymm(this->getTag(), bulk, shear, sigma_0,
00172          sigma_infty, delta, Hard, eta) ;
00173  return clone ; 
00174     }
00175     else if ((strcmp(type,"ThreeDimensional") == 0) ||
00176       (strcmp(type,"3D") == 0))
00177     {
00178  J2ThreeDimensional  *clone ;
00179  clone = new J2ThreeDimensional(this->getTag(), bulk, shear, sigma_0,
00180          sigma_infty, delta, Hard, eta) ;
00181  return clone ; 
00182     }
00183     else if ( (strcmp(type,"PlateFiber") == 0) )
00184     {
00185  J2PlateFiber  *clone ;
00186  clone = new J2PlateFiber(this->getTag(), bulk, shear, sigma_0,
00187          sigma_infty, delta, Hard, eta) ;
00188  return clone ; 
00189     }
00190 
00191  
00192     // Handle other cases
00193     else
00194     {
00195  g3ErrorHandler->fatal("J2Plasticity::getModel failed to get model %s",
00196          type);
00197 
00198  return 0;
00199     }
00200 }
00201 
00202 //swap history variables
00203 int J2Plasticity :: commitState( )  
00204 {
00205   epsilon_p_n = epsilon_p_nplus1 ;
00206   xi_n        = xi_nplus1 ;
00207 
00208   return 0 ;
00209 }
00210 
00211 
00212 //revert to last saved state
00213 int J2Plasticity :: revertToLastCommit( )
00214 { 
00215   return 0 ;
00216 } 
00217 
00218 //revert to start
00219 int J2Plasticity :: revertToStart( ) 
00220 {
00221   this->zero( ) ;
00222   return 0 ;
00223 }
00224 
00225 
00226 //print out material data
00227 void J2Plasticity :: Print( ostream &s, int flag )
00228 {
00229   s << '\n' ;
00230   s << "J2-Plasticity : " ; 
00231   s << this->getType( ) << '\n' ;
00232   s << "Bulk Modulus =   " << bulk        << '\n' ;
00233   s << "Shear Modulus =  " << shear       << '\n' ;
00234   s << "Sigma_0 =        " << sigma_0     << '\n' ;
00235   s << "Sigma_infty =    " << sigma_infty << '\n' ;
00236   s << "Delta =          " << delta       << '\n' ;
00237   s << "H =              " << Hard        << '\n' ;
00238   s << "Eta =            " << eta         << '\n' ;
00239   s << endl ;
00240 }
00241 
00242 
00243 //--------------------Plasticity-------------------------------------
00244 
00245 //plasticity integration routine
00246 void J2Plasticity :: plastic_integrator( )
00247 {
00248   const double tolerance = (1.0e-12)*sigma_0 ;
00249 
00250   const double dt = 1.0 ; //time step = 1 for now
00251 
00252   static Matrix dev_strain(3,3) ; //deviatoric strain
00253 
00254   static Matrix dev_stress(3,3) ; //deviatoric stress
00255  
00256   static Matrix normal(3,3) ;     //normal to yield surface
00257 
00258   static double IIdev[3][3][3][3] ; //rank 4 deviatoric 
00259 
00260   static double IbunI[3][3][3][3] ; //rank 4 I bun I 
00261 
00262   double NbunN ; //normal bun normal 
00263 
00264   double norm_tau = 0.0 ;   //norm of deviatoric stress 
00265   double inv_norm_tau = 0.0 ;
00266 
00267   double phi = 0.0 ; //trial value of yield function
00268 
00269   double trace = 0.0 ; //trace of strain
00270 
00271   double gamma = 0.0 ; //consistency parameter
00272 
00273   double resid = 1.0 ; 
00274   double tang  = 0.0 ;
00275   
00276   double theta = 0.0 ; 
00277   double theta_inv = 0.0 ;
00278 
00279   double c1 = 0.0 ; 
00280   double c2 = 0.0 ;
00281   double c3 = 0.0 ;
00282 
00283   int ii, jj ; 
00284   int i, j, k, l ;
00285 
00286   int iteration_counter ;
00287   const int max_iterations = 25 ;
00288 
00289   //zero rank4 IIdev and IbunI 
00290   for ( i = 0; i < 3; i++ ) {
00291     for ( j = 0; j < 3; j++ )  {
00292       for ( k = 0; k < 3; k++ ) {
00293  for ( l = 0; l < 3; l++)  { 
00294 
00295    IbunI[i][j][k][l] = 0.0 ;
00296 
00297    IIdev[i][j][k][l] = 0.0 ;
00298 
00299  } // end for l
00300       } // end for k
00301     } // end for j
00302   } // end for i
00303 
00304 
00305   //form rank4 IbunI 
00306 
00307   IbunI [0][0] [0][0] = 1.0 ;
00308   IbunI [0][0] [1][1] = 1.0 ;
00309   IbunI [0][0] [2][2] = 1.0 ;
00310   IbunI [1][1] [0][0] = 1.0 ;
00311   IbunI [1][1] [1][1] = 1.0 ;
00312   IbunI [1][1] [2][2] = 1.0 ;
00313   IbunI [2][2] [0][0] = 1.0 ;
00314   IbunI [2][2] [1][1] = 1.0 ;
00315   IbunI [2][2] [2][2] = 1.0 ;
00316 
00317   //form rank4 IIdev
00318 
00319   IIdev [0][0] [0][0] =  two3 ; // 0.666667 
00320   IIdev [0][0] [1][1] = -one3 ; //-0.333333 
00321   IIdev [0][0] [2][2] = -one3 ; //-0.333333 
00322   IIdev [0][1] [0][1] = 0.5 ;
00323   IIdev [0][1] [1][0] = 0.5 ;
00324   IIdev [0][2] [0][2] = 0.5 ;
00325   IIdev [0][2] [2][0] = 0.5 ;
00326   IIdev [1][0] [0][1] = 0.5 ;
00327   IIdev [1][0] [1][0] = 0.5 ;
00328   IIdev [1][1] [0][0] = -one3 ; //-0.333333 
00329   IIdev [1][1] [1][1] =  two3 ; // 0.666667 
00330   IIdev [1][1] [2][2] = -one3 ; //-0.333333 
00331   IIdev [1][2] [1][2] = 0.5 ;
00332   IIdev [1][2] [2][1] = 0.5 ;
00333   IIdev [2][0] [0][2] = 0.5 ;
00334   IIdev [2][0] [2][0] = 0.5 ;
00335   IIdev [2][1] [1][2] = 0.5 ;
00336   IIdev [2][1] [2][1] = 0.5 ;
00337   IIdev [2][2] [0][0] = -one3 ; //-0.333333 
00338   IIdev [2][2] [1][1] = -one3 ; //-0.333333 
00339   IIdev [2][2] [2][2] =  two3 ; // 0.666667 
00340 
00341 
00342 
00343   //compute the deviatoric strains
00344 
00345   trace = strain(0,0) + strain(1,1) + strain(2,2) ;
00346  
00347   dev_strain = strain ;
00348   for ( i = 0; i < 3; i++ )
00349     dev_strain(i,i) -= ( one3*trace ) ;
00350    
00351   //compute the trial deviatoric stresses
00352 
00353   dev_stress = (2.0*shear) * ( dev_strain - epsilon_p_n ) ;
00354 
00355   //compute norm of deviatoric stress
00356 
00357   norm_tau = 0.0 ;
00358   for ( i = 0; i < 3; i++ ){
00359     for ( j = 0; j < 3; j++ ) 
00360       norm_tau += dev_stress(i,j)*dev_stress(i,j) ;
00361   } //end for i 
00362 
00363   norm_tau = sqrt( norm_tau ) ;
00364 
00365   if ( norm_tau > tolerance ) {
00366     inv_norm_tau = 1.0 / norm_tau ;
00367     normal =  inv_norm_tau * dev_stress ;
00368   }
00369   else {
00370     normal.Zero( ) ;
00371     inv_norm_tau = 0.0 ;
00372   } //end if 
00373 
00374   //compute trial value of yield function
00375 
00376   phi = norm_tau -  root23 * q(xi_n) ;
00377  
00378 
00379   // check if phi > 0 
00380   
00381   if ( phi > 0.0 ) { //plastic
00382 
00383      //solve for gamma 
00384      gamma = 0.0 ;
00385      resid = 1.0 ;
00386      iteration_counter = 0 ;
00387      while ( fabs(resid) > tolerance ) {
00388 
00389         resid = norm_tau 
00390               - (2.0*shear) * gamma 
00391               - root23 * q( xi_n + root23*gamma ) 
00392               - (eta/dt) * gamma ;
00393 
00394         tang =  - (2.0*shear)  
00395                 - two3 * qprime( xi_n + root23*gamma )
00396                 - (eta/dt) ;
00397 
00398         gamma -= ( resid / tang ) ;
00399 
00400  iteration_counter++ ;
00401 
00402  if ( iteration_counter > max_iterations ) {
00403      cerr << "More than " << max_iterations ;
00404      cerr << " iterations in constituive subroutine J2-plasticity \n" ;
00405      break ;
00406  } //end if 
00407  
00408      } //end while resid
00409 
00410      gamma *= (1.0 - 1e-08) ;
00411 
00412      //update plastic internal variables
00413 
00414      epsilon_p_nplus1 = epsilon_p_n + gamma*normal ;
00415 
00416      xi_nplus1 = xi_n + root23*gamma ;
00417 
00418      //recompute deviatoric stresses 
00419 
00420      dev_stress = (2.0*shear) * ( dev_strain - epsilon_p_nplus1 ) ;
00421 
00422      //compute the terms for plastic part of tangent
00423 
00424      theta =  (2.0*shear)  
00425            +  two3 * qprime( xi_nplus1 )
00426            +  (eta/dt) ;
00427 
00428      theta_inv = 1.0/theta ;
00429 
00430   }
00431   else { //elastic 
00432 
00433     //update history variables -- they remain unchanged
00434 
00435     epsilon_p_nplus1 = epsilon_p_n ;
00436 
00437     xi_nplus1 = xi_n ;
00438 
00439     //no extra tangent terms to compute 
00440     
00441     gamma = 0.0 ; 
00442     theta = 0.0 ;
00443     theta_inv = 0.0 ;
00444 
00445   } //end if phi > 0
00446 
00447 
00448   //add on bulk part of stress
00449 
00450   stress = dev_stress ;
00451   for ( i = 0; i < 3; i++ )
00452      stress(i,i) += bulk*trace ;
00453 
00454   //compute the tangent
00455 
00456   c1 = -4.0 * shear * shear ;
00457   c2 = c1 * theta_inv ;
00458   c3 = c1 * gamma * inv_norm_tau ;
00459 
00460   for ( ii = 0; ii < 6; ii++ ) {
00461     for ( jj = 0; jj < 6; jj++ )  {
00462 
00463           index_map( ii, i, j ) ;
00464           index_map( jj, k, l ) ;
00465 
00466           NbunN  = normal(i,j)*normal(k,l) ; 
00467 
00468           //elastic terms
00469           tangent[i][j][k][l]  = bulk * IbunI[i][j][k][l] ;
00470 
00471           tangent[i][j][k][l] += (2.0*shear) * IIdev[i][j][k][l] ;
00472 
00473           //plastic terms 
00474           tangent[i][j][k][l] += c2 * NbunN ;
00475 
00476    tangent[i][j][k][l] += c3 * (  IIdev[i][j][k][l] - NbunN ) ;
00477 
00478           //minor symmetries 
00479           tangent [j][i][k][l] = tangent[i][j][k][l] ;
00480           tangent [i][j][l][k] = tangent[i][j][k][l] ;
00481           tangent [j][i][l][k] = tangent[i][j][k][l] ;
00482 
00483     } // end for jj
00484   } // end for ii
00485 
00486   return ;
00487 } 
00488 
00489 
00490 
00491 //hardening function
00492 double J2Plasticity :: q( double xi ) 
00493 {
00494 //  q(xi) = simga_infty + (sigma_0 - sigma_infty)*exp(-delta*xi) + H*xi 
00495 
00496  return    sigma_infty
00497          + (sigma_0 - sigma_infty)*exp(-delta*xi)
00498          + Hard*xi ;
00499 }
00500 
00501 
00502 //hardening function derivative
00503 double J2Plasticity :: qprime( double xi )
00504 {
00505   return  (sigma_0 - sigma_infty) * (-delta) * exp(-delta*xi)
00506          + Hard ;
00507 }
00508 
00509 
00510 //matrix_index ---> tensor indices i,j
00511 void J2Plasticity :: index_map( int matrix_index, int &i, int &j )
00512 {
00513   switch ( matrix_index+1 ) { //add 1 for standard tensor indices
00514 
00515     case 1 :
00516       i = 1 ; 
00517       j = 1 ;
00518       break ;
00519  
00520     case 2 :
00521       i = 2 ;
00522       j = 2 ; 
00523       break ;
00524 
00525     case 3 :
00526       i = 3 ;
00527       j = 3 ;
00528       break ;
00529 
00530     case 4 :
00531       i = 1 ;
00532       j = 2 ;
00533       break ;
00534 
00535     case 5 :
00536       i = 2 ;
00537       j = 3 ;
00538       break ;
00539 
00540     case 6 :
00541       i = 3 ;
00542       j = 1 ;
00543       break ;
00544 
00545 
00546     default :
00547       i = 1 ;
00548       j = 1 ;
00549       break ;
00550 
00551   } //end switch
00552 
00553 i-- ; //subtract 1 for C-indexing
00554 j-- ;
00555 
00556 return ; 
00557 }
00558 
00559 
00560 NDMaterial*
00561 J2Plasticity::getCopy (void)
00562 {
00563     g3ErrorHandler->fatal("J2Plasticity::getCopy -- subclass responsibility");
00564     return 0;
00565 }
00566 
00567 const char*
00568 J2Plasticity::getType (void) const
00569 {
00570     g3ErrorHandler->fatal("J2Plasticity::getType -- subclass responsibility");
00571     return 0;
00572 }
00573 
00574 int
00575 J2Plasticity::getOrder (void) const
00576 {
00577     g3ErrorHandler->fatal("J2Plasticity::getOrder -- subclass responsibility");
00578     return 0;
00579 }
00580 
00581 int
00582 J2Plasticity::sendSelf (int commitTag, Channel &theChannel)
00583 {
00584     g3ErrorHandler->fatal("J2Plasticity::sendSelf -- subclass responsibility");
00585     return 0;
00586 }
00587 
00588 int
00589 J2Plasticity::recvSelf (int commitTag, Channel &theChannel, 
00590    FEM_ObjectBroker &theBroker)
00591 {
00592     g3ErrorHandler->fatal("J2Plasticity::recvSelf -- subclass responsibility");
00593     return 0;
00594 }
Copyright Contact Us