00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00034
00035 void MaterialTimeStep( sMaterial *, double * );
00036 void MaterialDensity ( sMaterial *, double * );
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 typedef struct _isodata
00048 {
00049 double E;
00050 double Nu;
00051 double N;
00052 } sMaxwellData;
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 static void MaxwellNew ( int, sMaterial ** );
00066 static void MaxwellFree ( sMaterial * );
00067 static void MaxwellRead ( sMaterial * );
00068 static void MaxwellEParameter ( sMaterial *, double * );
00069 static void MaxwellNuParameter ( sMaterial *, double * );
00070 static void MaxwellCMatrix ( sMaterial *, double [6][6] );
00071 static void MaxwellViscoStrain ( sMaterial *, double, sTensor *, sTensor * );
00072 static void MaxwellUpdateStress( sMaterial *, double, double *, double *,
00073 double *, double * );
00074
00075
00076
00077
00078
00079
00080
00081
00082 static void MaxwellNew( int label, sMaterial **mat )
00083 {
00084 sMaxwellData *data = 0L;
00085
00086
00087
00088 (*mat) = (sMaterial *)calloc(1, sizeof(sMaterial));
00089
00090
00091
00092 data = (sMaxwellData *)calloc(1, sizeof(sMaxwellData));
00093
00094
00095
00096 data->E = 0.0;
00097 data->Nu = 0.0;
00098 data->N = 0.0;
00099
00100
00101
00102 (*mat)->type = MAXWELL;
00103 (*mat)->label = label;
00104 (*mat)->Gamma = 0.0;
00105 (*mat)->data = (void *)data;
00106
00107
00108
00109 MatList[label-1] = (*mat);
00110
00111 }
00112
00113
00114
00115
00116
00117
00118 static void MaxwellFree( sMaterial *mat )
00119 {
00120 sMaxwellData *data = 0L;
00121
00122
00123
00124 data = (sMaxwellData *)mat->data;
00125
00126
00127
00128 free( data );
00129
00130
00131
00132 mat->data = 0L;
00133
00134 }
00135
00136
00137
00138
00139
00140
00141 static void MaxwellRead( sMaterial *mat )
00142 {
00143 sMaxwellData *data = 0L;
00144 double e, nu, n;
00145
00146
00147
00148 data = (sMaxwellData *)mat->data;
00149
00150
00151
00152 fscanf( nf, "%lf %lf %lf", &e, &nu, &n );
00153
00154
00155
00156 data->E = e;
00157 data->Nu = nu;
00158 data->N = n;
00159
00160 }
00161
00162
00163
00164
00165
00166 static void MaxwellEParameter( sMaterial *mat, double *e )
00167 {
00168 sMaxwellData *data = 0L;
00169
00170
00171
00172 data = (sMaxwellData *)mat->data;
00173
00174
00175
00176 (*e) = data->E;
00177
00178 }
00179
00180
00181
00182
00183
00184 static void MaxwellNuParameter( sMaterial *mat, double *nu )
00185 {
00186 sMaxwellData *data = 0L;
00187
00188
00189
00190 data = (sMaxwellData *)mat->data;
00191
00192
00193
00194 (*nu) = data->Nu;
00195
00196 }
00197
00198
00199
00200
00201
00202 static void MaxwellCMatrix( sMaterial *mat, double cm[6][6] )
00203 {
00204 int i, j;
00205 sMaxwellData *data = 0L;
00206 double e, nu;
00207
00208
00209
00210 for( i = 0; i < 6; i++ )
00211 for( j = 0; j < 6; j++ )
00212 cm[i][j] = 0.0;
00213
00214
00215
00216 data = (sMaxwellData *)mat->data;
00217
00218
00219
00220 e = data->E;
00221 nu = data->Nu;
00222
00223
00224
00225 if( NDof == 3 )
00226 {
00227 cm[0][0] =
00228 cm[1][1] =
00229 cm[2][2] = e*(nu*nu-1.0) / (nu*(nu+nu*nu)+nu*(nu*nu+nu)+nu*nu-1.0);
00230 cm[1][0] =
00231 cm[2][0] =
00232 cm[0][1] =
00233 cm[2][1] =
00234 cm[0][2] =
00235 cm[1][2] = -e*(nu*nu+nu) / (nu*(nu+nu*nu)+nu*(nu*nu+nu)+nu*nu-1.0);
00236 cm[3][3] =
00237 cm[4][4] =
00238 cm[5][5] = (e * e) / (e + e * (1.0 + 2.0 * nu));
00239 }
00240 else
00241 {
00242 cm[0][0] = cm[1][1] = (e * (1.0 - nu)) / ((1.0 + nu) * (1.0 - (2.0 * nu)));
00243 cm[0][1] = cm[1][0] = (e * nu) / ((1.0 + nu) * (1.0 - (2.0 * nu)));
00244 cm[2][2] = e / (2.0 * (1.0 + nu));
00245 }
00246
00247 }
00248
00249
00250
00251
00252 static void MaxwellViscoStrain( sMaterial *mat, double timeStep, sTensor *str,
00253 sTensor *stav )
00254 {
00255 double sm, n;
00256 sMaxwellData *data = 0L;
00257
00258
00259
00260 data = (sMaxwellData *)mat->data;
00261
00262
00263
00264 n = data->N;
00265
00266
00267
00268 sm = (str->xx + str->yy + str->zz) / 3.0;
00269
00270
00271
00272 stav->xx = 0.5 * n * (str->xx - sm) / timeStep;
00273 stav->yy = 0.5 * n * (str->yy - sm) / timeStep;
00274 stav->zz = 0.5 * n * (str->zz - sm) / timeStep;
00275 stav->xy = 0.5 * n * str->xy / timeStep;
00276 stav->xz = 0.5 * n * str->xz / timeStep;
00277 stav->yz = 0.5 * n * str->yz / timeStep;
00278
00279 }
00280
00283 static void MaxwellUpdateStress( sMaterial *mat, double dtime,
00284 double *yield,
00285 double *effdef,
00286 double *str,
00287 double *def )
00288 {
00289 sMaxwellData *data = 0L;
00290 double n, ni;
00291 double cm[6][6];
00292 double C1, C2;
00293 sTensor stre, stra, stred, strad, upstrd;
00294 sPTensor pstr;
00295
00296
00297
00298 data = (sMaxwellData *)mat->data;
00299
00300
00301
00302 MaxwellCMatrix( mat, cm );
00303
00304
00305
00306 MaxwellNuParameter( mat, &ni );
00307
00308
00309
00310 n = data->N;
00311
00312
00313
00314 C1 = 1.0 - ((cm[2][2] * dtime)/(2.0 * n));
00315 C2 = 1.0 / (1.0 + ((cm[2][2] * dtime)/(2.0 * n)));
00316
00317
00318
00319 stre.xx = str[0];
00320 stre.yy = str[1];
00321 stre.xy = str[2];
00322 PrincipalTensor( &stre, &pstr );
00323
00324 stred.xx = stre.xx - ((pstr.dir1 + pstr.dir3 + pstr.dir2)/3.0);
00325 stred.yy = stre.yy - ((pstr.dir1 + pstr.dir3 + pstr.dir2)/3.0);
00326
00327 stra.xx = def[0];
00328 stra.yy = def[1];
00329 stra.xy = def[2];
00330 PrincipalTensor( &stra, &pstr );
00331
00332 strad.xx = stra.xx - ((pstr.dir1 + pstr.dir3 + pstr.dir2)/3.0);
00333 strad.yy = stra.yy - ((pstr.dir1 + pstr.dir3 + pstr.dir2)/3.0);
00334
00335
00336
00337 upstrd.xx = C2 * ((C1 * stred.xx) + (2.0 * cm[2][2] * strad.xx));
00338 upstrd.yy = C2 * ((C1 * stred.yy) + (2.0 * cm[2][2] * strad.yy));
00339
00340 }
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351 void MaxwellInit( void );
00352 void MaxwellInit( void )
00353 {
00354
00355
00356 MatClass[MAXWELL].new = MaxwellNew;
00357 MatClass[MAXWELL].free = MaxwellFree;
00358 MatClass[MAXWELL].read = MaxwellRead;
00359 MatClass[MAXWELL].epar = MaxwellEParameter;
00360 MatClass[MAXWELL].nupar = MaxwellNuParameter;
00361 MatClass[MAXWELL].cmatrix = MaxwellCMatrix;
00362 MatClass[MAXWELL].updatestr = 0L;
00363 MatClass[MAXWELL].updatepar = 0L;
00364 MatClass[MAXWELL].timestep = MaterialTimeStep;
00365 MatClass[MAXWELL].density = MaterialDensity;
00366 MatClass[MAXWELL].vstrain = MaxwellViscoStrain;
00367
00368 }
00369
00370
00371
00372