MODFLOW 6  version 6.9.0.dev0
USGS Modular Hydrologic Model
tvkmodule Module Reference

This module contains time-varying conductivity package methods. More...

Data Types

type  tvktype
 

Functions/Subroutines

subroutine, public tvk_cr (tvk, name_model, mempath, inunit, iout)
 Create a new TvkType object. More...
 
subroutine tvk_ar_set_pointers (this)
 Announce package and set pointers to variables. More...
 
subroutine tvk_apply_row_changes (this, nodeu, node)
 Apply this node's K/K22/K33 input values to node. More...
 
subroutine tvk_set_changed_at (this, kper, kstp)
 Mark property changes as having occurred at (kper, kstp) More...
 
subroutine tvk_reset_change_flags (this)
 Clear all per-node change flags. More...
 
subroutine tvk_validate_change (this, n, varName)
 Check that a given property value is valid. More...
 
subroutine tvk_da (this)
 Deallocate package memory. More...
 

Detailed Description

This module contains the methods used to allow hydraulic conductivity parameters in the NPF package (K11, K22, K33) to be varied throughout a simulation.

Function/Subroutine Documentation

◆ tvk_apply_row_changes()

subroutine tvkmodule::tvk_apply_row_changes ( class(tvktype 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 107 of file gwf-tvk.f90.

108  ! -- dummy
109  class(TvkType) :: this
110  integer(I4B), intent(in) :: nodeu
111  integer(I4B), intent(in) :: node
112  ! -- local
113  character(len=LINELENGTH) :: cellstr
114  ! -- formats
115  character(len=*), parameter :: fmtvalchg = &
116  "(a, ' package: Setting ', a, ' value for cell ', a, ' at start of &
117  &stress period ', i0, ' = ', g12.5)"
118  !
119  ! -- K is processed before K22/K33 so that validate_change can use
120  ! -- the already-updated k11 value when ik22overk/ik33overk are set.
121  if (this%k11_src(nodeu) /= dnodata) then
122  if (node < 1 .or. node > this%dis%nodes) then
123  call this%dis%noder_to_string(node, cellstr)
124  write (errmsg, '(a,2(1x,a))') &
125  'CELLID', trim(cellstr), 'is not in the active model domain.'
126  call store_error(errmsg)
127  else
128  this%k11(node) = this%k11_src(nodeu)
129  call this%validate_change(node, 'K')
130  if (this%iprpak /= 0) then
131  call this%dis%noder_to_string(node, cellstr)
132  write (this%iout, fmtvalchg) &
133  trim(adjustl(this%packName)), 'K', trim(cellstr), kper, &
134  this%k11(node)
135  end if
136  end if
137  end if
138  !
139  if (this%k22_src(nodeu) /= dnodata) then
140  if (node < 1 .or. node > this%dis%nodes) then
141  call this%dis%noder_to_string(node, cellstr)
142  write (errmsg, '(a,2(1x,a))') &
143  'CELLID', trim(cellstr), 'is not in the active model domain.'
144  call store_error(errmsg)
145  else
146  this%k22(node) = this%k22_src(nodeu)
147  call this%validate_change(node, 'K22')
148  if (this%iprpak /= 0) then
149  call this%dis%noder_to_string(node, cellstr)
150  write (this%iout, fmtvalchg) &
151  trim(adjustl(this%packName)), 'K22', trim(cellstr), kper, &
152  this%k22(node)
153  end if
154  end if
155  end if
156  !
157  if (this%k33_src(nodeu) /= dnodata) then
158  if (node < 1 .or. node > this%dis%nodes) then
159  call this%dis%noder_to_string(node, cellstr)
160  write (errmsg, '(a,2(1x,a))') &
161  'CELLID', trim(cellstr), 'is not in the active model domain.'
162  call store_error(errmsg)
163  else
164  this%k33(node) = this%k33_src(nodeu)
165  call this%validate_change(node, 'K33')
166  if (this%iprpak /= 0) then
167  call this%dis%noder_to_string(node, cellstr)
168  write (this%iout, fmtvalchg) &
169  trim(adjustl(this%packName)), 'K33', trim(cellstr), kper, &
170  this%k33(node)
171  end if
172  end if
173  end if
Here is the call graph for this function:

◆ tvk_ar_set_pointers()

subroutine tvkmodule::tvk_ar_set_pointers ( class(tvktype this)
private

Announce package version and set array and variable pointers from the NPF package for access by TVK.

Definition at line 72 of file gwf-tvk.f90.

73  ! -- dummy
74  class(TvkType) :: this
75  ! -- local
76  character(len=LENMEMPATH) :: npfMemoryPath
77  ! -- formats
78  character(len=*), parameter :: fmttvk = &
79  "(1x,/1x,'TVK -- TIME-VARYING K PACKAGE, VERSION 1, 08/18/2021', &
80  &' INPUT READ FROM MEMPATH ', A, //)"
81  !
82  write (this%iout, fmttvk) this%input_mempath
83  !
84  npfmemorypath = create_mem_path(this%name_model, 'NPF')
85  call mem_setptr(this%ik22overk, 'IK22OVERK', npfmemorypath)
86  call mem_setptr(this%ik33overk, 'IK33OVERK', npfmemorypath)
87  call mem_setptr(this%k11, 'K11', npfmemorypath)
88  call mem_setptr(this%k22, 'K22', npfmemorypath)
89  call mem_setptr(this%k33, 'K33', npfmemorypath)
90  call mem_setptr(this%kchangeper, 'KCHANGEPER', npfmemorypath)
91  call mem_setptr(this%kchangestp, 'KCHANGESTP', npfmemorypath)
92  call mem_setptr(this%nodekchange, 'NODEKCHANGE', npfmemorypath)
93  !
94  ! -- set input mempath pointers
95  call mem_setptr(this%k11_src, 'K', this%input_mempath)
96  call mem_setptr(this%k22_src, 'K22', this%input_mempath)
97  call mem_setptr(this%k33_src, 'K33', this%input_mempath)
Here is the call graph for this function:

◆ tvk_cr()

subroutine, public tvkmodule::tvk_cr ( type(tvktype), intent(out), pointer  tvk,
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 conductivity (TvkType) object.

Definition at line 55 of file gwf-tvk.f90.

56  ! -- dummy
57  type(TvkType), pointer, intent(out) :: tvk
58  character(len=*), intent(in) :: name_model
59  character(len=*), intent(in) :: mempath
60  integer(I4B), intent(in) :: inunit
61  integer(I4B), intent(in) :: iout
62  !
63  allocate (tvk)
64  call tvk%init(name_model, 'TVK', 'TVK', mempath, inunit, iout)
Here is the caller graph for this function:

◆ tvk_da()

subroutine tvkmodule::tvk_da ( class(tvktype this)
private

Deallocate TVK package scalars and arrays.

Definition at line 265 of file gwf-tvk.f90.

266  ! -- dummy
267  class(TvkType) :: this
268  !
269  nullify (this%ik22overk)
270  nullify (this%ik33overk)
271  nullify (this%k11)
272  nullify (this%k22)
273  nullify (this%k33)
274  nullify (this%kchangeper)
275  nullify (this%kchangestp)
276  nullify (this%nodekchange)
277  nullify (this%k11_src)
278  nullify (this%k22_src)
279  nullify (this%k33_src)
280  call tvbase_da(this)
Here is the call graph for this function:

◆ tvk_reset_change_flags()

subroutine tvkmodule::tvk_reset_change_flags ( class(tvktype 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 197 of file gwf-tvk.f90.

198  ! -- dummy variables
199  class(TvkType) :: this
200  ! -- local variables
201  integer(I4B) :: i
202  !
203  do i = 1, this%dis%nodes
204  this%nodekchange(i) = 0
205  end do

◆ tvk_set_changed_at()

subroutine tvkmodule::tvk_set_changed_at ( class(tvktype 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 181 of file gwf-tvk.f90.

182  ! -- dummy
183  class(TvkType) :: this
184  integer(I4B), intent(in) :: kper
185  integer(I4B), intent(in) :: kstp
186  !
187  this%kchangeper = kper
188  this%kchangestp = kstp

◆ tvk_validate_change()

subroutine tvkmodule::tvk_validate_change ( class(tvktype 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. Update K22 and K33 values appropriately when specified as anisotropy.

Definition at line 215 of file gwf-tvk.f90.

216  ! -- dummy
217  class(TvkType) :: this
218  integer(I4B), intent(in) :: n
219  character(len=*), intent(in) :: varName
220  ! -- local
221  character(len=LINELENGTH) :: cellstr
222  ! -- formats
223  character(len=*), parameter :: fmtkerr = &
224  "(1x, a, ' changed hydraulic property ', a, ' is <= 0 for cell ', a, &
225  &' ', 1pg15.6)"
226  !
227  ! -- Mark the node as being changed this time step
228  this%nodekchange(n) = 1
229  !
230  ! -- Check the changed value is ok
231  if (varname == 'K') then
232  if (this%k11(n) <= dzero) then
233  call this%dis%noder_to_string(n, cellstr)
234  write (errmsg, fmtkerr) &
235  trim(adjustl(this%packName)), 'K', trim(cellstr), this%k11(n)
236  call store_error(errmsg)
237  end if
238  elseif (varname == 'K22') then
239  if (this%ik22overk == 1) then
240  this%k22(n) = this%k22(n) * this%k11(n)
241  end if
242  if (this%k22(n) <= dzero) then
243  call this%dis%noder_to_string(n, cellstr)
244  write (errmsg, fmtkerr) &
245  trim(adjustl(this%packName)), 'K22', trim(cellstr), this%k22(n)
246  call store_error(errmsg)
247  end if
248  elseif (varname == 'K33') then
249  if (this%ik33overk == 1) then
250  this%k33(n) = this%k33(n) * this%k11(n)
251  end if
252  if (this%k33(n) <= dzero) then
253  call this%dis%noder_to_string(n, cellstr)
254  write (errmsg, fmtkerr) &
255  trim(adjustl(this%packName)), 'K33', trim(cellstr), this%k33(n)
256  call store_error(errmsg)
257  end if
258  end if
Here is the call graph for this function: