MODFLOW 6  version 6.6.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, inunit, iout)
 Create a new TvsType object. More...
 
subroutine tvs_ar_set_pointers (this)
 Announce package and set pointers to variables. More...
 
logical function tvs_read_option (this, keyword)
 Read a TVS-specific option from the OPTIONS block. More...
 
real(dp) function, pointer tvs_get_pointer_to_value (this, n, varName)
 Get an array value pointer given a variable name and node index. 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_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 64 of file gwf-tvs.f90.

65  ! -- dummy
66  class(TvsType) :: this
67  ! -- local
68  character(len=LENMEMPATH) :: stoMemoryPath
69  ! -- formats
70  character(len=*), parameter :: fmttvs = &
71  "(1x,/1x,'TVS -- TIME-VARYING S PACKAGE, VERSION 1, 08/18/2021', &
72  &' INPUT READ FROM UNIT ', i0, //)"
73  !
74  ! -- Print a message identifying the TVS package
75  write (this%iout, fmttvs) this%inunit
76  !
77  ! -- Set pointers to other package variables
78  ! -- STO
79  stomemorypath = create_mem_path(this%name_model, 'STO')
80  call mem_setptr(this%integratechanges, 'INTEGRATECHANGES', stomemorypath)
81  call mem_setptr(this%iusesy, 'IUSESY', stomemorypath)
82  call mem_setptr(this%ss, 'SS', stomemorypath)
83  call mem_setptr(this%sy, 'SY', stomemorypath)
84  !
85  ! -- Instruct STO to integrate storage changes, since TVS is active
86  this%integratechanges = 1
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,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout 
)

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

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

49  ! -- dummy
50  type(TvsType), pointer, intent(out) :: tvs
51  character(len=*), intent(in) :: name_model
52  integer(I4B), intent(in) :: inunit
53  integer(I4B), intent(in) :: iout
54  !
55  allocate (tvs)
56  call tvs%init(name_model, 'TVS', 'TVS', 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 215 of file gwf-tvs.f90.

216  ! -- dummy
217  class(TvsType) :: this
218  !
219  ! -- Nullify pointers to other package variables
220  nullify (this%integratechanges)
221  nullify (this%iusesy)
222  nullify (this%ss)
223  nullify (this%sy)
224  !
225  ! -- Deallocate parent
226  call tvbase_da(this)
Here is the call graph for this function:

◆ tvs_get_pointer_to_value()

real(dp) function, pointer tvsmodule::tvs_get_pointer_to_value ( class(tvstype this,
integer(i4b), intent(in)  n,
character(len=*), intent(in)  varName 
)
private

Return a pointer to the given node's value in the appropriate STO array based on the given variable name string.

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

121  ! -- dummy
122  class(TvsType) :: this
123  integer(I4B), intent(in) :: n
124  character(len=*), intent(in) :: varName
125  ! -- return
126  real(DP), pointer :: bndElem
127  !
128  select case (varname)
129  case ('SS')
130  bndelem => this%ss(n)
131  case ('SY')
132  bndelem => this%sy(n)
133  case default
134  bndelem => null()
135  end select

◆ tvs_read_option()

logical function tvsmodule::tvs_read_option ( class(tvstype this,
character(len=*), intent(in)  keyword 
)
private

Process a single TVS-specific option. Used when reading the OPTIONS block of the TVS package input file.

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

95  ! -- dummy
96  class(TvsType) :: this
97  character(len=*), intent(in) :: keyword
98  ! -- return
99  logical :: success
100  ! -- formats
101  character(len=*), parameter :: fmtdsci = &
102  "(4X, 'DISABLE_STORAGE_CHANGE_INTEGRATION OPTION:', /, 1X, &
103  &'Storage derivative terms will not be added to STO matrix formulation')"
104  !
105  select case (keyword)
106  case ('DISABLE_STORAGE_CHANGE_INTEGRATION')
107  success = .true.
108  this%integratechanges = 0
109  write (this%iout, fmtdsci)
110  case default
111  success = .false.
112  end select

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

160  ! -- dummy
161  class(TvsType) :: this
162  !
163  ! -- No need to record TVS/STO changes, as no other packages cache
164  ! -- 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 143 of file gwf-tvs.f90.

144  ! -- dummy
145  class(TvsType) :: this
146  integer(I4B), intent(in) :: kper
147  integer(I4B), intent(in) :: kstp
148  !
149  ! -- No need to record TVS/STO changes, as no other packages cache
150  ! -- Ss or Sy values

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

174  ! -- dummy
175  class(TvsType) :: this
176  integer(I4B), intent(in) :: n
177  character(len=*), intent(in) :: varName
178  ! -- local
179  character(len=LINELENGTH) :: cellstr
180  ! -- formats
181  character(len=*), parameter :: fmtserr = &
182  "(1x, a, ' changed storage property ', a, ' is < 0 for cell ', a,' ', &
183  &1pg15.6)"
184  character(len=*), parameter :: fmtsyerr = &
185  "(1x, a, ' cannot change ', a ,' for cell ', a, ' because SY is unused &
186  &in this model (all ICONVERT flags are 0).')"
187  !
188  ! -- Check the changed value is ok and convert to storage capacity
189  if (varname == 'SS') then
190  if (this%ss(n) < dzero) then
191  call this%dis%noder_to_string(n, cellstr)
192  write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SS', &
193  trim(cellstr), this%ss(n)
194  call store_error(errmsg)
195  end if
196  elseif (varname == 'SY') then
197  if (this%iusesy /= 1) then
198  call this%dis%noder_to_string(n, cellstr)
199  write (errmsg, fmtsyerr) trim(adjustl(this%packName)), 'SY', &
200  trim(cellstr)
201  call store_error(errmsg)
202  elseif (this%sy(n) < dzero) then
203  call this%dis%noder_to_string(n, cellstr)
204  write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SY', &
205  trim(cellstr), this%sy(n)
206  call store_error(errmsg)
207  end if
208  end if
Here is the call graph for this function: