2D AMRCLAW
physbd.f
Go to the documentation of this file.
1 c
2 c ------------------------------------------------------------------
3 c
4  subroutine physbd(val,aux,nrow,ncol,nvar,naux,
5  1 hx, hy, level, time,
6  2 xleft, xright, ybot, ytop,
7  3 xlower,ylower,xupper,yupper,
8  4 xperiodic, yperiodic)
9 
10 
11 c
12 c
13 c :::::::::: PHYSBD ::::::::::::::::::::::::::::::::::::::::::::::;
14 c
19 c
20 c The corners of the grid patch are at
21 c (xleft,ybot) -- lower left corner
22 c (xright,ytop) -- upper right corner
23 c
24 c The physical domain itself is a rectangle bounded by
25 c (xlower,ylower) -- lower left corner
26 c (xupper,yupper) -- upper right corner
27 c
28 c the picture is the following:
29 c
30 c _____________________ (xupper,yupper)
31 c | |
32 c _________ (xright,ytop) |
33 c | | | |
34 c | | | |
35 c | | | |
36 c |___|____| |
37 c (xleft,ybot) | |
38 c | |
39 c |_____________________|
40 c (xlower,ylower)
41 c
42 c
43 c Any cells that lie outside the physical domain are ghost cells whose
44 c values should be set in this routine. This is tested for by comparing
45 c xleft with xlower to see if values need to be set at the left, as in
46 c the figure above, and similarly at the other boundaries.
47 c
48 c Patches are guaranteed to have at least 1 row of cells filled
49 c with interior values so it is possible to extrapolate.
50 c Fix trimbd if you want more than 1 row pre-set.
51 c
52 c Make sure the order the boundaries are specified is correct
53 c so that diagonal corner cells are also properly taken care of.
54 c
55 c Periodic boundaries are set before calling this routine, so you
56 c can safely extrapolate there. Don't overwrite them!
57 c
58 c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;
59 
60  use amr_module
61  implicit double precision (a-h,o-z)
62  logical xperiodic, yperiodic
63 
64 
65  dimension val(nrow,ncol,nvar), aux(nrow,ncol,naux)
66 
67 
68 c right boundary
69  if (xright .gt. xupper+hxmarg) then
70  nxr = (xright - xupper + hxmarg)/hx
71  nxr = nxr - 1
72  ibeg = max0(nrow-nxr, 1)
73  do 11 i = ibeg, nrow
74  do 11 j = 1, ncol
75  do 11 ivar = 1, nvar
76  val(i,j,ivar) = val(2*ibeg-1-i,j,ivar)
77 11 continue
78  endif
79 
80 c bottom boundary - reflecting (for ramp part, else inflow
81  if (ybot .lt. ylower-hymarg) then
82  nyb = (ylower+hymarg-ybot)/hy
83  do 12 i=1,nrow
84  do 12 j=1,nyb
85  val(i,j,ivar)
86  12 continue
87 c
88  endif
89 
90 
91 c top boundary - reflecting
92  if (ytop .gt. yupper+hymarg) then
93  nyt = (ytop - yupper + hymarg)/hy
94  jbeg = max0(ncol-nyt+1, 1)
95  x0 = disp + 10.d0*time/cos(pi/6.d0)
96  y0 = ylower
97 
98  do 13 j=jbeg,ncol
99  ycen = ybot + float(j-.5d0)*hy
100 
101  do 13 i=1,nrow
102  xcen = xleft + float(i-.5d0)*hx
103 
104  call cellave(xcen-hx/2.d0,ycen-hy/2.d0,hx,hy,wl)
105 
106  rho = (1.d0-wl)*rhoamb + wl*rhoshk
107  u = (1.d0-wl)*uamb + wl*ushk
108  v = (1.d0-wl)*vamb + wl*vshk
109  p = (1.d0-wl)*pamb + wl*pshk
110 
111  val(i,j,1) = rho
112  val(i,j,2) = rho * u
113  val(i,j,3) = rho * v
114  val(i,j,4) = p/gamma1 + .5d0*rho*(u*u+v*v)
115 
116  13 continue
117 
118  endif
119 
120 c left boundary - inflow
121  if (xleft .lt. xlower-hxmarg) then
122  nxl = (xlower+hxmarg-xleft)/hx
123  do 10 i = 1, nxl
124  do 10 j = 1, ncol
125  val(i,j,1) = rhoshk
126  val(i,j,2) = rhoshk * ushk
127  val(i,j,3) = rhoshk * vshk
128  val(i,j,4) = rhoshk*(eshk+.5d0*(ushk**2+vshk**2))
129  10 continue
130  endif
131 
132  return
133  end
134  return
135  end
real(kind=8) xupper
Definition: amr_module.f90:231
real(kind=8) xlower
Definition: amr_module.f90:231
real(kind=8) yupper
Definition: amr_module.f90:231
real(kind=8) ylower
Definition: amr_module.f90:231
subroutine cellave(xlow, ylow, dx, dy, wl)
Definition: cellave.f:7
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21