18
19 type(CellPolyType), intent(in), pointer :: poly
20 type(CellRectType), intent(inout), pointer :: rect
21
22 type(CellDefnType), pointer :: defn
23 integer(I4B) :: ipv, ipv1, ipv2, ipv3, ipv4
24 integer(I4B), dimension(4) :: ipvnxt = (/2, 3, 4, 1/)
25 real(DP) :: x1, y1, x2, y2, x4, y4
26 real(DP) :: dx2, dy2, dx4, dy4, areax, areay, areaz
27 real(DP) :: xOrigin, yOrigin, zOrigin, dx, dy, dz, sinrot, cosrot
28 real(DP) :: factor, term
29
31 defn => poly%defn
32
33
34
35
36
37
38
39
40
41
42
43
44
45 do ipv = 1, 4
46 ipv4 = ipv
47 ipv1 = ipvnxt(ipv4)
48 x4 = defn%polyvert(1, ipv4)
49 y4 = defn%polyvert(2, ipv4)
50 x1 = defn%polyvert(1, ipv1)
51 y1 = defn%polyvert(2, ipv1)
52 if (x1 .lt. x4) then
53 ipv2 = ipvnxt(ipv1)
54 x2 = defn%polyvert(1, ipv2)
55 if (x2 .le. x1) then
56 y2 = defn%polyvert(2, ipv2)
57 exit
58 end if
59 else if (y1 .ge. y4) then
60 ipv2 = ipvnxt(ipv1)
61 y2 = defn%polyvert(2, ipv2)
62 if (y2 .gt. y1) then
63 x2 = defn%polyvert(1, ipv2)
64 exit
65 end if
66 end if
67 end do
68 ipv3 = ipvnxt(ipv2)
69
70
71
72
73 xorigin = x1
74 yorigin = y1
75 zorigin = defn%bot
76 dx2 = x2 - xorigin
77 dy2 = y2 - yorigin
78 dx4 = x4 - xorigin
79 dy4 = y4 - yorigin
80 dx = dsqrt(dx4 * dx4 + dy4 * dy4)
81 dy = dsqrt(dx2 * dx2 + dy2 * dy2)
82 dz = defn%top - zorigin
83 sinrot = dy4 / dx
84 cosrot = dx4 / dx
85 rect%defn = poly%defn
86 rect%dx = dx
87 rect%dy = dy
88 rect%dz = dz
89 rect%sinrot = sinrot
90 rect%cosrot = cosrot
91 rect%xOrigin = xorigin
92 rect%yOrigin = yorigin
93 rect%zOrigin = zorigin
94 rect%ipvOrigin = ipv1
95
96
97 areax = dx * dz
98 areay = dy * dz
99 areaz = dx * dy
100 factor =
done / (defn%retfactor * defn%porosity)
101 term = factor / areax
102 rect%vx1 = defn%faceflow(ipv1) * term
103 rect%vx2 = -defn%faceflow(ipv3) * term
104 term = factor / areay
105 rect%vy1 = defn%faceflow(ipv4) * term
106 rect%vy2 = -defn%faceflow(ipv2) * term
107 term = factor / areaz
108 rect%vz1 = defn%faceflow(6) * term
109 rect%vz2 = -defn%faceflow(7) * term
subroutine, public create_cell_rect(cell)
Create a new rectangular cell.
This module contains simulation constants.
real(dp), parameter done
real constant 1
Base grid cell definition.