MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
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.
subroutine tvs_ar_set_pointers (this)
 Announce package and set pointers to variables.
subroutine tvs_source_package_options (this)
 Source TVS-specific options from the input memory path.
subroutine tvs_apply_row_changes (this, nodeu, node)
 Apply this node's SS/SY input values to node.
subroutine tvs_set_changed_at (this, kper, kstp)
 Mark property changes as having occurred at (kper, kstp).
subroutine tvs_reset_change_flags (this)
 Clear all per-node change flags.
subroutine tvs_validate_change (this, n, varname)
 Check that a given property value is valid.
subroutine tvs_da (this)
 Deallocate package memory.

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) nodeu,
integer(i4b), intent(in) node )
private

Called for every tracked node; the DNODATA check on each field makes this a no-op except where a value is set. node may be invalid even when a field has a value at nodeu, so each field validates node itself before using it.

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

122 ! -- dummy
123 class(TvsType) :: this
124 integer(I4B), intent(in) :: nodeu
125 integer(I4B), intent(in) :: node
126 ! -- local
127 character(len=LINELENGTH) :: cellstr
128 ! -- formats
129 character(len=*), parameter :: fmtvalchg = &
130 "(a, ' package: Setting ', a, ' value for cell ', a, ' at start of &
131 &stress period ', i0, ' = ', g12.5)"
132 !
133 if (this%ss_src(nodeu) /= dnodata) then
134 if (node < 1 .or. node > this%dis%nodes) then
135 call this%dis%noder_to_string(node, cellstr)
136 write (errmsg, '(a,2(1x,a))') &
137 'CELLID', trim(cellstr), 'is not in the active model domain.'
138 call store_error(errmsg)
139 else
140 this%ss(node) = this%ss_src(nodeu)
141 call this%validate_change(node, 'SS')
142 if (this%iprpak /= 0) then
143 call this%dis%noder_to_string(node, cellstr)
144 write (this%iout, fmtvalchg) &
145 trim(adjustl(this%packName)), 'SS', trim(cellstr), kper, &
146 this%ss(node)
147 end if
148 end if
149 end if
150 !
151 if (this%sy_src(nodeu) /= dnodata) then
152 if (node < 1 .or. node > this%dis%nodes) then
153 call this%dis%noder_to_string(node, cellstr)
154 write (errmsg, '(a,2(1x,a))') &
155 'CELLID', trim(cellstr), 'is not in the active model domain.'
156 call store_error(errmsg)
157 else
158 this%sy(node) = this%sy_src(nodeu)
159 call this%validate_change(node, 'SY')
160 if (this%iprpak /= 0) then
161 call this%dis%noder_to_string(node, cellstr)
162 write (this%iout, fmtvalchg) &
163 trim(adjustl(this%packName)), 'SY', trim(cellstr), kper, &
164 this%sy(node)
165 end if
166 end if
167 end if
Here is the call graph for this function:

◆ 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 246 of file gwf-tvs.f90.

247 ! -- dummy
248 class(TvsType) :: this
249 !
250 nullify (this%integratechanges)
251 nullify (this%iusesy)
252 nullify (this%ss)
253 nullify (this%sy)
254 nullify (this%ss_src)
255 nullify (this%sy_src)
256 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 191 of file gwf-tvs.f90.

192 ! -- dummy
193 class(TvsType) :: this
194 !
195 ! -- No need to record TVS/STO changes, as no other packages cache
196 ! -- 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 175 of file gwf-tvs.f90.

176 ! -- dummy
177 class(TvsType) :: this
178 integer(I4B), intent(in) :: kper
179 integer(I4B), intent(in) :: kstp
180 !
181 ! -- No need to record TVS/STO changes, as no other packages cache
182 ! -- 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 205 of file gwf-tvs.f90.

206 ! -- dummy
207 class(TvsType) :: this
208 integer(I4B), intent(in) :: n
209 character(len=*), intent(in) :: varName
210 ! -- local
211 character(len=LINELENGTH) :: cellstr
212 ! -- formats
213 character(len=*), parameter :: fmtserr = &
214 "(1x, a, ' changed storage property ', a, ' is < 0 for cell ', a,' ', &
215 &1pg15.6)"
216 character(len=*), parameter :: fmtsyerr = &
217 "(1x, a, ' cannot change ', a ,' for cell ', a, ' because SY is unused &
218 &in this model (all ICONVERT flags are 0).')"
219 !
220 if (varname == 'SS') then
221 if (this%ss(n) < dzero) then
222 call this%dis%noder_to_string(n, cellstr)
223 write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SS', &
224 trim(cellstr), this%ss(n)
225 call store_error(errmsg)
226 end if
227 elseif (varname == 'SY') then
228 if (this%iusesy /= 1) then
229 call this%dis%noder_to_string(n, cellstr)
230 write (errmsg, fmtsyerr) trim(adjustl(this%packName)), 'SY', &
231 trim(cellstr)
232 call store_error(errmsg)
233 elseif (this%sy(n) < dzero) then
234 call this%dis%noder_to_string(n, cellstr)
235 write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SY', &
236 trim(cellstr), this%sy(n)
237 call store_error(errmsg)
238 end if
239 end if
Here is the call graph for this function: