J2PlaneStress.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.6 $
00017 // $Date: 2004/02/24 22:53:34 $
00018 // $Source: /usr/local/cvs/OpenSees/SRC/material/nD/J2PlaneStress.cpp,v $
00019 
00020 // Written: Ed "C++" Love
00021 //
00022 // J2PlaneStress 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 //  Send strains in following format :
00044 // 
00045 //     strain_vec = {   eps_00
00046 //                      eps_11
00047 //                    2 eps_01   }   <--- note the 2
00048 // 
00049 //  set eta := 0 for rate independent case
00050 //
00051 
00052 #include <J2PlaneStress.h>
00053 #include <Channel.h>
00054 #include <FEM_ObjectBroker.h>
00055 
00056 Vector J2PlaneStress :: strain_vec(3) ;
00057 Vector J2PlaneStress :: stress_vec(3) ;
00058 Matrix J2PlaneStress :: tangent_matrix(3,3) ;
00059 
00060 //null constructor
00061 J2PlaneStress ::  J2PlaneStress( ) : 
00062 J2Plasticity( ) 
00063 {  }
00064 
00065 
00066 //full constructor
00067 J2PlaneStress :: 
00068 J2PlaneStress(   int    tag, 
00069                  double K,
00070                  double G,
00071                  double yield0,
00072                  double yield_infty,
00073                  double d,
00074                  double H,
00075                  double viscosity ) : 
00076 J2Plasticity(tag, ND_TAG_J2PlaneStress, 
00077              K, G, yield0, yield_infty, d, H, viscosity )
00078 { 
00079 
00080 }
00081 
00082 
00083 //elastic constructor
00084 J2PlaneStress :: 
00085 J2PlaneStress(   int    tag, 
00086                  double K, 
00087                  double G ) :
00088 J2Plasticity(tag, ND_TAG_J2PlaneStress, K, G )
00089 { 
00090 
00091 }
00092 
00093 
00094 //destructor
00095 J2PlaneStress :: ~J2PlaneStress( ) 
00096 {  } 
00097 
00098 
00099 //make a clone of this material
00100 NDMaterial* J2PlaneStress :: getCopy( ) 
00101 { 
00102   J2PlaneStress  *clone;
00103   clone = new J2PlaneStress( ) ;   //new instance of this class
00104   *clone = *this ;                 //asignment to make copy
00105   return clone ;
00106 }
00107 
00108 
00109 //send back type of material
00110 const char* J2PlaneStress :: getType( ) const 
00111 {
00112   return "PlaneStress" ;
00113 }
00114 
00115 
00116 //send back order of strain in vector form
00117 int J2PlaneStress :: getOrder( ) const 
00118 { 
00119   return 3 ; 
00120 } 
00121 
00122 //get the strain and integrate plasticity equations
00123 int J2PlaneStress :: setTrialStrain( const Vector &strain_from_element ) 
00124 {
00125   const double tolerance = 1e-12 ;
00126 
00127   const int max_iterations = 25 ;
00128   int iteration_counter  = 0 ;
00129 
00130   int i, j, k, l ;
00131   int ii, jj ;
00132 
00133   double eps22  =  strain(2,2) ;
00134   strain.Zero( ) ;
00135 
00136   strain(0,0) =        strain_from_element(0) ;
00137   strain(1,1) =        strain_from_element(1) ;
00138   strain(0,1) = 0.50 * strain_from_element(2) ;
00139   strain(1,0) =        strain(0,1) ;
00140 
00141   strain(2,2) =        eps22 ; 
00142 
00143   //enforce the plane stress condition sigma_22 = 0 
00144   //solve for epsilon_22 
00145   iteration_counter = 0 ;  
00146   do {
00147 
00148      this->plastic_integrator( ) ;
00149     
00150      strain(2,2) -= stress(2,2) / tangent[2][2][2][2] ;
00151 
00152      iteration_counter++ ;
00153      if ( iteration_counter > max_iterations ) {
00154        opserr << "More than " << max_iterations ;
00155        opserr << " iterations in setTrialStrain of J2PlaneStress \n" ;
00156        break ;
00157      }// end if 
00158 
00159   } while ( fabs(stress(2,2)) > tolerance ) ;
00160 
00161   //modify tangent for plane stress 
00162   for ( ii = 0; ii < 3; ii++ ) {
00163     for ( jj = 0; jj < 3; jj++ )  {
00164 
00165           index_map( ii, i, j ) ;
00166           index_map( jj, k, l ) ;
00167 
00168           tangent[i][j][k][l] -=   tangent[i][j][2][2] 
00169                                  * tangent[2][2][k][l] 
00170                                  / tangent[2][2][2][2] ;
00171 
00172           //minor symmetries 
00173           tangent [j][i][k][l] = tangent[i][j][k][l] ;
00174           tangent [i][j][l][k] = tangent[i][j][k][l] ;
00175           tangent [j][i][l][k] = tangent[i][j][k][l] ;
00176 
00177     } // end for jj
00178   } // end for ii 
00179 
00180   return 0 ;
00181 }
00182 
00183 
00184 //unused trial strain functions
00185 int J2PlaneStress :: setTrialStrain( const Vector &v, const Vector &r )
00186 { 
00187    return this->setTrialStrain( v ) ;
00188 } 
00189 
00190 int J2PlaneStress :: setTrialStrainIncr( const Vector &v ) 
00191 {
00192   static Vector newStrain(3);
00193   newStrain(0) = strain(0,0) + v(0);
00194   newStrain(1) = strain(1,1) + v(1);
00195   newStrain(2) = 2.0 * strain(0,1) + v(2);
00196 
00197   return this->setTrialStrain(newStrain);  
00198 }
00199 
00200 int J2PlaneStress :: setTrialStrainIncr( const Vector &v, const Vector &r ) 
00201 {
00202     return this->setTrialStrainIncr(v);
00203 }
00204 
00205 
00206 //send back the strain
00207 const Vector& J2PlaneStress :: getStrain( ) 
00208 {
00209   strain_vec(0) =       strain(0,0) ;
00210   strain_vec(1) =       strain(1,1) ;
00211   strain_vec(2) = 2.0 * strain(0,1) ;
00212 
00213   return strain_vec ;
00214 } 
00215 
00216 
00217 //send back the stress 
00218 const Vector& J2PlaneStress :: getStress( ) 
00219 {
00220   stress_vec(0) = stress(0,0) ;
00221   stress_vec(1) = stress(1,1) ;
00222   stress_vec(2) = stress(0,1) ;
00223 
00224   return stress_vec ;
00225 }
00226 
00227 //send back the tangent 
00228 const Matrix& J2PlaneStress :: getTangent( ) 
00229 {
00230   // matrix to tensor mapping
00231   //  Matrix      Tensor
00232   // -------     -------
00233   //   0           0 0
00234   //   1           1 1
00235   //   2           0 1  ( or 1 0 ) 
00236   // 
00237        
00238   tangent_matrix(0,0) = tangent [0][0] [0][0] ;
00239   tangent_matrix(1,1) = tangent [1][1] [1][1] ;
00240   tangent_matrix(2,2) = tangent [0][1] [0][1] ;
00241 
00242   tangent_matrix(0,1) = tangent [0][0] [1][1] ;
00243   tangent_matrix(1,0) = tangent [1][1] [0][0] ;
00244 
00245   tangent_matrix(0,2) = tangent [0][0] [0][1] ;
00246   tangent_matrix(2,0) = tangent [0][1] [0][0] ;
00247 
00248   tangent_matrix(1,2) = tangent [1][1] [0][1] ;
00249   tangent_matrix(2,1) = tangent [0][1] [1][1] ;
00250 
00251   return tangent_matrix ;
00252 } 
00253 
00254 
00255 //send back the tangent 
00256 const Matrix& J2PlaneStress :: getInitialTangent( ) 
00257 {
00258   // matrix to tensor mapping
00259   //  Matrix      Tensor
00260   // -------     -------
00261   //   0           0 0
00262   //   1           1 1
00263   //   2           0 1  ( or 1 0 ) 
00264   // 
00265 
00266   this->doInitialTangent();
00267        
00268   tangent_matrix(0,0) = initialTangent [0][0] [0][0] ;
00269   tangent_matrix(1,1) = initialTangent [1][1] [1][1] ;
00270   tangent_matrix(2,2) = initialTangent [0][1] [0][1] ;
00271 
00272   tangent_matrix(0,1) = initialTangent [0][0] [1][1] ;
00273   tangent_matrix(1,0) = initialTangent [1][1] [0][0] ;
00274 
00275   tangent_matrix(0,2) = initialTangent [0][0] [0][1] ;
00276   tangent_matrix(2,0) = initialTangent [0][1] [0][0] ;
00277 
00278   tangent_matrix(1,2) = initialTangent [1][1] [0][1] ;
00279   tangent_matrix(2,1) = initialTangent [0][1] [1][1] ;
00280 
00281   return tangent_matrix ;
00282 } 
00283 
00284 //this is mike's problem
00285 int J2PlaneStress :: setTrialStrain(const Tensor &v) 
00286 {
00287   return -1 ;
00288 }
00289 
00290 int J2PlaneStress :: setTrialStrain(const Tensor &v, const Tensor &r)     
00291 {
00292   return -1 ;
00293 }
00294 
00295 int J2PlaneStress :: setTrialStrainIncr(const Tensor &v) 
00296 {
00297   return -1 ;
00298 }
00299 
00300 int J2PlaneStress :: setTrialStrainIncr(const Tensor &v, const Tensor &r) 
00301 {
00302   return -1 ;
00303 }
00304 
00305 const Tensor& J2PlaneStress :: getTangentTensor( ) 
00306 {
00307   return rank4 ;
00308 }
00309 
00310 //jeremic@ucdavis.edu 22jan2001const Tensor& J2PlaneStress :: getStressTensor( ) 
00311 //jeremic@ucdavis.edu 22jan2001{
00312 //jeremic@ucdavis.edu 22jan2001  return rank2 ;
00313 //jeremic@ucdavis.edu 22jan2001}
00314 //jeremic@ucdavis.edu 22jan2001
00315 //jeremic@ucdavis.edu 22jan2001const Tensor& J2PlaneStress :: getStrainTensor( ) 
00316 //jeremic@ucdavis.edu 22jan2001{
00317 //jeremic@ucdavis.edu 22jan2001  return rank2 ;
00318 //jeremic@ucdavis.edu 22jan2001}
00319 
00320 int 
00321 J2PlaneStress::commitState( ) 
00322 {
00323   epsilon_p_n = epsilon_p_nplus1 ;
00324   xi_n        = xi_nplus1 ;
00325 
00326   commitEps22 =       strain(2,2);
00327 
00328   return 0;
00329 }
00330 
00331 int 
00332 J2PlaneStress::revertToLastCommit( ) {
00333 
00334   strain(2,2)  = commitEps22;
00335 
00336   return 0;
00337 }
00338 
00339 
00340 int 
00341 J2PlaneStress::revertToStart( ) {
00342   commitEps22 = 0.0;
00343 
00344   this->zero( ) ;
00345 
00346   return 0;
00347 }
00348 
00349 int
00350 J2PlaneStress::sendSelf(int commitTag, Channel &theChannel)
00351 {
00352   // we place all the data needed to define material and it's state
00353   // int a vector object
00354   static Vector data(10+9);
00355   int cnt = 0;
00356   data(cnt++) = this->getTag();
00357   data(cnt++) = bulk;
00358   data(cnt++) = shear;
00359   data(cnt++) = sigma_0;
00360   data(cnt++) = sigma_infty;
00361   data(cnt++) = delta;
00362   data(cnt++) = Hard;
00363   data(cnt++) = eta;
00364   data(cnt++) = xi_n;
00365   data(cnt++) = commitEps22;
00366 
00367   for (int i=0; i<3; i++) 
00368     for (int j=0; j<3; j++) 
00369       data(cnt++) = epsilon_p_n(i,j);
00370 
00371   // send the vector object to the channel
00372   if (theChannel.sendVector(this->getDbTag(), commitTag, data) < 0) {
00373     opserr << "J2PlaneStress::sendSelf - failed to send vector to channel\n";
00374     return -1;
00375   }
00376 
00377   return 0;
00378 }
00379 
00380 int
00381 J2PlaneStress::recvSelf (int commitTag, Channel &theChannel, 
00382                          FEM_ObjectBroker &theBroker)
00383 {
00384 
00385   // recv the vector object from the channel which defines material param and state
00386   static Vector data(10+9);
00387   if (theChannel.recvVector(this->getDbTag(), commitTag, data) < 0) {
00388     opserr << "J2PlaneStress::recvSelf - failed to recv vector from channel\n";
00389     return -1;
00390   }
00391 
00392   // set the material parameters and state variables
00393   int cnt = 0;
00394   this->setTag(data(cnt++));
00395   bulk = data(cnt++);
00396   shear = data(cnt++);
00397   sigma_0 = data(cnt++);
00398   sigma_infty = data(cnt++);
00399   delta = data(cnt++);
00400   Hard = data(cnt++);
00401   eta = data(cnt++);
00402   xi_n = data(cnt++);
00403   commitEps22 = data(cnt++);
00404   for (int i=0; i<3; i++)
00405     for (int j=0; j<3; j++) 
00406       epsilon_p_n(i,j) = data(cnt++);
00407 
00408   epsilon_p_nplus1 = epsilon_p_n;
00409   xi_nplus1        = xi_n;
00410   strain(2,2) = commitEps22;
00411 
00412   return 0;
00413 }
00414 
00415 
00416 //matrix_index ---> tensor indices i,j
00417 // plane stress different because of condensation on tangent
00418 // case 3 switched to 1-2 and case 4 to 3-3 
00419 void 
00420 J2PlaneStress :: index_map( int matrix_index, int &i, int &j )
00421 {
00422   switch ( matrix_index+1 ) { //add 1 for standard tensor indices
00423 
00424     case 1 :
00425       i = 1 ; 
00426       j = 1 ;
00427       break ;
00428  
00429     case 2 :
00430       i = 2 ;
00431       j = 2 ; 
00432       break ;
00433 
00434     case 3 :
00435       i = 1 ;
00436       j = 2 ;
00437       break ;
00438 
00439     case 4 :
00440       i = 3 ;
00441       j = 3 ;
00442       break ;
00443 
00444     case 5 :
00445       i = 2 ;
00446       j = 3 ;
00447       break ;
00448 
00449     case 6 :
00450       i = 3 ;
00451       j = 1 ;
00452       break ;
00453 
00454 
00455     default :
00456       i = 1 ;
00457       j = 1 ;
00458       break ;
00459 
00460   } //end switch
00461 
00462 i-- ; //subtract 1 for C-indexing
00463 j-- ;
00464 
00465 return ; 
00466 }
00467 
00468 

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