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

This module contains the FLW package methods. More...

Data Types

type  swfflwtype
 

Functions/Subroutines

subroutine, public flw_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
 @ brief Create a new package object More...
 
subroutine flw_allocate_scalars (this)
 @ brief Allocate scalars More...
 
subroutine flw_allocate_arrays (this, nodelist, auxvar)
 @ brief Allocate arrays More...
 
subroutine flw_da (this)
 @ brief Deallocate package memory More...
 
subroutine flw_options (this)
 @ brief Source additional options for package More...
 
subroutine log_flw_options (this)
 @ brief Log SWF specific package options More...
 
subroutine flw_cf (this)
 @ brief Formulate the package hcof and rhs terms. More...
 
subroutine flw_fc (this, rhs, ia, idxglo, matrix_sln)
 @ brief Copy hcof and rhs terms into solution. More...
 
subroutine define_listlabel (this)
 @ brief Define the list label for the package More...
 
logical function flw_obs_supported (this)
 Determine if observations are supported. More...
 
subroutine flw_df_obs (this)
 Define the observation types available in the package. More...
 
subroutine flw_bd_obs (this)
 Save observations for the package. More...
 
subroutine flw_rp_ts (this)
 Assign time series links for the package. More...
 
real(dp) function q_mult (this, row)
 
real(dp) function flw_bound_value (this, col, row)
 @ brief Return a bound value More...
 

Variables

character(len=lenftype) ftype = 'FLW'
 package ftype More...
 
character(len=16) text = ' FLW'
 package flow text string More...
 

Detailed Description

This module can be used to represent inflow to streams. It is designed similarly to the GWF WEL package.

Function/Subroutine Documentation

◆ define_listlabel()

subroutine swfflwmodule::define_listlabel ( class(swfflwtype), intent(inout)  this)
private

Method defined the list label for the FLW package. The list label is the heading that is written to iout when PRINT_INPUT option is used.

Parameters
[in,out]thisSwfFlwType object

Definition at line 272 of file swf-flw.f90.

273  ! -- dummy variables
274  class(SwfFlwType), intent(inout) :: this !< SwfFlwType object
275  !
276  ! -- create the header list label
277  this%listlabel = trim(this%filtyp)//' NO.'
278  if (this%dis%ndim == 3) then
279  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
280  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
281  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
282  elseif (this%dis%ndim == 2) then
283  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
284  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
285  else
286  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
287  end if
288  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'FLOW RATE'
289  if (this%inamedbound == 1) then
290  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
291  end if

◆ flw_allocate_arrays()

subroutine swfflwmodule::flw_allocate_arrays ( class(swfflwtype this,
integer(i4b), dimension(:), optional, pointer, contiguous  nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous  auxvar 
)

Allocate and initialize arrays for the SWF package

Definition at line 121 of file swf-flw.f90.

122  ! -- modules
124  ! -- dummy
125  class(SwfFlwType) :: this
126  integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist
127  real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar
128  ! -- local
129  !
130  ! -- call BndExtType allocate scalars
131  call this%BndExtType%allocate_arrays(nodelist, auxvar)
132  !
133  ! -- set q array input context pointer
134  call mem_setptr(this%q, 'Q', this%input_mempath)
135  !
136  ! -- checkin q array input context pointer
137  call mem_checkin(this%q, 'Q', this%memoryPath, &
138  'Q', this%input_mempath)

◆ flw_allocate_scalars()

subroutine swfflwmodule::flw_allocate_scalars ( class(swfflwtype this)
private

Allocate and initialize scalars for the FLW package. The base model allocate scalars method is also called.

Parameters
thisSwfFlwType object

Definition at line 100 of file swf-flw.f90.

101  ! -- modules
103  ! -- dummy variables
104  class(SwfFlwType) :: this !< SwfFlwType object
105  !
106  ! -- call base type allocate scalars
107  call this%BndExtType%allocate_scalars()
108  !
109  ! -- allocate the object and assign values to object variables
110  ! none for this package
111  !
112  ! -- Set values
113  ! none for this package

◆ flw_bd_obs()

subroutine swfflwmodule::flw_bd_obs ( class(swfflwtype this)
private

Method to save simulated values for the FLW package.

Parameters
thisSwfFlwType object

Definition at line 338 of file swf-flw.f90.

339  ! -- dummy variables
340  class(SwfFlwType) :: this !< SwfFlwType object
341  ! -- local variables
342  integer(I4B) :: i
343  integer(I4B) :: n
344  integer(I4B) :: jj
345  real(DP) :: v
346  type(ObserveType), pointer :: obsrv => null()
347  !
348  ! -- clear the observations
349  call this%obs%obs_bd_clear()
350  !
351  ! -- Save simulated values for all of package's observations.
352  do i = 1, this%obs%npakobs
353  obsrv => this%obs%pakobs(i)%obsrv
354  if (obsrv%BndFound) then
355  do n = 1, obsrv%indxbnds_count
356  v = dnodata
357  jj = obsrv%indxbnds(n)
358  select case (obsrv%ObsTypeId)
359  case ('TO-MVR')
360  if (this%imover == 1) then
361  v = this%pakmvrobj%get_qtomvr(jj)
362  if (v > dzero) then
363  v = -v
364  end if
365  end if
366  case ('FLW')
367  v = this%simvals(jj)
368  case default
369  errmsg = 'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
370  call store_error(errmsg)
371  end select
372  call this%obs%SaveOneSimval(obsrv, v)
373  end do
374  else
375  call this%obs%SaveOneSimval(obsrv, dnodata)
376  end if
377  end do
Here is the call graph for this function:

◆ flw_bound_value()

real(dp) function swfflwmodule::flw_bound_value ( class(swfflwtype), intent(inout)  this,
integer(i4b), intent(in)  col,
integer(i4b), intent(in)  row 
)

Return a bound value associated with an ncolbnd index and row.

Definition at line 429 of file swf-flw.f90.

430  ! -- modules
431  use constantsmodule, only: dzero
432  ! -- dummy variables
433  class(SwfFlwType), intent(inout) :: this
434  integer(I4B), intent(in) :: col
435  integer(I4B), intent(in) :: row
436  ! -- result
437  real(DP) :: bndval
438  !
439  select case (col)
440  case (1)
441  bndval = this%q_mult(row)
442  case default
443  errmsg = 'Programming error. FLW bound value requested column '&
444  &'outside range of ncolbnd (1).'
445  call store_error(errmsg)
446  call store_error_filename(this%input_fname)
447  end select
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
Here is the call graph for this function:

◆ flw_cf()

subroutine swfflwmodule::flw_cf ( class(swfflwtype this)
private

Formulate the hcof and rhs terms for the FLW package that will be added to the coefficient matrix and right-hand side vector.

Parameters
thisSwfFlwType object

Definition at line 205 of file swf-flw.f90.

206  ! -- dummy variables
207  class(SwfFlwType) :: this !< SwfFlwType object
208  ! -- local variables
209  integer(I4B) :: i, node
210  real(DP) :: q
211  !
212  ! -- Return if no inflows
213  if (this%nbound == 0) return
214  !
215  ! -- Calculate hcof and rhs for each flw entry
216  do i = 1, this%nbound
217  node = this%nodelist(i)
218  this%hcof(i) = dzero
219  if (this%ibound(node) <= 0) then
220  this%rhs(i) = dzero
221  cycle
222  end if
223  q = this%q_mult(i)
224  this%rhs(i) = -q
225  end do

◆ flw_create()

subroutine, public swfflwmodule::flw_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 
)

Create a new FLW Package object

Parameters
packobjpointer to default package type
[in]idpackage id
[in]ibcnumboundary condition number
[in]inunitunit number of FLW package input file
[in]ioutunit number of model listing file
[in]namemodelmodel name
[in]paknamepackage name
[in]mempathinput mempath

Definition at line 57 of file swf-flw.f90.

59  ! -- dummy variables
60  class(BndType), pointer :: packobj !< pointer to default package type
61  integer(I4B), intent(in) :: id !< package id
62  integer(I4B), intent(in) :: ibcnum !< boundary condition number
63  integer(I4B), intent(in) :: inunit !< unit number of FLW package input file
64  integer(I4B), intent(in) :: iout !< unit number of model listing file
65  character(len=*), intent(in) :: namemodel !< model name
66  character(len=*), intent(in) :: pakname !< package name
67  character(len=*), intent(in) :: mempath !< input mempath
68  ! -- local variables
69  type(SwfFlwType), pointer :: flwobj
70  !
71  ! -- allocate the object and assign values to object variables
72  allocate (flwobj)
73  packobj => flwobj
74  !
75  ! -- create name and memory path
76  call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
77  packobj%text = text
78  !
79  ! -- allocate scalars
80  call flwobj%allocate_scalars()
81  !
82  ! -- initialize package
83  call packobj%pack_initialize()
84 
85  packobj%inunit = inunit
86  packobj%iout = iout
87  packobj%id = id
88  packobj%ibcnum = ibcnum
89  packobj%ncolbnd = 1
90  packobj%iscloc = 1
91  packobj%ictMemPath = ''
Here is the caller graph for this function:

◆ flw_da()

subroutine swfflwmodule::flw_da ( class(swfflwtype this)

Deallocate SWF package scalars and arrays.

Parameters
thisSwfFlwType object

Definition at line 146 of file swf-flw.f90.

147  ! -- modules
149  ! -- dummy variables
150  class(SwfFlwType) :: this !< SwfFlwType object
151  !
152  ! -- Deallocate parent package
153  call this%BndExtType%bnd_da()
154  !
155  ! -- scalars
156  call mem_deallocate(this%q, 'Q', this%memoryPath)

◆ flw_df_obs()

subroutine swfflwmodule::flw_df_obs ( class(swfflwtype this)
private

Method to define the observation types available in the FLW package.

Parameters
thisSwfFlwType object

Definition at line 317 of file swf-flw.f90.

318  ! -- dummy variables
319  class(SwfFlwType) :: this !< SwfFlwType object
320  ! -- local variables
321  integer(I4B) :: indx
322  !
323  ! -- initialize observations
324  call this%obs%StoreObsType('flw', .true., indx)
325  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
326  !
327  ! -- Store obs type and assign procedure pointer
328  ! for to-mvr observation type.
329  call this%obs%StoreObsType('to-mvr', .true., indx)
330  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
Here is the call graph for this function:

◆ flw_fc()

subroutine swfflwmodule::flw_fc ( class(swfflwtype 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

Add the hcof and rhs terms for the FLW package to the coefficient matrix and right-hand side vector.

Parameters
thisSwfFlwType object
[in,out]rhsright-hand side vector for model
[in]iasolution CRS row pointers
[in]idxglomapping vector for model (local) to solution (global)
matrix_slnsolution coefficient matrix

Definition at line 234 of file swf-flw.f90.

235  ! -- dummy variables
236  class(SwfFlwType) :: this !< SwfFlwType object
237  real(DP), dimension(:), intent(inout) :: rhs !< right-hand side vector for model
238  integer(I4B), dimension(:), intent(in) :: ia !< solution CRS row pointers
239  integer(I4B), dimension(:), intent(in) :: idxglo !< mapping vector for model (local) to solution (global)
240  class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
241  ! -- local variables
242  integer(I4B) :: i
243  integer(I4B) :: n
244  integer(I4B) :: ipos
245  !
246  ! -- pakmvrobj fc
247  if (this%imover == 1) then
248  call this%pakmvrobj%fc()
249  end if
250  !
251  ! -- Copy package rhs and hcof into solution rhs and amat
252  do i = 1, this%nbound
253  n = this%nodelist(i)
254  rhs(n) = rhs(n) + this%rhs(i)
255  ipos = ia(n)
256  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
257  !
258  ! -- If mover is active and this flw item is discharging,
259  ! store available water (as positive value).
260  if (this%imover == 1 .and. this%rhs(i) > dzero) then
261  call this%pakmvrobj%accumulate_qformvr(i, this%rhs(i))
262  end if
263  end do

◆ flw_obs_supported()

logical function swfflwmodule::flw_obs_supported ( class(swfflwtype this)
private

Function to determine if observations are supported by the FLW package. Observations are supported by the FLW package.

Returns
flw_obs_supported boolean indicating if observations are supported
Parameters
thisSwfFlwType object

Definition at line 304 of file swf-flw.f90.

305  ! -- dummy variables
306  class(SwfFlwType) :: this !< SwfFlwType object
307  !
308  ! -- set boolean
309  flw_obs_supported = .true.

◆ flw_options()

subroutine swfflwmodule::flw_options ( class(swfflwtype), intent(inout)  this)

Source additional options for SWF package.

Parameters
[in,out]thisSwfFlwType object

Definition at line 164 of file swf-flw.f90.

165  ! -- modules
166  use inputoutputmodule, only: urword
168  ! -- dummy variables
169  class(SwfFlwType), intent(inout) :: this !< SwfFlwType object
170  ! -- formats
171  !
172  ! -- source base BndExtType options
173  call this%BndExtType%source_options()
174  !
175  ! -- source options from input context
176  ! none
177  !
178  ! -- log SWF specific options
179  call this%log_flw_options()
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
Here is the call graph for this function:

◆ flw_rp_ts()

subroutine swfflwmodule::flw_rp_ts ( class(swfflwtype), intent(inout)  this)
private

Assign the time series links for the FLW package. Only the Q variable can be defined with time series.

Parameters
[in,out]thisSwfFlwType object

Definition at line 388 of file swf-flw.f90.

389  ! -- dummy variables
390  class(SwfFlwType), intent(inout) :: this !< SwfFlwType object
391  ! -- local variables
392  integer(I4B) :: i, nlinks
393  type(TimeSeriesLinkType), pointer :: tslink => null()
394  !
395  ! -- set up the time series links
396  nlinks = this%TsManager%boundtslinks%Count()
397  do i = 1, nlinks
398  tslink => gettimeserieslinkfromlist(this%TsManager%boundtslinks, i)
399  if (associated(tslink)) then
400  if (tslink%JCol == 1) then
401  tslink%Text = 'Q'
402  end if
403  end if
404  end do
Here is the call graph for this function:

◆ log_flw_options()

subroutine swfflwmodule::log_flw_options ( class(swfflwtype), intent(inout)  this)

Definition at line 184 of file swf-flw.f90.

185  ! -- dummy variables
186  class(SwfFlwType), intent(inout) :: this
187  ! -- local variables
188  ! -- format
189  !
190  ! -- log found options
191  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text)) &
192  //' OPTIONS'
193  !
194  ! -- close logging block
195  write (this%iout, '(1x,a)') &
196  'END OF '//trim(adjustl(this%text))//' OPTIONS'

◆ q_mult()

real(dp) function swfflwmodule::q_mult ( class(swfflwtype), intent(inout)  this,
integer(i4b), intent(in)  row 
)
private

Definition at line 407 of file swf-flw.f90.

408  ! -- modules
409  use constantsmodule, only: dzero
410  ! -- dummy variables
411  class(SwfFlwType), intent(inout) :: this
412  integer(I4B), intent(in) :: row
413  ! -- result
414  real(DP) :: q
415  !
416  if (this%iauxmultcol > 0) then
417  q = this%q(row) * this%auxvar(this%iauxmultcol, row)
418  else
419  q = this%q(row)
420  end if

Variable Documentation

◆ ftype

character(len=lenftype) swfflwmodule::ftype = 'FLW'
private

Definition at line 26 of file swf-flw.f90.

26  character(len=LENFTYPE) :: ftype = 'FLW' !< package ftype

◆ text

character(len=16) swfflwmodule::text = ' FLW'
private

Definition at line 27 of file swf-flw.f90.

27  character(len=16) :: text = ' FLW' !< package flow text string