2D AMRCLAW
Functions/Subroutines
flglvl2.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine flglvl2 (nvar, naux, lcheck, nxypts, index, lbase, npts, start_time)
 Controls the error estimation/flagging bad pts. More...
 
subroutine freeflags (lcheck)
 

Function/Subroutine Documentation

◆ flglvl2()

subroutine flglvl2 (   nvar,
  naux,
  lcheck,
  nxypts,
  index,
  lbase,
  npts,
  start_time 
)

Controls the error estimation/flagging bad pts.

for an entire level of grids. returns pointer into alloc where the (x,y) coordinations of the flagged pts. are.

Parameters
nvarnumber of equations for the system
nauxnumber of auxiliary variables
lchecklevel to be flagged
nxyptsnumber of flagged points in total
indexstarting index (memory address) in alloc of the flagged points (which occupy 2*nxypts locations)
lbasebase AMR level for current refinement, which stays fixed. Note that lbase is always less or equal to lcheck
nptsNumber of unique flagged cells (after removing duplicates)
[in]start_timestart time of current simulation

Definition at line 26 of file flglvl2.f.

References amr_module::alloc, bufnst2(), colate2(), flagger(), freeflags(), igetsp(), amr_module::timebufnst, and amr_module::timeflagger.

Referenced by grdfit().

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
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
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 timebufnst
Definition: amr_module.f90:242
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeflags()

subroutine freeflags (   lcheck)

Definition at line 80 of file flglvl2.f.

References amr_module::domflags2, amr_module::domflags_base, amr_module::ibuff, amr_module::levelptr, amr_module::lstart, amr_module::ndihi, amr_module::ndilo, amr_module::ndjhi, amr_module::ndjlo, amr_module::nghost, amr_module::node, reclam(), and amr_module::storeflags.

Referenced by flglvl2().

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
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, 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, 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
Here is the call graph for this function:
Here is the caller graph for this function: