MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
MethodModel.f90
Go to the documentation of this file.
2  use kindmodule, only: dp, i4b
3  use constantsmodule, only: dzero, done
10  use mathutilmodule, only: is_close
11  use errorutilmodule, only: pstop
12 
13  private
14  public :: methodmodeltype
15 
16  type, abstract, extends(methodtype) :: methodmodeltype
17  contains
18  procedure, public :: assess
19  procedure, public :: get_level
20  ! cell load utilities
21  procedure :: cap_cell_wt_flow
24  end type methodmodeltype
25 
26 contains
27 
28  !> @brief Check particle reporting/termination status
29  subroutine assess(this, particle, cell_defn, tmax)
30  ! dummy
31  class(methodmodeltype), intent(inout) :: this
32  type(particletype), pointer, intent(inout) :: particle
33  type(celldefntype), pointer, intent(inout) :: cell_defn
34  real(DP), intent(in) :: tmax
35  ! noop
36  end subroutine assess
37 
38  !> @brief Get the model method's level.
39  function get_level(this) result(level)
40  class(methodmodeltype), intent(in) :: this
41  integer(I4B) :: level
42  level = level_model
43  end function get_level
44 
45  !> @brief Prevent non-boundary upwards flow at the water table.
46  !!
47  !! Unless the top face is an assigned boundary with outflow,
48  !! cells which contain a water table should not have upward
49  !! flow through the top (i.e., the water table). Prevent it
50  !! by capping the top face flow at zero in these conditions.
51  !!
52  !! Assumes cell properties and flows are already loaded.
53  !<
54  subroutine cap_cell_wt_flow(this, defn)
55  class(methodmodeltype), intent(inout) :: this
56  type(celldefntype), pointer, intent(inout) :: defn
57  ! local
58  integer(I4B) :: itopface
59 
60  ! If the cell contains a water table that is not an
61  ! assigned boundary face with upflow, cap flow at 0.
62  itopface = this%fmi%max_faces ! fmi's lateral face indices are not closed
63  if (this%fmi%is_boundary_face(defn%icell, itopface)) return
64  if (defn%isatstat == saturation_watertable) then
65  itopface = defn%npolyverts + 3 ! cell defn's lateral face indices are closed
66  defn%faceflow(itopface) = max(dzero, defn%faceflow(itopface))
67  end if
68 
69  end subroutine cap_cell_wt_flow
70 
71  !> @brief Set flag indicating if the cell has any faces with outflow.
72  !! Assumes cell properties and flows are already loaded.
73  subroutine load_cell_no_exit_face(this, defn)
74  ! dummy
75  class(methodmodeltype), intent(inout) :: this
76  type(celldefntype), pointer, intent(inout) :: defn
77  ! local
78  integer(I4B) :: m, nfaces
79 
80  defn%inoexitface = 1
81  nfaces = defn%npolyverts + 3
82  do m = 1, nfaces
83  if (defn%faceflow(m) < dzero) defn%inoexitface = 0
84  end do
85 
86  end subroutine load_cell_no_exit_face
87 
88  !> @brief Set the saturation status of a cell.
89  !! See the status enumeration in CellDefnModule.
90  subroutine load_cell_saturation_status(this, defn)
91  ! dummy
92  class(methodmodeltype), intent(inout) :: this
93  type(celldefntype), pointer, intent(inout) :: defn
94  ! local
95  integer(I4B) :: ic, ictopnbr, itopface, idiag, ipos
96 
97  ic = defn%icell
98  defn%isatstat = saturation_saturated
99 
100  ! dry?
101  if (this%fmi%ibdgwfsat0(ic) == 0) then
102  defn%isatstat = saturation_dry
103  return
104  end if
105 
106  ! partially saturated?
107  if (this%fmi%gwfsat(ic) < done) then
108  defn%isatstat = saturation_watertable
109  return
110  end if
111 
112  ! no top neighbor?
113  itopface = defn%npolyverts + 3 ! cell defn's lateral face indices are closed
114  if (defn%facenbr(itopface) == 0) then
115  defn%isatstat = saturation_saturated
116  return
117  end if
118 
119  ! dry top neighbor?
120  idiag = this%fmi%dis%con%ia(ic)
121  ipos = idiag + defn%facenbr(itopface)
122  ictopnbr = this%fmi%dis%con%ja(ipos)
123  if (this%fmi%ibdgwfsat0(ictopnbr) == 0) then
124  defn%isatstat = saturation_watertable
125  return
126  end if
127 
128  end subroutine load_cell_saturation_status
129 
130 end module methodmodelmodule
@, public saturation_saturated
Definition: CellDefn.f90:21
@, public saturation_dry
Definition: CellDefn.f90:19
@, public saturation_watertable
Definition: CellDefn.f90:20
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
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
Definition: ErrorUtil.f90:24
This module defines variable data types.
Definition: kind.f90:8
pure logical function, public is_close(a, b, rtol, atol, symmetric)
Check if a real value is approximately equal to another.
Definition: MathUtil.f90:46
subroutine cap_cell_wt_flow(this, defn)
Prevent non-boundary upwards flow at the water table.
Definition: MethodModel.f90:55
subroutine load_cell_saturation_status(this, defn)
Set the saturation status of a cell. See the status enumeration in CellDefnModule.
Definition: MethodModel.f90:91
subroutine load_cell_no_exit_face(this, defn)
Set flag indicating if the cell has any faces with outflow. Assumes cell properties and flows are alr...
Definition: MethodModel.f90:74
integer(i4b) function get_level(this)
Get the model method's level.
Definition: MethodModel.f90:40
Particle tracking strategies.
Definition: Method.f90:2
@, public level_model
Definition: Method.f90:40
Base grid cell definition.
Definition: CellDefn.f90:25
Base type for particle tracking methods.
Definition: Method.f90:58
Base type for particle events.
Particle tracked by the PRT model.
Definition: Particle.f90:56