mises.c

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

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