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

Data Types

type  gwtsrctype
 

Functions/Subroutines

subroutine, public src_create (packobj, id, ibcnum, inunit, iout, namemodel, depvartype, pakname, input_mempath, fmi)
 Create a source loading package. More...
 
subroutine src_options (this)
 Set additional options specific to the GwtSrcType. More...
 
subroutine src_da (this)
 Deallocate memory. More...
 
subroutine src_allocate_scalars (this)
 Allocate scalars. More...
 
subroutine src_allocate_arrays (this, nodelist, auxvar)
 Allocate arrays. More...
 
subroutine src_rp (this)
 
subroutine set_nodesontop (this)
 Store nodelist in nodesontop. More...
 
subroutine src_cf (this)
 Formulate the HCOF and RHS terms. More...
 
subroutine src_fc (this, rhs, ia, idxglo, matrix_sln)
 Add matrix terms related to specified mass source loading. More...
 
subroutine define_listlabel (this)
 Define list labels. More...
 
logical function src_obs_supported (this)
 Support function for specified mass source loading observations. More...
 
subroutine src_df_obs (this)
 Define observations. More...
 
real(dp) function src_bound_value (this, col, row)
 @ brief Return a bound value More...
 
real(dp) function mass_mult (this, row)
 Return a value that applies a multiplier. More...
 

Variables

character(len=lenftype) ftype = 'SRC'
 
character(len=16) text = ' SRC'
 

Function/Subroutine Documentation

◆ define_listlabel()

subroutine gwtsrcmodule::define_listlabel ( class(gwtsrctype), intent(inout)  this)
private

Define the list heading that is written to iout when PRINT_INPUT option is used.

Definition at line 323 of file gwt-src.f90.

324  ! -- dummy
325  class(GwtSrcType), intent(inout) :: this
326  ! -- local
327  !
328  ! -- create the header list label
329  this%listlabel = trim(this%filtyp)//' NO.'
330  if (this%dis%ndim == 3) then
331  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
332  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
333  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
334  elseif (this%dis%ndim == 2) then
335  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
336  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
337  else
338  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
339  end if
340  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'STRESS RATE'
341  if (this%inamedbound == 1) then
342  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
343  end if

◆ mass_mult()

real(dp) function gwtsrcmodule::mass_mult ( class(gwtsrctype), intent(inout)  this,
integer(i4b), intent(in)  row 
)

Apply multiplier to specified mass-source load depending on user-selected option

Definition at line 410 of file gwt-src.f90.

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

◆ set_nodesontop()

subroutine gwtsrcmodule::set_nodesontop ( class(gwtsrctype), intent(inout)  this)

Definition at line 220 of file gwt-src.f90.

221  implicit none
222  ! -- dummy
223  class(GwtSrcType), intent(inout) :: this
224  ! -- local
225  integer(I4B) :: n
226  ! !
227  ! ! -- allocate if necessary
228  ! if (.not. associated(this%nodesontop)) then
229  ! allocate (this%nodesontop(this%maxbound))
230  ! end if
231  !
232  ! -- copy nodelist into nodesontop
233  do n = 1, this%nbound
234  this%nodesontop(n) = this%nodelist(n)
235  end do

◆ src_allocate_arrays()

