2D AMRCLAW
Functions/Subroutines
cellave.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine cellave (xlow, ylow, dx, dy, wl)
 

Function/Subroutine Documentation

◆ cellave()

subroutine cellave (   xlow,
  ylow,
  dx,
  dy,
  wl 
)

Definition at line 7 of file cellave.f.

References fdisc(), fss(), and zeroin().

7 c =================================================
8  implicit double precision (a-h,o-z)
9  external fss
10  logical fl(5),alll,allr
11  dimension x(10),y(10),xx(5),yy(5)
12  common/fsscorn/ xc0,yc0,xc1,yc1
13 c
14 c # compute wl, fraction of cell that lies in left state.
15 c # For initial data with two states ql and qr separated by a
16 c # discontinuity. The curve along which the discontinuity lies is
17 c # specified by the function fdisc, which should return a value that
18 c # is negative on the side where ql lies and positive on the qr side.
19 c
20 c # xlow,ylow is the coordinate of the lower left corner of the cell.
21 c # dx, dy are grid spacing in x and y.
22 c
23  xx(1) = xlow
24  xx(2) = xlow
25  xx(3) = xlow+dx
26  xx(4) = xlow+dx
27  xx(5) = xx(1)
28  yy(1) = ylow
29  yy(2) = ylow+dy
30  yy(3) = ylow+dy
31  yy(4) = ylow
32  yy(5) = yy(1)
33  alll = .true.
34  allr = .true.
35 c
36  do 20 i=1,4
37  fl(i) = fdisc(xx(i),yy(i)) .lt. 0.d0
38  alll = alll .and. fl(i)
39  allr = allr .and. (.not. fl(i))
40  20 continue
41  fl(5) = fl(1)
42 c
43  if (alll) then
44  wl = 1.d0
45  return
46  endif
47  if (allr) then
48  wl = 0.d0
49  return
50  endif
51 c
52  iv = 0
53  do 40 i=1,4
54  if (fl(i)) then
55  iv = iv+1
56  x(iv) = xx(i)
57  y(iv) = yy(i)
58  endif
59  if (fl(i).neqv.fl(i+1)) then
60  iv = iv+1
61  xc0 = xx(i)
62  yc0 = yy(i)
63  xc1 = xx(i+1)
64  yc1 = yy(i+1)
65  ss = zeroin(0.d0, 1.d0, fss, 1d-8)
66 c write(27,*) 'xc,yc,ss:',xc0,yc0,xc1,yc1,ss
67  x(iv) = xx(i) + ss*(xx(i+1)-xx(i))
68  y(iv) = yy(i) + ss*(yy(i+1)-yy(i))
69  endif
70  40 continue
71 c
72 c # compute area:
73 c
74  if (iv.eq.0) then
75  wl = 0.d0
76  return
77  endif
78 c
79  x(iv+1) = x(1)
80  y(iv+1) = y(1)
81  area = 0.d0
82  do 50 i=1,iv
83  area = area + .5d0*(y(i)+y(i+1))*(x(i+1)-x(i))
84 c write(27,*) ' x,y:',x(i),y(i)
85  50 continue
86 c
87  wl = area / (dx*dy)
88 c write(27,*) 'area,wl:',area,wl
89 c
90  return
function fdisc(x, y)
Definition: fdisc.f:6
function zeroin(ax, bx, f, tol)
Definition: zeroin.f:6
function fss(s)
Definition: fss.f:8
Here is the call graph for this function: