00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 #include <stdio.h>
00060 #include <stdlib.h>
00061 #include <string.h>
00062
00063 #include "nfi.h"
00064 #include "drv.h"
00065 #include "load.h"
00066 #include "elm.h"
00067 #include "node.h"
00068 #include "material.h"
00069 #include "load.h"
00070 #include "alg.h"
00071 #include "xgplib.h"
00072 #include "rio.h"
00073 #include "damp.h"
00074 #include "constrain.h"
00075 #include "relax.h"
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 typedef struct _nfiversion
00087 {
00088 int version;
00089 int release;
00090 int revision;
00091 } sNfiVersion;
00092
00093
00094
00095
00096
00097 static sNfiVersion _NfiVersion = { 2, 0, 0 };
00098
00099
00100
00101
00102
00103 #define LABEL_SIZE 12
00104
00105
00106
00107
00108
00109 static FILE *_NfiName = 0L;
00110
00111
00112
00113
00114
00115 static int _CurrCase = 0;
00116
00117
00118
00119
00120
00121 static int _TimeStep = 0;
00122 static int _TotalTime = 0;
00123 static int _TimeFraction = 0;
00124 static int _DampParameters = 0;
00125 static int _Tolerance = 0;
00126 static int _NumStepTol = 0;
00127 static int _MaxIterations = 0;
00128 static int _GeomNonLinear = 0;
00129 static int _Fsolution = 0;
00130 static int _NumLoadStep = 0;
00131 static int _AlgType = 0;
00132 static int _NumRes = 0;
00133 static int _SolverType = 0;
00134
00135
00136
00137
00138
00139 static int _NfiNextLabel ( char * );
00140 static int _NfiReadString ( char * );
00141 static void _NfiReadVersion ( void );
00142 static int _NfiReadAnalysisType ( void );
00143 static int _NfiReadNode ( void );
00144 static int _NfiReadNodeCoord ( void );
00145 static void _NfiReadNodeSupport ( void );
00146 static void _NfiReadNodeDispTimeDisplay ( void );
00147 static void _NfiReadNodeDispDisplay ( void );
00148 static void _NfiReadNodeVelocDisplay ( void );
00149 static void _NfiReadIntegrationOrder ( void );
00150 static void _NfiReadThickness ( void );
00151 static void _NfiReadMaterial ( void );
00152 static void _NfiReadMaterialPROPERTYDENSITY ( void );
00153 static void _NfiReadMaterialPROPERTYLAMBDA ( void );
00154 static void _NfiReadMaterialFLUIDDENSITY ( void );
00155 static void _NfiReadMaterialFLUIDLAMBDA ( void );
00156 static void _NfiReadMaterialMISES ( void );
00157 static void _NfiReadMaterialINTERFACEMOHRCOULOMB( void );
00158 static void _NfiReadMaterialINTERFACE ( void );
00159 static void _NfiReadMaterialISOTROPIC ( void );
00160 static void _NfiReadMaterialISOTROPICFAIL ( void );
00161 static void _NfiReadMaterialORTHOTROPIC ( void );
00162 static void _NfiReadMaterialHIPERBOLIC ( void );
00163 static void _NfiReadMaterialMOHRCOULOMB ( void );
00164 static void _NfiReadMaterialMOHRCOULOMBCUTOFF ( void );
00165 static void _NfiReadMaterialMOHRCOULOMBNAC ( void );
00166 static void _NfiReadMaterialMOHRCOULOMBNAV ( void );
00167 static void _NfiReadMaterialKELVIN ( void );
00168 static void _NfiReadMaterialMAXWELL ( void );
00169 static void _NfiReadMaterialGENERIC ( void );
00170 static int _NfiReadElement ( void );
00171 static void _NfiReadElementLINE2 ( void );
00172 static void _NfiReadElementT3 ( void );
00173 static void _NfiReadElementQ4 ( void );
00174 static void _NfiReadElementBRICK8 ( void );
00175 static void _NfiReadElementTETR4 ( void );
00176 static void _NfiReadElementINTERFACE ( void );
00177 static void _NfiReadElementINFINITE ( void );
00178 static void _NfiReadLoad ( void );
00179 static void _NfiReadLoadCase ( void );
00180 static void _NfiReadLoadCaseGravity ( void );
00181 static void _NfiReadLoadCaseNodalPressure ( void );
00182 static void _NfiReadLoadCaseNodalForces ( void );
00183 static void _NfiReadLoadCaseNodalVelocity ( void );
00184 static void _NfiReadLoadCaseLineForcesUni ( void );
00185 static void _NfiReadLoadCaseLineForcesVar ( void );
00186 static int _NfiReadLoadCaseDomainInitStressUni ( void );
00187 static void _NfiReadLoadCaseDomainTempUni ( void );
00188 static void _NfiReadLoadCaseNodalDisplacements ( void );
00189 static void _NfiReadLoadCaseElementPotencial ( void );
00190 static void _NfiReadLoadCaseNodalSupport ( void );
00191 static void _NfiReadTotalTime ( void );
00192 static void _NfiReadTimeStep ( void );
00193 static void _NfiReadTimeFraction ( void );
00194 static int _NfiReadDamping ( void );
00195 static void _NfiReadDampingGlobalParameter ( void );
00196 static void _NfiReadDampingLocalParameter ( void );
00197 static void _NfiReadDampingRayleighParameter ( void );
00198 static void _NfiReadTolerance ( void );
00199 static void _NfiReadNumStepTol ( void );
00200 static void _NfiReadMaximumIteration ( void );
00201 static void _NfiReadPrintStep ( void );
00202 static void _NfiReadDrawStep ( void );
00203 static void _NfiReadGeometricallyNonLinear ( void );
00204 static void _NfiReadRezone ( void );
00205 static void _NfiReadRezoneCase ( void );
00206 static void _NfiReadRezoneCaseElement ( void );
00207 static void _NfiWriteResultStep ( int, long, long, double * );
00208 static int _NfiReadConstrain ( void );
00209 static void _NfiReadConstrainCurve ( void );
00210 static void _NfiReadNodeConstrain ( void );
00211 static void _NfiReadNodePilot ( void );
00212 static void _NfiReadElementProfileT3 ( void );
00213 static void _NfiReadElementProfileQ4 ( void );
00214 static void _NfiReadElementProfileBRICK8 ( void );
00215 static void _NfiReadElementProfileTETRA4 ( void );
00216
00217 static void _NfiReadLoadCaseAreaUniform ( void );
00218 static int _NfiReadAlgorithmType ( void );
00219 static void _NfiReadNumLoadStep ( void );
00220 static void _NfiReadNumGaussResults ( void );
00221 static int _NfiReadSolverType ( void );
00222 static void _NfiReadLoadCaseAreaPressure ( void );
00223
00224 static void _NfiReadElementDKT ( void );
00228 static void _NfiReadNodePilot( void )
00229 {
00230 int id, c, num, i;
00231
00232
00233
00234 fscanf(_NfiName, "%d", &num);
00235
00236
00237
00238 for(i = 0; i < num; i++)
00239 {
00240 fscanf(_NfiName, "%d%d", &id, &c);
00241 NodeVector[id-1].pilot = c;
00242 }
00243
00244 }
00245
00249 static void _NfiReadNodeConstrain(void)
00250 {
00251 int id, c, num, i;
00252
00253 fscanf(_NfiName, "%d", &num);
00254 for( i = 0; i < num; i++ )
00255 {
00256 fscanf(_NfiName, "%d%d", &id, &c);
00257 NodeVector[id-1].dof.x = OBJECT;
00258 NodeVector[id-1].dof.y = OBJECT;
00259 NodeVector[id-1].dof.z = OBJECT;
00260 NodeVector[id-1].constrain.id = c;
00261 }
00262 }
00263
00267 static int _NfiReadConstrain(void)
00268 {
00269 int nconst;
00270
00271
00272
00273 fscanf(_NfiName, "%d", &nconst);
00274
00275
00276
00277 if( nconst == 0 ) {
00278 printf("\nThe number of constrains must be given!\n");
00279 return 0;
00280 }
00281
00282
00283
00284 NumConstrains = nconst;
00285
00286
00287
00288 ConstrainInit();
00289
00290 return 1;
00291
00292 }
00293
00297 static void _NfiReadConstrainCurve(void)
00298 {
00299 int n, i;
00300 int id, num_nodes, num_elems;
00301 sConstrain *c = 0L;
00302
00303
00304
00305 fscanf(_NfiName, "%d", &n);
00306
00307
00308
00309 for( i = 0; i < n; i++ )
00310 {
00311 fscanf(_NfiName, "%d%d%d", &id, &num_nodes, &num_elems);
00312 ConstNew(CURVE, id, num_nodes, num_elems, &c, ConstList);
00313 ConstRead(c);
00314 }
00315
00316 }
00317
00321 static void _NfiReadConstrainShot(void)
00322 {
00323 int n, i;
00324 int id;
00325 int num_nodes = 2;
00326 int num_elems = 1;
00327 sConstrain *c = 0L;
00328
00329
00330
00331 fscanf(_NfiName, "%d", &n);
00332
00333
00334
00335 for( i = 0; i < n; i++ )
00336 {
00337 fscanf(_NfiName, "%d", &id);
00338 ConstNew(SHOT, id, num_nodes, num_elems, &c, ConstList);
00339 ConstRead(c);
00340 }
00341 }
00342
00346 static void _NfiReadConstrainSurface(void)
00347 {
00348 int n, i;
00349 int id, num_nodes, num_elems;
00350 sConstrain *c = 0L;
00351
00352
00353
00354 fscanf(_NfiName, "%d", &n);
00355
00356
00357
00358 for( i = 0; i < n; i++ )
00359 {
00360 fscanf(_NfiName, "%d%d%d", &id, &num_nodes, &num_elems);
00361 ConstNew(SURFACE, id, num_nodes, num_elems, &c, ConstList);
00362 ConstRead(c);
00363 }
00364
00365 }
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 static int _NfiNextLabel( char *label )
00376 {
00377 int c;
00378
00379
00380
00381 while( (c = fgetc( _NfiName )) != '%' )
00382 if( c == EOF )
00383 return( 0 );
00384
00385
00386
00387 if( fscanf( _NfiName, "%s", label ) != 1 )
00388 return( 0 );
00389 else
00390 return( 1 );
00391
00392 }
00393
00394
00395
00396
00397
00398
00399
00400 static int _NfiReadString( char *s )
00401 {
00402 char c;
00403 char tmp[256];
00404
00405 if( fscanf( _NfiName, " '%[^\n']", tmp ) != 1 )
00406 return( 0 );
00407
00408 #if 0
00409 strncpy( s, tmp, LABEL_SIZE );
00410 #else
00411 strcpy( s, tmp );
00412 #endif
00413
00414 fscanf( _NfiName, "%c", &c );
00415
00416 if( c == '\'' )
00417 return( 1 );
00418 else
00419 return( 0 );
00420
00421 }
00422
00423
00424
00425
00426
00427 static void _NfiReadVersion( void )
00428 {
00429 char version[80];
00430
00431
00432
00433 if( !_NfiReadString( version ) )
00434 return;
00435
00436
00437
00438 sscanf( version, "%d.%d.%d", &_NfiVersion.version,
00439 &_NfiVersion.release,
00440 &_NfiVersion.revision );
00441
00442 }
00443
00444
00445
00446
00447
00448 static int _NfiReadAnalysisType( void )
00449 {
00450 char anmtype[80];
00451
00452
00453
00454 DriverInit( );
00455
00456
00457
00458 if( !_NfiReadString( anmtype ) )
00459 {
00460 printf( "\n\n\tError on read the analysis type...\n\n" );
00461 return 0;
00462 }
00463
00464
00465
00466 if( (strcmp( anmtype, "plane_strain" ) == 0) ||
00467 (strcmp( anmtype, "Plane_Strain" ) == 0) ||
00468 (strcmp( anmtype, "PLANE_STRAIN" ) == 0) )
00469 {
00470 NDof = 2;
00471 }
00472 else if( (strcmp( anmtype, "solid" ) == 0) ||
00473 (strcmp( anmtype, "Solid" ) == 0) ||
00474 (strcmp( anmtype, "SOLID" ) == 0) )
00475 {
00476 NDof = 3;
00477 }
00478 else
00479 {
00480 printf( "\n\n\tThis Analysis type is not implemented yet...\n\n" );
00481 return 0;
00482 }
00483
00484 return 1;
00485 }
00486
00487
00488
00489
00490
00491 static int _NfiReadAlgorithmType( void )
00492 {
00493 char algtype[80];
00494
00495
00496 if( !_NfiReadString( algtype ) )
00497 {
00498 printf( "\n\n\tError on read the analysis algorithm type...\n\n" );
00499 return 0;
00500 }
00501 if(strcmp( algtype, "dr" ) == 0){ Config.algtype = 0; }
00502 else if(strcmp( algtype, "linear" ) == 0 ){Config.algtype = 1; }
00503 else if(strcmp( algtype, "nrm" ) == 0){ Config.algtype = 2; }
00504 else if(strcmp( algtype, "bfgs" ) == 0){ Config.algtype = 3; }
00505 else if(strcmp( algtype, "hs" ) == 0){ Config.algtype = 4; }
00506 else{
00507 printf( "\n\n\tThis Analysis algorithm type is not implemented yet...\n\n" );
00508 return 0;
00509 }
00510
00511 _AlgType = 1;
00512
00513 return ( _AlgType );
00514 }
00515
00516
00517
00518
00519
00520 static int _NfiReadSolverType( void )
00521 {
00522 char solvertype[80];
00523
00524
00525 if( !_NfiReadString( solvertype ) )
00526 {
00527 printf( "\n\n\tError on read the solver algorithm type...\n\n" );
00528 return 0;
00529 }
00530 if(strcmp( solvertype, "pcg" ) == 0) { Config.solver = 0; }
00531 else if(strcmp( solvertype, "samg" ) == 0 ){ Config.solver = 1; }
00532 else{
00533 printf( "\n\n\tThis Solver type is not implemented yet...\n\n" );
00534 return 0;
00535 }
00536
00537 _SolverType = 1;
00538
00539 return ( _SolverType );
00540 }
00541
00542
00543
00544
00545
00546 static void _NfiReadTimeFraction( void )
00547 {
00548 double time_frac;
00549
00550
00551
00552 fscanf( _NfiName, "%lf", &time_frac );
00553
00554
00555
00556 Config.dtfrac = time_frac;
00557
00558
00559
00560 _TimeFraction = 1;
00561
00562 }
00563
00564
00565
00566
00567 static void _NfiReadTimeStep( void )
00568 {
00569 double time_step;
00570
00571
00572
00573 fscanf( _NfiName, "%lf", &time_step );
00574
00575
00576
00577 Config.timeStep = time_step;
00578
00579
00580
00581 _TimeStep = 1;
00582
00583 }
00584
00585
00586
00587
00588 static void _NfiReadTotalTime( void )
00589 {
00590 double total_time;
00591
00592
00593
00594 fscanf( _NfiName, "%lf", &total_time );
00595
00596
00597
00598 Config.totalTime = total_time;
00599
00600
00601
00602 _TotalTime = 1;
00603
00604 }
00605
00609 static int _NfiReadDamping(void)
00610 {
00611 char damptype[80];
00612
00613
00614
00615 if( !_NfiReadString(damptype) ) {
00616 printf("\n\n\tError on read the damping type...\n\n");
00617 return 0;
00618 }
00619
00620 if( strcmp(damptype, "auto_global") == 0 ) {
00621 DampNew(AUTO_GLOBAL,&DampObj);
00622 }
00623 else if( strcmp(damptype, "auto_local") == 0 ) {
00624 DampNew(AUTO_LOCAL,&DampObj);
00625 }
00626 else {
00627 DampNew(RAYLEIGH,&DampObj);
00628 }
00629 DampRead(DampObj);
00630 _DampParameters = 1;
00631
00632 return 1;
00633
00634 }
00635
00636
00637
00638
00639 static void _NfiReadDampingGlobalParameter( void )
00640 {
00641
00642
00643 DampNew(AUTO_GLOBAL,&DampObj);
00644 DampRead(DampObj);
00645
00646
00647
00648 _DampParameters = 1;
00649
00650 }
00651
00652
00653
00654
00655 static void _NfiReadDampingLocalParameter( void )
00656 {
00657
00658
00659 DampNew(AUTO_LOCAL,&DampObj);
00660 DampRead(DampObj);
00661
00662
00663
00664 _DampParameters = 2;
00665
00666 }
00667
00668
00669
00670
00671 static void _NfiReadDampingRayleighParameter( void )
00672 {
00673
00674
00675 DampNew(RAYLEIGH,&DampObj);
00676 DampRead(DampObj);
00677
00678
00679
00680 _DampParameters = 3;
00681
00682 }
00683
00684
00685
00686
00687
00688 static void _NfiReadTolerance( void )
00689 {
00690 double tol;
00691
00692
00693
00694 fscanf( _NfiName, "%lf", &tol );
00695
00696
00697
00698 Config.tolerance = tol;
00699
00700
00701
00702 _Tolerance = 1;
00703
00704 }
00705
00706
00707
00708
00709
00710
00711 static void _NfiReadNumStepTol( void )
00712 {
00713 int step;
00714
00715
00716
00717 fscanf( _NfiName, "%d", &step );
00718
00719
00720
00721 Config.numsteptol = step;
00722
00723
00724
00725 _NumStepTol = 1;
00726
00727 }
00728
00729
00730
00731
00732
00733 static void _NfiReadNumGaussResults( void )
00734 {
00735 int i,numres;
00736 char res[80];
00737
00738
00739
00740 fscanf( _NfiName, "%d", &numres );
00741
00742
00743
00744 Config.numgaussresults = numres;
00745
00746 Config.gaussresults = (char**) malloc( numres * sizeof( char * ) );
00747
00748 for( i = 0; i < numres; i++){
00749 fscanf( _NfiName, "%s", &res );
00750 Config.gaussresults[i] = strdup ( res );
00751 }
00752
00753
00754
00755 _NumRes = 1;
00756
00757 }
00758
00759
00760
00761
00762
00763
00764 static void _NfiReadGeometricallyNonLinear( void )
00765 {
00766 int flag;
00767
00768
00769
00770 fscanf( _NfiName, "%d", &flag );
00771
00772
00773
00774 Config.nonlinear = flag;
00775
00776
00777
00778 _GeomNonLinear = 1;
00779
00780 }
00781
00782
00783 static void _NfiReadNumLoadStep( void )
00784 {
00785 int flag;
00786
00787
00788
00789 fscanf( _NfiName, "%d", &flag );
00790
00791
00792
00793 Config.num_load_step = flag;
00794
00795
00796
00797 _NumLoadStep = 1;
00798
00799 }
00800
00801
00802
00803
00804
00805 static void _NfiReadMaximumIteration( void )
00806 {
00807 int iter;
00808
00809
00810
00811 fscanf( _NfiName, "%d", &iter );
00812
00813
00814
00815 Config.max_iter = iter;
00816
00817
00818
00819 NumMaxPoints = iter;
00820
00821
00822
00823 _MaxIterations = 1;
00824
00825 }
00826
00827
00828
00829
00830
00831 static void _NfiReadPrintStep( void )
00832 {
00833 int step;
00834
00835
00836
00837 fscanf( _NfiName, "%d", &step );
00838
00839
00840
00841 Config.print_step = step;
00842
00843 }
00844
00848 static void _NfiReadDrawStep(void)
00849 {
00850 int step;
00851
00852
00853
00854 fscanf(_NfiName, "%d", &step);
00855
00856
00857
00858 Config.draw_step = step;
00859
00860 }
00861
00862
00863
00864
00865
00866
00867 static int _NfiReadNode( void )
00868 {
00869 int nnode;
00870
00871
00872
00873 fscanf( _NfiName, "%d", &nnode );
00874
00875
00876
00877 if( nnode == 0 )
00878 {
00879 printf( "\nThe number of nodes must be given!\n" );
00880 return 0;
00881 }
00882
00883
00884
00885 NumNodes = nnode;
00886
00887
00888
00889 NodeVector = (sNode *)calloc( nnode, sizeof(sNode) );
00890
00891 return 1;
00892 }
00893
00894
00895
00896
00897
00898
00899 static int _NfiReadNodeCoord( void )
00900 {
00901 int nnode, i, id;
00902 double x, y, z;
00903
00904
00905
00906 fscanf( _NfiName, "%d", &nnode );
00907
00908
00909
00910 if( nnode != NumNodes )
00911 {
00912 printf( "\nThe number of nodes were redefined!\n" );
00913 return 0;
00914 }
00915
00916
00917
00918 for( i = 0; i < NumNodes; i++ )
00919 {
00920 fscanf( _NfiName, "%d%lf%lf%lf", &id, &x, &y, &z );
00921 NodeVector[i].id = id;
00922 NodeVector[i].coord.x = x;
00923 NodeVector[i].coord.y = y;
00924 NodeVector[i].coord.z = z;
00925 NodeVector[i].dof.x = FORCE;
00926 NodeVector[i].dof.y = FORCE;
00927 NodeVector[i].dof.z = FORCE;
00928 NodeVector[i].dof.psi = 0.0;
00929 NodeVector[i].rezone = NONE;
00930 NodeVector[i].curve = 0;
00931 NodeVector[i].dspIteration = DSP_NO;
00932 NodeVector[i].dspTime = DSP_NO;
00933 NodeVector[i].pilot = 0;
00934 }
00935
00936 return 1;
00937 }
00938
00939
00940
00941
00942
00943 static void _NfiReadNodeSupport( void )
00944 {
00945 int i, num;
00946 int id, dx, dy, dz;
00947
00948
00949
00950 fscanf( _NfiName, "%d", &num );
00951
00952
00953
00954 for( i = 0; i < num; i++ )
00955 {
00956 fscanf( _NfiName, "%d %d %d %d %*d%*d%*d", &id, &dx, &dy, &dz );
00957
00958 if( dx == 1 ) NodeVector[id-1].dof.x = DISPLACEMENT;
00959
00960 if( dy == 1 ) NodeVector[id-1].dof.y = DISPLACEMENT;
00961
00962 if( dz == 1 ) NodeVector[id-1].dof.z = DISPLACEMENT;
00963 }
00964
00965 }
00966
00967
00968
00969
00970
00971 static void _NfiReadNodeDispDisplay( void )
00972 {
00973 int i, num;
00974 int id;
00975
00976
00977
00978 fscanf( _NfiName, "%d", &num );
00979
00980
00981
00982 NumCurves = num;
00983 Labels = (char **)calloc( num, sizeof(char *) );
00984 for( i = 0; i < num; i++ )
00985 Labels[i] = (char *)calloc( 20, sizeof(char) );
00986
00987
00988
00989 for( i = 0; i < num; i++ )
00990 {
00991 fscanf( _NfiName, "%d", &id );
00992
00993 NodeVector[id-1].dspIteration = DSP_YES;
00994 NodeVector[id-1].curve = i;
00995 sprintf( Labels[i], "Node %d", id );
00996 }
00997
00998
00999
01000 GpType = 0;
01001
01002 }
01003
01004
01005
01006
01007
01008 static void _NfiReadNodeDispTimeDisplay( void )
01009 {
01010 int i, num;
01011 int id;
01012
01013
01014
01015 fscanf( _NfiName, "%d", &num );
01016
01017
01018
01019 NumCurves = num;
01020 Labels = (char **)calloc( num, sizeof(char *) );
01021 for( i = 0; i < num; i++ )
01022 Labels[i] = (char *)calloc( 20, sizeof(char) );
01023
01024
01025
01026 for( i = 0; i < num; i++ )
01027 {
01028 fscanf( _NfiName, "%d", &id );
01029
01030 NodeVector[id-1].dspTime = DSP_YES;
01031 NodeVector[id-1].curve = i;
01032 sprintf( Labels[i], "Node %d", id );
01033 }
01034
01035
01036
01037 GpType = 4;
01038
01039 }
01040
01041
01042
01043
01044
01045 static void _NfiReadNodeVelocDisplay( void )
01046 {
01047 int i, num;
01048 int id;
01049
01050
01051
01052 fscanf( _NfiName, "%d", &num );
01053
01054
01055
01056 NumCurves = num;
01057 Labels = (char **)calloc( num, sizeof(char *) );
01058 for( i = 0; i < num; i++ )
01059 Labels[i] = (char *)calloc( 20, sizeof(char) );
01060
01061
01062
01063 for( i = 0; i < num; i++ )
01064 {
01065 fscanf( _NfiName, "%d", &id );
01066
01067 NodeVector[id-1].dspIteration = DSP_YES;
01068 NodeVector[id-1].curve = i;
01069 sprintf( Labels[i], "Node %d", id );
01070 }
01071
01072
01073
01074 GpType = 1;
01075
01076 }
01077
01078
01079
01080
01081
01082 static void _NfiReadIntegrationOrder( void )
01083 {
01084 int num, i, r, s, t, id;
01085
01086
01087
01088 fscanf( _NfiName, "%d", &num );
01089
01090
01091
01092 NumIntOrder = num;
01093
01094
01095
01096 IntOrder = (sOrder *)calloc( NumIntOrder, sizeof(sOrder) );
01097
01098
01099
01100 for( i = 0; i < num; i++ )
01101 {
01102 fscanf( _NfiName, "%d %d %d %d %*d %*d %*d", &id, &r, &s, &t );
01103 IntOrder[id-1].r = r;
01104 IntOrder[id-1].s = s;
01105 IntOrder[id-1].t = t;
01106 }
01107
01108 }
01109
01110
01111
01112
01113
01114 static void _NfiReadThickness( void )
01115 {
01116 int num, i, id;
01117 double tck;
01118
01119
01120
01121 fscanf( _NfiName, "%d", &num );
01122
01123
01124
01125 NumThickness = num;
01126
01127
01128
01129 Thickness = (double *)calloc( NumThickness, sizeof(double) );
01130
01131
01132
01133 for( i = 0; i < num; i++ )
01134 {
01135 fscanf( _NfiName, "%d %lf", &id, &tck );
01136 Thickness[id-1] = tck;
01137 }
01138
01139 }
01140
01141
01142
01143
01144
01145 static void _NfiReadMaterial( void )
01146 {
01147 int num;
01148
01149
01150
01151 fscanf( _NfiName, "%d", &num );
01152
01153
01154
01155 NumMaterials = num;
01156
01157
01158
01159 MaterialInit( );
01160
01161 }
01162
01163
01164
01165
01166
01167 static void _NfiReadMaterialFLUIDDENSITY( void )
01168 {
01169 int num, i, id;
01170 double rho;
01171
01172
01173
01174 fscanf( _NfiName, "%d", &num );
01175
01176
01177
01178 for( i = 0; i < num; i++ )
01179 {
01180 fscanf( _NfiName, "%d %lf", &id, &rho );
01181 MatList[id-1]->Rhof = rho;
01182 }
01183
01184 }
01185
01186
01187
01188
01189
01190 static void _NfiReadMaterialPROPERTYDENSITY( void )
01191 {
01192 int num, i, id;
01193 double gamma;
01194
01195
01196
01197 fscanf( _NfiName, "%d", &num );
01198
01199
01200
01201 for( i = 0; i < num; i++ )
01202 {
01203 fscanf( _NfiName, "%d %lf", &id, &gamma );
01204 MatList[id-1]->Gamma = gamma;
01205 }
01206
01207 }
01208
01209
01210
01211
01212 static void _NfiReadMaterialPROPERTYLAMBDA( void )
01213 {
01214 int num, i, id;
01215 double lambda;
01216
01217
01218
01219 fscanf( _NfiName, "%d", &num );
01220
01221
01222
01223 for( i = 0; i < num; i++ )
01224 {
01225 fscanf( _NfiName, "%d %lf", &id, &lambda );
01226 MatList[id-1]->Lambda = lambda;
01227 }
01228
01229 }
01230
01231
01232
01233
01234
01235 static void _NfiReadMaterialMISES( void )
01236 {
01237 int num, i, id;
01238 sMaterial *mat = 0L;
01239
01240
01241
01242 fscanf( _NfiName, "%d", &num );
01243
01244
01245
01246 for( i = 0; i < num; i++ )
01247 {
01248 fscanf( _NfiName, "%d", &id );
01249 MatNew( MISES, id, &mat );
01250 MatRead( mat );
01251 }
01252
01253 }
01254
01255
01256
01257
01258
01259 static void _NfiReadMaterialINTERFACEMOHRCOULOMB( void )
01260 {
01261 int num, i, id;
01262 sMaterial *mat = 0L;
01263
01264
01265
01266 fscanf( _NfiName, "%d", &num );
01267
01268
01269
01270 for( i = 0; i < num; i++ )
01271 {
01272 fscanf( _NfiName, "%d", &id );
01273 MatNew( ITF_MOHR_COULOMB, id, &mat );
01274 MatRead( mat );
01275 }
01276
01277 }
01278
01279
01280
01281
01282
01283 static void _NfiReadMaterialINTERFACE( void )
01284 {
01285 int num, i, id;
01286 sMaterial *mat = 0L;
01287
01288
01289
01290 fscanf( _NfiName, "%d", &num );
01291
01292
01293
01294 for( i = 0; i < num; i++ )
01295 {
01296 fscanf( _NfiName, "%d", &id );
01297 MatNew( INTERFACE_MAT, id, &mat );
01298 MatRead( mat );
01299 }
01300
01301 }
01302
01303
01304
01305
01306
01307 static void _NfiReadMaterialKELVIN( void )
01308 {
01309 int num, i, id;
01310 sMaterial *mat = 0L;
01311
01312
01313
01314 fscanf( _NfiName, "%d", &num );
01315
01316
01317
01318 for( i = 0; i < num; i++ )
01319 {
01320 fscanf( _NfiName, "%d", &id );
01321 MatNew( KELVIN, id, &mat );
01322 MatRead( mat );
01323 }
01324
01325 }
01326
01327
01328
01329
01330
01331 static void _NfiReadMaterialMAXWELL( void )
01332 {
01333 int num, i, id;
01334 sMaterial *mat = 0L;
01335
01336
01337
01338 fscanf( _NfiName, "%d", &num );
01339
01340
01341
01342 for( i = 0; i < num; i++ )
01343 {
01344 fscanf( _NfiName, "%d", &id );
01345 MatNew( MAXWELL, id, &mat );
01346 MatRead( mat );
01347 }
01348
01349 }
01350
01351
01352
01353
01354
01355
01356 static void _NfiReadMaterialGENERIC( void )
01357 {
01358 int num, numpar, mtype, i, id;
01359 long fpos;
01360 sMaterial *mat = 0L;
01361
01362
01363
01364 fscanf( _NfiName, "%d", &num );
01365
01366
01367
01368 for( i = 0; i < num; i++ )
01369 {
01370 fscanf( _NfiName, "%d %d", &id, &numpar );
01371 switch( numpar )
01372 {
01373 case 4:
01374
01375
01376 fpos = ftell( _NfiName );
01377
01378
01379
01380 fscanf( _NfiName, "%*f %*f %*f %d", &mtype );
01381
01382
01383
01384 if( mtype == 0 )
01385 {
01386 MatNew( KELVIN, id, &mat );
01387 }
01388 else
01389 {
01390 MatNew( MAXWELL, id, &mat );
01391 }
01392
01393
01394
01395 fseek( _NfiName, fpos, SEEK_SET );
01396
01397
01398
01399 MatRead( mat );
01400
01401
01402
01403 fscanf( _NfiName, "%d", &mtype );
01404 break;
01405
01406 case 5:
01407
01408
01409 MatNew( MOHR_COULOMB_NAC, id, &mat );
01410 MatRead( mat );
01411
01412 case 11:
01413
01414
01415 MatNew( MOHR_COULOMB_NAV, id, &mat );
01416 MatRead( mat );
01417
01418 default:
01419 break;
01420 }
01421 }
01422
01423 }
01424
01425
01426
01427
01428
01429 static void _NfiReadMaterialISOTROPIC( void )
01430 {
01431 int num, i, id;
01432 sMaterial *mat = 0L;
01433
01434
01435
01436 fscanf( _NfiName, "%d", &num );
01437
01438
01439
01440 for( i = 0; i < num; i++ )
01441 {
01442 fscanf( _NfiName, "%d", &id );
01443 MatNew( ISOTROPIC, id, &mat );
01444 MatRead( mat );
01445 }
01446
01447 }
01448
01449
01450
01451
01452
01453 static void _NfiReadMaterialISOTROPICFAIL( void )
01454 {
01455 int num, i, id;
01456 sMaterial *mat = 0L;
01457
01458
01459
01460 fscanf( _NfiName, "%d", &num );
01461
01462
01463
01464 for( i = 0; i < num; i++ )
01465 {
01466 fscanf( _NfiName, "%d", &id );
01467 MatNew( ISOTROPIC_FAIL, id, &mat );
01468 MatRead( mat );
01469 }
01470
01471 }
01472
01473
01474
01475
01476
01477 static void _NfiReadMaterialORTHOTROPIC( void )
01478 {
01479 int num, i, id;
01480 sMaterial *mat = 0L;
01481
01482
01483
01484 fscanf( _NfiName, "%d", &num );
01485
01486
01487
01488 for( i = 0; i < num; i++ )
01489 {
01490 fscanf( _NfiName, "%d", &id );
01491 MatNew( ORTHOTROPIC, id, &mat );
01492 MatRead( mat );
01493 }
01494
01495 }
01496
01497
01498
01499
01500
01501 static void _NfiReadMaterialHIPERBOLIC( void )
01502 {
01503 int num, i, id;
01504 sMaterial *mat = 0L;
01505
01506
01507
01508 fscanf( _NfiName, "%d", &num );
01509
01510
01511
01512 for( i = 0; i < num; i++ )
01513 {
01514 fscanf( _NfiName, "%d", &id );
01515 MatNew( HIPERBOLIC, id, &mat );
01516 MatRead( mat );
01517 }
01518
01519 }
01520
01521
01522
01523
01524
01525 static void _NfiReadMaterialMOHRCOULOMB( void )
01526 {
01527 int num, i, id;
01528 sMaterial *mat = 0L;
01529
01530
01531
01532 fscanf( _NfiName, "%d", &num );
01533
01534
01535
01536 for( i = 0; i < num; i++ )
01537 {
01538 fscanf( _NfiName, "%d", &id );
01539 MatNew(MOHR_COULOMB,id,&mat);
01540 MatRead(mat);
01541 }
01542
01543 }
01544
01545
01546
01547
01548
01549
01550 static void _NfiReadMaterialMOHRCOULOMBCUTOFF( void )
01551 {
01552 int num, i, id;
01553 sMaterial *mat = 0L;
01554
01555
01556
01557 fscanf( _NfiName, "%d", &num );
01558
01559
01560
01561 for( i = 0; i < num; i++ )
01562 {
01563 fscanf( _NfiName, "%d", &id );
01564 MatNew(MOHR_COULOMB_CUTOFF,id,&mat);
01565 MatRead(mat);
01566 }
01567
01568 }
01569
01570
01571
01572
01573
01574
01575 static void _NfiReadMaterialMOHRCOULOMBNAC( void )
01576 {
01577 int num, i, id;
01578 sMaterial *mat = 0L;
01579
01580
01581
01582 fscanf( _NfiName, "%d", &num );
01583
01584
01585
01586 for( i = 0; i < num; i++ )
01587 {
01588 fscanf( _NfiName, "%d", &id );
01589 MatNew(MOHR_COULOMB_NAC,id,&mat);
01590 MatRead(mat);
01591 }
01592
01593 }
01594
01595
01596
01597
01598
01599
01600 static void _NfiReadMaterialMOHRCOULOMBNAV( void )
01601 {
01602 int num, i, id;
01603 sMaterial *mat = 0L;
01604
01605
01606
01607 fscanf( _NfiName, "%d", &num );
01608
01609
01610
01611 for( i = 0; i < num; i++ )
01612 {
01613 fscanf( _NfiName, "%d", &id );
01614 MatNew(MOHR_COULOMB_NAV,id,&mat);
01615 MatRead(mat);
01616 }
01617
01618 }
01619
01620
01621
01622
01623
01624 static int _NfiReadElement( void )
01625 {
01626 int nelem;
01627
01628
01629
01630 fscanf( _NfiName, "%d", &nelem );
01631
01632
01633
01634 if( nelem == 0 )
01635 {
01636 printf( "\nThe number of elements must be given!\n" );
01637 return 0;
01638 }
01639
01640
01641
01642 NumElements = nelem;
01643
01644
01645
01646 ElementInit( );
01647
01648 return 1;
01649
01650 }
01651
01655 static void _NfiReadElementLINE2(void)
01656 {
01657 int nelem, i;
01658 int id, matid, tckid, ordid;
01659 sElement *elm = 0L;
01660
01661
01662
01663 fscanf(_NfiName, "%d", &nelem);
01664
01665
01666
01667 for( i = 0; i < nelem; i++ ) {
01668 fscanf( _NfiName, "%d%d%d%d", &id, &matid, &tckid, &ordid );
01669 ElmNew(LINE2,id,matid,ordid,tckid,&elm,ElmList,NodeVector);
01670 ElmRead(elm);
01671 }
01672
01673 }
01674
01675
01676
01677
01678 static void _NfiReadElementT3( void )
01679 {
01680 int nelem, i;
01681 int id, matid, tckid, ordid;
01682 sElement *elm = 0L;
01683
01684
01685
01686 fscanf( _NfiName, "%d", &nelem );
01687
01688
01689
01690 for( i = 0; i < nelem; i++ )
01691 {
01692 fscanf( _NfiName, "%d%d%d%d", &id, &matid, &tckid, &ordid );
01693 ElmNew(T3,id,matid,ordid,tckid,&elm,ElmList,NodeVector);
01694 ElmRead(elm);
01695 }
01696
01697 }
01698
01699
01700
01701
01702 static void _NfiReadElementDKT( void )
01703 {
01704 int nelem, i;
01705 int id, matid, tckid, ordid;
01706 sElement *elm = 0L;
01707
01708
01709
01710 fscanf( _NfiName, "%d", &nelem );
01711
01712
01713
01714 for( i = 0; i < nelem; i++ )
01715 {
01716 fscanf( _NfiName, "%d%d%d%d", &id, &matid, &tckid, &ordid );
01717 ElmNew(DKT,id,matid,ordid,tckid,&elm,ElmList,NodeVector);
01718 ElmRead(elm);
01719 }
01720
01721 }
01722
01723
01724
01725
01726
01727 static void _NfiReadElementQ4( void )
01728 {
01729 int nelem, i;
01730 int id, matid, tckid, ordid;
01731 sElement *elm = 0L;
01732
01733
01734
01735 fscanf( _NfiName, "%d", &nelem );
01736
01737
01738
01739 for( i = 0; i < nelem; i++ )
01740 {
01741 fscanf( _NfiName, "%d%d%d%d", &id, &matid, &tckid, &ordid );
01742 ElmNew(Q4,id,matid,ordid,tckid,&elm,ElmList,NodeVector);
01743 ElmRead(elm);
01744 }
01745
01746 }
01747
01748
01749
01750
01751
01752 static void _NfiReadElementBRICK8( void )
01753 {
01754 int nelem, i;
01755 int id, matid, ordid;
01756 sElement *elm = 0L;
01757
01758
01759
01760 fscanf( _NfiName, "%d", &nelem );
01761
01762
01763
01764 for( i = 0; i < nelem; i++ )
01765 {
01766 fscanf( _NfiName, "%d%d%d", &id, &matid, &ordid );
01767 ElmNew(BRICK8,id,matid,ordid,0,&elm,ElmList,NodeVector);
01768 ElmRead(elm);
01769 }
01770
01771 }
01772
01773
01774
01775
01776
01777 static void _NfiReadElementTETR4( void )
01778 {
01779 int nelem, i;
01780 int id, matid, ordid;
01781 sElement *elm = 0L;
01782
01783
01784
01785 fscanf( _NfiName, "%d", &nelem );
01786
01787
01788
01789 for( i = 0; i < nelem; i++ )
01790 {
01791 fscanf( _NfiName, "%d%d%d", &id, &matid, &ordid );
01792 ElmNew(TETR4,id,matid,ordid,0,&elm,ElmList,NodeVector);
01793 ElmRead(elm);
01794 }
01795
01796 }
01797
01798
01799
01800
01801
01802 static void _NfiReadElementINTERFACE( void )
01803 {
01804 int nelem, i;
01805 int id, matid, tckid, ordid;
01806 sElement *elm = 0L;
01807
01808
01809
01810 fscanf( _NfiName, "%d", &nelem );
01811
01812
01813
01814 for( i = 0; i < nelem; i++ )
01815 {
01816 fscanf( _NfiName, "%d%d%d%d", &id, &matid, &tckid, &ordid );
01817 ElmNew(INTERFACE,id,matid,ordid,tckid,&elm,ElmList,NodeVector);
01818 ElmRead(elm);
01819 }
01820
01821 }
01822
01823
01824
01825
01826
01827 static void _NfiReadElementINFINITE( void )
01828 {
01829 int nelem, i;
01830 int id, matid, tckid, ordid;
01831 sElement *elm = 0L;
01832
01833
01834
01835 fscanf( _NfiName, "%d", &nelem );
01836
01837
01838
01839 for( i = 0; i < nelem; i++ )
01840 {
01841 fscanf( _NfiName, "%d%d%d%d", &id, &matid, &tckid, &ordid );
01842 ElmNew(INFINITE,id,matid,ordid,tckid,&elm,ElmList,NodeVector);
01843 ElmRead(elm);
01844 }
01845
01846 }
01847
01848
01849
01850
01851
01852 static void _NfiReadElementProfileT3( void )
01853 {
01854 int nelem, i, id;
01855
01856
01857
01858 fscanf( _NfiName, "%d", &nelem );
01859
01860
01861
01862
01863 for( i = 0; i < nelem; i++ )
01864 {
01865 fscanf( _NfiName, "%d", &id );
01866 ElmReadProfile( ElmList[id-1] );
01867 }
01868
01869 }
01870
01871 static void _NfiReadElementProfileQ4( void )
01872 {
01873 int nelem, i, id;
01874
01875
01876
01877 fscanf( _NfiName, "%d", &nelem );
01878
01879
01880
01881
01882 for( i = 0; i < nelem; i++ )
01883 {
01884 fscanf( _NfiName, "%d", &id );
01885 ElmReadProfile( ElmList[id-1] );
01886 }
01887
01888 }
01889
01890 static void _NfiReadElementProfileBRICK8( void )
01891 {
01892 int nelem, i, id;
01893
01894
01895
01896 fscanf( _NfiName, "%d", &nelem );
01897
01898
01899
01900
01901 for( i = 0; i < nelem; i++ )
01902 {
01903 fscanf( _NfiName, "%d", &id );
01904 ElmReadProfile( ElmList[id-1] );
01905 }
01906
01907 }
01908
01909 static void _NfiReadElementProfileTETRA4( void )
01910 {
01911 int nelem, i, id;
01912
01913
01914
01915 fscanf( _NfiName, "%d", &nelem );
01916
01917
01918
01919
01920 for( i = 0; i < nelem; i++ )
01921 {
01922 fscanf( _NfiName, "%d", &id );
01923 ElmReadProfile( ElmList[id-1] );
01924 }
01925
01926 }
01927
01928
01929
01930
01931
01932 static void _NfiReadLoad( void )
01933 {
01934 int i, id;
01935
01936
01937
01938 fscanf( _NfiName, "%d", &NumLoadCase );
01939
01940
01941
01942 LoadCase = (sLoadCase *)calloc( NumLoadCase, sizeof(sLoadCase) );
01943
01944
01945
01946 for( i = 0; i < NumLoadCase; i++ )
01947 {
01948 fscanf( _NfiName, "%d", &id );
01949 _NfiReadString( LoadCase[i].label );
01950 LoadCase[i].icase = id;
01951 }
01952
01953
01954
01955 if( NumLoadCase > 1 )
01956 DrvNew( LOAD_CASE, &DrvObj );
01957
01958 }
01959
01960
01961
01962
01963
01964 static void _NfiReadLoadCase( void )
01965 {
01966 int icase;
01967
01968
01969
01970 fscanf( _NfiName, "%d", &icase );
01971
01972 CurrLoadCase = icase - 1;
01973
01974 }
01975
01976
01977
01978
01979
01980 static void _NfiReadLoadCaseGravity( void )
01981 {
01982 double gx, gy, gz;
01983
01984
01985
01986 fscanf( _NfiName, "%lf%lf%lf", &gx, &gy, &gz );
01987 GravForce.gx = gx;
01988 GravForce.gy = gy;
01989 GravForce.gz = gz;
01990
01991 }
01992
01993
01994
01995
01996
01997 static void _NfiReadLoadCaseElementPotencial( void )
01998 {
01999 int i, elem;
02000 double pot;
02001
02002
02003
02004 fscanf( _NfiName, "%d", &NumElemPoten );
02005
02006
02007
02008 ElemPoten = (sElemPoten *)calloc( NumElemPoten, sizeof(sElemPoten) );
02009
02010
02011
02012 for( i = 0; i < NumElemPoten; i++ )
02013 {
02014 fscanf( _NfiName, "%d%lf", &elem, &pot );
02015 ElemPoten[i].elem = elem;
02016 ElemPoten[i].phi = pot;
02017 }
02018
02019 }
02020
02021
02022
02023
02024 static void _NfiReadLoadCaseNodalSupport( void )
02025 {
02026 int i, node, tx, ty, tz;
02027
02028
02029
02030 fscanf( _NfiName, "%d", &NumNodalSupp );
02031
02032
02033
02034 NodalSupp = (sNodalSupp *)calloc( NumNodalSupp, sizeof(sNodalSupp) );
02035
02036
02037
02038 for( i = 0; i < NumNodalSupp; i++ )
02039 {
02040 fscanf( _NfiName, "%d%d%d%d%*d%*d%*d", &node, &tx, &ty, &tz );
02041 NodalSupp[i].node = node;
02042 NodalSupp[i].tx = tx;
02043 NodalSupp[i].ty = ty;
02044 NodalSupp[i].tz = tz;
02045 }
02046
02047 }
02048
02049
02050
02051
02052 static void _NfiReadLoadCaseNodalPressure( void )
02053 {
02054 int i, node;
02055 double press;
02056
02057
02058
02059 fscanf( _NfiName, "%d", &NumNodalPress );
02060
02061
02062
02063 NodalPress = (sNodalPress *)calloc( NumNodalPress, sizeof(sNodalPress) );
02064
02065
02066
02067 for( i = 0; i < NumNodalPress; i++ )
02068 {
02069 fscanf( _NfiName, "%d%lf", &node, &press );
02070 NodalPress[i].node = node;
02071 NodalPress[i].psi = press;
02072 }
02073
02074 }
02075
02076
02077
02078
02079
02080 static void _NfiReadLoadCaseNodalForces( void )
02081 {
02082 int i, node;
02083 double fx, fy, fz;
02084
02085
02086
02087 fscanf( _NfiName, "%d", &NumNodalForce );
02088
02089
02090
02091 NodalForce = (sNodalForce *)calloc( NumNodalForce, sizeof(sNodalForce) );
02092
02093
02094
02095 for( i = 0; i < NumNodalForce; i++ )
02096 {
02097 fscanf( _NfiName, "%d%lf%lf%lf%*f%*f%*f", &node, &fx, &fy, &fz );
02098 NodalForce[i].node = node;
02099 NodalForce[i].fx = fx;
02100 NodalForce[i].fy = fy;
02101 NodalForce[i].fz = fz;
02102 }
02103
02104 }
02105
02106
02107
02108
02109
02110 static void _NfiReadLoadCaseNodalVelocity( void )
02111 {
02112 int i, node;
02113 double vx, vy, vz;
02114
02115
02116
02117 fscanf( _NfiName, "%d", &NumNodalVel );
02118
02119
02120
02121 NodalVel = (sNodalVel *)calloc( NumNodalVel, sizeof(sNodalVel) );
02122
02123
02124
02125 for( i = 0; i < NumNodalVel; i++ )
02126 {
02127 fscanf( _NfiName, "%d%lf%lf%lf", &node, &vx, &vy, &vz );
02128 NodalVel[i].node = node;
02129 NodalVel[i].vx = vx;
02130 NodalVel[i].vy = vy;
02131 NodalVel[i].vz = vz;
02132 }
02133
02134 }
02135
02136
02137
02138
02139
02140 static void _NfiReadLoadCaseLineForcesUni( void )
02141 {
02142 int i, elem, key, noi, noj;
02143 double qx, qy, qz;
02144
02145
02146
02147 fscanf( _NfiName, "%d", &NumLineForce );
02148
02149
02150
02151 LineForce = (sLineForce *)calloc( NumLineForce, sizeof(sLineForce) );
02152
02153
02154
02155 for( i = 0; i < NumLineForce; i++ )
02156 {
02157 fscanf( _NfiName, "%d%d%d%d%lf%lf%lf", &elem,
02158 &noi,
02159 &noj,
02160 &key,
02161 &qx,
02162 &qy,
02163 &qz );
02164 LineForce[i].elem = elem;
02165 LineForce[i].type = UNIFORM;
02166 LineForce[i].noi = noi;
02167 LineForce[i].noj = noj;
02168 LineForce[i].key = key;
02169 LineForce[i].q1x = qx;
02170 LineForce[i].q1y = qy;
02171 LineForce[i].q1z = qz;
02172 LineForce[i].q2x = qx;
02173 LineForce[i].q2y = qy;
02174 LineForce[i].q2z = qz;
02175 }
02176
02177 }
02178
02179
02180
02181
02182 static void _NfiReadLoadCaseAreaUniform( void )
02183 {
02184 int i, elem, key, noi, noj, nok;
02185 double qx, qy, qz;
02186
02187
02188
02189 fscanf( _NfiName, "%d", &NumAreaForceUniform );
02190
02191
02192
02193 AreaForceUniform = (sAreaForceUniform *)calloc( NumAreaForceUniform, sizeof(sAreaForceUniform) );
02194
02195
02196
02197 for( i = 0; i < NumAreaForceUniform; i++ )
02198 {
02199 fscanf( _NfiName, "%d%d%d%d%d%lf%lf%lf", &elem,
02200 &noi,
02201 &noj,
02202 &nok,
02203 &key,
02204 &qx,
02205 &qy,
02206 &qz );
02207 AreaForceUniform[i].elem = elem;
02208 AreaForceUniform[i].type = AREAUNIFORM;
02209 AreaForceUniform[i].noi = noi;
02210 AreaForceUniform[i].noj = noj;
02211 AreaForceUniform[i].nok = nok;
02212 AreaForceUniform[i].key = key;
02213 AreaForceUniform[i].qx = qx;
02214 AreaForceUniform[i].qy = qy;
02215 AreaForceUniform[i].qz = qz;
02216
02217 }
02218
02219 }
02220
02221
02222
02223
02224
02225 static void _NfiReadLoadCaseAreaPressure( void )
02226 {
02227 int i, elem, key, noi, noj, nok;
02228 double qx, qy, qz;
02229
02230
02231
02232 fscanf( _NfiName, "%d", &NumAreaForcePressure );
02233
02234
02235
02236 AreaForcePressure = (sAreaForcePressure *)calloc( NumAreaForcePressure, sizeof(sAreaForcePressure) );
02237
02238
02239
02240 for( i = 0; i < NumAreaForcePressure; i++ )
02241 {
02242 fscanf( _NfiName, "%d%d%d%d%d%lf%lf%lf", &elem,
02243 &noi,
02244 &noj,
02245 &nok,
02246 &key,
02247 &qx,
02248 &qy,
02249 &qz );
02250 AreaForcePressure[i].elem = elem;
02251 AreaForcePressure[i].type = AREAPRESSURE;
02252 AreaForcePressure[i].noi = noi;
02253 AreaForcePressure[i].noj = noj;
02254 AreaForcePressure[i].nok = nok;
02255 AreaForcePressure[i].key = key;
02256 AreaForcePressure[i].qx = qx;
02257 AreaForcePressure[i].qy = qy;
02258 AreaForcePressure[i].qz = qz;
02259
02260 }
02261
02262 }
02263
02264
02265
02266
02267
02268 static void _NfiReadLoadCaseLineForcesVar( void )
02269 {
02270 int i, elem, key, noi, noj;
02271 double q1x, q1y, q1z;
02272 double q2x, q2y, q2z;
02273
02274
02275
02276 fscanf( _NfiName, "%d", &NumLineForce );
02277
02278
02279
02280 LineForce = (sLineForce *)calloc( NumLineForce, sizeof(sLineForce) );
02281
02282
02283
02284 for( i = 0; i < NumLineForce; i++ )
02285 {
02286 fscanf( _NfiName, "%d%d%d%d%lf%lf%lf%lf%lf%lf", &elem, &noi, &noj, &key,
02287 &q1x, &q1y, &q1z,
02288 &q2x, &q2y, &q2z );
02289 LineForce[i].elem = elem;
02290 LineForce[i].type = VARIABLE;
02291 LineForce[i].noi = noi;
02292 LineForce[i].noj = noj;
02293 LineForce[i].key = key;
02294 LineForce[i].q1x = q1x;
02295 LineForce[i].q1y = q1y;
02296 LineForce[i].q1z = q1z;
02297 LineForce[i].q2x = q2x;
02298 LineForce[i].q2y = q2y;
02299 LineForce[i].q2z = q2z;
02300 }
02301
02302 }
02303
02304
02305
02306
02307
02308 static int _NfiReadLoadCaseDomainInitStressUni( void )
02309 {
02310 int status;
02311 int i, nelem, id;
02312
02313
02314
02315 fscanf( _NfiName, "%d", &nelem );
02316
02317
02318
02319 if( nelem != NumElements )
02320 {
02321 printf( "\nThe number of elements were redefined!\n" );
02322 return 0;
02323 }
02324
02325
02326
02327 for( i = 0; i < nelem; i++ )
02328 {
02329 fscanf( _NfiName, "%d", &id );
02330 status = ElmReadInitStress( ElmList[id-1] );
02331 if( !status ) return 0;
02332 }
02333
02334 return 1;
02335 }
02336
02337
02338
02339
02340
02341 static void _NfiReadLoadCaseDomainTempUni( void )
02342 {
02343 }
02344
02345
02346
02347
02348
02349 static void _NfiReadLoadCaseNodalDisplacements( void )
02350 {
02351 int i, node;
02352 double dx, dy, dz;
02353
02354
02355
02356 fscanf( _NfiName, "%d", &NumNodalDisp );
02357
02358
02359
02360 NodalDisp = (sNodalDisp *)calloc( NumNodalDisp, sizeof(sNodalDisp) );
02361
02362
02363
02364 for( i = 0; i < NumNodalDisp; i++ )
02365 {
02366 fscanf( _NfiName, "%d%lf%lf%lf%*f%*f%*f", &node, &dx, &dy, &dz );
02367 NodalDisp[i].node = node;
02368 NodalDisp[i].dx = dx;
02369 NodalDisp[i].dy = dy;
02370 NodalDisp[i].dz = dz;
02371 }
02372
02373 }
02374
02375
02376
02377
02378
02379 static void _NfiReadRezone( void )
02380 {
02381 int i;
02382
02383
02384
02385 fscanf( _NfiName, "%d", &NumRezones );
02386
02387
02388
02389 Rezone = (sRezone *)calloc( NumRezones, sizeof(sRezone) );
02390
02391
02392
02393 for( i = 0; i < NumRezones; i++ )
02394 {
02395 fscanf( _NfiName, "%d", &Rezone[i].id );
02396 _NfiReadString( Rezone[i].label );
02397 }
02398
02399
02400
02401 DrvNew( REZONE, &DrvObj );
02402
02403 }
02404
02405
02406
02407
02408
02409 static void _NfiReadRezoneCase( void )
02410 {
02411
02412
02413 fscanf( _NfiName, "%d", &_CurrCase );
02414
02415 _CurrCase--;
02416
02417 }
02418
02419
02420
02421
02422
02423 static void _NfiReadRezoneCaseElement( void )
02424 {
02425 int num, elm, i;
02426
02427
02428
02429 fscanf( _NfiName, "%d", &num );
02430 Rezone[_CurrCase].numelm = num;
02431
02432
02433
02434 Rezone[_CurrCase].elm = (int *)calloc( num, sizeof(int) );
02435
02436
02437
02438 for( i = 0; i < num; i++ )
02439 {
02440 fscanf( _NfiName, "%d", &elm );
02441 Rezone[_CurrCase].elm[i] = elm;
02442 }
02443
02444 }
02445
02446
02447
02448
02449
02450 static void _NfiWriteResultStep( int step, long ndlrpos, long elmrpos,
02451 double *disp )
02452 {
02453 int i;
02454 double gauge;
02455 int totstepgauge;
02456
02457 totstepgauge = (Config.max_iter/Config.print_step)+1;
02458
02459
02460
02461
02462 fprintf( _NfiName, "%%RESULT.CASE.STEP\n%d\n\n", step );
02463
02464 gauge = ((double)(step-1) / (double)totstepgauge);
02465 if( _fposgauge != NULL )
02466 {
02467 (*_fposgauge) ( gauge );
02468 }
02469
02470
02471
02472 fread( disp, sizeof(double), NDof*NumNodes, ndlr );
02473
02474
02475
02476 fprintf( _NfiName, "%%RESULT.CASE.STEP.NODAL.DISPLACEMENT\n" );
02477 fprintf( _NfiName, "%d\t'Displacement'\n", NumNodes );
02478 for( i = 0; i < NumNodes; i++ )
02479 {
02480 if( NDof == 2 )
02481 fprintf( _NfiName, "%d\t%+10.5e\t%+10.5e\t%+10.5e", i+1, disp[2*i],
02482 disp[2*i+1],
02483 0.0 );
02484 else
02485 fprintf( _NfiName, "%d\t%+10.5e\t%+10.5e\t%+10.5e", i+1, disp[3*i],
02486 disp[3*i+1],
02487 disp[3*i+2] );
02488 fprintf( _NfiName, "\t%+10.5e\t%+10.5e\t%+10.5e\n", 0.0, 0.0, 0.0 );
02489 }
02490 fprintf( _NfiName, "\n" );
02491
02492
02493
02494 if( NDof == 2 )
02495 {
02496 if(Config.numgaussresults == -1){
02497 Config.numgaussresults = 24;
02498 Config.gaussresults = (char**) malloc( Config.numgaussresults * sizeof( char * ) );
02499 Config.gaussresults[0] = strdup ( "Yield" );
02500 Config.gaussresults[1] = strdup ( "Rf" );
02501 Config.gaussresults[2] = strdup ( "Sxx" );
02502 Config.gaussresults[3] = strdup ( "Syy" );
02503 Config.gaussresults[4] = strdup ( "Sxy" );
02504 Config.gaussresults[5] = strdup ( "Pf" );
02505 Config.gaussresults[6] = strdup ( "SExx" );
02506 Config.gaussresults[7] = strdup ( "SEyy" );
02507 Config.gaussresults[8] = strdup ( "Siso" );
02508 Config.gaussresults[9] = strdup ( "SDxx" );
02509 Config.gaussresults[10] = strdup ( "SDyy" );
02510 Config.gaussresults[11] = strdup ( "S1" );
02511 Config.gaussresults[12] = strdup ( "S3" );
02512 Config.gaussresults[13] = strdup ( "SE1" );
02513 Config.gaussresults[14] = strdup ( "SE3" );
02514 Config.gaussresults[15] = strdup ( "SD1" );
02515 Config.gaussresults[16] = strdup ( "SD3" );
02516 Config.gaussresults[17] = strdup ( "Exx" );
02517 Config.gaussresults[18] = strdup ( "Eyy" );
02518 Config.gaussresults[19] = strdup ( "Exy" );
02519 Config.gaussresults[20] = strdup ( "E1" );
02520 Config.gaussresults[21] = strdup ( "E3" );
02521 Config.gaussresults[22] = strdup ( "Ev" );
02522 Config.gaussresults[23] = strdup ( "K0" );
02523 }
02524 }
02525 else
02526 {
02527 if(Config.numgaussresults == -1){
02528 Config.numgaussresults = 22;
02529 Config.gaussresults = (char**) malloc( Config.numgaussresults * sizeof( char * ) );
02530 Config.gaussresults[0] = strdup ( "Sxx" );
02531 Config.gaussresults[1] = strdup ( "Syy" );
02532 Config.gaussresults[2] = strdup ( "Szz" );
02533 Config.gaussresults[3] = strdup ( "Sxy" );
02534 Config.gaussresults[4] = strdup ( "Sxz" );
02535 Config.gaussresults[5] = strdup ( "Syz" );
02536 Config.gaussresults[6] = strdup ( "S1" );
02537 Config.gaussresults[7] = strdup ( "S2" );
02538 Config.gaussresults[8] = strdup ( "S3" );
02539 Config.gaussresults[9] = strdup ( "Sdx" );
02540 Config.gaussresults[10] = strdup ( "Sdy" );
02541 Config.gaussresults[11] = strdup ( "Sdz" );
02542 Config.gaussresults[12] = strdup ( "Exx" );
02543 Config.gaussresults[13] = strdup ( "Eyy" );
02544 Config.gaussresults[14] = strdup ( "Ezz" );
02545 Config.gaussresults[15] = strdup ( "Exy" );
02546 Config.gaussresults[16] = strdup ( "Exz" );
02547 Config.gaussresults[17] = strdup ( "Eyz" );
02548 Config.gaussresults[18] = strdup ( "E1" );
02549 Config.gaussresults[19] = strdup ( "E2" );
02550 Config.gaussresults[20] = strdup ( "E3" );
02551 Config.gaussresults[21] = strdup ( "Ev" );
02552 }
02553 }
02554 if(Config.numgaussresults > 0){
02555 fprintf( _NfiName, "\n%%RESULT.CASE.STEP.ELEMENT.GAUSS.SCALAR\n%d\n",Config.numgaussresults );
02556 for( i = 0; i < Config.numgaussresults; i++){
02557 fprintf( _NfiName, "'%s'", Config.gaussresults[i] );
02558 }
02559 fprintf( _NfiName, "\n" );
02560 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.GAUSS.SCALAR.DATA\n" );
02561 fprintf( _NfiName, "%d\n", NumElements );
02562
02563 fseek( elmr, elmrpos, SEEK_SET );
02564 for( i = 0; i < NumElements; i++ )
02565 ElmWriteGaussResults( ElmList[i], _NfiName, elmr );
02566 fprintf( _NfiName, "\n" );
02567 }
02568
02569 #if 0
02570
02571
02572
02573 if( _NfiVersion.version == 1 )
02574 {
02575 if( NDof == 2 )
02576 {
02577 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.NODAL.SCALAR\n17\n" );
02578 fprintf( _NfiName, "'Sxx'\t'Syy'\t'Szz'\t'Sxy'\t'S1'\t'S2'\t'S3'\t" );
02579 fprintf( _NfiName, "'Sdx'\t'Sdy'\t'Iso'\t" );
02580 fprintf( _NfiName, "'Exx'\t'Eyy'\t'Exy'\t'E1'\t'E2'\t'E3'\t" );
02581 fprintf( _NfiName, "'Yield'\n\n" );
02582 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.NODAL.SCALAR.DATA\n" );
02583 fprintf( _NfiName, "%d\n", NumElements );
02584 }
02585 else
02586 {
02587 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.NODAL.SCALAR\n21\n" );
02588 fprintf( _NfiName, "'Sxx'\t'Syy'\t'Szz'\t'Sxy'\t'Sxz'\t'Syz'\t" );
02589 fprintf( _NfiName, "'S1'\t'S2'\t'S3'\t'Sdx'\t'Sdy'\t'Sdz'\t" );
02590 fprintf( _NfiName, "'Exx'\t'Eyy'\t'Ezz'\t'Exy'\t'Exz'\t'Eyz'\t" );
02591 fprintf( _NfiName, "'E1'\t'E2'\t'E3'\t'Yield'\n\n" );
02592 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.NODAL.SCALAR.DATA\n" );
02593 fprintf( _NfiName, "%d\n", NumElements );
02594 }
02595 fseek( elmr, elmrpos, SEEK_SET );
02596 for( i = 0; i < NumElements; i++ )
02597 ElmWriteNodalResults( ElmList[i], _NfiName, elmr );
02598 fprintf( _NfiName, "\n" );
02599 }
02600
02601 #endif
02602
02603
02604
02605 if( _NfiVersion.version == 1 )
02606 {
02607 if( NDof == 2 )
02608 {
02609 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.GAUSS.VECTOR\n8\n" );
02610 fprintf( _NfiName, "'S1+'\t'S1-'\t'S3+'\t'S3-'\t" );
02611 fprintf( _NfiName, "'E1+'\t'E1-'\t'E3+'\t'E3-'\n\n" );
02612 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.GAUSS.VECTOR.DATA\n" );
02613 fprintf( _NfiName, "%d\n", NumElements );
02614 }
02615 else
02616 {
02617 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.GAUSS.VECTOR\n12\n" );
02618 fprintf( _NfiName, "'S1+'\t'S1-'\t'S2+'\t'S2-'\t'S3+'\t'S3-'\t" );
02619 fprintf( _NfiName, "'E1+'\t'E1-'\t'E2+'\t'E2-'\t'E3+'\t'E3-'\n\n" );
02620 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.GAUSS.VECTOR.DATA\n" );
02621 fprintf( _NfiName, "%d\n", NumElements );
02622 }
02623 }
02624 else
02625 {
02626 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.GAUSS.PRINCIPAL_TENSOR\n2\n" );
02627 fprintf( _NfiName, "'Stress'\t'Strain'\n\n" );
02628 fprintf( _NfiName, "%%RESULT.CASE.STEP.ELEMENT.GAUSS.PRINCIPAL_TENSOR.DATA\n" );
02629 fprintf( _NfiName, "%d\n", NumElements );
02630 }
02631 fseek( elmr, elmrpos, SEEK_SET );
02632 for( i = 0; i < NumElements; i++ )
02633 ElmWriteGaussVectorResults( ElmList[i], _NfiVersion.version, _NfiName, elmr );
02634 fprintf( _NfiName, "\n" );
02635
02636 }
02637
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647 void NfiSetFileHandle( FILE *file )
02648 {
02649
02650
02651 _NfiName = file;
02652
02653 }
02654
02655
02656
02657
02658
02659 int NfiInterpFile( void )
02660 {
02661 char label[80];
02662
02663
02664
02665 DampingInit( );
02666
02667
02668
02669 while( 1 )
02670 {
02671 if( _NfiNextLabel( label ) == 0 )
02672 {
02673 printf( "\n\n" );
02674 return 0;
02675 }
02676
02677 else if( strcmp( label, "HEADER.VERSION" ) == 0 )
02678 {
02679 _NfiReadVersion( );
02680 }
02681
02682 else if( strcmp( label, "HEADER.ANALYSIS" ) == 0 )
02683 {
02684 if ( !_NfiReadAnalysisType( ) ) return 0;
02685 }
02686
02687 else if( strcmp( label, "HEADER.ANALYSIS.ALGORITHM" ) == 0 )
02688 {
02689 if ( !_NfiReadAlgorithmType( ) ) return 0;
02690 }
02691
02692 else if( strcmp( label, "HEADER.ANALYSIS.SOLVER" ) == 0 )
02693 {
02694 if ( !_NfiReadSolverType( ) ) return 0;
02695 }
02696
02697 else if( strcmp( label, "HEADER.ANALYSIS.TOTAL.TIME" ) == 0 )
02698 {
02699 _NfiReadTotalTime( );
02700 }
02701
02702 else if( strcmp( label, "HEADER.ANALYSIS.TIME.STEP" ) == 0 )
02703 {
02704 _NfiReadTimeStep( );
02705 }
02706
02707 else if( strcmp( label, "HEADER.ANALYSIS.TIME.FRACTION" ) == 0 )
02708 {
02709 _NfiReadTimeFraction( );
02710 }
02711
02712 else if( strcmp( label, "HEADER.ANALYSIS.DAMPPING" ) == 0 )
02713 {
02714 if( !_NfiReadDamping() ) return 0;
02715 }
02716
02717 else if( strcmp( label, "HEADER.ANALYSIS.DAMPING.GLOBAL.PARAMETER" ) == 0 )
02718 {
02719 _NfiReadDampingGlobalParameter( );
02720 }
02721
02722 else if( strcmp( label, "HEADER.ANALYSIS.DAMPING.LOCAL.PARAMETER" ) == 0 )
02723 {
02724 _NfiReadDampingLocalParameter( );
02725 }
02726
02727 else if( strcmp( label, "HEADER.ANALYSIS.DAMPING.RAYLEIGH.PARAMETER" ) == 0 )
02728 {
02729 _NfiReadDampingRayleighParameter( );
02730 }
02731
02732 else if( strcmp( label, "HEADER.ANALYSIS.LOAD.STEP" ) == 0 )
02733 {
02734 _NfiReadNumLoadStep( );
02735 }
02736
02737 else if( strcmp( label, "HEADER.ANALYSIS.TOLERANCE" ) == 0 )
02738 {
02739 _NfiReadTolerance( );
02740 }
02741
02742 else if( strcmp( label, "HEADER.ANALYSIS.NUM.STEP.TOLERANCE" ) == 0 )
02743 {
02744 _NfiReadNumStepTol( );
02745 }
02746
02747 else if( strcmp( label, "HEADER.ANALYSIS.NUM.GAUSS.RESULTS" ) == 0 )
02748 {
02749 _NfiReadNumGaussResults( );
02750 }
02751
02752 else if( strcmp( label, "HEADER.ANALYSIS.GEOMETRICALLY.NONLINEAR" ) == 0 )
02753 {
02754 _NfiReadGeometricallyNonLinear( );
02755 }
02756
02757 else if( strcmp( label, "HEADER.ANALYSIS.MAXIMUM.ITERATION" ) == 0 )
02758 {
02759 _NfiReadMaximumIteration( );
02760 }
02761
02762 else if( strcmp( label, "HEADER.ANALYSIS.PRINT.STEP" ) == 0 )
02763 {
02764 _NfiReadPrintStep( );
02765 }
02766
02767 else if( strcmp( label, "HEADER.ANALYSIS.DRAW.STEP" ) == 0 )
02768 {
02769 _NfiReadDrawStep( );
02770 }
02771
02772 else if( strcmp( label, "NODE" ) == 0 )
02773 {
02774 if( !_NfiReadNode( ) ) return 0;
02775 }
02776
02777 else if( strcmp( label, "NODE.COORD" ) == 0 )
02778 {
02779 if( !_NfiReadNodeCoord( ) ) return 0;
02780 }
02781
02782 else if( strcmp( label, "NODE.SUPPORT" ) == 0 )
02783 {
02784 _NfiReadNodeSupport( );
02785 }
02786
02787 else if( (strcmp( label, "NODE.DISPLAY" ) == 0) ||
02788 (strcmp( label, "NODE.DISPLAY.GRAPHIC" ) == 0) ||
02789 (strcmp( label, "NODE.DISPLAY.DISPLACEMENT.GRAPHIC" ) == 0) )
02790 {
02791 _NfiReadNodeDispDisplay( );
02792 }
02793
02794 else if( strcmp( label, "NODE.DISPLAY.DISPLACEMENT.TIME.GRAPHIC" ) == 0 )
02795 {
02796 _NfiReadNodeDispTimeDisplay( );
02797 }
02798
02799 else if( strcmp( label, "NODE.DISPLAY.VELOCITY.GRAPHIC" ) == 0 )
02800 {
02801 _NfiReadNodeVelocDisplay( );
02802 }
02803
02804 else if( strcmp( label, "INTEGRATION.ORDER" ) == 0 )
02805 {
02806 _NfiReadIntegrationOrder( );
02807 }
02808
02809 else if( strcmp( label, "THICKNESS" ) == 0 )
02810 {
02811 _NfiReadThickness( );
02812 }
02813
02814 else if( strcmp( label, "MATERIAL" ) == 0 )
02815 {
02816 _NfiReadMaterial( );
02817 }
02818
02819 else if( strcmp( label, "MATERIAL.PROPERTY.DENSITY" ) == 0 )
02820 {
02821 _NfiReadMaterialPROPERTYDENSITY( );
02822 }
02823
02824 else if( strcmp( label, "MATERIAL.PROPERTY.LAMBDA" ) == 0 )
02825 {
02826 _NfiReadMaterialPROPERTYLAMBDA( );
02827 }
02828
02829 else if( strcmp( label, "MATERIAL.FLUID.DENSITY" ) == 0 )
02830 {
02831 _NfiReadMaterialFLUIDDENSITY( );
02832 }
02833
02834 else if( strcmp( label, "MATERIAL.MISES" ) == 0 )
02835 {
02836 _NfiReadMaterialMISES( );
02837 }
02838
02839 else if( strcmp( label, "MATERIAL.INTERFACE.MOHR.COULOMB" ) == 0 )
02840 {
02841 _NfiReadMaterialINTERFACEMOHRCOULOMB( );
02842 }
02843
02844 else if( strcmp( label, "MATERIAL.INTERFACE" ) == 0 )
02845 {
02846 _NfiReadMaterialINTERFACE( );
02847 }
02848
02849 else if( strcmp( label, "MATERIAL.KELVIN" ) == 0 )
02850 {
02851 _NfiReadMaterialKELVIN( );
02852 }
02853
02854 else if( strcmp( label, "MATERIAL.MAXWELL" ) == 0 )
02855 {
02856 _NfiReadMaterialMAXWELL( );
02857 }
02858
02859 else if( strcmp( label, "MATERIAL.GENERIC" ) == 0 )
02860 {
02861 _NfiReadMaterialGENERIC( );
02862 }
02863
02864 else if( strcmp( label, "MATERIAL.ISOTROPIC" ) == 0 )
02865 {
02866 _NfiReadMaterialISOTROPIC( );
02867 }
02868
02869 else if( strcmp( label, "MATERIAL.ISOTROPIC.FAIL" ) == 0 )
02870 {
02871 _NfiReadMaterialISOTROPICFAIL( );
02872 }
02873
02874 else if( strcmp( label, "MATERIAL.ORTHOTROPIC" ) == 0 )
02875 {
02876 _NfiReadMaterialORTHOTROPIC( );
02877 }
02878
02879 else if( strcmp( label, "MATERIAL.HIPERBOLIC" ) == 0 )
02880 {
02881 _NfiReadMaterialHIPERBOLIC( );
02882 }
02883
02884 else if( strcmp( label, "MATERIAL.MOHR.COULOMB" ) == 0 )
02885 {
02886 _NfiReadMaterialMOHRCOULOMB( );
02887 }
02888
02889 else if( strcmp( label, "MATERIAL.MOHR.COULOMB.CUTOFF" ) == 0 )
02890 {
02891 _NfiReadMaterialMOHRCOULOMBCUTOFF( );
02892 }
02893
02894 else if( strcmp( label, "MATERIAL.MOHR.COULOMB.NONASSOCIATED.CONSTANT" ) == 0 )
02895 {
02896 _NfiReadMaterialMOHRCOULOMBNAC( );
02897 }
02898
02899 else if( strcmp( label, "MATERIAL.MOHR.COULOMB.NONASSOCIATED.VARIABLE" ) == 0 )
02900 {
02901 _NfiReadMaterialMOHRCOULOMBNAV( );
02902 }
02903
02904 else if( strcmp( label, "ELEMENT" ) == 0 )
02905 {
02906 if ( !_NfiReadElement( ) ) return 0;
02907 }
02908
02909 else if( strcmp( label, "ELEMENT.LINE2" ) == 0 )
02910 {
02911 _NfiReadElementLINE2();
02912 }
02913
02914 else if( strcmp( label, "ELEMENT.T3" ) == 0 )
02915 {
02916 _NfiReadElementT3( );
02917 }
02918
02919 else if( strcmp( label, "ELEMENT.DKT" ) == 0 )
02920 {
02921 _NfiReadElementDKT( );
02922 }
02923
02924 else if( strcmp( label, "ELEMENT.Q4" ) == 0 )
02925 {
02926 _NfiReadElementQ4( );
02927 }
02928
02929 else if( strcmp( label, "ELEMENT.BRICK8" ) == 0 )
02930 {
02931 _NfiReadElementBRICK8( );
02932 }
02933
02934 else if( strcmp( label, "ELEMENT.TETR4" ) == 0 )
02935 {
02936 _NfiReadElementTETR4( );
02937 }
02938
02939 else if( strcmp( label, "ELEMENT.INTERFACE" ) == 0 )
02940 {
02941 _NfiReadElementINTERFACE( );
02942 }
02943
02944 else if( strcmp( label, "ELEMENT.INFINITE" ) == 0 )
02945 {
02946 _NfiReadElementINFINITE( );
02947 }
02948
02949 else if( strcmp( label, "ELEMENT.PROFILE.T3" ) == 0 )
02950 {
02951 _NfiReadElementProfileT3( );
02952 }
02953
02954 else if( strcmp( label, "ELEMENT.PROFILE.Q4" ) == 0 )
02955 {
02956 _NfiReadElementProfileQ4( );
02957 }
02958
02959 else if( strcmp( label, "ELEMENT.PROFILE.BRICK8" ) == 0 )
02960 {
02961 _NfiReadElementProfileBRICK8( );
02962 }
02963
02964 else if( strcmp( label, "ELEMENT.PROFILE.TETR4" ) == 0 )
02965 {
02966 _NfiReadElementProfileTETRA4( );
02967 }
02968
02969 else if( strcmp( label, "LOAD" ) == 0 )
02970 {
02971 _NfiReadLoad( );
02972 }
02973
02974 else if( strcmp( label, "LOAD.CASE" ) == 0 )
02975 {
02976 _NfiReadLoadCase( );
02977 }
02978
02979 else if( strcmp( label, "LOAD.CASE.GRAVITY" ) == 0 )
02980 {
02981 _NfiReadLoadCaseGravity( );
02982 }
02983
02984 else if( strcmp( label, "LOAD.CASE.NODAL.PRESSURE" ) == 0 )
02985 {
02986 _NfiReadLoadCaseNodalPressure( );
02987 }
02988
02989 else if( strcmp( label, "LOAD.CASE.NODAL.FORCES" ) == 0 )
02990 {
02991 _NfiReadLoadCaseNodalForces( );
02992 }
02993
02994 else if( strcmp( label, "LOAD.CASE.NODAL.VELOCITY" ) == 0 )
02995 {
02996 _NfiReadLoadCaseNodalVelocity( );
02997 }
02998
02999 else if( strcmp( label, "LOAD.CASE.NODAL.SUPPORT" ) == 0 )
03000 {
03001 _NfiReadLoadCaseNodalSupport( );
03002 }
03003
03004 else if( strcmp( label, "LOAD.CASE.LINE.FORCE.UNIFORM" ) == 0 )
03005 {
03006 _NfiReadLoadCaseLineForcesUni( );
03007 }
03008
03009 else if( strcmp( label, "LOAD.CASE.LINE.FORCE.VARIABLE" ) == 0 )
03010 {
03011 _NfiReadLoadCaseLineForcesVar( );
03012 }
03013
03014 else if( strcmp( label, "LOAD.CASE.DOMAIN.INITIAL.STRESS.UNIFORM" ) == 0 )
03015 {
03016 if( !_NfiReadLoadCaseDomainInitStressUni( ) ) return 0;
03017 }
03018
03019 else if( strcmp( label, "LOAD.CASE.DOMAIN.TEMPERATURE.UNIFORM" ) == 0 )
03020 {
03021 _NfiReadLoadCaseDomainTempUni( );
03022 }
03023
03024 else if( strcmp( label, "LOAD.CASE.NODAL.DISPLACEMENT" ) == 0 )
03025 {
03026 _NfiReadLoadCaseNodalDisplacements( );
03027 }
03028
03029 else if( strcmp( label, "LOAD.CASE.ELEMENT.POTENCIAL" ) == 0 )
03030 {
03031 _NfiReadLoadCaseElementPotencial( );
03032 }
03033
03034
03035 else if( strcmp( label, "LOAD.CASE.AREA.UNIFORM" ) == 0 )
03036 {
03037 _NfiReadLoadCaseAreaUniform( );
03038 }
03039
03040 else if( strcmp( label, "LOAD.CASE.AREA.PRESSURE" ) == 0 )
03041 {
03042 _NfiReadLoadCaseAreaPressure( );
03043 }
03044
03045
03046 else if( strcmp( label, "REZONE" ) == 0 )
03047 {
03048 _NfiReadRezone( );
03049 }
03050
03051 else if( strcmp( label, "REZONE.CASE" ) == 0 )
03052 {
03053 _NfiReadRezoneCase( );
03054 }
03055
03056 else if( strcmp( label, "REZONE.CASE.ELEMENT" ) == 0 )
03057 {
03058 _NfiReadRezoneCaseElement( );
03059 }
03060
03061 else if( strcmp( label, "CONSTRAIN" ) == 0 )
03062 {
03063 if( !_NfiReadConstrain() ) return 0;
03064 }
03065
03066 else if( strcmp( label, "CONSTRAIN.CURVE" ) == 0 )
03067 {
03068 _NfiReadConstrainCurve();
03069 }
03070
03071 else if( strcmp( label, "CONSTRAIN.SHOT" ) == 0 )
03072 {
03073 _NfiReadConstrainShot();
03074 }
03075
03076 else if( strcmp( label, "CONSTRAIN.SURFACE" ) == 0 )
03077 {
03078 _NfiReadConstrainSurface();
03079 }
03080
03081 else if( strcmp( label, "NODE.CONSTRAIN" ) == 0 )
03082 {
03083 _NfiReadNodeConstrain();
03084 }
03085
03086 else if( strcmp( label, "NODE.PILOT" ) == 0 )
03087 {
03088 _NfiReadNodePilot();
03089 }
03090
03091 else if( strcmp( label, "REMARK" ) == 0 )
03092 continue;
03093
03094 else if( strcmp( label, "END" ) == 0 )
03095 break;
03096
03097 else
03098 continue;
03099 }
03100
03101
03102
03103
03104 if( (DrvObj == 0L) && (_TotalTime == 0) && (Config.algtype == 0) && (Config.num_load_step == 1))
03105 {
03106 DrvNew( STANDARD, &DrvObj );
03107 }
03108 else if( (DrvObj == 0L) && (Config.num_load_step == 1) && (Config.algtype == 1))
03109 {
03110 DrvNew( IMPLINEAR, &DrvObj );
03111 }
03112 else if( (DrvObj == 0L) && (Config.num_load_step == 1) && (Config.algtype == 2))
03113 {
03114 DrvNew( IMPNRM, &DrvObj );
03115 }
03116 else if( (DrvObj == 0L) && (Config.num_load_step == 1) && (Config.algtype == 3))
03117 {
03118 DrvNew( IMPBFGS, &DrvObj );
03119 }
03120 else if( (DrvObj == 0L) && (Config.num_load_step == 1) && (Config.algtype == 4))
03121 {
03122 DrvNew( HYBRID, &DrvObj );
03123 }
03124 else if( (DrvObj == 0L) && (_DampParameters == 1) && (Config.num_load_step == 1))
03125 {
03126 DrvNew( STANDARD_VE, &DrvObj );
03127 }
03128 else if( (DrvObj == 0L) && (_DampParameters == 2) && (Config.num_load_step == 1))
03129 {
03130 DrvNew( STANDARD_VE_FLAC, &DrvObj );
03131 }
03132 else if( (DrvObj == 0L) && (Config.num_load_step > 1) )
03133 {
03134 DrvNew( LOAD_STEP, &DrvObj );
03135 }
03136
03137 if( NumConstrains != 0 ) {
03138 ConstrainBuild();
03139 }
03140 return 1;
03141
03142 }
03143
03144
03145
03146
03147
03148 int NfiWriteResults( void )
03149 {
03150 int i,j;
03151 long ndlrpos, elmrpos;
03152 double *disp = 0L;
03153
03154
03155
03156 disp = (double *)calloc( NDof*NumNodes, sizeof(double) );
03157
03158
03159
03160 if( NumRezones > 0 )
03161 {
03162
03163
03164 fprintf( _NfiName, "%%RESULT\n1\n1\t'Rezone'\n\n" );
03165 fprintf( _NfiName, "%%RESULT.CASE\n1\t%d\n", NumRezones+1 );
03166 for( i = 0; i <= NumRezones; i++ )
03167 fprintf( _NfiName, "%d\t'Step_%d'\n", i+1, i+1 );
03168 fprintf( _NfiName, "\n" );
03169 }
03170 else if( NumLoadCase > 1 )
03171 {
03172
03173
03174 fprintf( _NfiName, "%%RESULT\n" );
03175 fprintf( _NfiName, "%d\n", NumLoadCase);
03176 for( i = 0; i < NumLoadCase; i++ )
03177 fprintf( _NfiName, "%d\t'LoadCase_%d'\n", i+1, i+1 );
03178 }
03179 else if( Config.num_load_step > 1 )
03180 {
03181
03182
03183 fprintf( _NfiName, "%%RESULT\n" );
03184 fprintf( _NfiName, "%d\n", Config.num_load_step);
03185 for( i = 0; i < Config.num_load_step; i++ )
03186 fprintf( _NfiName, "%d\t'LoadStep_%d'\n", i+1, i+1 );
03187 }
03188 else if( Config.num_step > 0 )
03189 {
03190
03191
03192 fprintf( _NfiName, "%%RESULT\n1\n1\t'Solution'\n\n" );
03193 fprintf( _NfiName, "%%RESULT.CASE\n1\t%d\n", Config.num_step+1 );
03194 for( i = 0; i < Config.num_step+1; i++ )
03195 fprintf( _NfiName, "%d\t'Step_%d'\n", i+1, i+1 );
03196 fprintf( _NfiName, "\n" );
03197 }
03198 else if( Config.num_time_step > 0 )
03199 {
03200
03201
03202 fprintf( _NfiName, "%%RESULT\n1\n1\t'Solution'\n\n" );
03203 fprintf( _NfiName, "%%RESULT.CASE\n1\t%d\n", Config.num_time_step );
03204 for( i = 0; i < Config.num_time_step; i++ )
03205 fprintf( _NfiName, "%d\t'Step_%d'\n", i+1, i+1 );
03206 fprintf( _NfiName, "\n" );
03207 }
03208 else
03209 {
03210
03211
03212 fprintf( _NfiName, "%%RESULT\n1\n1\t'Solution'\n\n" );
03213 fprintf( _NfiName, "%%RESULT.CASE\n1\t1\n1\t'Step_1'\n\n" );
03214 }
03215
03216
03217
03218 if( NumRezones > 0 )
03219 {
03220 for( i = 0; i <= NumRezones; i++ )
03221 {
03222 if( !IoFindResultTag( i, &ndlrpos, &elmrpos ) ) return 0;
03223
03224 _NfiWriteResultStep( i+1, ndlrpos, elmrpos, disp );
03225 }
03226 }
03227 else if( NumLoadCase > 1 )
03228 {
03229 for( i = 0; i < NumLoadCase; i++ )
03230 {
03231 if ( !IoFindResultTag( i, &ndlrpos, &elmrpos ) ) return 0;
03232
03233 fprintf( _NfiName, "%%RESULT.CASE\n" );
03234 fprintf( _NfiName, "%d\t%d\n", i+1, Config.num_step+1);
03235 for( j = 0; j < Config.num_step+1; j++ ){
03236 fprintf( _NfiName, "%d\t'Step_%d'\n", j+1, j+1 );
03237 fprintf( _NfiName, "\n" );
03238 _NfiWriteResultStep( j+1, ndlrpos, elmrpos, disp );
03239 }
03240 }
03241 }
03242 else if( Config.num_load_step > 1 )
03243 {
03244 for( i = 0; i < Config.num_load_step; i++ )
03245 {
03246 if ( !IoFindResultTag( i, &ndlrpos, &elmrpos ) ) return 0;
03247
03248 fprintf( _NfiName, "%%RESULT.CASE\n" );
03249 fprintf( _NfiName, "%d\t%d\n", i+1, Config.num_step+1);
03250 for( j = 0; j < Config.num_step+1; j++ ){
03251 fprintf( _NfiName, "%d\t'Step_%d'\n", j+1, j+1 );
03252 fprintf( _NfiName, "\n" );
03253 _NfiWriteResultStep( j+1, ndlrpos, elmrpos, disp );
03254 }
03255 }
03256 }
03257 else if( Config.num_step > 0 )
03258 {
03259
03260
03261 for( i = 0; i < Config.num_step+1; i++ )
03262 {
03263 if( !IoFindResultTag( i, &ndlrpos, &elmrpos ) ) return 0;
03264
03265 _NfiWriteResultStep( i+1, ndlrpos, elmrpos, disp );
03266 }
03267 }
03268 else if( Config.num_time_step > 0 )
03269 {
03270
03271
03272 for( i = 0; i < Config.num_time_step; i++ )
03273 {
03274 if( !IoFindResultTag( i, &ndlrpos, &elmrpos ) ) return 0;
03275
03276 fprintf( _NfiName, "%%RESULT.CASE.TIME\n%f\n\n", i * Config.timeStep );
03277 _NfiWriteResultStep( i+1, ndlrpos, elmrpos, disp );
03278 }
03279 }
03280 else
03281 {
03282 if( !IoFindResultTag( 0, &ndlrpos, &elmrpos ) ) return 0;
03283
03284 _NfiWriteResultStep( 1, ndlrpos, elmrpos, disp );
03285 }
03286 IoCloseTempFile( );
03287
03288
03289
03290 fprintf( _NfiName, "%%END\n" );
03291 return 1;
03292
03293 }
03294
03295
03296
03297
03298
03299 int NfiReadConfigFile( void )
03300 {
03301 char label[80];
03302
03303
03304
03305 while( 1 )
03306 {
03307 if( _NfiNextLabel( label ) == 0 )
03308 {
03309 printf( "\n\n" );
03310 return 0;
03311 }
03312
03313 else if( strcmp( label, "RELAX.TIME.FRACTION" ) == 0 )
03314 {
03315 _NfiReadTimeFraction( );
03316 }
03317
03318 else if( strcmp( label, "RELAX.DAMPING.GLOBAL.PARAMETER" ) == 0 )
03319 {
03320 _NfiReadDampingGlobalParameter( );
03321 }
03322
03323 else if( strcmp( label, "RELAX.TOLERANCE" ) == 0 )
03324 {
03325 _NfiReadTolerance( );
03326 }
03327
03328 else if( strcmp( label, "RELAX.GEOMETRICALLY.NONLINEAR" ) == 0 )
03329 {
03330 _NfiReadGeometricallyNonLinear( );
03331 }
03332
03333 else if( strcmp( label, "RELAX.MAXIMUM.STEPS" ) == 0 )
03334 {
03335 _NfiReadMaximumIteration( );
03336 }
03337
03338 else if( strcmp( label, "END" ) == 0 )
03339 break;
03340
03341 else
03342 continue;
03343 }
03344 return 1;
03345
03346 }
03347
03348
03349
03350
03351
03352 int NfiCheckParameters( void )
03353 {
03354 if( (_TimeFraction == 0) || (_DampParameters == 0) ||
03355 (_Tolerance == 0) || (_MaxIterations == 0) ||
03356 (_NumStepTol == 0))
03357 return( 0 );
03358 else
03359 return( 1 );
03360
03361 }
03362
03363
03364
03365