2D AMRCLAW
flglvl2.f
Go to the documentation of this file.
1 c :::::::::::::::::::: FLGLVL :::::::::::::::::::::::::::::::::
2 c
19 c
20 c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
21 c
22 c -----------------------------------------------------------
23 c
24  subroutine flglvl2(nvar,naux,lcheck,nxypts,index,lbase,npts,
25  & start_time)
26 c
27  use amr_module
28  implicit double precision (a-h,o-z)
29  integer clock_start, clock_finish, clock_rate
30 c
31 c
32 c
33  nxypts = 0
34  numbad = 0
35 
36 
37 c flag arrays- based on either spatial gradients (and/or user defined
38 c criteria), or Richardson error estimation
39 
40  call system_clock(clock_start,clock_rate)
41  call flagger(nvar,naux,lcheck,start_time)
42  call system_clock(clock_finish,clock_rate)
43  timeflagger = timeflagger + clock_finish - clock_start
44 
45 
46 c buffer the flagged cells (done for each grid patch of flags)
47 c also project flags from finer levels onto this level to ensure
48 c proper nesting. Finally compute proper domain for each patch
49  call system_clock(clock_start,clock_rate)
50  call bufnst2(nvar,naux,numbad,lcheck,lbase)
51  call system_clock(clock_finish,clock_rate)
52  timebufnst = timebufnst + clock_finish - clock_start
53 
54  nxypts = nxypts + numbad
55 c
56 c colate flagged pts into flagged points array
57 c new version needs to check for proper nesting at this point
58 c also needs to sort, so can remove duplicates.
59 c
60  if (nxypts .gt. 0) then
61 c build domain flags for each grid at level lcheck, instead of
62 c previous approach using domain flags over entire domain
63 c call domgrid(lbase,lcheck) ! will need since there are flagged pts NOW IN BUFNST2
64 c
65 c in new version, there are bad cells but nxypts isnt true count any longer
66 c since there are duplicates, and proper nesting not yet checked
67  index = igetsp(2*nxypts)
68  call colate2(alloc(index),nxypts,lcheck,npts,lbase)
69  else
70  npts = 0 !npts is number of unique flagged points after removing duplicates
71  call freeflags(lcheck) ! otherwise storage freed in colate2. perhaps always do it here
72  endif
73 
74  return
75  end
76 c
77 c ---------------------------------------------------------------------------------
78 c
79  subroutine freeflags(lcheck)
80 
81  use amr_module
82  implicit double precision (a-h, o-z)
83 
84  mptr = lstart(lcheck)
85  10 continue
86  locamrflags = node(storeflags,mptr)
87  locdomflags = node(domflags_base,mptr)
88  locdom2 = node(domflags2,mptr)
89 
90  nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
91  ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
92  mbuff = max(nghost,ibuff+1)
93  mibuff = nx + 2*mbuff
94  mjbuff = ny + 2*mbuff
95 
96  ibytesperdp = 8
97  nwords = (mibuff*mjbuff)/ibytesperdp+1
98  call reclam(locdomflags, nwords)
99  call reclam(locdom2, nwords)
100  call reclam(locamrflags,mibuff*mjbuff)
101 
102  mptr = node(levelptr, mptr)
103  if (mptr .ne. 0) go to 10
104 
105  return
106  end
function igetsp(nwords)
Allocate contiguous space of length nword in main storage array alloc.
Definition: igetsp.f:9
subroutine colate2(badpts, len, lcheck, nUniquePts, lbase)
Takes flagged points on all grids on level lcheck and pack their (i,j) cell centered indices into the...
Definition: colate2.f:11
subroutine freeflags(lcheck)
Definition: flglvl2.f:80
subroutine flglvl2(nvar, naux, lcheck, nxypts, index, lbase, npts, start_time)
Controls the error estimation/flagging bad pts.
Definition: flglvl2.f:26
subroutine reclam(index, nwords)
Definition: reclam.f:5
integer, parameter ndihi
global i index of right border of this grid
Definition: amr_module.f90:111
integer timeflagger
Definition: amr_module.f90:242
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...
Definition: bufnst2.f:16
integer, dimension(nsize, maxgr) node
Definition: amr_module.f90:198
integer, parameter domflags_base
domain flags, indexed within base level (lbase) index space
Definition: amr_module.f90:129
integer, parameter storeflags
pointer to the address of memory storing flags for refinement on this grid
Definition: amr_module.f90:123
integer, parameter domflags2
domain flags, indexed within level-of-this-grid level index space
Definition: amr_module.f90:132
integer, parameter ndilo
global i index of left border of this grid
Definition: amr_module.f90:108
integer, parameter ndjlo
global j index of lower border of this grid
Definition: amr_module.f90:114
integer, dimension(maxlv) lstart
Definition: amr_module.f90:198
integer ibuff
Definition: amr_module.f90:198
integer timebufnst
Definition: amr_module.f90:242
integer, parameter ndjhi
global j index of upper border of this grid
Definition: amr_module.f90:117
integer, parameter levelptr
node number (index) of next grid on the same level
Definition: amr_module.f90:35
integer nghost
Definition: amr_module.f90:232
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21
subroutine flagger(nvar, naux, lcheck, start_time)
Set up for and call two routines that flag using (a) spatial gradients, or other user-specified crite...
Definition: flagger.f:32
real(kind=8), dimension(:), allocatable alloc
Definition: amr_module.f90:218