orth.c

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

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