inter.c

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

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