MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
HGeoUtil.f90
Go to the documentation of this file.
1 !> @brief General-purpose hydrogeologic functions.
3  use kindmodule, only: dp, i4b
4  use constantsmodule, only: dzero, done
5 
6  implicit none
7  private
8  public :: hyeff
9 
10 contains
11 
12  !> @brief Calculate the effective horizontal hydraulic conductivity from an
13  !! ellipse using a specified direction (unit vector vg1, vg2, vg3)
14  !!
15  !! k11 is the hydraulic conductivity of the major ellipse axis
16  !! k22 is the hydraulic conductivity of first minor axis
17  !! k33 is the hydraulic conductivity of the second minor axis
18  !! ang1 is the counter-clockwise rotation (radians) of the ellipse in
19  !! the (x, y) plane
20  !! ang2 is the rotation of the conductivity ellipsoid upward or
21  !! downward from the (x, y) plane
22  !! ang3 is the rotation of the conductivity ellipsoid about the major
23  !! axis
24  !! vg1, vg2, and vg3 are the components of a unit vector in model coordinates
25  !! in the direction of the connection between cell n and m
26  !!iavgmeth is the averaging method. If zero, then use harmonic averaging.
27  !! if one, then use arithmetic averaging.
28  !<
29  function hyeff(k11, k22, k33, ang1, ang2, ang3, vg1, vg2, vg3, &
30  iavgmeth) result(K)
31  ! -- return
32  real(dp) :: k
33  ! -- dummy
34  real(dp), intent(in) :: k11
35  real(dp), intent(in) :: k22
36  real(dp), intent(in) :: k33
37  real(dp), intent(in) :: ang1
38  real(dp), intent(in) :: ang2
39  real(dp), intent(in) :: ang3
40  real(dp), intent(in) :: vg1
41  real(dp), intent(in) :: vg2
42  real(dp), intent(in) :: vg3
43  integer(I4B), intent(in) :: iavgmeth
44  ! -- local
45  real(dp) :: s1, s2, s3, c1, c2, c3
46  real(dp), dimension(3, 3) :: r
47  real(dp) :: ve1, ve2, ve3
48  real(dp) :: denom, dnum, d1, d2, d3
49  !
50  ! -- Sin and cos of angles
51  s1 = sin(ang1)
52  c1 = cos(ang1)
53  s2 = sin(ang2)
54  c2 = cos(ang2)
55  s3 = sin(ang3)
56  c3 = cos(ang3)
57  !
58  ! -- Rotation matrix
59  r(1, 1) = c1 * c2
60  r(1, 2) = c1 * s2 * s3 - s1 * c3
61  r(1, 3) = -c1 * s2 * c3 - s1 * s3
62  r(2, 1) = s1 * c2
63  r(2, 2) = s1 * s2 * s3 + c1 * c3
64  r(2, 3) = -s1 * s2 * c3 + c1 * s3
65  r(3, 1) = s2
66  r(3, 2) = -c2 * s3
67  r(3, 3) = c2 * c3
68  !
69  ! -- Unit vector in direction of n-m connection in a local coordinate
70  ! system aligned with the ellipse axes
71  ve1 = r(1, 1) * vg1 + r(2, 1) * vg2 + r(3, 1) * vg3
72  ve2 = r(1, 2) * vg1 + r(2, 2) * vg2 + r(3, 2) * vg3
73  ve3 = r(1, 3) * vg1 + r(2, 3) * vg2 + r(3, 3) * vg3
74  !
75  ! -- Effective hydraulic conductivity calculated using harmonic (1)
76  ! or arithmetic (2) weighting
77  k = dzero
78  if (iavgmeth == 0) then
79  !
80  ! -- Arithmetic weighting. If principal direction corresponds exactly with
81  ! unit vector then set to principal direction. Otherwise weight it.
82  dnum = done
83  d1 = ve1**2
84  d2 = ve2**2
85  d3 = ve3**2
86  if (ve1 /= dzero) then
87  dnum = dnum * k11
88  d2 = d2 * k11
89  d3 = d3 * k11
90  end if
91  if (ve2 /= dzero) then
92  dnum = dnum * k22
93  d1 = d1 * k22
94  d3 = d3 * k22
95  end if
96  if (ve3 /= dzero) then
97  dnum = dnum * k33
98  d1 = d1 * k33
99  d2 = d2 * k33
100  end if
101  denom = d1 + d2 + d3
102  if (denom > dzero) k = dnum / denom
103  else if (iavgmeth == 1) then
104  ! -- arithmetic
105  k = ve1**2 * k11 + ve2**2 * k22 + ve3**2 * k33
106  end if
107 
108  end function hyeff
109 
110 end module hgeoutilmodule
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
real(dp), parameter done
real constant 1
Definition: Constants.f90:76
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