isofail.c

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

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