MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
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, found)
 @ brief Log SWF specific package options More...
 
subroutine flw_rp (this)
 @ brief SWF read and prepare 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 334 of file swf-flw.f90.

335  ! -- dummy variables
336  class(SwfFlwType), intent(inout) :: this !< SwfFlwType object
337  !
338  ! -- create the header list label
339  this%listlabel = trim(this%filtyp)//' NO.'
340  if (this%dis%ndim == 3) then
341  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
342  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
343  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
344  elseif (this%dis%ndim == 2) then
345  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
346  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
347  else
348  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
349  end if
350  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'FLOW RATE'
351  if (this%inamedbound == 1) then
352  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
353  end if
354  !
355  ! -- return
356  return

◆ 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 133 of file swf-flw.f90.

134  ! -- modules
136  ! -- dummy
137  class(SwfFlwType) :: this
138  integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist
139  real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar
140  ! -- local
141  !
142  ! -- call BndExtType allocate scalars
143  call this%BndExtType%allocate_arrays(nodelist, auxvar)
144  !
145  ! -- set q array input context pointer
146  call mem_setptr(this%q, 'Q', this%input_mempath)
147  !
148  ! -- checkin q array input context pointer
149  call mem_checkin(this%q, 'Q', this%memoryPath, &
150  'Q', this%input_mempath)
151  !
152  ! -- return
153  return

◆ 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 109 of file swf-flw.f90.

110  ! -- modules
112  ! -- dummy variables
113  class(SwfFlwType) :: this !< SwfFlwType object
114  !
115  ! -- call base type allocate scalars
116  call this%BndExtType%allocate_scalars()
117  !
118  ! -- allocate the object and assign values to object variables
119  ! none for this package
120  !
121  ! -- Set values
122  ! none for this package
123  !
124  ! -- return
125  return

◆ 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 409 of file swf-flw.f90.

410  ! -- dummy variables
411  class(SwfFlwType) :: this !< SwfFlwType object
412  ! -- local variables
413  integer(I4B) :: i
414  integer(I4B) :: n
415  integer(I4B) :: jj
416  real(DP) :: v
417  type(ObserveType), pointer :: obsrv => null()
418  !
419  ! -- clear the observations
420  call this%obs%obs_bd_clear()
421  !
422  ! -- Save simulated values for all of package's observations.
423  do i = 1, this%obs%npakobs
424  obsrv => this%obs%pakobs(i)%obsrv
425  if (obsrv%BndFound) then
426  do n = 1, obsrv%indxbnds_count
427  v = dnodata
428  jj = obsrv%indxbnds(n)
429  select case (obsrv%ObsTypeId)
430  case ('TO-MVR')
431  if (this%imover == 1) then
432  v = this%pakmvrobj%get_qtomvr(jj)
433  if (v > dzero) then
434  v = -v
435  end if
436  end if
437  case ('FLW')
438  v = this%simvals(jj)
439  case default
440  errmsg = 'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
441  call store_error(errmsg)
442  end select
443  call this%obs%SaveOneSimval(obsrv, v)
444  end do
445  else
446  call this%obs%SaveOneSimval(obsrv, dnodata)
447  end if
448  end do
449  !
450  ! -- return
451  return
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.

Parameters
[in,out]thisBndExtType object

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

510  ! -- modules
511  use constantsmodule, only: dzero
512  ! -- dummy variables
513  class(SwfFlwType), intent(inout) :: this !< BndExtType object
514  integer(I4B), intent(in) :: col
515  integer(I4B), intent(in) :: row
516  ! -- result
517  real(DP) :: bndval
518  !
519  select case (col)
520  case (1)
521  bndval = this%q_mult(row)
522  case default
523  errmsg = 'Programming error. FLW bound value requested column '&
524  &'outside range of ncolbnd (1).'
525  call store_error(errmsg)
526  call store_error_filename(this%input_fname)
527  end select
528  !
529  ! -- return
530  return
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:64
Here is the call graph for this function:

◆ flw_cf()

