MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
TspDispersionUtils.f90
Go to the documentation of this file.
1!> @brief Dispersion coefficients shared by solute dispersion and
2!! heat conduction
3!<
5 use kindmodule, only: dp, i4b
8
9 implicit none
10 private
11 public :: calc_dispcoef
12
13contains
14
15 !> @brief Calculate the dispersion coefficient for each connection
16 !!
17 !! The coefficient combines the half-cell conductances of cells n
18 !! and m, each using the effective dispersion normal to the shared
19 !! face and the saturated flow area. Connections to inactive or
20 !! unsaturated cells get a coefficient of zero.
21 !<
22 subroutine calc_dispcoef(dis, ibdsat, sat, d11, d22, d33, &
23 angle1, angle2, angle3, dispcoef)
24 ! modules
25 use hgeoutilmodule, only: hyeff
27 ! dummy
28 class(disbasetype) :: dis !< discretization
29 integer(I4B), dimension(:), intent(in) :: ibdsat !< nonzero if cell has saturation
30 real(dp), dimension(:), intent(in) :: sat !< cell saturation
31 real(dp), dimension(:), intent(in) :: d11 !< dispersion coefficient
32 real(dp), dimension(:), intent(in) :: d22 !< dispersion coefficient
33 real(dp), dimension(:), intent(in) :: d33 !< dispersion coefficient
34 real(dp), dimension(:), intent(in) :: angle1 !< rotation angle 1
35 real(dp), dimension(:), intent(in) :: angle2 !< rotation angle 2
36 real(dp), dimension(:), intent(in) :: angle3 !< rotation angle 3
37 real(dp), dimension(:), intent(inout) :: dispcoef !< (size:njas) dispersion coefficient
38 ! local
39 integer(I4B) :: nodes, n, m, ipos
40 real(dp) :: clnm, clmn, dn, dm
41 real(dp) :: vg1, vg2, vg3
42 integer(I4B) :: ihc, isympos
43 integer(I4B) :: iavgmeth
44 real(dp) :: satn, satm
45 real(dp) :: cond, cn, cm, denom
46 real(dp) :: hwva, anm, amn
47
48 ! use arithmetic averaging for effective dispersion
49 iavgmeth = 1
50
51 nodes = size(d11)
52 do n = 1, nodes
53 if (ibdsat(n) == 0) cycle
54 do ipos = dis%con%ia(n) + 1, dis%con%ia(n + 1) - 1
55 m = dis%con%ja(ipos)
56 if (m < n) cycle
57 isympos = dis%con%jas(ipos)
58 dispcoef(isympos) = dzero
59 if (ibdsat(m) == 0) cycle
60
61 clnm = dis%con%cl1(isympos)
62 clmn = dis%con%cl2(isympos)
63 ihc = dis%con%ihc(isympos)
64 satn = sat(n)
65 satm = sat(m)
66
67 ! effective dispersion for n and m normal to the shared face
68 call dis%connection_normal(n, m, ihc, vg1, vg2, vg3, ipos)
69 dn = hyeff(d11(n), d22(n), d33(n), &
70 angle1(n), angle2(n), angle3(n), &
71 vg1, vg2, vg3, iavgmeth)
72 dm = hyeff(d11(m), d22(m), d33(m), &
73 angle1(m), angle2(m), angle3(m), &
74 vg1, vg2, vg3, iavgmeth)
75
76 hwva = dis%con%hwva(isympos)
77 anm = flow_area(ihc, hwva, dis%top(n), dis%bot(n), satn, &
78 dis%top(m), dis%bot(m))
79 amn = flow_area(ihc, hwva, dis%top(m), dis%bot(m), satm, &
80 dis%top(n), dis%bot(n))
81 if (ihc == 0) then
82 clnm = satn * (dis%top(n) - dis%bot(n)) * dhalf
83 clmn = satm * (dis%top(m) - dis%bot(m)) * dhalf
84
85 ! no vertical dispersion if either cell is dry, or if the
86 ! higher-numbered cell is partially saturated
87 if (satn == dzero) then
88 anm = dzero
89 else if (n > m .and. satn < done) then
90 anm = dzero
91 end if
92 if (satm == dzero) then
93 anm = dzero
94 else if (m > n .and. satm < done) then
95 anm = dzero
96 end if
97 amn = anm
98 else
99 ! no horizontal dispersion to or from a dry cell
100 if (satn == dzero .or. satm == dzero) then
101 anm = dzero
102 amn = dzero
103 end if
104 end if
105
106 ! combine the two half-cell conductances
107 cn = dzero
108 if (clnm > dzero) cn = dn * anm / clnm
109 cm = dzero
110 if (clmn > dzero) cm = dm * amn / clmn
111 denom = cn + cm
112 if (denom > dzero) then
113 cond = cn * cm / denom
114 else
115 cond = dzero
116 end if
117 dispcoef(isympos) = cond
118 end do
119 end do
120 end subroutine calc_dispcoef
121
This module contains simulation constants.
Definition Constants.f90:9
@ dis
DIS6 discretization.
real(dp), parameter dhalf
real constant 1/2
Definition Constants.f90:68
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
real(dp), parameter done
real constant 1
Definition Constants.f90:76
This module contains stateless conductance functions.
real(dp) function, public flow_area(ihc, hwva, top, bot, sat, topc, botc)
Calculate the saturated flow area of a cell for a connection.
General-purpose hydrogeologic functions.
Definition HGeoUtil.f90:2
real(dp) function, public hyeff(k11, k22, k33, ang1, ang2, ang3, vg1, vg2, vg3, iavgmeth)
Calculate the effective horizontal hydraulic conductivity from an ellipse using a specified direction...
Definition HGeoUtil.f90:31
This module defines variable data types.
Definition kind.f90:8
Dispersion coefficients shared by solute dispersion and heat conduction.
subroutine, public calc_dispcoef(dis, ibdsat, sat, d11, d22, d33, angle1, angle2, angle3, dispcoef)
Calculate the dispersion coefficient for each connection.