iso.c

Go to the documentation of this file.
00001 /*
00002 %M This modules contains the ISOTROPIC material sub-class methods and 
00003    definitions
00004 %a Joao Luiz Elias Campos.
00005 %d September 2nd, 1998.
00006 %r $Id: iso.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-1998, 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 
00026 #include "load.h"
00027 #include "elm.h"
00028 #include "material.h"
00029 #include "node.h"
00030 #include "rio.h"
00031 
00032 
00033 /* Parent methods
00034  */
00035 void MaterialTimeStep( sMaterial *, double * );
00036 void MaterialDensity ( sMaterial *, double * );
00037 
00038 /*
00039 ** ------------------------------------------------------------------------
00040 ** Local variables and symbols:
00041 */
00042 
00043 /*
00044 %T ISOTROPIC material data definition
00045 */
00046 typedef struct _isodata
00047 {
00048  double E;             /* Young modulos       */
00049  double Nu;            /* Poisson coefficient */
00050 } sIsoData;
00051 
00052 
00053 /*
00054 ** ------------------------------------------------------------------------
00055 ** Local functions:
00056 */
00057 
00058 
00059 /*
00060 ** ------------------------------------------------------------------------
00061 ** Subclass methods:
00062 */
00063 static void IsotropicNew        ( int, sMaterial ** );
00064 static void IsotropicFree       ( sMaterial * );
00065 static void IsotropicRead       ( sMaterial * );
00066 static void IsotropicEParameter ( sMaterial *, double * );
00067 static void IsotropicNuParameter( sMaterial *, double * );
00068 static void IsotropicCMatrix    ( sMaterial *, double [6][6] );
00069 static void IsotropicCPSMatrix  ( sMaterial *, double [6][6] ); 
00070 
00071 
00072 /*
00073 %F This method allocates memory for a ISOTROPIC material and fills its 
00074    data with the specific values.
00075 %i Material label (number)
00076 %o Material descriptor.
00077 */
00078 static void IsotropicNew( int label, sMaterial **mat )
00079 {
00080  sIsoData *data = 0L;
00081 
00082 /* Get memory for the material descriptor
00083  */
00084  (*mat) = (sMaterial *)calloc(1, sizeof(sMaterial));
00085 
00086 /* Get memory for the ISOTROPIC material data
00087  */
00088  data = (sIsoData *)calloc(1, sizeof(sIsoData));
00089 
00090 /* Fill ISOTROPIC material data
00091  */
00092  data->E   = 0.0;
00093  data->Nu  = 0.0;
00094 
00095 /* Fill material descriptor
00096  */
00097  (*mat)->type  = ISOTROPIC;
00098  (*mat)->label = label;
00099  (*mat)->Gamma = 0.0;
00100  (*mat)->Lambda = 0.0;
00101  (*mat)->data  = (void *)data;
00102 
00103 /* Add to the material list
00104  */
00105  MatList[label-1] = (*mat);
00106 
00107 } /* End of IsotropicNew */
00108 
00109 
00110 /*
00111 %F This method frees the ISOTROPIC material data for a given material.
00112 %i Material descriptor.
00113 */
00114 static void IsotropicFree( sMaterial *mat )
00115 {
00116  sIsoData *data = 0L;
00117 
00118 /* Get ISOTROPIC material data
00119  */
00120  data = (sIsoData *)mat->data;
00121 
00122 /* Release allocated memory
00123  */
00124  free( data );
00125 
00126 /* Reset material data
00127  */
00128  mat->data = 0L;
00129 
00130 } /* End of IsotropicFree */
00131 
00132 
00133 /*
00134 %F This method reads the ISOTROPIC material information.
00135 %i Material descriptor.
00136 */
00137 static void IsotropicRead( sMaterial *mat )
00138 {
00139  sIsoData *data = 0L;
00140  double    e, nu;
00141 
00142 /* Get the material data
00143  */
00144  data = (sIsoData *)mat->data;
00145 
00146 /* Read the material parameters
00147  */
00148  fscanf( nf, "%lf %lf", &e, &nu );
00149 
00150 /* Fill material information
00151  */
00152  data->E  = e;
00153  data->Nu = nu;
00154 
00155 } /* End of IsotropicRead */
00156 
00157 
00158 /*
00159 %F
00160 */
00161 static void IsotropicEParameter( sMaterial *mat, double *e )
00162 {
00163  sIsoData *data = 0L;
00164 
00165 /* Get material descriptor
00166  */ 
00167  data = (sIsoData *)mat->data;
00168 
00169 /* Get Young modules parameters
00170  */
00171  (*e) = data->E;
00172 
00173 } /* End of IsotropicEParameter */
00174 
00175 
00176 /*
00177 %F
00178 */
00179 static void IsotropicNuParameter( sMaterial *mat, double *nu )
00180 {
00181  sIsoData *data = 0L;
00182 
00183 /* Get material descriptor
00184  */ 
00185  data = (sIsoData *)mat->data;
00186 
00187 /* Get Poisson coefficient parameters
00188  */
00189  (*nu) = data->Nu;
00190 
00191 } /* End of IsotropicNuParameter */
00192 
00193 
00194 /*
00195 %F This function computes the material constitutive matrix
00196 */
00197 static void IsotropicCMatrix( sMaterial *mat, double cm[6][6] )
00198 {
00199  int       i, j;
00200  sIsoData *data = 0L;
00201  double    e, nu;
00202 
00203 /* Intialize matrix
00204  */
00205  for( i = 0; i < 6; i++ )
00206   for( j = 0; j < 6; j++ )
00207    cm[i][j] = 0.0;
00208 
00209 /* Get material descriptor
00210  */
00211  data = (sIsoData *)mat->data;
00212 
00213 /* Get element parameters
00214  */
00215  e  = data->E;
00216  nu = data->Nu;
00217 
00218 /* Compute matrix elements
00219  */
00220  if( NDof == 3 ) {
00221   cm[0][0] =
00222   cm[1][1] =
00223   cm[2][2] = (e*(1.0-nu))/((1.0+nu)*(1.0-(2.0*nu)));
00224   cm[3][3] =
00225   cm[4][4] =
00226   cm[5][5] = (e*(1.0-(2.0*nu)))/(2.0*(1.0+nu)*(1.0-(2.0*nu)));
00227   cm[0][1] =
00228   cm[0][2] =
00229   cm[1][2] =
00230   cm[1][0] =
00231   cm[2][0] =
00232   cm[2][1] = (e*nu)/((1.0+nu)*(1.0-(2.0*nu)));
00233  }
00234  else {
00235   cm[0][0] = cm[1][1] = (e * (1.0 - nu)) / ((1.0 + nu) * (1.0 - (2.0 * nu)));
00236   cm[0][1] = cm[1][0] = (e * nu) / ((1.0 + nu) * (1.0 - (2.0 * nu)));
00237   cm[2][2] = e / (2.0 * (1.0 + nu));
00238  }
00239  
00240 } /* End of IsotropicCMatrix */
00241 
00242 static void IsotropicCPSMatrix( sMaterial *mat, double cm[6][6] )
00243 {
00244  int       i, j;
00245  sIsoData *data = 0L;
00246  double    e, nu;
00247 
00248 /* Intialize matrix
00249  */
00250  for( i = 0; i < 6; i++ )
00251   for( j = 0; j < 6; j++ )
00252    cm[i][j] = 0.0;
00253 
00254 /* Get material descriptor
00255  */
00256  data = (sIsoData *)mat->data;
00257 
00258 /* Get element parameters
00259  */
00260  e  = data->E;
00261  nu = data->Nu;
00262 
00263 /* Compute matrix elements
00264  */
00265  cm[0][0] = cm[1][1] = e / (1.0 - nu * nu);
00266  cm[0][1] = cm[1][0] = (e *nu)/ (1.0 - nu * nu);
00267  cm[2][2] = (e * (1.0 - nu)) / (2.0 * (1.0 - nu * nu));
00268  
00269  
00270 } /* End of IsotropicCPSMatrix */
00271 
00272 
00273 /*
00274 ** ------------------------------------------------------------------------
00275 ** Public functions:
00276 */
00277 
00278 /*
00279 %F This function initializes the sub-class "ISOTROPIC".
00280 */
00281 void IsotropicInit( void );
00282 void IsotropicInit( void )
00283 {
00284 /* Initialize ISOTROPIC material sub-class
00285  */
00286  MatClass[ISOTROPIC].new       = IsotropicNew;
00287  MatClass[ISOTROPIC].free      = IsotropicFree;
00288  MatClass[ISOTROPIC].read      = IsotropicRead;
00289  MatClass[ISOTROPIC].epar      = IsotropicEParameter;
00290  MatClass[ISOTROPIC].nupar     = IsotropicNuParameter;
00291  MatClass[ISOTROPIC].cmatrix   = IsotropicCMatrix;
00292  MatClass[ISOTROPIC].updatestr = 0L;
00293  MatClass[ISOTROPIC].updatepar = 0L;
00294  MatClass[ISOTROPIC].timestep  = MaterialTimeStep;
00295  MatClass[ISOTROPIC].density   = MaterialDensity;
00296  MatClass[ISOTROPIC].vstrain   = 0L;
00297  MatClass[ISOTROPIC].cpsmatrix = IsotropicCPSMatrix;
00298  
00299 } /* End of IsotropicInit */
00300 
00301 
00302 /* =======================================================  End of File  */
00303 

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