subroutine swfflwmodule::flw_cf ( class(swfflwtype this)

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 262 of file swf-flw.f90.

263  ! -- dummy variables
264  class(SwfFlwType) :: this !< SwfFlwType object
265  ! -- local variables
266  integer(I4B) :: i, node
267  real(DP) :: q
268  !
269  ! -- Return if no inflows
270  if (this%nbound == 0) return
271  !
272  ! -- Calculate hcof and rhs for each flw entry
273  do i = 1, this%nbound
274  node = this%nodelist(i)
275  this%hcof(i) = dzero
276  if (this%ibound(node) <= 0) then
277  this%rhs(i) = dzero
278  cycle
279  end if
280  q = this%q_mult(i)
281  this%rhs(i) = -q
282  end do
283  !
284  return

◆ 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 63 of file swf-flw.f90.

65  ! -- dummy variables
66  class(BndType), pointer :: packobj !< pointer to default package type
67  integer(I4B), intent(in) :: id !< package id
68  integer(I4B), intent(in) :: ibcnum !< boundary condition number
69  integer(I4B), intent(in) :: inunit !< unit number of FLW package input file
70  integer(I4B), intent(in) :: iout !< unit number of model listing file
71  character(len=*), intent(in) :: namemodel !< model name
72  character(len=*), intent(in) :: pakname !< package name
73  character(len=*), intent(in) :: mempath !< input mempath
74  ! -- local variables
75  type(SwfFlwType), pointer :: flwobj
76  !
77  ! -- allocate the object and assign values to object variables
78  allocate (flwobj)
79  packobj => flwobj
80  !
81  ! -- create name and memory path
82  call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
83  packobj%text = text
84  !
85  ! -- allocate scalars
86  call flwobj%allocate_scalars()
87  !
88  ! -- initialize package
89  call packobj%pack_initialize()
90 
91  packobj%inunit = inunit
92  packobj%iout = iout
93  packobj%id = id
94  packobj%ibcnum = ibcnum
95  packobj%ncolbnd = 1
96  packobj%iscloc = 1
97  packobj%ictMemPath = ''
98  !
99  ! -- return
100  return
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 161 of file swf-flw.f90.

162  ! -- modules
164  ! -- dummy variables
165  class(SwfFlwType) :: this !< SwfFlwType object
166  !
167  ! -- Deallocate parent package
168  call this%BndExtType%bnd_da()
169  !
170  ! -- scalars
171  call mem_deallocate(this%q, 'Q', this%memoryPath)
172  !
173  ! -- return
174  return

◆ 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 385 of file swf-flw.f90.

386  ! -- dummy variables
387  class(SwfFlwType) :: this !< SwfFlwType object
388  ! -- local variables
389  integer(I4B) :: indx
390  !
391  ! -- initialize observations
392  call this%obs%StoreObsType('flw', .true., indx)
393  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
394  !
395  ! -- Store obs type and assign procedure pointer
396  ! for to-mvr observation type.
397  call this%obs%StoreObsType('to-mvr', .true., indx)
398  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
399  !
400  ! -- return
401  return
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 293 of file swf-flw.f90.

294  ! -- dummy variables
295  class(SwfFlwType) :: this !< SwfFlwType object
296  real(DP), dimension(:), intent(inout) :: rhs !< right-hand side vector for model
297  integer(I4B), dimension(:), intent(in) :: ia !< solution CRS row pointers
298  integer(I4B), dimension(:), intent(in) :: idxglo !< mapping vector for model (local) to solution (global)
299  class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
300  ! -- local variables
301  integer(I4B) :: i
302  integer(I4B) :: n
303  integer(I4B) :: ipos
304  !
305  ! -- pakmvrobj fc
306  if (this%imover == 1) then
307  call this%pakmvrobj%fc()
308  end if
309  !
310  ! -- Copy package rhs and hcof into solution rhs and amat
311  do i = 1, this%nbound
312  n = this%nodelist(i)
313  rhs(n) = rhs(n) + this%rhs(i)
314  ipos = ia(n)
315  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
316  !
317  ! -- If mover is active and this flw item is discharging,
318  ! store available water (as positive value).
319  if (this%imover == 1 .and. this%rhs(i) > dzero) then
320  call this%pakmvrobj%accumulate_qformvr(i, this%rhs(i))
321  end if
322  end do
323  !
324  ! -- return
325  return

◆ 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 369 of file swf-flw.f90.

370  ! -- dummy variables
371  class(SwfFlwType) :: this !< SwfFlwType object
372  !
373  ! -- set boolean
374  flw_obs_supported = .true.
375  !
376  ! -- return
377  return

◆ 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 182 of file swf-flw.f90.

183  ! -- modules
184  use inputoutputmodule, only: urword
187  ! -- dummy variables
188  class(SwfFlwType), intent(inout) :: this !< SwfFlwType object
189  ! -- local variables
190  type(SwfFlwParamFoundType) :: found
191  ! -- formats
192  !
193  ! -- source base BndExtType options
194  call this%BndExtType%source_options()
195  !
196  ! -- source options from input context
197  ! none
198  !
199  ! -- log SWF specific options
200  call this%log_flw_options(found)
201  !
202  ! -- return
203  return
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()

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

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

237  use tdismodule, only: kper
238  ! -- dummy
239  class(SwfFlwType), intent(inout) :: this
240  ! -- local
241  !
242  if (this%iper /= kper) return
243  !
244  ! -- Call the parent class read and prepare
245  call this%BndExtType%bnd_rp()
246  !
247  ! -- Write the list to iout if requested
248  if (this%iprpak /= 0) then
249  call this%write_list()
250  end if
251  !
252  ! -- return
253  return
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23

◆ 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 462 of file swf-flw.f90.

463  ! -- dummy variables
464  class(SwfFlwType), intent(inout) :: this !< SwfFlwType object
465  ! -- local variables
466  integer(I4B) :: i, nlinks
467  type(TimeSeriesLinkType), pointer :: tslink => null()
468  !
469  ! -- set up the time series links
470  nlinks = this%TsManager%boundtslinks%Count()
471  do i = 1, nlinks
472  tslink => gettimeserieslinkfromlist(this%TsManager%boundtslinks, i)
473  if (associated(tslink)) then
474  if (tslink%JCol == 1) then
475  tslink%Text = 'Q'
476  end if
477  end if
478  end do
479  !
480  ! -- return
481  return
Here is the call graph for this function:

◆ log_flw_options()

subroutine swfflwmodule::log_flw_options ( class(swfflwtype), intent(inout)  this,
type(swfflwparamfoundtype), intent(in)  found 
)
Parameters
[in,out]thisBndExtType object

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

209  ! -- modules
211  ! -- dummy variables
212  class(SwfFlwType), intent(inout) :: this !< BndExtType object
213  type(SwfFlwParamFoundType), intent(in) :: found
214  ! -- local variables
215  ! -- format
216  !
217  ! -- log found options
218  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text)) &
219  //' OPTIONS'
220  !
221  ! if (found%mover) then
222  ! write (this%iout, '(4x,A)') 'MOVER OPTION ENABLED'
223  ! end if
224  !
225  ! -- close logging block
226  write (this%iout, '(1x,a)') &
227  'END OF '//trim(adjustl(this%text))//' OPTIONS'
228  !
229  ! -- return
230  return

◆ q_mult()

real(dp) function swfflwmodule::q_mult ( class(swfflwtype), intent(inout)  this,
integer(i4b), intent(in)  row 
)
private
Parameters
[in,out]thisBndExtType object

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

485  ! -- modules
486  use constantsmodule, only: dzero
487  ! -- dummy variables
488  class(SwfFlwType), intent(inout) :: this !< BndExtType object
489  integer(I4B), intent(in) :: row
490  ! -- result
491  real(DP) :: q
492  !
493  if (this%iauxmultcol > 0) then
494  q = this%q(row) * this%auxvar(this%iauxmultcol, row)
495  else
496  q = this%q(row)
497  end if
498  !
499  ! -- return
500  return

Variable Documentation

◆ ftype

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

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

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

◆ text

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

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

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