8 subroutine bufnst2(nvar,naux,numbad,lcheck,lbase)
11 implicit double precision (a-h,o-z)
15 integer listgrids(numgrids(lcheck))
16 integer omp_get_thread_num, omp_get_max_threads
17 integer mythread/0/, maxthreads/1/
22 iadd(i,j) = locamrflags + i-1+ mibuff*(j-1)
33 time = rnode(timemult,lstart(lcheck))
38 levst = liststart(lcheck)
51 do jg = 1, numgrids(lcheck)
53 mptr = listofgrids(levst+jg-1)
54 ilo = node(ndilo,mptr)
55 ihi = node(ndihi,mptr)
56 jlo = node(ndjlo,mptr)
57 jhi = node(ndjhi,mptr)
58 nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
59 ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
62 mbuff = max(nghost,ibuff+1)
65 locamrflags = node(storeflags,mptr)
78 if (flag_richardson)
then
79 locbig = node(tempptr,mptr)
80 call
reclam(locbig,mitot*mjtot*nvar)
83 if (eprint .and. maxthreads .eq. 1)
then
84 write(outunit,*)
" flagged points before projec2",
85 . lcheck,
" grid ",mptr,
" (no buff cells)"
86 do j = mjbuff-mbuff, mbuff+1, -1
87 write(outunit,100)(int(alloc(
iadd(i,j))),
88 & i=mbuff+1,mibuff-mbuff)
96 1 rnode(cornylo,mptr),dx,dy,lcheck,time,
97 2 alloc(locamrflags),goodpt,badpt)
100 if (lcheck+2 .le. mxnest)
then
102 call
projec2(lcheck,numpro2,alloc(locamrflags),
103 . ilo,ihi,jlo,jhi,mbuff)
107 if (eprint .and. maxthreads .eq. 1)
then
108 write(outunit,*)
" flagged points before buffering on level",
109 . lcheck,
" grid ",mptr,
" (no buff cells)"
110 do 47 j = mjbuff-mbuff, mbuff+1, -1
111 write(outunit,100)(int(alloc(
iadd(i,j))),
112 & i=mbuff+1,mibuff-mbuff)
117 if (eprint .and. maxthreads .eq. 1)
then
118 write(outunit,*)
" flagged points after projecting to level",
119 . lcheck,
" grid ",mptr,
120 .
"(withOUT buff cells)"
124 do 49 j = mjbuff-mbuff, mbuff+1, -1
125 write(outunit,100)(int(alloc(
iadd(i,j))),
126 . i=mbuff+1,mibuff-mbuff)
134 call
shiftset2(alloc(locamrflags),ilo,ihi,jlo,jhi,mbuff)
136 if (eprint .and. maxthreads .eq. 1)
then
137 write(outunit,*)
" flagged points after buffering on level",
138 . lcheck,
" grid ",mptr,
" (WITHOUT buff cells))"
139 do 51 j = mjbuff-mbuff, mbuff+1, -1
140 write(outunit,100)(int(alloc(
iadd(i,j))),
141 . i=mbuff+1, mibuff-mbuff)
150 if (alloc(
iadd(i,j)) .ne. goodpt)
then
151 numflagged=numflagged + 1
156 116
format(i5,
' points flagged on level ',i4,
' grid ',i4)
157 node(numflags,mptr) = numflagged
159 numbad = numbad + numflagged
166 locdomflags =
igetsp( (mibuff*mjbuff)/ibytesperdp+1)
167 locdom2 =
igetsp( (mibuff*mjbuff)/ibytesperdp+1)
169 node(domflags_base,mptr) = locdomflags
170 node(domflags2,mptr) = locdom2
171 call
setdomflags(mptr,alloc(locdomflags),ilo,ihi,jlo,jhi,
172 . mbuff,lbase,lcheck,mibuff,mjbuff)
180 if (verbosity_regrid .ge. lcheck)
then
181 write(outunit,*)
" total flagged points counted on level ",
182 . lcheck,
" is ",numbad
183 write(outunit,*)
"this may include double counting buffer cells",
184 &
" on multiple grids"
subroutine flagregions2(mx, my, mbuff, xlower, ylower, dx, dy, level, t, amrflags, DONTFLAG, DOFLAG)
Modify array of flagged points to respect minlevels and maxlevels specified by regions.
subroutine reclam(index, nwords)
subroutine bufnst2(nvar, naux, numbad, lcheck, lbase)
After error estimation, need to tag the cell for refinement, buffer the tags, take care of level nest...
subroutine shiftset2(rectflags, ilo, ihi, jlo, jhi, mbuff)
For an input grid, flag cells near the previously flagged cells for creating buffer zone...
integer pure function iadd(ivar, i, j)
subroutine projec2(level, numpro, rectflags, ilo, ihi, jlo, jhi, mbuff)
This subroutine projects all level level+1 and level+2 grids to a level level grid and flag the cells...
subroutine setdomflags(mptr, igridflags, ilo, ihi, jlo, jhi, mbuff, lbase, lcheck, mibuff, mjbuff)