00001 subroutine generateIndexMatrix
00002
00003 use global
00004
00005 implicit none
00006
00007
00008
00009 integer i,j,k,t
00010
00011 integer myI,myJ,myK,myT
00012
00013 integer sumI,sumJ,sumK
00014
00015 real(8) myVal
00016
00017 integer,pointer :: myNx,myNy
00018
00019
00020
00021 integer sumNodes,sumDof,sum
00022
00023 integer, pointer :: myNodeMatrix(:,:,:),myNodeVectorArray(:,:)
00024 integer, pointer :: myDofMatrix(:,:,:,:),myDofVectorArray(:,:)
00025
00026 real(8), allocatable :: resVec(:)
00027
00028
00029
00030
00031
00032
00033
00034
00035 integer,pointer :: minI,minJ,maxI,maxJ,maxUnk,myLocalDof
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 myNodeMatrix=>myModel%physics(currentPhysics)%domain(currentDomain)%NodeMatrix
00050 myDofMatrix=>myModel%physics(currentPhysics)%domain(currentDomain)%DofMatrix
00051
00052 myNodeMatrix=0
00053 myDofMatrix=0
00054
00055
00056
00057
00058
00059 sumNodes=1
00060 sumDof=1
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 minI=>myModel%physics(currentPhysics)%domain(currentDomain)%minI
00071 maxI=>myModel%physics(currentPhysics)%domain(currentDomain)%maxI
00072 minJ=>myModel%physics(currentPhysics)%domain(currentDomain)%minJ
00073 maxJ=>myModel%physics(currentPhysics)%domain(currentDomain)%maxJ
00074
00075
00076 myNx=>myModel%physics(currentPhysics)%domain(currentDomain)%nx
00077 myNy=>myModel%physics(currentPhysics)%domain(currentDomain)%ny
00078
00079
00080
00081 myLocalDof=>myModel%physics(currentPhysics)%dof
00082
00083
00084
00085 if (myModel%physics(currentPhysics)%dFX.eq.dFV) print*,'skip function is neeeded for no-compatible FV mode'
00086
00087
00088
00089 do j=minJ,maxJ
00090
00091 do i=minI,maxI
00092
00093
00094
00095
00096
00097
00098
00099 do t=1,myLocalDof
00100
00101 myDofMatrix(i,j,t,relative)=sumDof
00102
00103 sumDof=sumDof+1
00104
00105
00106 end do
00107
00108 end do
00109
00110 end do
00111
00112
00113 if ((poissonCompatibility.eqv.on).and.(myModel%physics(currentPhysics)%dFX.eq.dFV)) then
00114
00115 sumDof=1
00116 myDofMatrix=0
00117
00118
00119 do j=1,myNy-1
00120
00121 do i=1,myNx-1
00122
00123
00124
00125
00126
00127 do t=1,myLocalDof
00128
00129 myDofMatrix(i,j,t,relative)=sumDof
00130
00131 sumDof=sumDof+1
00132
00133
00134 end do
00135
00136 end do
00137
00138 end do
00139
00140 if (myModel%physics(currentPhysics)%domain(currentDomain)%numberOfGhostCells.gt.0) then
00141
00142
00143
00144
00145 do j=0,myNy,myNy
00146
00147 do i=1,myNx-1
00148
00149 do t=1,myLocalDof
00150
00151 myDofMatrix(i,j,t,relative)=sumDof
00152 sumDof=sumDof+1
00153
00154 end do
00155
00156
00157 end do
00158
00159 end do
00160
00161
00162
00163
00164 do i=0,myNx,myNx
00165
00166 do j=1,myNy-1
00167
00168 do t=1,myLocalDof
00169
00170 myDofMatrix(i,j,t,relative)=sumDof
00171 sumDof=sumDof+1
00172
00173 end do
00174
00175 end do
00176
00177 end do
00178
00179
00180 end if
00181
00182
00183 if (myModel%physics(currentPhysics)%domain(currentDomain)%numberOfGhostCells.gt.1) then
00184
00185
00186
00187
00188 do j=-1,myNy+1,myNy+2
00189
00190 do i=1,myNx-1
00191
00192 do t=1,myLocalDof
00193
00194 myDofMatrix(i,j,t,relative)=sumDof
00195 sumDof=sumDof+1
00196
00197 end do
00198
00199
00200 end do
00201
00202 end do
00203
00204
00205
00206
00207 do i=-1,myNx+1,myNx+2
00208
00209 do j=1,myNy-1
00210
00211 do t=1,myLocalDof
00212 myDofMatrix(i,j,t,relative)=sumDof
00213 sumDof=sumDof+1
00214 end do
00215
00216
00217 end do
00218 end do
00219
00220 end if
00221
00222
00223
00224
00225
00226
00227 end if
00228
00229
00230 do j=1,myNy
00231
00232 do i=1,myNx
00233
00234
00235
00236
00237
00238
00239
00240 myNodeMatrix(i,j,relative)=sumNodes
00241
00242
00243 sumNodes=sumNodes+1
00244
00245 end do
00246
00247 end do
00248
00249
00250
00251
00252 myModel%physics(currentPhysics)%domain(currentDomain)%totalNode=sumNodes-1
00253
00254 myModel%physics(currentPhysics)%domain(currentDomain)%totalDof=sumDof-1
00255
00256 myModel%physics(currentPhysics)%totalDof=myModel%physics(currentPhysics)%domain(currentDomain)%totalDof+myModel%physics(currentPhysics)%totalDof
00257
00258 myModel%physics(currentPhysics)%totalNode=myModel%physics(currentPhysics)%domain(currentDomain)%totalNode+myModel%physics(currentPhysics)%totalNode
00259
00260
00261
00262
00263
00264
00265
00266 myNodeMatrix(:,:,absolute)=myNodeMatrix(:,:,relative)+modelNode
00267 myDofMatrix(:,:,:,absolute)=myDofMatrix(:,:,:,relative)+modelDof
00268
00269
00270
00271 myModel%physics(currentPhysics)%domain(currentDomain)%relativeIndex=modelDof
00272 myModel%physics(currentPhysics)%domain(currentDomain)%relativeIndexNode=modelNode
00273
00274
00275 modelDof=myModel%physics(currentPhysics)%domain(currentDomain)%totalDof+modelDof
00276 modelNode=myModel%physics(currentPhysics)%domain(currentDomain)%totalNode+modelNode
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 return
00297
00298
00299
00300 print*,'now create a residual vector'
00301
00302 allocate(resVec(size(myDofVectorArray,dim=1)))
00303
00304 resVec=0.d0
00305
00306
00307 resVec=0.4d0
00308
00309 resVec(1)=0.6d0
00310 resVec(3)=0.6d0
00311 resVec(11)=0.6d0
00312 resVec(13)=0.6d0
00313 resVec(15)=0.6d0
00314 resVec(17)=0.6d0
00315 resVec(25)=0.6d0
00316 resVec(27)=0.6d0
00317 resVec(43)=0.6d0
00318 resVec(45)=0.6d0
00319 resVec(47)=0.6d0
00320
00321 resVec(2)=2.1d0
00322 resVec(10)=2.1d0
00323 resVec(12)=2.1d0
00324 resVec(16)=2.1d0
00325 resVec(22)=2.1d0
00326 resVec(24)=2.1d0
00327 resVec(26)=2.1d0
00328 resVec(38)=2.1d0
00329
00330
00331
00332
00333 print*,'flag the values'
00334
00335
00336 do i=1,size(resVec)
00337
00338
00339 myVal=resVec(i)
00340 myT=myDofVectorArray(i,4)
00341
00342
00343 if (myVal.ge.setTol(myT)) then
00344
00345 myI=myDofVectorArray(i,2)
00346 myJ=myDofVectorArray(i,3)
00347
00348 myDofMatrix(myI,myJ,myT,flag)=1
00349
00350 end if
00351
00352
00353 end do
00354
00355
00356
00357 do j=fullNy,1,-1
00358
00359 print*,myDofMatrix(:,j,1,flag)
00360
00361
00362 end do
00363
00364
00365
00366 print*,'--------------------'
00367
00368
00369 do j=-1,-2
00370
00371 print*,'woink'
00372
00373 end do
00374
00375
00376
00377 print*,'nodes are flagged'
00378
00379
00380
00381
00382
00383
00384 return
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397 print*,'each time a set is solved, new set should be found using all values'
00398 print*,'so we need a default set function'
00399
00400
00401
00402
00403 end subroutine generateIndexMatrix
00404