itfmohr.c

Go to the documentation of this file.
00001 /*
00002 %M This modules contains the INTERFACE MOHR COULOMB material sub-class 
00003    methods and definitions
00004 %a Joao Luiz Elias Campos.
00005 %d September 9th, 1998.
00006 %r $Id: itfmohr.c,v 1.1 2004/06/22 05:29:58 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 method
00035  */
00036 void MaterialDensity( sMaterial *, double * );
00037 
00038 
00039 /*
00040 ** ------------------------------------------------------------------------
00041 ** Local variables and symbols:
00042 */
00043 
00044 /*
00045 %T INTERFACE MOHR COULOMB material data definition
00046 */
00047 typedef struct _isodata
00048 {
00049  double Ks;            /* Shear rigidity moduless */
00050  double Kn;            /* Normal rigidity modules */
00051  double C;             /* Coesion value           */
00052  double Phi;           /* Friction angle          */
00053 } sItfMohrData;
00054 
00055 
00056 #ifndef PI
00057 #define PI 3.141592654
00058 #endif
00059 
00060 
00061 /*
00062 ** ------------------------------------------------------------------------
00063 ** Local functions:
00064 */
00065 
00066 
00067 /*
00068 ** ------------------------------------------------------------------------
00069 ** Subclass methods:
00070 */
00071 static void ItfMohrCoulombNew         ( int, sMaterial ** );
00072 static void ItfMohrCoulombFree        ( sMaterial * );
00073 static void ItfMohrCoulombRead        ( sMaterial * );
00074 static void ItfMohrCoulombEParameter  ( sMaterial *, double * );
00075 static void ItfMohrCoulombNuParameter ( sMaterial *, double * );
00076 static void ItfMohrCoulombCMatrix     ( sMaterial *, double [6][6] );
00077 static void ItfMohrCoulombUpdateStress( sMaterial *, double, double *, double *,
00078                                                      double *, double * );
00079 
00080 
00081 /*
00082 %F This method allocates memory for a INTERFACE MOHR COULOMB material 
00083    and fills its data with the specific values.
00084 %i Material label (number)
00085 %o Material descriptor.
00086 */
00087 static void ItfMohrCoulombNew( int label, sMaterial **mat )
00088 {
00089  sItfMohrData *data = 0L;
00090 
00091 /* Get memory for the material descriptor
00092  */
00093  (*mat) = (sMaterial *)calloc(1, sizeof(sMaterial));
00094 
00095 /* Get memory for the INTERFACE MOHR COULOMB material data
00096  */
00097  data = (sItfMohrData *)calloc(1, sizeof(sItfMohrData));
00098 
00099 /* Fill INTERFACE MOHR COULOMB material data
00100  */
00101  data->Ks  = 0.0;
00102  data->Kn  = 0.0;
00103  data->C   = 0.0;
00104  data->Phi = 0.0;
00105 
00106 /* Fill material descriptor
00107  */
00108  (*mat)->type  = ITF_MOHR_COULOMB;
00109  (*mat)->label = label;
00110  (*mat)->Gamma = 0.0;
00111  (*mat)->data  = (void *)data;
00112 
00113 /* Add to the material list
00114  */
00115  MatList[label-1] = (*mat);
00116 
00117 } /* End of ItfMohrCoulombNew */
00118 
00119 
00120 /*
00121 %F This method frees the INTERFACE MOHR COULOMB material data for a 
00122    given material.
00123 %i Material descriptor.
00124 */
00125 static void ItfMohrCoulombFree( sMaterial *mat )
00126 {
00127  sItfMohrData *data = 0L;
00128 
00129 /* Get INTERFACE MOHR COULOMB material data
00130  */
00131  data = (sItfMohrData *)mat->data;
00132 
00133 /* Release allocated memory
00134  */
00135  free( data );
00136 
00137 /* Reset material data
00138  */
00139  mat->data = 0L;
00140 
00141 } /* End of ItfMohrCoulombFree */
00142 
00143 
00144 /*
00145 %F This method reads the INTERFACE MOHR COULOMB material information.
00146 %i Material descriptor.
00147 */
00148 static void ItfMohrCoulombRead( sMaterial *mat )
00149 {
00150  sItfMohrData *data = 0L;
00151  double        ks, kn, c, phi;
00152 
00153 /* Get the material data
00154  */
00155  data = (sItfMohrData *)mat->data;
00156 
00157 /* Read the material parameters
00158  */
00159  fscanf( nf, "%lf %lf %lf %lf", &kn, &ks, &c, &phi );
00160 
00161 /* Fill material information
00162  */
00163  data->Ks  = ks;
00164  data->Kn  = kn;
00165  data->C   = c;
00166  data->Phi = phi;
00167 
00168 } /* End of ItfMohrCoulombRead */
00169 
00170 
00171 /*
00172 %F
00173 */
00174 static void ItfMohrCoulombEParameter( sMaterial *mat, double *ks )
00175 {
00176  sItfMohrData *data = 0L;
00177 
00178 /* Get material descriptor
00179  */ 
00180  data = (sItfMohrData *)mat->data;
00181 
00182 /* Get Young modules parameters
00183  */
00184  (*ks) = data->Ks;
00185 
00186 } /* End of ItfMohrCoulombEParameter */
00187 
00188 
00189 /*
00190 %F
00191 */
00192 static void ItfMohrCoulombNuParameter( sMaterial *mat, double *kn )
00193 {
00194  sItfMohrData *data = 0L;
00195 
00196 /* Get material descriptor
00197  */ 
00198  data = (sItfMohrData *)mat->data;
00199 
00200 /* Get Poisson coefficient parameters
00201  */
00202  (*kn) = data->Kn;
00203 
00204 } /* End of ItfMohrCoulombNuParameter */
00205 
00206 
00207 /*
00208 %F This function computes the material constitutive matrix
00209 */
00210 static void ItfMohrCoulombCMatrix( sMaterial *mat, double cm[6][6] )
00211 {
00212  int           i, j;
00213  sItfMohrData *data = 0L;
00214  double        ks, kn;
00215 
00216 /* Intialize matrix
00217  */
00218  for( i = 0; i < 6; i++ )
00219   for( j = 0; j < 6; j++ )
00220    cm[i][j] = 0.0;
00221 
00222 /* Get material descriptor
00223  */
00224  data = (sItfMohrData *)mat->data;
00225 
00226 /* Get element parameters
00227  */
00228  ks = data->Ks;
00229  kn = data->Kn;
00230 
00231 /* Compute matrix elements
00232  */
00233  if( NDof == 3 )
00234  {
00235   cm[0][0] = ks;
00236   cm[1][1] = kn;
00237   cm[2][2] = kn;
00238  }
00239  else
00240  {
00241   cm[0][0] = ks;
00242   cm[1][1] = kn;
00243  }
00244  
00245 } /* End of ItfMohrCoulombCMatrix */
00246 
00247 
00248 /*
00249 %F
00250 */
00251 static void ItfMohrCoulombUpdateStress( sMaterial *mat, double dtime, 
00252                                                         double *yield,
00253                                                         double *effdef, 
00254                                                         double *str,
00255                                                         double *def )
00256 {
00257  sItfMohrData *data = 0L;
00258  double        sig1, sig3;
00259  double        c, phi, pf;
00260  double        cm[6][6];
00261 
00262 /* Get material data
00263  */
00264  data = (sItfMohrData *)mat->data;
00265 
00266 /* Get material contitutive matrix
00267  */
00268  ItfMohrCoulombCMatrix( mat, cm );
00269 
00270 /* Get material plastic properties
00271  */
00272  c   = data->C;
00273  phi = data->Phi;
00274 
00275 /* Computes the principal stresses (Sigma 1 and Sigma 3)
00276  */
00277  sig1 = ((str[0] + str[1]) / 2.0) -
00278         sqrt( (str[0] - str[1])*(str[0] - str[1])/4.0 + str[2] * str[2] );
00279  sig3 = ((str[0] + str[1]) / 2.0) +
00280         sqrt( (str[0] - str[1])*(str[0] - str[1])/4.0 + str[2] * str[2] );
00281 
00282 /* Computes the angle
00283  */
00284  phi *= PI / 180.0;
00285 
00286 /* Compute plastic function (maximum shear stress)
00287  */
00288  (*yield) = pf = c - (str[1] * tan(phi));
00289 
00290 /* Correct the stress if necessery
00291  */
00292  if( pf < 0.0 )
00293  {
00294   str[0] = str[1] = 0.0;
00295  }
00296  else
00297  {
00298   if( pf < fabs(str[0]) ) 
00299   {
00300    if( str[0] > 0.0 ) str[0] =  pf;
00301    else               str[0] = -pf;
00302   }
00303  }
00304 
00305 } /* End of ItfMohrCoulombUpdateStress */
00306 
00307 
00308 /*
00309 ** ------------------------------------------------------------------------
00310 ** Public functions:
00311 */
00312 
00313 /*
00314 %F This function initializes the sub-class "INTERFACE MOHR COULOMB".
00315 */
00316 void ItfMohrCoulombMatInit( void );
00317 void ItfMohrCoulombMatInit( void )
00318 {
00319 /* Initialize INTERFACE MOHR COULOMB material sub-class
00320  */
00321  MatClass[ITF_MOHR_COULOMB].new       = ItfMohrCoulombNew;
00322  MatClass[ITF_MOHR_COULOMB].free      = ItfMohrCoulombFree;
00323  MatClass[ITF_MOHR_COULOMB].read      = ItfMohrCoulombRead;
00324  MatClass[ITF_MOHR_COULOMB].epar      = ItfMohrCoulombEParameter;
00325  MatClass[ITF_MOHR_COULOMB].nupar     = ItfMohrCoulombNuParameter;
00326  MatClass[ITF_MOHR_COULOMB].cmatrix   = ItfMohrCoulombCMatrix;
00327  MatClass[ITF_MOHR_COULOMB].updatestr = ItfMohrCoulombUpdateStress;
00328  MatClass[ITF_MOHR_COULOMB].updatepar = 0L;
00329  MatClass[ITF_MOHR_COULOMB].timestep  = 0L;
00330  MatClass[ITF_MOHR_COULOMB].density   = MaterialDensity;
00331  MatClass[ITF_MOHR_COULOMB].vstrain   = 0L;
00332 
00333 } /* End of ItfMohrCoulombMatInit */
00334 
00335 
00336 /* =======================================================  End of File  */
00337 

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