kelvin.c

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

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