material.c

Go to the documentation of this file.
00001 /*
00002 %M This modules contains the material super class methods and definitions
00003 %a Joao Luiz Elias Campos.
00004 %d September 2nd, 1998.
00005 %r $Id: material.c,v 1.1 2004/06/22 05:29:59 joaoluiz Exp $
00006 %w (C) COPYRIGHT 1995-1996, Eduardo Nobre Lages.
00007    (C) COPYRIGHT 1997-1999, Joao Luiz Elias Campos.
00008    All Rights Reserved
00009    Duplication of this program or any part thereof without the express
00010    written consent of the author is prohibited.
00011 */
00012 
00013 /*
00014 ** ------------------------------------------------------------------------
00015 ** Global variables and symbols:
00016 */
00017 #include <stdio.h>
00018 #include <stdlib.h>
00019 #include <math.h>
00020 
00021 #include "load.h"
00022 #include "elm.h"
00023 #include "material.h"
00024 
00025 /*
00026 %V Material class, material list and number of material in the model
00027 */
00028 sMatClass   MatClass[NumMatTypes];
00029 sMaterial **MatList      = 0L;
00030 int         NumMaterials = 0;
00031 
00032 
00033 /*
00034 ** ------------------------------------------------------------------------
00035 ** Local variables and symbols:
00036 */
00037 
00038 /*
00039 ** ------------------------------------------------------------------------
00040 ** Local functions:
00041 */
00042 void MohrCoulombInit      ( void );
00043 void MohrCoulombCutOffInit( void );
00044 void MohrCoulombNACInit   ( void );
00045 void MohrCoulombNAVInit   ( void );
00046 void IsotropicInit        ( void );
00047 void IsotropicFailInit    ( void );
00048 void OrthotropicInit      ( void );
00049 void HiperbolicInit       ( void );
00050 void MisesInit            ( void );
00051 void InterfaceMatInit     ( void );
00052 void ItfMohrCoulombMatInit( void );
00053 void KelvinInit           ( void );
00054 void MaxwellInit          ( void );
00055 
00056 
00057 /*
00058 ** ------------------------------------------------------------------------
00059 ** Public functions:
00060 */
00061 void MaterialTimeStep( sMaterial *, double * );
00062 void MaterialDensity ( sMaterial *, double * );
00063 
00064 
00065 /*
00066 %F This function returns the material density value.
00067 %i Material identifier.
00068 %o Density value.
00069 */
00070 void MaterialDensity( sMaterial *mat, double *gamma )
00071 {
00072 /* Get density value
00073  */
00074  (*gamma) = mat->Gamma;
00075 
00076 } /* End of MaterialDensity */
00077 
00078 
00079 /*
00080 %F
00081 */
00082 void MaterialTimeStep( sMaterial *mat, double *dt )
00083 {
00084  double e, nu, gamma;
00085 
00086 /* material properties
00087  */
00088  MatEParameter( mat, &e );
00089  MatNuParameter( mat, &nu );
00090  MatDensity( mat, &gamma ); 
00091 
00092 /* Compute time step
00093  */
00094  (*dt) = 0.5 * sqrt(gamma * (1.0 - (2.0 * nu)) * (1.0 + nu) / (e * (1.0 - nu)));
00095 
00096 } /* End of MaterialTimeStep */
00097 
00098 
00099 /*
00100 %F This function initializes the globally shared "MatClass" variable. This
00101    variable holds the pointers to the necessary functions which implement 
00102    the material class methods.
00103 */
00104 void MaterialInit( void )
00105 {
00106  int i;
00107 
00108 /* Define the subclasses initialization methods
00109  */
00110  MatClass[MOHR_COULOMB_CUTOFF].init = MohrCoulombCutOffInit;
00111  MatClass[MOHR_COULOMB].init        = MohrCoulombInit;
00112  MatClass[MOHR_COULOMB_NAC].init    = MohrCoulombNACInit;
00113  MatClass[MOHR_COULOMB_NAV].init    = MohrCoulombNAVInit;
00114  MatClass[ISOTROPIC].init           = IsotropicInit;
00115  MatClass[ISOTROPIC_FAIL].init      = IsotropicFailInit;
00116  MatClass[ORTHOTROPIC].init         = OrthotropicInit;
00117  MatClass[HIPERBOLIC].init          = HiperbolicInit;
00118  MatClass[MISES].init               = MisesInit;
00119  MatClass[INTERFACE_MAT].init       = InterfaceMatInit;
00120  MatClass[ITF_MOHR_COULOMB].init    = ItfMohrCoulombMatInit;
00121  MatClass[KELVIN].init              = KelvinInit;
00122  MatClass[MAXWELL].init             = MaxwellInit;
00123 
00124  for( i = 0; i < NumMatTypes; i++ )
00125   MatInit( i );
00126 
00127 /* Allocate memory for element list
00128  */
00129  if( MatList != 0L )
00130   free( MatList );
00131 
00132  MatList = (sMaterial **)calloc( NumMaterials, sizeof(sMaterial *) );
00133 
00134 } /* End of MaterialInit */
00135 
00136 
00137 /*
00138 %F This function release memory used by element super-class.
00139 */
00140 void MaterialFree( void )
00141 {
00142  int i;
00143 
00144 /* Releases sub-classes
00145  */
00146  for( i = 0; i < NumMaterials; i++ )
00147   MatFree( MatList[i] );
00148 
00149 /* Release element list and reset it
00150  */
00151  free( MatList );
00152 
00153  MatList = 0L;
00154 
00155 } /* End of MaterialFree */
00156 
00157 /*
00158 %F
00159 */
00160 int MaterialIsVisco( sMaterial *mat )
00161 {
00162 /* Check to see if material is visco
00163  */
00164  if( mat->type != MAXWELL )
00165   return 0;
00166 
00167  return 1;
00168 
00169 } /* End of MaterialIsVisco */
00170 
00171 
00172 /* =======================================================  End of File  */
00173 

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