00001 subroutine gs
00002
00003 use global
00004
00005 use model
00006
00007
00008 implicit none
00009
00010
00011 integer myP,myD
00012
00013 integer,pointer :: IM(:,:,:,:)
00014
00015 integer,pointer :: IV(:,:)
00016
00017 integer,pointer :: gsSetVec(:)
00018
00019 integer maxNewtonBackup
00020
00021 integer i
00022
00023 integer gsIter
00024
00025 integer gsTol
00026
00027 real(8) normGS
00028
00029 integer myIndex
00030
00031 integer myI,myJ,myT,myN
00032
00033 integer mySize
00034
00035 integer,allocatable :: myPVec(:),myDvec(:)
00036
00037 integer gsCurrentPhysics,gsCurrentDomain
00038
00039
00040 maxNewtonBackup=maxNewtonIter
00041
00042 maxNewtonIter=gsMaxNewton
00043
00044 gsTol=1e-5
00045
00046
00047 pVec=>myModel%pVec
00048
00049
00050 if (accumulating.eqv.yes) maxGsIter=1
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 do myP=1,size(pVec)
00063
00064 currentPhysics=pVec(myP)
00065
00066 dVec=>myModel%physics(currentPhysics)%dVec
00067
00068 do myD=1,size(dVec)
00069
00070 currentDomain=dVec(myD)
00071
00072 IM=>myModel%physics(currentPhysics)%domain(currentDomain)%dofMatrix
00073
00074 IM(:,:,:,flag)=0
00075
00076 mySize=size(myModel%physics(currentPhysics)%domain(currentDomain)%setVec)
00077
00078 allocate(myModel%physics(currentPhysics)%domain(currentDomain)%gsSetVec(mySize))
00079 gsSetVec=>myModel%physics(currentPhysics)%domain(currentDomain)%gsSetVec
00080 gsSetVEc=myModel%physics(currentPhysics)%domain(currentDomain)%setVec
00081
00082 end do
00083
00084 end do
00085
00086
00087
00088 allocate(myPvec(size(pVec)))
00089 myPVec=pVEc
00090
00091 do myP=1,size(mypVec)
00092
00093 gsCurrentPhysics=myPVec(myP)
00094
00095 dVec=>myModel%physics(gsCurrentPhysics)%dVec
00096
00097 allocate(myDvec(size(dVec)))
00098 myDVec=dVEc
00099
00100 do myD=1,size(mydVec)
00101
00102
00103
00104 gsCurrentDomain=myDVec(myD)
00105
00106 IM=>myModel%physics(gsCurrentPhysics)%domain(gsCurrentDomain)%dofMatrix
00107 IV=>myModel%physics(gsCurrentPhysics)%domain(gsCurrentDomain)%dofVector
00108
00109 relativeIndex=>myModel%physics(gsCurrentPhysics)%domain(gsCurrentDomain)%relativeIndex
00110
00111
00112
00113 gsSetVec=>myModel%physics(gsCurrentPhysics)%domain(gsCurrentDomain)%gsSetVec
00114
00115
00116 do gsIter=1,maxGsIter
00117
00118
00119 if (mod(gsIter,10).eq.0) then
00120
00121 print*,'^^^^^^^^^^^^^^^^^^^^^'
00122 print*,'gauss seidel iteration=',gsIter
00123 print*,'^^^^^^^^^^^^^^^^^^^^^'
00124
00125 end if
00126
00127 call postprocessor
00128
00129 print*,'if block is on, then gsSetVec should be smaller'
00130
00131 IM(:,:,:,flag)=0
00132
00133 do i=1,size(gsSetVec)
00134
00135
00136 myIndex=gsSetVec(i)
00137
00138 myIndex=myIndex-relativeIndex
00139
00140 myN=IV(myIndex,1)
00141 myI=IV(myIndex,2)
00142 myJ=IV(myIndex,3)
00143 myT=IV(myIndex,4)
00144
00145 IM(myI,myJ,myT,flag)=1
00146
00147 if (blockGS.eqv.yes) then
00148
00149 IM(myI,myJ,:,flag)=1
00150
00151 end if
00152
00153
00154
00155 call currentSet
00156
00157
00158
00159
00160
00161
00162 call Newton
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 if (accumulating.eqv.no) IM(myI,myJ,myT,flag)=0
00174
00175 if (blockGS.eqv.yes) then
00176
00177
00178 if (accumulating.eqv.no) IM(myI,myJ,:,flag)=0
00179
00180 end if
00181
00182
00183
00184 end do
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 normGS=dsqrt(dot_product(discrete(0),discrete(0)))
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 end do
00209
00210
00211
00212
00213
00214
00215
00216 nullify(gsSetVec)
00217
00218 end do
00219
00220 deallocate(myDVec)
00221
00222
00223 end do
00224
00225
00226
00227
00228 do myP=1,size(pVec)
00229
00230 currentPhysics=pVec(myP)
00231
00232 dVec=>myModel%physics(currentPhysics)%dVec
00233
00234 do myD=1,size(dVec)
00235
00236 currentDomain=dVec(myD)
00237
00238 IM=>myModel%physics(currentPhysics)%domain(currentDomain)%dofMatrix
00239
00240 IM(:,:,:,flag)=1
00241
00242 deallocate(myModel%physics(currentPhysics)%domain(currentDomain)%gsSetVec)
00243
00244
00245 end do
00246
00247 end do
00248
00249 call currentset
00250
00251 maxNewtonIter=maxNewtonBackup
00252
00253
00254
00255
00256
00257 deallocate(myPVec)
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 end subroutine gs