MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
CentralDifferenceScheme.f90
Go to the documentation of this file.
2  use kindmodule, only: dp, i4b
3  use constantsmodule, only: dhalf, done
6  use basedismodule, only: disbasetype
7  use tspfmimodule, only: tspfmitype
8 
9  implicit none
10  private
11 
13 
15  private
16  class(disbasetype), pointer :: dis
17  type(tspfmitype), pointer :: fmi
18  contains
19  procedure :: compute
21 
23  module procedure constructor
24  end interface centraldifferenceschemetype
25 
26 contains
27  function constructor(dis, fmi) result(interpolation_scheme)
28  ! -- return
29  type(centraldifferenceschemetype) :: interpolation_scheme
30  ! --dummy
31  class(disbasetype), pointer, intent(in) :: dis
32  type(tspfmitype), pointer, intent(in) :: fmi
33 
34  interpolation_scheme%dis => dis
35  interpolation_scheme%fmi => fmi
36 
37  end function constructor
38 
39  function compute(this, n, m, iposnm, phi) result(phi_face)
40  !-- return
41  type(coefficientstype) :: phi_face
42  ! -- dummy
43  class(centraldifferenceschemetype), target :: this
44  integer(I4B), intent(in) :: n
45  integer(I4B), intent(in) :: m
46  integer(I4B), intent(in) :: iposnm
47  real(dp), intent(in), dimension(:) :: phi
48  ! -- local
49  real(dp) :: lnm, lmn, omega
50 
51  ! -- calculate weight based on distances between nodes and the shared
52  ! face of the connection
53  if (this%dis%con%ihc(this%dis%con%jas(iposnm)) == 0) then
54  ! -- vertical connection; assume cell is fully saturated
55  lnm = dhalf * (this%dis%top(n) - this%dis%bot(n))
56  lmn = dhalf * (this%dis%top(m) - this%dis%bot(m))
57  else
58  ! -- horizontal connection
59  lnm = this%dis%con%cl1(this%dis%con%jas(iposnm))
60  lmn = this%dis%con%cl2(this%dis%con%jas(iposnm))
61  end if
62 
63  omega = lmn / (lnm + lmn)
64 
65  phi_face%c_n = omega
66  phi_face%c_m = done - omega
67 
68  end function compute
type(coefficientstype) function compute(this, n, m, iposnm, phi)
type(centraldifferenceschemetype) function constructor(dis, fmi)
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dhalf
real constant 1/2
Definition: Constants.f90:68
real(dp), parameter done
real constant 1
Definition: Constants.f90:76
This module defines variable data types.
Definition: kind.f90:8