MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
NumericalExchange.f90
Go to the documentation of this file.
2 
3  use kindmodule, only: dp, i4b
7  use listmodule, only: listtype
9 
10  implicit none
11 
12  private
13  public :: numericalexchangetype, &
15 
17  contains
18 
19  procedure :: exg_df
20  procedure :: exg_ac
21  procedure :: exg_mc
22  procedure :: exg_ar
23  !procedure :: exg_rp (not needed yet; base exg_rp does nothing)
24  procedure :: exg_cf
25  procedure :: exg_fc
26  procedure :: exg_cc
27  procedure :: exg_cq
28  procedure :: exg_bd
29  procedure :: exg_ot
30  procedure :: exg_da
31  procedure :: get_iasym
32  end type numericalexchangetype
33 
34 contains
35 
36  !> @brief Define the exchange
37  subroutine exg_df(this)
38  class(numericalexchangetype) :: this
39  end subroutine exg_df
40 
41  !> @brief If an implicit exchange then add connections to sparse
42  subroutine exg_ac(this, sparse)
43  use sparsemodule, only: sparsematrix
44  class(numericalexchangetype) :: this
45  type(sparsematrix), intent(inout) :: sparse
46  end subroutine exg_ac
47 
48  !> @brief Map the connections in the global matrix
49  subroutine exg_mc(this, matrix_sln)
50  class(numericalexchangetype) :: this
51  class(matrixbasetype), pointer :: matrix_sln
52  end subroutine exg_mc
53 
54  !> @brief Allocate and read
55  subroutine exg_ar(this)
56  class(numericalexchangetype) :: this
57  end subroutine exg_ar
58 
59  !> @brief Calculate conductance, and for explicit exchanges, set the
60  !! conductance in the boundary package
61  subroutine exg_cf(this, kiter)
62  class(numericalexchangetype) :: this
63  integer(I4B), intent(in) :: kiter
64  end subroutine exg_cf
65 
66  !> @brief Fill the matrix
67  subroutine exg_fc(this, kiter, matrix_sln, rhs_sln, inwtflag)
68  class(numericalexchangetype) :: this
69  integer(I4B), intent(in) :: kiter
70  class(matrixbasetype), pointer :: matrix_sln
71  real(DP), dimension(:), intent(inout) :: rhs_sln
72  integer(I4B), optional, intent(in) :: inwtflag
73  end subroutine exg_fc
74 
75  !> @brief Additional convergence check
76  subroutine exg_cc(this, icnvg)
77  class(numericalexchangetype) :: this
78  integer(I4B), intent(inout) :: icnvg
79  end subroutine exg_cc
80 
81  !> @brief Calculate flow
82  subroutine exg_cq(this, icnvg, isuppress_output, isolnid)
83  class(numericalexchangetype) :: this
84  integer(I4B), intent(inout) :: icnvg
85  integer(I4B), intent(in) :: isuppress_output
86  integer(I4B), intent(in) :: isolnid
87  end subroutine exg_cq
88 
89  !> @brief Exchange budget
90  subroutine exg_bd(this, icnvg, isuppress_output, isolnid)
91  class(numericalexchangetype) :: this
92  integer(I4B), intent(inout) :: icnvg
93  integer(I4B), intent(in) :: isuppress_output
94  integer(I4B), intent(in) :: isolnid
95  end subroutine exg_bd
96 
97  !> @brief Output
98  subroutine exg_ot(this)
99  class(numericalexchangetype) :: this
100  end subroutine exg_ot
101 
102  !> @brief Deallocate memory
103  subroutine exg_da(this)
104  class(numericalexchangetype) :: this
105  end subroutine exg_da
106 
107  function get_iasym(this) result(iasym)
108  class(numericalexchangetype) :: this
109  integer(I4B) :: iasym
110  iasym = 0
111  end function get_iasym
112 
113  function castasnumericalexchangeclass(obj) result(res)
114  implicit none
115  class(*), pointer, intent(inout) :: obj
116  class(numericalexchangetype), pointer :: res
117 
118  res => null()
119  if (.not. associated(obj)) return
120 
121  select type (obj)
122  class is (numericalexchangetype)
123  res => obj
124  end select
125  end function castasnumericalexchangeclass
126 
127  !> @brief Add numerical exchange to a list
128  subroutine addnumericalexchangetolist(list, exchange)
129  implicit none
130  type(listtype), intent(inout) :: list
131  class(numericalexchangetype), pointer, intent(in) :: exchange
132  class(*), pointer :: obj
133 
134  obj => exchange
135  call list%Add(obj)
136  end subroutine addnumericalexchangetolist
137 
138  !> @brief Retrieve a specific numerical exchange from a list
139  function getnumericalexchangefromlist(list, idx) result(res)
140  implicit none
141  type(listtype), intent(inout) :: list
142  integer(I4B), intent(in) :: idx
143  class(numericalexchangetype), pointer :: res
144  class(*), pointer :: obj
145 
146  obj => list%GetItem(idx)
147  res => castasnumericalexchangeclass(obj)
148  end function getnumericalexchangefromlist
149 
150 end module numericalexchangemodule
subroutine, public addbaseexchangetolist(list, exchange)
Add the exchange object (BaseExchangeType) to a list.
This module defines variable data types.
Definition: kind.f90:8
class(numericalexchangetype) function, pointer, public getnumericalexchangefromlist(list, idx)
Retrieve a specific numerical exchange from a list.
subroutine exg_ot(this)
Output.
subroutine exg_mc(this, matrix_sln)
Map the connections in the global matrix.
subroutine, public addnumericalexchangetolist(list, exchange)
Add numerical exchange to a list.
class(numericalexchangetype) function, pointer castasnumericalexchangeclass(obj)
subroutine exg_bd(this, icnvg, isuppress_output, isolnid)
Exchange budget.
subroutine exg_cf(this, kiter)
Calculate conductance, and for explicit exchanges, set the conductance in the boundary package.
subroutine exg_cc(this, icnvg)
Additional convergence check.
subroutine exg_cq(this, icnvg, isuppress_output, isolnid)
Calculate flow.
subroutine exg_da(this)
Deallocate memory.
subroutine exg_ac(this, sparse)
If an implicit exchange then add connections to sparse.
integer(i4b) function get_iasym(this)
subroutine exg_fc(this, kiter, matrix_sln, rhs_sln, inwtflag)
Fill the matrix.
Highest level model type. All models extend this parent type.
Definition: BaseModel.f90:16
A generic heterogeneous doubly-linked list.
Definition: List.f90:14