2D AMRCLAW
birect.f
Go to the documentation of this file.
1 c
2 c --------------------------------------------------
3 c
4  subroutine birect(mptr1)
5 c
6  use amr_module
7  implicit double precision (a-h,o-z)
8 
9 
10 c
11 c ::::::::::::: BIRECT :::::::::::::::::::::::::::::::::::::::
12 c check each grid, starting with mptr1 (either newstl or lstart)
13 c to see that it has no more than max1d points in either dimensions.
14 c needed so that scratch array space in stepgrid not exceeded.
15 c
16 c also check for too small grids - but has never happened.
17 c :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
18 c
19  mptr = mptr1
20  level = node(nestlevel,mptr)
21  hx = hxposs(level)
22  hy = hyposs(level)
23 c
24 10 continue
25  cxlo = rnode(cornxlo,mptr)
26  cxhi = rnode(cornxhi,mptr)
27  cylo = rnode(cornylo,mptr)
28  cyhi = rnode(cornyhi,mptr)
29  nx = node(ndihi,mptr) - node(ndilo,mptr) + 1
30  ny = node(ndjhi,mptr) - node(ndjlo,mptr) + 1
31  minsize = 2*nghost
32 c
33 c check number of rows first - if too many, bisect grid with vertical
34 c line down the middle. make sure new grid corners are anchored
35 c on coarse grid point. make sure if bisecting coarse grid that
36 c new grids have even number of points
37 c
38  if (nx + 2*nghost .gt. max1d) then
39 
40  nxl = nx/2
41  if (level .gt. 1) then
42  lratio = intratx(level-1)
43  else
44  lratio = 2
45  endif
46  nxl = (nxl/lratio)*lratio
47  nxr = nx - nxl
48  cxmid = cxlo + nxl*hx
49 
50  mptrnx = nodget()
51  node(levelptr,mptrnx) = node(levelptr,mptr)
52  node(levelptr,mptr) = mptrnx
53 
54  rnode(cornxhi,mptr) = cxmid
55  node(ndihi,mptrnx) = node(ndihi,mptr)
56  node(ndihi,mptr) = node(ndilo,mptr) + nxl - 1
57  node(ndilo,mptrnx) = node(ndihi,mptr) + 1
58  node(ndjhi,mptrnx) = node(ndjhi,mptr)
59  node(ndjlo,mptrnx) = node(ndjlo,mptr)
60 
61  rnode(cornxlo,mptrnx) = cxmid
62  rnode(cornylo,mptrnx) = cylo
63  rnode(cornyhi,mptrnx) = cyhi
64  rnode(cornxhi,mptrnx) = cxhi
65  rnode(timemult,mptrnx) = rnode(timemult,mptr)
66  node(nestlevel,mptrnx) = node(nestlevel,mptr)
67 
68  go to 10
69 c
70 c check number of columns next - if too many, bisect grid with horizontal
71 c line down the middle
72 c
73  else if (ny + 2*nghost .gt. max1d) then
74 
75  nyl = ny/2
76  if (level .gt. 1) then
77  lratio = intraty(level-1)
78  else
79  lratio = 2
80  endif
81  nyl = (nyl/lratio)*lratio
82  nyr = ny - nyl
83  cymid = cylo + nyl*hy
84 
85  mptrnx = nodget()
86  node(levelptr,mptrnx) = node(levelptr,mptr)
87  node(levelptr,mptr) = mptrnx
88 
89  rnode(cornyhi,mptr) = cymid
90 
91  node(ndjhi,mptrnx) = node(ndjhi,mptr)
92  node(ndjhi,mptr) = node(ndjlo,mptr) + nyl - 1
93  node(ndjlo,mptrnx) = node(ndjhi,mptr) + 1
94  node(ndihi,mptrnx) = node(ndihi,mptr)
95  node(ndilo,mptrnx) = node(ndilo,mptr)
96 
97  rnode(cornxlo,mptrnx) = cxlo
98  rnode(cornylo,mptrnx) = cymid
99  rnode(cornyhi,mptrnx) = cyhi
100  rnode(cornxhi,mptrnx) = cxhi
101  node(nestlevel,mptrnx) = node(nestlevel,mptr)
102  rnode(timemult,mptrnx) = rnode(timemult,mptr)
103  go to 10
104 c
105 c grid ok - check the next
106 c
107  else
108  mptr = node(levelptr,mptr)
109  if (mptr.ne.0) go to 10
110 
111  endif
112 
113  return
114  end
integer function nodget()
Definition: nodget.f:4
subroutine birect(mptr1)
Definition: birect.f:4