00001 subroutine RunMS
00002
00003 use global
00004
00005 use DFPORT
00006
00007 use mf
00008
00009 implicit none
00010
00011 integer i,j,msIter
00012
00013 integer,pointer :: IM(:,:,:,:)
00014
00015 integer,pointer :: nx,ny
00016
00017 integer nxStart,nxEnd
00018
00019 integer nyStart,nyEnd
00020
00021 integer MSIndexes(xPartition*yPartition,4)
00022 integer MSBcs(xPartition*yPartition,4)
00023
00024 integer myDomainList(xPartition*yPartition)
00025
00026 integer index
00027
00028 integer xDomSize,yDomSize
00029
00030 integer,pointer :: minI, minJ, maxI, maxJ
00031
00032 integer dummyX,dummyY
00033
00034 real(8), allocatable :: myRandom(:)
00035
00036
00037
00038
00039 print*,'MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM'
00040 print*,'MULTIPLICATIVE SCHWARZ STARTS'
00041 print*,' '
00042
00043 print*,'for the time being assume 1 domain'
00044 print*,'caller of modelsolver should be such that domains are called 1 by 1'
00045
00046 print*,'ghost cell idea is skipped!!!'
00047 print*,'minI and the rest should be used, maybe transforming them from min:max to 1:n'
00048
00049
00050 IM=>myModel%physics(currentPhysics)%domain(currentDomain)%dofMatrix
00051
00052 nx=>myModel%physics(currentPhysics)%domain(currentDomain)%nx
00053 ny=>myModel%physics(currentPhysics)%domain(currentDomain)%ny
00054
00055 minI=>myModel%physics(currentPhysics)%domain(currentDomain)%minI
00056 minJ=>myModel%physics(currentPhysics)%domain(currentDomain)%minJ
00057 maxI=>myModel%physics(currentPhysics)%domain(currentDomain)%maxI
00058 maxJ=>myModel%physics(currentPhysics)%domain(currentDomain)%maxJ
00059
00060
00061 numberOfMSDomains=xPartition*yPartition
00062
00063
00064 MSIndexes=0
00065 MSBcs=1
00066
00067
00068 xDomSize=(nx-1)/xPartition
00069 yDomSize=(ny-1)/yPartition
00070
00071
00072
00073 dummyY=1
00074
00075 do j=1,yPartition
00076
00077
00078 dummyX=1
00079
00080 do i=1,xPartition
00081
00082 index=(j-1)*xPartition+i
00083
00084 MSIndexes(index,1)=dummyX
00085 MSIndexes(index,2)=MSIndexes(index,1)+xDomSize
00086
00087 dummyX=dummyX+xDomSize
00088
00089 MSIndexes(index,3)=dummyY
00090 MSIndexes(index,4)=MSIndexes(index,3)+yDomSize
00091
00092 end do
00093
00094 dummyY=dummyY+yDomSize
00095
00096 end do
00097
00098
00099
00100 if (msArtificialBC.eqv.on) then
00101
00102 do i=1,numberOfMSDomains
00103
00104
00105 MSBcs(i,1)=7
00106
00107 MSBcs(i,2)=8
00108
00109 MSBcs(i,3)=9
00110
00111 MSBcs(i,4)=10
00112
00113 end do
00114
00115 end if
00116
00117
00118
00119
00120
00121
00122
00123 do i=1,numberOfMSDomains
00124
00125 MSIndexes(i,1)=MSIndexes(i,1)-overlap
00126
00127 if (MSIndexes(i,1).lt.minI) then
00128
00129 MSIndexes(i,1)=minI
00130
00131 MSBCs(i,1)=0
00132
00133
00134 end if
00135
00136 MSIndexes(i,2)=MSIndexes(i,2)+overlap
00137
00138 if (MSIndexes(i,2).gt.maxI) then
00139
00140 MSIndexes(i,2)=maxI
00141
00142 MSBCs(i,2)=0
00143
00144 end if
00145
00146 MSIndexes(i,3)=MSIndexes(i,3)-overlap
00147
00148 if (MSIndexes(i,3).lt.minJ) then
00149
00150 MSIndexes(i,3)=minJ
00151
00152 MSBCs(i,3)=0
00153
00154 end if
00155
00156 MSIndexes(i,4)=MSIndexes(i,4)+overlap
00157
00158 if (MSIndexes(i,4).gt.maxJ) then
00159
00160 MSIndexes(i,4)=maxJ
00161
00162 MSBCs(i,4)=0
00163
00164 end if
00165
00166
00167 end do
00168
00169
00170
00171
00172 do i=1,numberOfMSDomains
00173
00174 myDomainList(i)=i
00175
00176
00177 end do
00178
00179
00180 dummyX=1
00181
00182 do i=numberOfMSDomains,1,-1
00183
00184 myDomainList(i)=dummyX
00185
00186 dummyX=dummyX+1
00187
00188
00189 end do
00190
00191
00192
00193
00194 msArtificialAlpha(1)=1.d0
00195 msArtificialAlpha(2)=1.d0
00196
00197
00198
00199
00200
00201 do msIter=1,maxMSIter
00202
00203 print*,'-------------------------------------------------------'
00204 print*,'ms iter=',msIter
00205 print*,'-------------------------------------------------------'
00206 if (msRandom.eqv.on) print*,'random domain list'
00207 if (msRandom.eqv.on) print*,'-------------------------------------------------------'
00208
00209
00210
00211
00212
00213 if (msRandom.eqv.on) then
00214
00215 allocate(myRandom(numberOfMSDomains))
00216
00217 call random_seed()
00218 CALL RANDOM_NUMBER(myRandom)
00219
00220 call qsortd(floor(myRandom*numberOfMSDomains),myDomainList,numberOfMSDomains)
00221
00222 deallocate(myRandom)
00223
00224 end if
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 do i=1,numberOfMSDomains
00244
00245
00246
00247 print*,'domain=',i,'/',numberOfMSDomains,' MS iter=',msIter,'/',maxMsIter
00248
00249
00250
00251
00252 index=myDomainList(i)
00253
00254
00255 nxStart=MSIndexes(index,1)
00256 nxEnd=MSIndexes(index,2)
00257 nyStart=MSIndexes(index,3)
00258 nyEnd=MSIndexes(index,4)
00259
00260
00261
00262 IM(:,:,:,flag)=0
00263 IM(nxStart:nxEnd,nyStart:nyEnd,:,flag)=1
00264
00265
00266 if (msArtificialBC.eqv.on) then
00267
00268
00269
00270
00271
00272
00273
00274 end if
00275
00276
00277
00278 call currentset
00279
00280
00281
00282
00283
00284 gsSolver=on
00285
00286 call RunNewton
00287
00288
00289
00290
00291
00292 call postProcessor
00293
00294
00295
00296
00297 end do
00298
00299
00300
00301
00302 call postProcessor
00303
00304
00305
00306
00307
00308
00309
00310 end do
00311
00312
00313
00314 print*,' '
00315 print*,'MULTIPLICATIVE SCHWARZ ENDS'
00316 print*,'MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM'
00317
00318
00319
00320
00321
00322
00323 end subroutine RunMS