subroutine gwtsrcmodule::src_allocate_arrays ( class(gwtsrctype this,
integer(i4b), dimension(:), optional, pointer, contiguous  nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous  auxvar 
)

Allocate scalars specific to this source loading package

Parameters
nodelistpackage nodelist
auxvarpackage aux variable array

Definition at line 172 of file gwt-src.f90.

174  ! -- dummy
175  class(GwtSrcType) :: this
176  integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist !< package nodelist
177  real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar !< package aux variable array
178  ! local
179  integer(I4B) :: n
180  !
181  ! -- base class allocate arrays
182  call this%BndExtType%allocate_arrays(nodelist, auxvar)
183  !
184  ! -- allocate the object and assign values to object variables
185  if (this%highest_sat) then
186  call mem_allocate(this%nodesontop, this%maxbound, 'NODESONTOP', &
187  this%memoryPath)
188  end if
189 
190  ! -- set input context pointers
191  call mem_setptr(this%smassrate, 'SMASSRATE', this%input_mempath)
192  !
193  ! -- checkin input context pointers
194  call mem_checkin(this%smassrate, 'SMASSRATE', this%memoryPath, &
195  'SMASSRATE', this%input_mempath)
196  !
197  ! -- Set values
198  if (this%highest_sat) then
199  do n = 1, this%maxbound
200  this%nodesontop(n) = 0
201  end do
202  end if

◆ src_allocate_scalars()

subroutine gwtsrcmodule::src_allocate_scalars ( class(gwtsrctype this)

Allocate scalars specific to this source loading package

Definition at line 152 of file gwt-src.f90.

154  ! -- dummy
155  class(GwtSrcType) :: this
156  !
157  ! -- base class allocate scalars
158  call this%BndExtType%allocate_scalars()
159  !
160  ! -- allocate the object and assign values to object variables
161  call mem_allocate(this%highest_sat, 'HIGHEST_SAT', this%memoryPath)
162  !
163  ! -- Set values
164  this%highest_sat = .false.
165 

◆ src_bound_value()

real(dp) function gwtsrcmodule::src_bound_value ( class(gwtsrctype), intent(inout)  this,
integer(i4b), intent(in)  col,
integer(i4b), intent(in)  row 
)
private

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

Definition at line 388 of file gwt-src.f90.

389  ! -- modules
390  use constantsmodule, only: dzero
391  ! -- dummy variables
392  class(GwtSrcType), intent(inout) :: this
393  integer(I4B), intent(in) :: col
394  integer(I4B), intent(in) :: row
395  ! -- result
396  real(DP) :: bndval
397  !
398  select case (col)
399  case (1)
400  bndval = this%smassrate(row)
401  case default
402  end select

◆ src_cf()

subroutine gwtsrcmodule::src_cf ( class(gwtsrctype this)
private

This subroutine:

  • calculates hcof and rhs terms
  • skip if no sources

Definition at line 244 of file gwt-src.f90.

245  ! -- dummy
246  class(GwtSrcType) :: this
247  ! -- local
248  integer(I4B) :: i, node
249  real(DP) :: q
250  !
251  ! -- Return if no sources
252  if (this%nbound == 0) return
253  !
254  ! -- Calculate hcof and rhs for each source entry
255  do i = 1, this%nbound
256  !
257  ! -- Find the node number
258  if (this%highest_sat) then
259  node = this%nodesontop(i)
260  else
261  node = this%nodelist(i)
262  end if
263  !
264  ! -- reset nodelist to highest active
265  if (this%highest_sat) then
266  if (this%fmi%gwfsat(node) == 0) &
267  call this%dis%highest_saturated(node, this%fmi%gwfsat)
268  this%nodelist(i) = node
269  end if
270 
271  this%hcof(i) = dzero
272  if (this%ibound(node) <= 0) then
273  this%rhs(i) = dzero
274  cycle
275  end if
276  !
277  ! -- set energy loading rate accounting for multiplier
278  q = this%mass_mult(i)
279  !
280  this%rhs(i) = -q
281  end do

◆ src_create()

subroutine, public gwtsrcmodule::src_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=lenvarname), intent(in)  depvartype,
character(len=*), intent(in)  pakname,
character(len=*), intent(in)  input_mempath,
type(tspfmitype), intent(in), target  fmi 
)

This subroutine points bndobj to the newly created package

Definition at line 53 of file gwt-src.f90.

55  ! -- modules
56  use bndmodule, only: bndtype
57  ! -- dummy
58  class(BndType), pointer :: packobj
59  integer(I4B), intent(in) :: id
60  integer(I4B), intent(in) :: ibcnum
61  integer(I4B), intent(in) :: inunit
62  integer(I4B), intent(in) :: iout
63  character(len=*), intent(in) :: namemodel
64  character(len=*), intent(in) :: pakname
65  character(len=LENVARNAME), intent(in) :: depvartype
66  character(len=*), intent(in) :: input_mempath
67  type(TspFmiType), intent(in), target :: fmi
68  ! -- local
69  type(GwtSrcType), pointer :: srcobj
70  !
71  ! -- allocate the object and assign values to object variables
72  allocate (srcobj)
73  packobj => srcobj
74  !
75  ! -- create name and memory path
76  call packobj%set_names(ibcnum, namemodel, pakname, ftype, input_mempath)
77  packobj%text = text
78  !
79  ! -- allocate scalars
80  call srcobj%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  !
92  ! -- Store the appropriate label based on the dependent variable
93  srcobj%depvartype = depvartype
94 
95  srcobj%fmi => fmi
96 
This module contains the base boundary package.
@ brief BndType
Here is the caller graph for this function:

◆ src_da()

subroutine gwtsrcmodule::src_da ( class(gwtsrctype this)

Definition at line 129 of file gwt-src.f90.

130  ! -- modules
132  ! -- dummy
133  class(GwtSrcType) :: this
134  !
135  ! -- Deallocate parent package
136  call this%BndExtType%bnd_da()
137  !
138  ! -- arrays
139  call mem_deallocate(this%smassrate, 'SMASSRATE', this%memoryPath)
140  if (this%highest_sat) then
141  call mem_deallocate(this%nodesontop, "NODESONTOP", this%memoryPath)
142  end if
143  !
144  ! -- scalars
145  call mem_deallocate(this%highest_sat)

◆ src_df_obs()

subroutine gwtsrcmodule::src_df_obs ( class(gwtsrctype this)
private

This subroutine:

  • stores observation types supported by SRC package.
  • overrides BndTypebnd_df_obs

Definition at line 367 of file gwt-src.f90.

368  implicit none
369  ! -- dummy
370  class(GwtSrcType) :: this
371  ! -- local
372  integer(I4B) :: indx
373  !
374  call this%obs%StoreObsType('src', .true., indx)
375  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
376  !
377  ! -- Store obs type and assign procedure pointer
378  ! for to-mvr observation type.
379  call this%obs%StoreObsType('to-mvr', .true., indx)
380  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
Here is the call graph for this function:

◆ src_fc()

subroutine gwtsrcmodule::src_fc ( class(gwtsrctype 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

Copy rhs and hcof into solution rhs and amat

Definition at line 288 of file gwt-src.f90.

289  ! -- dummy
290  class(GwtSrcType) :: this
291  real(DP), dimension(:), intent(inout) :: rhs
292  integer(I4B), dimension(:), intent(in) :: ia
293  integer(I4B), dimension(:), intent(in) :: idxglo
294  class(MatrixBaseType), pointer :: matrix_sln
295  ! -- local
296  integer(I4B) :: i, n, ipos
297  !
298  ! -- pakmvrobj fc
299  if (this%imover == 1) then
300  call this%pakmvrobj%fc()
301  end if
302  !
303  ! -- Copy package rhs and hcof into solution rhs and amat
304  do i = 1, this%nbound
305  n = this%nodelist(i)
306  rhs(n) = rhs(n) + this%rhs(i)
307  ipos = ia(n)
308  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
309  !
310  ! -- If mover is active and mass is being withdrawn,
311  ! store available mass (as positive value).
312  if (this%imover == 1 .and. this%rhs(i) > dzero) then
313  call this%pakmvrobj%accumulate_qformvr(i, this%rhs(i))
314  end if
315  end do

◆ src_obs_supported()

logical function gwtsrcmodule::src_obs_supported ( class(gwtsrctype this)
private

This function:

  • returns true because SRC package supports observations.
  • overrides BndTypebnd_obs_supported()

Definition at line 353 of file gwt-src.f90.

354  implicit none
355  ! -- dummy
356  class(GwtSrcType) :: this
357  !
358  src_obs_supported = .true.

◆ src_options()

subroutine gwtsrcmodule::src_options ( class(gwtsrctype), intent(inout)  this)

Definition at line 101 of file gwt-src.f90.

102  ! -- modules
106  ! -- dummy
107  class(GwtSrcType), intent(inout) :: this
108  ! -- local
109  type(GwtSrcParamFoundType) :: found
110  !
111  ! -- source base class options
112  call this%BndExtType%source_options()
113  !
114  ! -- source options from input context
115  call mem_set_value(this%highest_sat, 'HIGHEST_SAT', this%input_mempath, &
116  found%highest_sat)
117 
118  write (this%iout, '(/1x,a)') 'PROCESSING SRC OPTIONS'
119  if (found%highest_sat) then
120  write (this%iout, '(4x,a)') &
121  'Mass source loading rate will be applied to the highest cell at or below &
122  &the specified cellid with a non-zero saturation.'
123  end if
124  write (this%iout, '(1x,a)') 'END OF SRC OPTIONS'
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23

◆ src_rp()

subroutine gwtsrcmodule::src_rp ( class(gwtsrctype), intent(inout)  this)

Definition at line 205 of file gwt-src.f90.

206  ! -- modules
207  use tdismodule, only: kper
208  ! -- dummy
209  class(GwtSrcType), intent(inout) :: this
210  !
211  if (this%iper /= kper) return
212  !
213  call this%BndExtType%bnd_rp()
214  !
215  if (this%highest_sat) call this%set_nodesontop()
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23

Variable Documentation

◆ ftype

character(len=lenftype) gwtsrcmodule::ftype = 'SRC'
private

Definition at line 17 of file gwt-src.f90.

17  character(len=LENFTYPE) :: ftype = 'SRC'

◆ text

character(len=16) gwtsrcmodule::text = ' SRC'
private

Definition at line 18 of file gwt-src.f90.

18  character(len=16) :: text = ' SRC'