MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
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 67 of file gwf-tvs.f90.

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

237  ! -- dummy
238  class(TvsType) :: this
239  !
240  ! -- Nullify pointers to other package variables
241  nullify (this%integratechanges)
242  nullify (this%iusesy)
243  nullify (this%ss)
244  nullify (this%sy)
245  !
246  ! -- Deallocate parent
247  call tvbase_da(this)
248  !
249  ! -- Return
250  return
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 129 of file gwf-tvs.f90.

130  ! -- dummy
131  class(TvsType) :: this
132  integer(I4B), intent(in) :: n
133  character(len=*), intent(in) :: varName
134  ! -- return
135  real(DP), pointer :: bndElem
136  !
137  select case (varname)
138  case ('SS')
139  bndelem => this%ss(n)
140  case ('SY')
141  bndelem => this%sy(n)
142  case default
143  bndelem => null()
144  end select
145  !
146  ! -- Return
147  return

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

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

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

175  ! -- dummy
176  class(TvsType) :: this
177  !
178  ! -- No need to record TVS/STO changes, as no other packages cache
179  ! -- Ss or Sy values
180  !
181  ! -- Return
182  return

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

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

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

192  ! -- dummy
193  class(TvsType) :: this
194  integer(I4B), intent(in) :: n
195  character(len=*), intent(in) :: varName
196  ! -- local
197  character(len=LINELENGTH) :: cellstr
198  ! -- formats
199  character(len=*), parameter :: fmtserr = &
200  "(1x, a, ' changed storage property ', a, ' is < 0 for cell ', a,' ', &
201  &1pg15.6)"
202  character(len=*), parameter :: fmtsyerr = &
203  "(1x, a, ' cannot change ', a ,' for cell ', a, ' because SY is unused &
204  &in this model (all ICONVERT flags are 0).')"
205  !
206  ! -- Check the changed value is ok and convert to storage capacity
207  if (varname == 'SS') then
208  if (this%ss(n) < dzero) then
209  call this%dis%noder_to_string(n, cellstr)
210  write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SS', &
211  trim(cellstr), this%ss(n)
212  call store_error(errmsg)
213  end if
214  elseif (varname == 'SY') then
215  if (this%iusesy /= 1) then
216  call this%dis%noder_to_string(n, cellstr)
217  write (errmsg, fmtsyerr) trim(adjustl(this%packName)), 'SY', &
218  trim(cellstr)
219  call store_error(errmsg)
220  elseif (this%sy(n) < dzero) then
221  call this%dis%noder_to_string(n, cellstr)
222  write (errmsg, fmtserr) trim(adjustl(this%packName)), 'SY', &
223  trim(cellstr), this%sy(n)
224  call store_error(errmsg)
225  end if
226  end if
227  !
228  ! -- Return
229  return
Here is the call graph for this function: