MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
rivmodule Module Reference

Data Types

type  rivtype
 

Functions/Subroutines

subroutine, public riv_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
 Create a New Riv Package and point packobj to the new package. More...
 
subroutine riv_da (this)
 Deallocate memory. More...
 
subroutine riv_options (this)
 Set options specific to RivType. More...
 
subroutine log_riv_options (this, found)
 Log options specific to RivType. More...
 
subroutine riv_allocate_arrays (this, nodelist, auxvar)
 Allocate package arrays. More...
 
subroutine riv_rp (this)
 Read and prepare. More...
 
subroutine riv_ck (this)
 Check river boundary condition data. More...
 
subroutine riv_cf (this)
 Formulate the HCOF and RHS terms. More...
 
subroutine riv_fc (this, rhs, ia, idxglo, matrix_sln)
 Copy rhs and hcof into solution rhs and amat. More...
 
subroutine define_listlabel (this)
 Define the list heading that is written to iout when PRINT_INPUT option is used. More...
 
logical function riv_obs_supported (this)
 Return true because RIV package supports observations. More...
 
subroutine riv_df_obs (this)
 Store observation type supported by RIV package. More...
 
subroutine riv_store_user_cond (this)
 Store user-specified conductance value. More...
 
real(dp) function cond_mult (this, row)
 Apply multiplier to conductance if auxmultcol option is in use. More...
 
real(dp) function riv_bound_value (this, col, row)
 Return requested boundary value. More...
 

Variables

character(len=lenftype) ftype = 'RIV'
 
character(len=lenpackagename) text = ' RIV'
 

Function/Subroutine Documentation

◆ cond_mult()

real(dp) function rivmodule::cond_mult ( class(rivtype), intent(inout)  this,
integer(i4b), intent(in)  row 
)
private

Definition at line 410 of file gwf-riv.f90.

411  ! -- modules
412  use constantsmodule, only: dzero
413  ! -- dummy
414  class(RivType), intent(inout) :: this
415  integer(I4B), intent(in) :: row
416  ! -- result
417  real(DP) :: cond
418  !
419  if (this%iauxmultcol > 0) then
420  cond = this%cond(row) * this%auxvar(this%iauxmultcol, row)
421  else
422  cond = this%cond(row)
423  end if
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65

◆ define_listlabel()

subroutine rivmodule::define_listlabel ( class(rivtype), intent(inout)  this)
private

Definition at line 336 of file gwf-riv.f90.

337  ! -- modules
338  class(RivType), intent(inout) :: this
339  !
340  ! -- create the header list label
341  this%listlabel = trim(this%filtyp)//' NO.'
342  if (this%dis%ndim == 3) then
343  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
344  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
345  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
346  elseif (this%dis%ndim == 2) then
347  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
348  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
349  else
350  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
351  end if
352  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'STAGE'
353  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'CONDUCTANCE'
354  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOTTOM EL.'
355  if (this%inamedbound == 1) then
356  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
357  end if

◆ log_riv_options()

subroutine rivmodule::log_riv_options ( class(rivtype), intent(inout)  this,
type(gwfrivparamfoundtype), intent(in)  found 
)

Definition at line 126 of file gwf-riv.f90.

127  ! -- modules
129  ! -- dummy variables
130  class(RivType), intent(inout) :: this
131  type(GwfRivParamFoundType), intent(in) :: found
132  !
133  ! -- log found options
134  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text)) &
135  //' OPTIONS'
136  !
137  if (found%mover) then
138  write (this%iout, '(4x,A)') 'MOVER OPTION ENABLED'
139  end if
140  !
141  ! -- close logging block
142  write (this%iout, '(1x,a)') &
143  'END OF '//trim(adjustl(this%text))//' OPTIONS'

◆ riv_allocate_arrays()

subroutine rivmodule::riv_allocate_arrays ( class(rivtype this,
integer(i4b), dimension(:), optional, pointer, contiguous  nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous  auxvar 
)

Definition at line 148 of file gwf-riv.f90.

149  ! -- modules
151  ! -- dummy
152  class(RivType) :: this
153  integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist
154  real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar
155  !
156  ! -- call base type allocate arrays
157  call this%BndExtType%allocate_arrays(nodelist, auxvar)
158  !
159  ! -- set riv input context pointers
160  call mem_setptr(this%stage, 'STAGE', this%input_mempath)
161  call mem_setptr(this%cond, 'COND', this%input_mempath)
162  call mem_setptr(this%rbot, 'RBOT', this%input_mempath)
163  !
164  ! --checkin riv input context pointers
165  call mem_checkin(this%stage, 'STAGE', this%memoryPath, &
166  'STAGE', this%input_mempath)
167  call mem_checkin(this%cond, 'COND', this%memoryPath, &
168  'COND', this%input_mempath)
169  call mem_checkin(this%rbot, 'RBOT', this%memoryPath, &
170  'RBOT', this%input_mempath)

◆ riv_bound_value()

real(dp) function rivmodule::riv_bound_value ( class(rivtype), intent(inout)  this,
integer(i4b), intent(in)  col,
integer(i4b), intent(in)  row 
)

Definition at line 428 of file gwf-riv.f90.

429  ! -- modules
430  use constantsmodule, only: dzero
431  ! -- dummy
432  class(RivType), intent(inout) :: this
433  integer(I4B), intent(in) :: col
434  integer(I4B), intent(in) :: row
435  ! -- result
436  real(DP) :: bndval
437  !
438  select case (col)
439  case (1)
440  bndval = this%stage(row)
441  case (2)
442  bndval = this%cond_mult(row)
443  case (3)
444  bndval = this%rbot(row)
445  case default
446  errmsg = 'Programming error. RIV bound value requested column '&
447  &'outside range of ncolbnd (3).'
448  call store_error(errmsg)
449  call store_error_filename(this%input_fname)
450  end select
Here is the call graph for this function:

◆ riv_cf()

subroutine rivmodule::riv_cf ( class(rivtype this)

Skip in no rivs, otherwise calculate hcof and rhs

Definition at line 266 of file gwf-riv.f90.

267  ! -- dummy
268  class(RivType) :: this
269  ! -- local
270  integer(I4B) :: i, node
271  real(DP) :: hriv, criv, rbot
272  !
273  ! -- Return if no rivs
274  if (this%nbound .eq. 0) return
275  !
276  ! -- Calculate hcof and rhs for each riv entry
277  do i = 1, this%nbound
278  node = this%nodelist(i)
279  if (this%ibound(node) <= 0) then
280  this%hcof(i) = dzero
281  this%rhs(i) = dzero
282  cycle
283  end if
284  hriv = this%stage(i)
285  criv = this%cond_mult(i)
286  rbot = this%rbot(i)
287  if (this%xnew(node) <= rbot) then
288  this%rhs(i) = -criv * (hriv - rbot)
289  this%hcof(i) = dzero
290  else
291  this%rhs(i) = -criv * hriv
292  this%hcof(i) = -criv
293  end if
294  end do

◆ riv_ck()

subroutine rivmodule::riv_ck ( class(rivtype), intent(inout)  this)

Definition at line 194 of file gwf-riv.f90.

195  ! -- modules
196  use constantsmodule, only: linelength
198  ! -- dummy
199  class(RivType), intent(inout) :: this
200  ! -- local
201  character(len=LINELENGTH) :: errmsg
202  integer(I4B) :: i
203  integer(I4B) :: node
204  real(DP) :: bt
205  real(DP) :: stage
206  real(DP) :: rbot
207  ! -- formats
208  character(len=*), parameter :: fmtriverr = &
209  "('RIV BOUNDARY (',i0,') RIVER BOTTOM (',f10.4,') IS LESS &
210  &THAN CELL BOTTOM (',f10.4,')')"
211  character(len=*), parameter :: fmtriverr2 = &
212  "('RIV BOUNDARY (',i0,') RIVER STAGE (',f10.4,') IS LESS &
213  &THAN RIVER BOTTOM (',f10.4,')')"
214  character(len=*), parameter :: fmtriverr3 = &
215  "('RIV BOUNDARY (',i0,') RIVER STAGE (',f10.4,') IS LESS &
216  &THAN CELL BOTTOM (',f10.4,')')"
217  character(len=*), parameter :: fmtcondmulterr = &
218  "('RIV BOUNDARY (',i0,') CONDUCTANCE MULTIPLIER (',g10.3,') IS &
219  &LESS THAN ZERO')"
220  character(len=*), parameter :: fmtconderr = &
221  "('RIV BOUNDARY (',i0,') CONDUCTANCE (',g10.3,') IS LESS THAN &
222  &ZERO')"
223  !
224  ! -- check stress period data
225  do i = 1, this%nbound
226  node = this%nodelist(i)
227  bt = this%dis%bot(node)
228  stage = this%stage(i)
229  rbot = this%rbot(i)
230  ! -- accumulate errors
231  if (rbot < bt .and. this%icelltype(node) /= 0) then
232  write (errmsg, fmt=fmtriverr) i, rbot, bt
233  call store_error(errmsg)
234  end if
235  if (stage < rbot) then
236  write (errmsg, fmt=fmtriverr2) i, stage, rbot
237  call store_error(errmsg)
238  end if
239  if (stage < bt .and. this%icelltype(node) /= 0) then
240  write (errmsg, fmt=fmtriverr3) i, stage, bt
241  call store_error(errmsg)
242  end if
243  if (this%iauxmultcol > 0) then
244  if (this%auxvar(this%iauxmultcol, i) < dzero) then
245  write (errmsg, fmt=fmtcondmulterr) &
246  i, this%auxvar(this%iauxmultcol, i)
247  call store_error(errmsg)
248  end if
249  end if
250  if (this%cond(i) < dzero) then
251  write (errmsg, fmt=fmtconderr) i, this%cond(i)
252  call store_error(errmsg)
253  end if
254  end do
255  !
256  ! -- write summary of river package error messages
257  if (count_errors() > 0) then
258  call store_error_unit(this%inunit)
259  end if
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
Definition: Sim.f90:168
Here is the call graph for this function:

◆ riv_create()

subroutine, public rivmodule::riv_create ( class(bndtype), pointer  packobj,
integer(i4b), intent(in)  id,
integer(i4b), intent(in)  ibcnum,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
character(len=*), intent(in)  namemodel,
character(len=*), intent(in)  pakname,
character(len=*), intent(in)  mempath 
)

Definition at line 49 of file gwf-riv.f90.

51  ! -- dummy
52  class(BndType), pointer :: packobj
53  integer(I4B), intent(in) :: id
54  integer(I4B), intent(in) :: ibcnum
55  integer(I4B), intent(in) :: inunit
56  integer(I4B), intent(in) :: iout
57  character(len=*), intent(in) :: namemodel
58  character(len=*), intent(in) :: pakname
59  character(len=*), intent(in) :: mempath
60  ! -- local
61  type(RivType), pointer :: rivobj
62  !
63  ! -- allocate the object and assign values to object variables
64  allocate (rivobj)
65  packobj => rivobj
66  !
67  ! -- create name and memory path
68  call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
69  packobj%text = text
70  !
71  ! -- allocate scalars
72  call rivobj%allocate_scalars()
73  !
74  ! -- initialize package
75  call packobj%pack_initialize()
76  !
77  packobj%inunit = inunit
78  packobj%iout = iout
79  packobj%id = id
80  packobj%ibcnum = ibcnum
81  packobj%ncolbnd = 3
82  packobj%ictMemPath = create_mem_path(namemodel, 'NPF')
Here is the call graph for this function:
Here is the caller graph for this function:

◆ riv_da()

subroutine rivmodule::riv_da ( class(rivtype this)
private

Definition at line 87 of file gwf-riv.f90.

88  ! -- modules
90  ! -- dummy
91  class(RivType) :: this
92  !
93  ! -- Deallocate parent package
94  call this%BndExtType%bnd_da()
95  !
96  ! -- arrays
97  call mem_deallocate(this%stage, 'STAGE', this%memoryPath)
98  call mem_deallocate(this%cond, 'COND', this%memoryPath)
99  call mem_deallocate(this%rbot, 'RBOT', this%memoryPath)

◆ riv_df_obs()

subroutine rivmodule::riv_df_obs ( class(rivtype this)
private

Overrides BndTypebnd_df_obs

Definition at line 378 of file gwf-riv.f90.

379  implicit none
380  ! -- dummy
381  class(RivType) :: this
382  ! -- local
383  integer(I4B) :: indx
384  !
385  call this%obs%StoreObsType('riv', .true., indx)
386  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
387  !
388  ! -- Store obs type and assign procedure pointer
389  ! for to-mvr observation type.
390  call this%obs%StoreObsType('to-mvr', .true., indx)
391  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
Here is the call graph for this function:

◆ riv_fc()

subroutine rivmodule::riv_fc ( class(rivtype this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)
private

Definition at line 299 of file gwf-riv.f90.

300  ! -- dummy
301  class(RivType) :: this
302  real(DP), dimension(:), intent(inout) :: rhs
303  integer(I4B), dimension(:), intent(in) :: ia
304  integer(I4B), dimension(:), intent(in) :: idxglo
305  class(MatrixBaseType), pointer :: matrix_sln
306  ! -- local
307  integer(I4B) :: i, n, ipos
308  real(DP) :: cond, stage, qriv !, rbot
309  !
310  ! -- pakmvrobj fc
311  if (this%imover == 1) then
312  call this%pakmvrobj%fc()
313  end if
314  !
315  ! -- Copy package rhs and hcof into solution rhs and amat
316  do i = 1, this%nbound
317  n = this%nodelist(i)
318  rhs(n) = rhs(n) + this%rhs(i)
319  ipos = ia(n)
320  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
321  !
322  ! -- If mover is active and this river cell is discharging,
323  ! store available water (as positive value).
324  stage = this%stage(i)
325  if (this%imover == 1 .and. this%xnew(n) > stage) then
326  cond = this%cond_mult(i)
327  qriv = cond * (this%xnew(n) - stage)
328  call this%pakmvrobj%accumulate_qformvr(i, qriv)
329  end if
330  end do

◆ riv_obs_supported()

logical function rivmodule::riv_obs_supported ( class(rivtype this)
private

Return true because RIV package supports observations.

Definition at line 366 of file gwf-riv.f90.

367  implicit none
368  ! -- dummy
369  class(RivType) :: this
370  !
371  riv_obs_supported = .true.

◆ riv_options()

subroutine rivmodule::riv_options ( class(rivtype), intent(inout)  this)

Definition at line 104 of file gwf-riv.f90.

105  ! -- modules
109  ! -- dummy
110  class(RivType), intent(inout) :: this
111  ! -- local
112  type(GwfRivParamFoundType) :: found
113  !
114  ! -- source base class options
115  call this%BndExtType%source_options()
116  !
117  ! -- source options from input context
118  call mem_set_value(this%imover, 'MOVER', this%input_mempath, found%mover)
119  !
120  ! -- log riv specific options
121  call this%log_riv_options(found)
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23

◆ riv_rp()

subroutine rivmodule::riv_rp ( class(rivtype), intent(inout)  this)

Definition at line 175 of file gwf-riv.f90.

176  ! -- modules
177  use tdismodule, only: kper
178  ! -- dummy
179  class(RivType), intent(inout) :: this
180  !
181  if (this%iper /= kper) return
182  !
183  ! -- Call the parent class read and prepare
184  call this%BndExtType%bnd_rp()
185  !
186  ! -- store user cond
187  if (this%ivsc == 1) then
188  call this%riv_store_user_cond()
189  end if
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23

◆ riv_store_user_cond()

subroutine rivmodule::riv_store_user_cond ( class(rivtype), intent(inout)  this)
private

Definition at line 396 of file gwf-riv.f90.

397  ! -- dummy
398  class(RivType), intent(inout) :: this
399  ! -- local
400  integer(I4B) :: n
401  !
402  ! -- store backup copy of conductance values
403  do n = 1, this%nbound
404  this%condinput(n) = this%cond_mult(n)
405  end do

Variable Documentation

◆ ftype

character(len=lenftype) rivmodule::ftype = 'RIV'
private

Definition at line 18 of file gwf-riv.f90.

18  character(len=LENFTYPE) :: ftype = 'RIV'

◆ text

character(len=lenpackagename) rivmodule::text = ' RIV'
private

Definition at line 19 of file gwf-riv.f90.

19  character(len=LENPACKAGENAME) :: text = ' RIV'