mohrco.c

Go to the documentation of this file.
00001 /*
00002 %M This modules contains the MOHR COULOMB CUTOFF material sub-class methods 
00003    and definitions
00004 %a Joao Luiz Elias Campos.
00005 %d September 13rd, 1999.
00006 %r $Id: mohrco.c,v 1.1 2004/06/22 05:29:59 joaoluiz Exp $
00007 %w (C) COPYRIGHT 1995-1996, Eduardo Nobre Lages.
00008    (C) COPYRIGHT 1997-1999, Joao Luiz Elias Campos.
00009    All Rights Reserved
00010    Duplication of this program or any part thereof without the express
00011    written consent of the author is prohibited.
00012 
00013    Modificacao: 28/04/2005    Alexandre A. Del Savio
00014      Foram substituídas todas as alocações dinâmicas feitas com malloc 
00015      por calloc.
00016 
00017 */
00018 
00019 /*
00020 ** ------------------------------------------------------------------------
00021 ** Global variables and symbols:
00022 */
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <math.h>
00026 
00027 #include "load.h"
00028 #include "elm.h"
00029 #include "material.h"
00030 #include "node.h"
00031 #include "rio.h"
00032 
00033 
00034 /* Parent methods
00035  */
00036 void MaterialTimeStep( sMaterial *, double * );
00037 void MaterialDensity ( sMaterial *, double * );
00038 
00039 
00040 /*
00041 ** ------------------------------------------------------------------------
00042 ** Local variables and symbols:
00043 */
00044 
00045 /*
00046 %T MOHR COULOMB CUTOFF material data definition
00047 */
00048 typedef struct _mohrcodata
00049 {
00050  double E;             /* Young modulos          */
00051  double Nu;            /* Poisson coefficient    */
00052  double C;             /* Coesion value          */
00053  double Phi;           /* Friction angle         */
00054  double Psi;           /* Expansion angle        */
00055  double St;            /* Traction stress cutoff */
00056 } sMohrCOData;
00057 
00058 #ifndef PI
00059 #define PI 3.141592654
00060 #endif
00061 
00062 /*
00063 ** ------------------------------------------------------------------------
00064 ** Local functions:
00065 */
00066 
00067 
00068 /*
00069 ** ------------------------------------------------------------------------
00070 ** Subclass methods:
00071 */
00072 static void MohrCoulombCutOffNew         ( int, sMaterial ** );
00073 static void MohrCoulombCutOffFree        ( sMaterial * );
00074 static void MohrCoulombCutOffRead        ( sMaterial * );
00075 static void MohrCoulombCutOffEParameter  ( sMaterial *, double * );
00076 static void MohrCoulombCutOffNuParameter ( sMaterial *, double * );
00077 static void MohrCoulombCutOffCMatrix     ( sMaterial *, double [6][6] );
00078 static void MohrCoulombCutOffUpdateStress( sMaterial *, double, double *,
00079                                                         double *, double *,
00080                                                         double * );
00081 
00082 
00083 /*
00084 %F This method allocates memory for a MOHR COULOMB CUTOFF material and fills 
00085    its data with the specific values.
00086 %i Material label (number)
00087 %o Material descriptor.
00088 */
00089 static void MohrCoulombCutOffNew( int label, sMaterial **mat )
00090 {
00091  sMohrCOData *data = 0L;
00092 
00093 /* Get memory for the material descriptor
00094  */
00095  (*mat) = (sMaterial *)calloc(1, sizeof(sMaterial) );
00096 
00097 /* Get memory for the MOHR COULOMB CUTOFF material data
00098  */
00099  data = (sMohrCOData *)calloc(1, sizeof(sMohrCOData) );
00100 
00101 /* Fill MOHR COULOMB CUTOFF material data
00102  */
00103  data->E   = 0.0;
00104  data->Nu  = 0.0;
00105  data->C   = 0.0;
00106  data->Phi = 0.0;
00107  data->Psi = 0.0;
00108  data->St  = 0.0;
00109 
00110 /* Fill material descriptor
00111  */
00112  (*mat)->type  = MOHR_COULOMB_CUTOFF;
00113  (*mat)->label = label;
00114  (*mat)->Gamma = 0.0;
00115  (*mat)->data  = (void *)data;
00116 
00117 /* Add to the material list
00118  */
00119  MatList[label-1] = (*mat);
00120 
00121 } /* End of MohrCoulombCutOffNew */
00122 
00123 
00124 /*
00125 %F This method frees the MOHR COULOMB CUTOFF material data for a given 
00126    material.
00127 %i Material descriptor.
00128 */
00129 static void MohrCoulombCutOffFree( sMaterial *mat )
00130 {
00131  sMohrCOData *data = 0L;
00132 
00133 /* Get MOHR COULOMB CUTOFF material data
00134  */
00135  data = (sMohrCOData *)mat->data;
00136 
00137 /* Release allocated memory
00138  */
00139  free( data );
00140 
00141 /* Reset material data
00142  */
00143  mat->data = 0L;
00144 
00145 } /* End of MohrCoulombCutOffFree */
00146 
00147 
00148 /*
00149 %F This method reads the MOHR COULOMB CUTOFF material information.
00150 %i Material descriptor.
00151 */
00152 static void MohrCoulombCutOffRead( sMaterial *mat )
00153 {
00154  sMohrCOData *data = 0L;
00155  double       c, nu, e, phi, psi, st;
00156 
00157 /* Get the material data
00158  */
00159  data = (sMohrCOData *)mat->data;
00160 
00161 /* Read the material parameters
00162  */
00163  fscanf( nf, "%lf %lf %lf %lf %lf %lf", &e, &nu, &c, &phi, &psi, &st );
00164 
00165 /* Fill material information
00166  */
00167  data->E   = e;
00168  data->Nu  = nu;
00169  data->C   = c;
00170  data->Phi = phi;
00171  data->Psi = psi;
00172  data->St  = st;
00173 
00174 } /* End of MohrCoulombCutOffRead */
00175 
00176 /*
00177 %F
00178 */
00179 static void MohrCoulombCutOffEParameter( sMaterial *mat, double *e )
00180 {
00181  sMohrCOData *data = 0L;
00182 
00183 /* Get material descriptor
00184  */
00185  data = (sMohrCOData *)mat->data;
00186 
00187 /* Get Young modules parameters
00188  */
00189  (*e) = data->E;
00190 
00191 } /* End of MohrCoulombCutOffEParameter */
00192 
00193 
00194 /*
00195 %F 
00196 */ 
00197 static void MohrCoulombCutOffNuParameter( sMaterial *mat, double *nu )
00198 {
00199  sMohrCOData *data = 0L;
00200 
00201 /* Get material descriptor
00202  */
00203  data = (sMohrCOData *)mat->data;
00204 
00205 /* Get Poisson coefficient parameters
00206  */
00207  (*nu) = data->Nu;
00208 
00209 } /* End of MohrCoulombCutOffNuParameter */
00210 
00211 
00212 /*
00213 %F This function computes the material constitutive matrix
00214 */
00215 static void MohrCoulombCutOffCMatrix( sMaterial *mat, double cm[6][6] )
00216 {
00217  int          i, j;
00218  sMohrCOData *data = 0L;
00219  double       e, nu;
00220 
00221 /* Intialize matrix
00222  */
00223  for( i = 0; i < 6; i++ )
00224   for( j = 0; j < 6; j++ )
00225    cm[i][j] = 0.0;
00226 
00227 /* Get material descriptor
00228  */ 
00229  data = (sMohrCOData *)mat->data;
00230 
00231 /* Get element parameters
00232  */
00233  e  = data->E;
00234  nu = data->Nu;
00235 
00236 /* Compute matrix elements
00237  */
00238  if( NDof == 3 )
00239  {
00240   cm[0][0] =
00241   cm[1][1] =
00242   cm[2][2] =  e*(nu*nu-1.0) / (nu*(nu+nu*nu)+nu*(nu*nu+nu)+nu*nu-1.0);
00243   cm[1][0] =
00244   cm[2][0] =
00245   cm[0][1] =
00246   cm[2][1] =
00247   cm[0][2] =
00248   cm[1][2] = -e*(nu*nu+nu) / (nu*(nu+nu*nu)+nu*(nu*nu+nu)+nu*nu-1.0);
00249   cm[3][3] =
00250   cm[4][4] =
00251   cm[5][5] = (e * e) / (e + e * (1.0 + 2.0 * nu));
00252  }
00253  else
00254  {
00255   cm[0][0] = cm[1][1] = (e * (1.0 - nu)) / ((1.0 + nu) * (1.0 - (2.0 * nu)));
00256   cm[0][1] = cm[1][0] = (e * nu) / ((1.0 + nu) * (1.0 - (2.0 * nu)));
00257   cm[2][2] = e / (2.0 * (1.0 + nu));
00258  }
00259 
00260 } /* End of MohrCoulombCutOffCMatrix */
00261 
00262 
00263 /*
00264 %F
00265 */
00266 static void MohrCoulombCutOffUpdateStress( sMaterial *mat, double dtime, 
00267                                            double *yield, double *effdef, 
00268                                            double *str, double *def )
00269 {
00270  sMohrCOData *data = 0L;
00271  double       sig1, sig3, sig2;
00272  double       c, phi, psi, st, pf1, pf2, mult, aldp, ni;
00273  double       cm[6][6];
00274 
00275 /* Get material data
00276  */
00277  data = (sMohrCOData *)mat->data;
00278 
00279 /* Get material contitutive matrix
00280  */
00281  MohrCoulombCutOffCMatrix( mat, cm );
00282  
00283 /* Get material poisson coef.
00284  */
00285  MohrCoulombCutOffNuParameter( mat, &ni );
00286 
00287 /* Get material plastic properties
00288  */ 
00289  c   = data->C;
00290  phi = data->Phi;
00291  psi = data->Psi;
00292  st  = data->St;
00293 
00294 /* Computes the principal stresses (Sigma 1 and Sigma 3)
00295  */
00296  sig1 = ((str[0] + str[1]) / 2.0) -
00297         sqrt( (str[0] - str[1])*(str[0] - str[1])/4.0 + str[2] * str[2] );
00298  sig3 = ((str[0] + str[1]) / 2.0) +
00299         sqrt( (str[0] - str[1])*(str[0] - str[1])/4.0 + str[2] * str[2] );
00300  sig2 = ni * (sig1 + sig3);
00301 
00302 /* Computes the angle
00303  */
00304  phi *= PI / 180.0;
00305  phi  = (1.0 + sin(phi)) / (1.0 - sin(phi));
00306 
00307 /* Compute plastic functions
00308  */
00309  pf1      = sig1 - (sig3 * phi) + (2.0 * c * sqrt(phi));
00310  if( sig3 > 0.0 )
00311   pf2 = st - sig3;
00312  else
00313   pf2 = 1.0;
00314  (*yield) = 1.0;
00315 
00316 /* Correct the stress if necessery
00317  */
00318  if( pf2 <= 0.0 )
00319  {
00320   (*yield) = pf2;
00321 
00322   if( sig1 == str[0]) aldp = 0.0;
00323   else                aldp = atan2( (sig1 - str[0]), str[2] );
00324 
00325   mult = pf2 / cm[0][0];
00326 
00327   sig1 -= mult * cm[0][1];
00328   sig2 -= mult * cm[0][1];
00329   sig3 -= mult * cm[0][0];
00330 
00331   str[0] = ((sig1 + sig3) / 2.0) + ((sig1-sig3) * cos(2.0 * aldp) / 2.0);
00332   str[1] = ((sig1 + sig3) / 2.0) - ((sig1-sig3) * cos(2.0 * aldp) / 2.0);
00333   str[2] = ((sig1 - sig3) * (sin(2.0 * aldp))) / 2.0;
00334   str[3] = sig2;
00335  }
00336  else if( pf1 <= 0.0 )
00337  {
00338   (*yield) = pf1;
00339 
00340   if( sig1 == str[0]) aldp = 0.0;
00341   else                aldp = atan2( (sig1 - str[0]), str[2] );
00342 
00343   mult = pf1 / (-cm[0][0] * (1.0 + (phi*psi)) + (2.0 * phi * cm[0][1]));
00344 
00345   sig1 += mult * (cm[0][0] - (cm[0][1] * psi));
00346   sig3 += mult * (cm[0][1] - (cm[0][0] * psi));
00347   sig2 += mult * cm[0][0] * (1.0 - psi);
00348 
00349   str[0] = ((sig1 + sig3) / 2.0) + ((sig1-sig3) * cos(2.0 * aldp) / 2.0);
00350   str[1] = ((sig1 + sig3) / 2.0) - ((sig1-sig3) * cos(2.0 * aldp) / 2.0);
00351   str[2] = ((sig1 - sig3) * (sin(2.0 * aldp))) / 2.0;
00352   str[3] = sig2;
00353  }
00354 
00355 } /* End of MohrCoulombCutOffUpdateStress */
00356 
00357 
00358 /*
00359 ** ------------------------------------------------------------------------
00360 ** Public functions:
00361 */
00362 
00363 /*
00364 %F This function initializes the sub-class "MOHR COULOMB CUTOFF".
00365 */
00366 void MohrCoulombCutOffInit( void );
00367 void MohrCoulombCutOffInit( void )
00368 {
00369 /* Initialize MOHR COULOMB CUTOFF material sub-class
00370  */
00371  MatClass[MOHR_COULOMB_CUTOFF].new       = MohrCoulombCutOffNew;
00372  MatClass[MOHR_COULOMB_CUTOFF].free      = MohrCoulombCutOffFree;
00373  MatClass[MOHR_COULOMB_CUTOFF].read      = MohrCoulombCutOffRead;
00374  MatClass[MOHR_COULOMB_CUTOFF].epar      = MohrCoulombCutOffEParameter;
00375  MatClass[MOHR_COULOMB_CUTOFF].nupar     = MohrCoulombCutOffNuParameter;
00376  MatClass[MOHR_COULOMB_CUTOFF].cmatrix   = MohrCoulombCutOffCMatrix;
00377  MatClass[MOHR_COULOMB_CUTOFF].updatestr = MohrCoulombCutOffUpdateStress;
00378  MatClass[MOHR_COULOMB_CUTOFF].updatepar = 0L;
00379  MatClass[MOHR_COULOMB_CUTOFF].timestep  = MaterialTimeStep;
00380  MatClass[MOHR_COULOMB_CUTOFF].density   = MaterialDensity;
00381  MatClass[MOHR_COULOMB_CUTOFF].vstrain   = 0L;
00382 
00383 } /* End of MohrCoulombCutOffInit */
00384 
00385 
00386 /* =======================================================  End of File  */
00387 

Generated on Tue Oct 23 11:23:29 2007 for Relax by  doxygen 1.5.3