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 #include <stdio.h>
00026 #include <stdlib.h>
00027 #include <string.h>
00028
00029 #include "drv.h"
00030 #include "fem.h"
00031 #include "load.h"
00032 #include "elm.h"
00033 #include "node.h"
00034 #include "alg.h"
00035 #include "rio.h"
00036 #include "nfi.h"
00037 #include "load.h"
00038 #include "xgplib.h"
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 static void LoadStepNew ( sDriver ** );
00051 static void LoadStepFree ( sDriver * );
00052 static int LoadStepAnalysis ( UI_State * );
00053 static int LoadStepPrintResult( int, double *, double * );
00054
00055
00056
00057
00058
00059 static void LoadStepNew( sDriver **drv )
00060 {
00061
00062
00063 (*drv) = (sDriver *)calloc(1, sizeof(sDriver));
00064
00065
00066
00067 (*drv)->type = LOAD_STEP;
00068
00069 }
00070
00071
00072
00073
00074
00075 static void LoadStepFree( sDriver *drv )
00076 {
00077
00078
00079 drv->data = 0L;
00080
00081 }
00082
00083
00084
00085
00086
00087
00088 static int LoadStepAnalysis(UI_State *R)
00089 {
00090 int i, lstep = 0;
00091 double *FVector = 0L;
00092 double *UVector = 0L;
00093 double *VVector = 0L;
00094 double *MVector = 0L;
00095
00096
00097
00098 FVector = (double *)calloc( NDof*NumNodes, sizeof(double) );
00099 UVector = (double *)calloc( NDof*NumNodes, sizeof(double) );
00100 VVector = (double *)calloc( NDof*NumNodes, sizeof(double) );
00101 MVector = (double *)calloc( NDof*NumNodes, sizeof(double) );
00102
00103
00104
00105 XGPBegin( );
00106
00107
00108
00109 while( lstep < Config.num_load_step )
00110 {
00111
00112
00113 printf( "\tProcess load step..................: %d\n", lstep+1 );
00114 fflush( stdout );
00115
00116
00117
00118 PrescribedValues( );
00119
00120
00121
00122
00123 switch( Config.algtype )
00124 {
00125 case 0:
00126 if( !DRSolver(R, FVector, UVector, VVector, MVector, lstep ) ) return 0;
00127 break;
00128
00129 case 1:
00130 if( !IMPLINEARSolver(R, FVector, UVector, VVector, MVector, lstep ) ) return 0;
00131 break;
00132
00133 case 2:
00134 if( !IMPNRMSolver(R, FVector, UVector, VVector, MVector, lstep ) ) return 0;
00135 break;
00136
00137 case 3:
00138 if( !IMPBFGSSolver(R, FVector, UVector, VVector, MVector, lstep ) ) return 0;
00139 break;
00140
00141 case 4:
00142 if( !HYBRIDSolver(R, FVector, UVector, VVector, MVector, lstep ) ) return 0;
00143 break;
00144
00145 default:
00146 return 0;
00147 }
00148
00149
00150
00151 if( !IoStartSave( ) ) return 0;
00152
00153 fwrite( UVector, sizeof(double), NDof*NumNodes, ndlr );
00154 fflush( ndlr );
00155
00156 for( i = 0; i < NumElements; i++ )
00157 ElmWriteStress( ElmList[i], elmr, UVector, VVector );
00158 fflush( elmr );
00159
00160
00161
00162 lstep++;
00163 }
00164
00165
00166
00167 XGPEnd( );
00168
00169
00170
00171 free( FVector );
00172 free( UVector );
00173 free( VVector );
00174 free( MVector );
00175
00176 return 1;
00177
00178 }
00179
00180
00181
00182
00183
00184 static int LoadStepPrintResult( int iteration, double *U, double *V )
00185 {
00186 return 1;
00187 }
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 void LoadStepInit( void );
00199 void LoadStepInit( void )
00200 {
00201
00202
00203 DrvClass[LOAD_STEP].new = LoadStepNew;
00204 DrvClass[LOAD_STEP].free = LoadStepFree;
00205 DrvClass[LOAD_STEP].analysis = LoadStepAnalysis;
00206 DrvClass[LOAD_STEP].printres = LoadStepPrintResult;
00207
00208 }
00209
00210
00211
00212