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

This module contains the time-varying storage package methods. More...

Data Types

type  tvstype
 

Functions/Subroutines

subroutine, public tvs_cr (tvs, name_model, mempath, inunit, iout)
 Create a new TvsType object. More...
 
subroutine tvs_ar_set_pointers (this)
 Announce package and set pointers to variables. More...
 
subroutine tvs_source_package_options (this)
 Source TVS-specific options from the input memory path. More...
 
subroutine tvs_apply_row_changes (this, n, node)
 Apply input SS/SY column changes for period-data row n to node. More...
 
subroutine tvs_set_changed_at (this, kper, kstp)
 Mark property changes as having occurred at (kper, kstp) More...
 
subroutine tvs_reset_change_flags (this)
 Clear all per-node change flags. More...
 
subroutine tvs_validate_change (this, n, varName)
 Check that a given property value is valid. More...
 
subroutine tvs_da (this)
 Deallocate package memory. More...
 

Detailed Description

This module contains the methods used to allow storage parameters in the STO package (specific storage and specific yield) to be varied throughout a simulation.

Function/Subroutine Documentation

◆ tvs_apply_row_changes()

subroutine tvsmodule::tvs_apply_row_changes ( class(tvstype this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  node 
)
private

Definition at line 116 of file gwf-tvs.f90.

117  ! -- dummy
118  class(TvsType) :: this
119  integer(I4B), intent(in) :: n
120  integer(I4B), intent(in) :: node
121  ! -- local
122  character(len=LINELENGTH) :: cellstr
123  ! -- formats
124  character(len=*), parameter :: fmtvalchg = &
125  "(a, ' package: Setting ', a, ' value for cell ', a, ' at start of &
126  &stress period ', i0, ' = ', g12.5)"
127  !
128  if (this%ss_src(n) /= dnodata) then
129  this%ss(node) = this%ss_src(n)
130  call this%validate_change(node, 'SS')
131  if (this%iprpak /= 0) then
132  call this%dis%noder_to_string(node, cellstr)
133  write (this%iout, fmtvalchg) &
134  trim(adjustl(this%packName)), 'SS', trim(cellstr), kper, this%ss(node)
135  end if
136  end if
137  !
138  if (this%sy_src(n) /= dnodata) then
139  this%sy(node) = this%sy_src(n)
140  call this%validate_change(node, 'SY')
141  if (this%iprpak /= 0) then
142  call this%dis%noder_to_string(node, cellstr)
143  write (this%iout, fmtvalchg) &
144  trim(adjustl(this%packName)), 'SY', trim(cellstr), kper, this%sy(node)
145  end if
146  end if

◆ tvs_ar_set_pointers()

subroutine tvsmodule::tvs_ar_set_pointers ( class(tvstype this)
private

Announce package version, set array and variable pointers from the STO package for access by TVS, and enable storage change integration.

Definition at line 68 of file gwf-tvs.f90.

69  ! -- dummy
70  class(TvsType) :: this
71  ! -- local
72  character(len=LENMEMPATH) :: stoMemoryPath
73  ! -- formats
74  character(len=*), parameter :: fmttvs = &
75  "(1x,/1x,'TVS -- TIME-VARYING S PACKAGE, VERSION 1, 08/18/2021', &
76  &' INPUT READ FROM MEMPATH ', A, //)"
77  !
78  write (this%iout, fmttvs) this%input_mempath
79  !
80  stomemorypath = create_mem_path(this%name_model, 'STO')
81  call mem_setptr(this%integratechanges, 'INTEGRATECHANGES', stomemorypath)
82  call mem_setptr(this%iusesy, 'IUSESY', stomemorypath)
83  call mem_setptr(this%ss, 'SS', stomemorypath)
84  call mem_setptr(this%sy, 'SY', stomemorypath)
85  !
86  ! -- Instruct STO to integrate storage changes, since TVS is active
87  this%integratechanges = 1
88  !
89  ! -- set input mempath pointers
90  call mem_setptr(this%ss_src, 'SS', this%input_mempath)
91  call mem_setptr(this%sy_src, 'SY', this%input_mempath)
Here is the call graph for this function:

◆ tvs_cr()

subroutine, public tvsmodule::tvs_cr ( type(tvstype), intent(out), pointer  tvs,
character(len=*), intent(in)  name_model,
character(len=*), intent(in)  mempath,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout 
)

Create a new time-varying storage (TVS) object.

Definition at line 51 of file gwf-tvs.f90.

52  ! -- dummy
53  type(TvsType), pointer, intent(out) :: tvs
54  character(len=*), intent(in) :: name_model
55  character(len=*), intent(in) :: mempath
56  integer(I4B), intent(in) :: inunit
57  integer(I4B), intent(in) :: iout
58  !
59  allocate (tvs)
60  call tvs%init(name_model, 'TVS', 'TVS', mempath, inunit, iout)
Here is the caller graph for this function:

◆ tvs_da()

subroutine tvsmodule::tvs_da ( class(tvstype this)
private

Deallocate TVS package scalars and arrays.

Definition at line 225 of file gwf-tvs.f90.

226  ! -- dummy
227  class(TvsType) :: this
228  !
229  nullify (this%integratechanges)
230  nullify (this%iusesy)
231  nullify (this%ss)
232  nullify (this%sy)
233  nullify (this%ss_src)
234  nullify (this%sy_src)
235  call tvbase_da(this)
Here is the call graph for this function:

◆ tvs_reset_change_flags()

subroutine tvsmodule::tvs_reset_change_flags ( class(tvstype this)
private

Deferred procedure implementation called by the TvBaseType code when a new time step commences, indicating that any previously set per-node property value change flags should be reset.

Definition at line 170 of file gwf-tvs.f90.

171  ! -- dummy
172  class(TvsType) :: this
173  !
174  ! -- No need to record TVS/STO changes, as no other packages cache
175  ! -- Ss or Sy values

◆ tvs_set_changed_at()

subroutine tvsmodule::tvs_set_changed_at ( class(tvstype this,
integer(i4b), intent(in)  kper,
integer(i4b), intent(in)  kstp 
)
private

Deferred procedure implementation called by the TvBaseType code when a property value change occurs at (kper, kstp).

Definition at line 154 of file gwf-tvs.f90.

155  ! -- dummy
156  class(TvsType) :: this
157  integer(I4B), intent(in) :: kper
158  integer(I4B), intent(in) :: kstp
159  !
160  ! -- No need to record TVS/STO changes, as no other packages cache
161  ! -- Ss or Sy values

◆ tvs_source_package_options()

subroutine tvsmodule::tvs_source_package_options ( class(tvstype this)
private

Definition at line 96 of file gwf-tvs.f90.

97  ! -- dummy
98  class(TvsType) :: this
99  ! -- locals
100  integer(I4B) :: isize
101  ! -- formats
102  character(len=*), parameter :: fmtdsci = &
103  "(4X, 'DISABLE_STORAGE_CHANGE_INTEGRATION OPTION:', /, 6X, &
104  &'Storage derivative terms will not be added to STO matrix formulation')"
105  !
106  ! -- DISABLE_STORAGE_CHANGE_INTEGRATION is a keyword; check via get_isize
107  call get_isize('DISABLE_SC_INT', this%input_mempath, isize)
108  if (isize > 0) then
109  this%integratechanges = 0
110  write (this%iout, fmtdsci)
111  end if
Here is the call graph for this function:

◆ tvs_validate_change()

subroutine tvsmodule::tvs_validate_change ( class(tvstype this,
integer(i4b), intent(in)  n,
character(len=*), intent(in)  varName 
)
private

Deferred procedure implementation called by the TvBaseType code after a property value change occurs. Check if the property value of the given variable at the given node is invalid, and log an error if so.

Definition at line 184 of file gwf-tvs.f90.

185  ! -- dummy
186  class(TvsType) :: this
187  integer(I4B), intent(in) :: n
188  character(len=*), intent(in) :: varName
189  ! -- local
190  character(len=LINELENGTH) :: cellstr
191  ! -- formats
192  character(len=*), parameter :: fmtserr = &
193  "(1x, a, ' changed storage property ', a, ' is < 0 for cell ', a,' ', &
194  &1pg15.6)"
195  character(len=*), parameter :: fmtsyerr = &
196  "(1x, a, ' cannot change ', a ,' for cell ', a, ' because SY is unused &
197  &in this model (all ICONVERT flags are 0).')"
198  !
199  if (varname == 'SS') then
200  if (this%ss(n) < dzero) then
201  call this%dis%noder_to_string(n, cellstr)
202  write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SS', &
203  trim(cellstr), this%ss(n)
204  call store_error(errmsg)
205  end if
206  elseif (varname == 'SY') then
207  if (this%iusesy /= 1) then
208  call this%dis%noder_to_string(n, cellstr)
209  write (errmsg, fmtsyerr) trim(adjustl(this%packName)), 'SY', &
210  trim(cellstr)
211  call store_error(errmsg)
212  elseif (this%sy(n) < dzero) then
213  call this%dis%noder_to_string(n, cellstr)
214  write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SY', &
215  trim(cellstr), this%sy(n)
216  call store_error(errmsg)
217  end if
218  end if
Here is the call graph for this function: