MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
gwtlktmodule Module Reference

Data Types

type  gwtlkttype
 

Functions/Subroutines

subroutine, public lkt_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, eqnsclfac, dvt, dvu, dvua)
 Create a new lkt package. More...
 
subroutine find_lkt_package (this)
 Find corresponding lkt package. More...
 
subroutine lkt_fc_expanded (this, rhs, ia, idxglo, matrix_sln)
 Add matrix terms related to LKT. More...
 
subroutine lkt_solve (this)
 Add terms specific to lakes to the explicit lake solve. More...
 
integer(i4b) function lkt_get_nbudterms (this)
 Function to return the number of budget terms just for this package. More...
 
subroutine lkt_setup_budobj (this, idx)
 Set up the budget object that stores all the lake flows. More...
 
subroutine lkt_fill_budobj (this, idx, x, flowja, ccratin, ccratout)
 Copy flow terms into thisbudobj. More...
 
subroutine allocate_scalars (this)
 Allocate scalars specific to the lake mass transport (LKT) package. More...
 
subroutine lkt_allocate_arrays (this)
 Allocate arrays specific to the lake mass transport (LKT) package. More...
 
subroutine lkt_da (this)
 Deallocate memory. More...
 
subroutine lkt_rain_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Rain term. More...
 
subroutine lkt_evap_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Evaporative term. More...
 
subroutine lkt_roff_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Runoff term. More...
 
subroutine lkt_iflw_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Inflow Term. More...
 
subroutine lkt_wdrl_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Specified withdrawal term. More...
 
subroutine lkt_outf_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Outflow term. More...
 
subroutine lkt_df_obs (this)
 Defined observation types. More...
 
subroutine lkt_rp_obs (this, obsrv, found)
 Process package specific obs. More...
 
subroutine lkt_bd_obs (this, obstypeid, jj, v, found)
 Calculate observation value and pass it back to APT. More...
 
subroutine lkt_set_stressperiod (this, itemno, keyword, found)
 Sets the stress period attributes for keyword use. More...
 

Variables

character(len= *), parameter ftype = 'LKT'
 
character(len= *), parameter flowtype = 'LAK'
 
character(len=16) text = ' LKT'
 

Function/Subroutine Documentation

◆ allocate_scalars()

subroutine gwtlktmodule::allocate_scalars ( class(gwtlkttype this)

Definition at line 606 of file gwt-lkt.f90.

607  ! -- modules
609  ! -- dummy
610  class(GwtLktType) :: this
611  ! -- local
612  !
613  ! -- allocate scalars in TspAptType
614  call this%TspAptType%allocate_scalars()
615  !
616  ! -- Allocate
617  call mem_allocate(this%idxbudrain, 'IDXBUDRAIN', this%memoryPath)
618  call mem_allocate(this%idxbudevap, 'IDXBUDEVAP', this%memoryPath)
619  call mem_allocate(this%idxbudroff, 'IDXBUDROFF', this%memoryPath)
620  call mem_allocate(this%idxbudiflw, 'IDXBUDIFLW', this%memoryPath)
621  call mem_allocate(this%idxbudwdrl, 'IDXBUDWDRL', this%memoryPath)
622  call mem_allocate(this%idxbudoutf, 'IDXBUDOUTF', this%memoryPath)
623  !
624  ! -- Initialize
625  this%idxbudrain = 0
626  this%idxbudevap = 0
627  this%idxbudroff = 0
628  this%idxbudiflw = 0
629  this%idxbudwdrl = 0
630  this%idxbudoutf = 0

◆ find_lkt_package()

subroutine gwtlktmodule::find_lkt_package ( class(gwtlkttype this)

Definition at line 152 of file gwt-lkt.f90.

153  ! -- modules
155  ! -- dummy
156  class(GwtLktType) :: this
157  ! -- local
158  character(len=LINELENGTH) :: errmsg
159  class(BndType), pointer :: packobj
160  integer(I4B) :: ip, icount
161  integer(I4B) :: nbudterm
162  logical :: found
163  !
164  ! -- Initialize found to false, and error later if flow package cannot
165  ! be found
166  found = .false.
167  !
168  ! -- If user is specifying flows in a binary budget file, then set up
169  ! the budget file reader, otherwise set a pointer to the flow package
170  ! budobj
171  if (this%fmi%flows_from_file) then
172  call this%fmi%set_aptbudobj_pointer(this%flowpackagename, this%flowbudptr)
173  if (associated(this%flowbudptr)) found = .true.
174  !
175  else
176  if (associated(this%fmi%gwfbndlist)) then
177  ! -- Look through gwfbndlist for a flow package with the same name as
178  ! this transport package name
179  do ip = 1, this%fmi%gwfbndlist%Count()
180  packobj => getbndfromlist(this%fmi%gwfbndlist, ip)
181  if (packobj%packName == this%flowpackagename) then
182  found = .true.
183  !
184  ! -- store BndType pointer to packobj, and then
185  ! use the select type to point to the budobj in flow package
186  this%flowpackagebnd => packobj
187  select type (packobj)
188  type is (laktype)
189  this%flowbudptr => packobj%budobj
190  end select
191  end if
192  if (found) exit
193  end do
194  end if
195  end if
196  !
197  ! -- error if flow package not found
198  if (.not. found) then
199  write (errmsg, '(a)') 'Could not find flow package with name '&
200  &//trim(adjustl(this%flowpackagename))//'.'
201  call store_error(errmsg)
202  call this%parser%StoreErrorUnit()
203  end if
204  !
205  ! -- allocate space for idxbudssm, which indicates whether this is a
206  ! special budget term or one that is a general source and sink
207  nbudterm = this%flowbudptr%nbudterm
208  call mem_allocate(this%idxbudssm, nbudterm, 'IDXBUDSSM', this%memoryPath)
209  !
210  ! -- Process budget terms and identify special budget terms
211  write (this%iout, '(/, a, a)') &
212  'PROCESSING '//ftype//' INFORMATION FOR ', this%packName
213  write (this%iout, '(a)') ' IDENTIFYING FLOW TERMS IN '//flowtype//' PACKAGE'
214  write (this%iout, '(a, i0)') &
215  ' NUMBER OF '//flowtype//' = ', this%flowbudptr%ncv
216  icount = 1
217  do ip = 1, this%flowbudptr%nbudterm
218  select case (trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)))
219  case ('FLOW-JA-FACE')
220  this%idxbudfjf = ip
221  this%idxbudssm(ip) = 0
222  case ('GWF')
223  this%idxbudgwf = ip
224  this%idxbudssm(ip) = 0
225  case ('STORAGE')
226  this%idxbudsto = ip
227  this%idxbudssm(ip) = 0
228  case ('RAINFALL')
229  this%idxbudrain = ip
230  this%idxbudssm(ip) = 0
231  case ('EVAPORATION')
232  this%idxbudevap = ip
233  this%idxbudssm(ip) = 0
234  case ('RUNOFF')
235  this%idxbudroff = ip
236  this%idxbudssm(ip) = 0
237  case ('EXT-INFLOW')
238  this%idxbudiflw = ip
239  this%idxbudssm(ip) = 0
240  case ('WITHDRAWAL')
241  this%idxbudwdrl = ip
242  this%idxbudssm(ip) = 0
243  case ('EXT-OUTFLOW')
244  this%idxbudoutf = ip
245  this%idxbudssm(ip) = 0
246  case ('TO-MVR')
247  this%idxbudtmvr = ip
248  this%idxbudssm(ip) = 0
249  case ('FROM-MVR')
250  this%idxbudfmvr = ip
251  this%idxbudssm(ip) = 0
252  case ('AUXILIARY')
253  this%idxbudaux = ip
254  this%idxbudssm(ip) = 0
255  case default
256  !
257  ! -- set idxbudssm equal to a column index for where the concentrations
258  ! are stored in the concbud(nbudssm, ncv) array
259  this%idxbudssm(ip) = icount
260  icount = icount + 1
261  end select
262  write (this%iout, '(a, i0, " = ", a,/, a, i0)') &
263  ' TERM ', ip, trim(adjustl(this%flowbudptr%budterm(ip)%flowtype)), &
264  ' MAX NO. OF ENTRIES = ', this%flowbudptr%budterm(ip)%maxlist
265  end do
266  write (this%iout, '(a, //)') 'DONE PROCESSING '//ftype//' INFORMATION'
Here is the call graph for this function:

◆ lkt_allocate_arrays()

subroutine gwtlktmodule::lkt_allocate_arrays ( class(gwtlkttype), intent(inout)  this)

Definition at line 636 of file gwt-lkt.f90.

637  ! -- modules
639  ! -- dummy
640  class(GwtLktType), intent(inout) :: this
641  ! -- local
642  integer(I4B) :: n
643  !
644  ! -- time series
645  call mem_allocate(this%concrain, this%ncv, 'CONCRAIN', this%memoryPath)
646  call mem_allocate(this%concevap, this%ncv, 'CONCEVAP', this%memoryPath)
647  call mem_allocate(this%concroff, this%ncv, 'CONCROFF', this%memoryPath)
648  call mem_allocate(this%conciflw, this%ncv, 'CONCIFLW', this%memoryPath)
649  !
650  ! -- call standard TspAptType allocate arrays
651  call this%TspAptType%apt_allocate_arrays()
652  !
653  ! -- Initialize
654  do n = 1, this%ncv
655  this%concrain(n) = dzero
656  this%concevap(n) = dzero
657  this%concroff(n) = dzero
658  this%conciflw(n) = dzero
659  end do
660  !

◆ lkt_bd_obs()

subroutine gwtlktmodule::lkt_bd_obs ( class(gwtlkttype), intent(inout)  this,
character(len=*), intent(in)  obstypeid,
integer(i4b), intent(in)  jj,
real(dp), intent(inout)  v,
logical, intent(inout)  found 
)

Definition at line 971 of file gwt-lkt.f90.

972  ! -- dummy
973  class(GwtLktType), intent(inout) :: this
974  character(len=*), intent(in) :: obstypeid
975  real(DP), intent(inout) :: v
976  integer(I4B), intent(in) :: jj
977  logical, intent(inout) :: found
978  ! -- local
979  integer(I4B) :: n1, n2
980  !
981  found = .true.
982  select case (obstypeid)
983  case ('RAINFALL')
984  if (this%iboundpak(jj) /= 0) then
985  call this%lkt_rain_term(jj, n1, n2, v)
986  end if
987  case ('EVAPORATION')
988  if (this%iboundpak(jj) /= 0) then
989  call this%lkt_evap_term(jj, n1, n2, v)
990  end if
991  case ('RUNOFF')
992  if (this%iboundpak(jj) /= 0) then
993  call this%lkt_roff_term(jj, n1, n2, v)
994  end if
995  case ('EXT-INFLOW')
996  if (this%iboundpak(jj) /= 0) then
997  call this%lkt_iflw_term(jj, n1, n2, v)
998  end if
999  case ('WITHDRAWAL')
1000  if (this%iboundpak(jj) /= 0) then
1001  call this%lkt_wdrl_term(jj, n1, n2, v)
1002  end if
1003  case ('EXT-OUTFLOW')
1004  if (this%iboundpak(jj) /= 0) then
1005  call this%lkt_outf_term(jj, n1, n2, v)
1006  end if
1007  case default
1008  found = .false.
1009  end select

◆ lkt_create()

subroutine, public gwtlktmodule::lkt_create ( class(bndtype), pointer  packobj,
integer(i4b), intent(in)  id,
integer(i4b), intent(in)  ibcnum,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
character(len=*), intent(in)  namemodel,
character(len=*), intent(in)  pakname,
type(tspfmitype), pointer  fmi,
real(dp), intent(in), pointer  eqnsclfac,
character(len=*), intent(in)  dvt,
character(len=*), intent(in)  dvu,
character(len=*), intent(in)  dvua 
)
Parameters
[in]eqnsclfacgoverning equation scale factor
[in]dvtFor GWT, set to "CONCENTRATION" in TspAptType
[in]dvuFor GWT, set to "mass" in TspAptType
[in]dvuaFor GWT, set to "M" in TspAptType

Definition at line 97 of file gwt-lkt.f90.

99  ! -- dummy
100  class(BndType), pointer :: packobj
101  integer(I4B), intent(in) :: id
102  integer(I4B), intent(in) :: ibcnum
103  integer(I4B), intent(in) :: inunit
104  integer(I4B), intent(in) :: iout
105  character(len=*), intent(in) :: namemodel
106  character(len=*), intent(in) :: pakname
107  type(TspFmiType), pointer :: fmi
108  real(DP), intent(in), pointer :: eqnsclfac !< governing equation scale factor
109  character(len=*), intent(in) :: dvt !< For GWT, set to "CONCENTRATION" in TspAptType
110  character(len=*), intent(in) :: dvu !< For GWT, set to "mass" in TspAptType
111  character(len=*), intent(in) :: dvua !< For GWT, set to "M" in TspAptType
112  ! -- local
113  type(GwtLktType), pointer :: lktobj
114  !
115  ! -- allocate the object and assign values to object variables
116  allocate (lktobj)
117  packobj => lktobj
118  !
119  ! -- create name and memory path
120  call packobj%set_names(ibcnum, namemodel, pakname, ftype)
121  packobj%text = text
122  !
123  ! -- allocate scalars
124  call lktobj%allocate_scalars()
125  !
126  ! -- initialize package
127  call packobj%pack_initialize()
128 
129  packobj%inunit = inunit
130  packobj%iout = iout
131  packobj%id = id
132  packobj%ibcnum = ibcnum
133  packobj%ncolbnd = 1
134  packobj%iscloc = 1
135 
136  ! -- Store pointer to flow model interface. When the GwfGwt exchange is
137  ! created, it sets fmi%bndlist so that the GWT model has access to all
138  ! the flow packages
139  lktobj%fmi => fmi
140  !
141  ! -- Store pointer to governing equation scale factor
142  lktobj%eqnsclfac => eqnsclfac
143  !
144  ! -- Set labels that will be used in generalized APT class
145  lktobj%depvartype = dvt
146  lktobj%depvarunit = dvu
147  lktobj%depvarunitabbrev = dvua
Here is the caller graph for this function:

◆ lkt_da()

subroutine gwtlktmodule::lkt_da ( class(gwtlkttype this)

Definition at line 665 of file gwt-lkt.f90.

666  ! -- modules
668  ! -- dummy
669  class(GwtLktType) :: this
670  ! -- local
671  !
672  ! -- deallocate scalars
673  call mem_deallocate(this%idxbudrain)
674  call mem_deallocate(this%idxbudevap)
675  call mem_deallocate(this%idxbudroff)
676  call mem_deallocate(this%idxbudiflw)
677  call mem_deallocate(this%idxbudwdrl)
678  call mem_deallocate(this%idxbudoutf)
679  !
680  ! -- deallocate time series
681  call mem_deallocate(this%concrain)
682  call mem_deallocate(this%concevap)
683  call mem_deallocate(this%concroff)
684  call mem_deallocate(this%conciflw)
685  !
686  ! -- deallocate scalars in TspAptType
687  call this%TspAptType%bnd_da()

◆ lkt_df_obs()

subroutine gwtlktmodule::lkt_df_obs ( class(gwtlkttype this)

Store the observation type supported by the APT package and override BndTypebnd_df_obs

Definition at line 863 of file gwt-lkt.f90.

864  ! -- modules
865  ! -- dummy
866  class(GwtLktType) :: this
867  ! -- local
868  integer(I4B) :: indx
869  !
870  ! -- Store obs type and assign procedure pointer
871  ! for concentration observation type.
872  call this%obs%StoreObsType('concentration', .false., indx)
873  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
874  !
875  ! -- Store obs type and assign procedure pointer
876  ! for flow between features, such as lake to lake.
877  call this%obs%StoreObsType('flow-ja-face', .true., indx)
878  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid12
879  !
880  ! -- Store obs type and assign procedure pointer
881  ! for from-mvr observation type.
882  call this%obs%StoreObsType('from-mvr', .true., indx)
883  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
884  !
885  ! -- Store obs type and assign procedure pointer
886  ! for to-mvr observation type.
887  call this%obs%StoreObsType('to-mvr', .true., indx)
888  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
889  !
890  ! -- Store obs type and assign procedure pointer
891  ! for storage observation type.
892  call this%obs%StoreObsType('storage', .true., indx)
893  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
894  !
895  ! -- Store obs type and assign procedure pointer
896  ! for constant observation type.
897  call this%obs%StoreObsType('constant', .true., indx)
898  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
899  !
900  ! -- Store obs type and assign procedure pointer
901  ! for observation type: lkt
902  call this%obs%StoreObsType('lkt', .true., indx)
903  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid12
904  !
905  ! -- Store obs type and assign procedure pointer
906  ! for rainfall observation type.
907  call this%obs%StoreObsType('rainfall', .true., indx)
908  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
909  !
910  ! -- Store obs type and assign procedure pointer
911  ! for evaporation observation type.
912  call this%obs%StoreObsType('evaporation', .true., indx)
913  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
914  !
915  ! -- Store obs type and assign procedure pointer
916  ! for runoff observation type.
917  call this%obs%StoreObsType('runoff', .true., indx)
918  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
919  !
920  ! -- Store obs type and assign procedure pointer
921  ! for inflow observation type.
922  call this%obs%StoreObsType('ext-inflow', .true., indx)
923  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
924  !
925  ! -- Store obs type and assign procedure pointer
926  ! for withdrawal observation type.
927  call this%obs%StoreObsType('withdrawal', .true., indx)
928  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
929  !
930  ! -- Store obs type and assign procedure pointer
931  ! for ext-outflow observation type.
932  call this%obs%StoreObsType('ext-outflow', .true., indx)
933  this%obs%obsData(indx)%ProcessIdPtr => apt_process_obsid
Here is the call graph for this function:

◆ lkt_evap_term()

subroutine gwtlktmodule::lkt_evap_term ( class(gwtlkttype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)

Definition at line 717 of file gwt-lkt.f90.

719  ! -- dummy
720  class(GwtLktType) :: this
721  integer(I4B), intent(in) :: ientry
722  integer(I4B), intent(inout) :: n1
723  integer(I4B), intent(inout) :: n2
724  real(DP), intent(inout), optional :: rrate
725  real(DP), intent(inout), optional :: rhsval
726  real(DP), intent(inout), optional :: hcofval
727  ! -- local
728  real(DP) :: qbnd
729  real(DP) :: ctmp
730  real(DP) :: omega
731  !
732  n1 = this%flowbudptr%budterm(this%idxbudevap)%id1(ientry)
733  n2 = this%flowbudptr%budterm(this%idxbudevap)%id2(ientry)
734  ! -- note that qbnd is negative for evap
735  qbnd = this%flowbudptr%budterm(this%idxbudevap)%flow(ientry)
736  ctmp = this%concevap(n1)
737  if (this%xnewpak(n1) < ctmp) then
738  omega = done
739  else
740  omega = dzero
741  end if
742  if (present(rrate)) &
743  rrate = omega * qbnd * this%xnewpak(n1) + &
744  (done - omega) * qbnd * ctmp
745  if (present(rhsval)) rhsval = -(done - omega) * qbnd * ctmp
746  if (present(hcofval)) hcofval = omega * qbnd

◆ lkt_fc_expanded()

subroutine gwtlktmodule::lkt_fc_expanded ( class(gwtlkttype this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)

This will be called from TspAptTypeapt_fc_expanded() in order to add matrix terms specifically for LKT

Definition at line 274 of file gwt-lkt.f90.

275  ! -- modules
276  ! -- dummy
277  class(GwtLktType) :: this
278  real(DP), dimension(:), intent(inout) :: rhs
279  integer(I4B), dimension(:), intent(in) :: ia
280  integer(I4B), dimension(:), intent(in) :: idxglo
281  class(MatrixBaseType), pointer :: matrix_sln
282  ! -- local
283  integer(I4B) :: j, n1, n2
284  integer(I4B) :: iloc
285  integer(I4B) :: iposd
286  real(DP) :: rrate
287  real(DP) :: rhsval
288  real(DP) :: hcofval
289  !
290  ! -- add rainfall contribution
291  if (this%idxbudrain /= 0) then
292  do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
293  call this%lkt_rain_term(j, n1, n2, rrate, rhsval, hcofval)
294  iloc = this%idxlocnode(n1)
295  iposd = this%idxpakdiag(n1)
296  call matrix_sln%add_value_pos(iposd, hcofval)
297  rhs(iloc) = rhs(iloc) + rhsval
298  end do
299  end if
300  !
301  ! -- add evaporation contribution
302  if (this%idxbudevap /= 0) then
303  do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
304  call this%lkt_evap_term(j, n1, n2, rrate, rhsval, hcofval)
305  iloc = this%idxlocnode(n1)
306  iposd = this%idxpakdiag(n1)
307  call matrix_sln%add_value_pos(iposd, hcofval)
308  rhs(iloc) = rhs(iloc) + rhsval
309  end do
310  end if
311  !
312  ! -- add runoff contribution
313  if (this%idxbudroff /= 0) then
314  do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
315  call this%lkt_roff_term(j, n1, n2, rrate, rhsval, hcofval)
316  iloc = this%idxlocnode(n1)
317  iposd = this%idxpakdiag(n1)
318  call matrix_sln%add_value_pos(iposd, hcofval)
319  rhs(iloc) = rhs(iloc) + rhsval
320  end do
321  end if
322  !
323  ! -- add inflow contribution
324  if (this%idxbudiflw /= 0) then
325  do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
326  call this%lkt_iflw_term(j, n1, n2, rrate, rhsval, hcofval)
327  iloc = this%idxlocnode(n1)
328  iposd = this%idxpakdiag(n1)
329  call matrix_sln%add_value_pos(iposd, hcofval)
330  rhs(iloc) = rhs(iloc) + rhsval
331  end do
332  end if
333  !
334  ! -- add withdrawal contribution
335  if (this%idxbudwdrl /= 0) then
336  do j = 1, this%flowbudptr%budterm(this%idxbudwdrl)%nlist
337  call this%lkt_wdrl_term(j, n1, n2, rrate, rhsval, hcofval)
338  iloc = this%idxlocnode(n1)
339  iposd = this%idxpakdiag(n1)
340  call matrix_sln%add_value_pos(iposd, hcofval)
341  rhs(iloc) = rhs(iloc) + rhsval
342  end do
343  end if
344  !
345  ! -- add outflow contribution
346  if (this%idxbudoutf /= 0) then
347  do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
348  call this%lkt_outf_term(j, n1, n2, rrate, rhsval, hcofval)
349  iloc = this%idxlocnode(n1)
350  iposd = this%idxpakdiag(n1)
351  call matrix_sln%add_value_pos(iposd, hcofval)
352  rhs(iloc) = rhs(iloc) + rhsval
353  end do
354  end if

◆ lkt_fill_budobj()

subroutine gwtlktmodule::lkt_fill_budobj ( class(gwtlkttype this,
integer(i4b), intent(inout)  idx,
real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(inout), contiguous  flowja,
real(dp), intent(inout)  ccratin,
real(dp), intent(inout)  ccratout 
)

Definition at line 527 of file gwt-lkt.f90.

528  ! -- modules
529  ! -- dummy
530  class(GwtLktType) :: this
531  integer(I4B), intent(inout) :: idx
532  real(DP), dimension(:), intent(in) :: x
533  real(DP), dimension(:), contiguous, intent(inout) :: flowja
534  real(DP), intent(inout) :: ccratin
535  real(DP), intent(inout) :: ccratout
536  ! -- local
537  integer(I4B) :: j, n1, n2
538  integer(I4B) :: nlist
539  real(DP) :: q
540  ! -- formats
541  !
542  ! -- RAIN
543  idx = idx + 1
544  nlist = this%flowbudptr%budterm(this%idxbudrain)%nlist
545  call this%budobj%budterm(idx)%reset(nlist)
546  do j = 1, nlist
547  call this%lkt_rain_term(j, n1, n2, q)
548  call this%budobj%budterm(idx)%update_term(n1, n2, q)
549  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
550  end do
551  !
552  ! -- EVAPORATION
553  idx = idx + 1
554  nlist = this%flowbudptr%budterm(this%idxbudevap)%nlist
555  call this%budobj%budterm(idx)%reset(nlist)
556  do j = 1, nlist
557  call this%lkt_evap_term(j, n1, n2, q)
558  call this%budobj%budterm(idx)%update_term(n1, n2, q)
559  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
560  end do
561  !
562  ! -- RUNOFF
563  idx = idx + 1
564  nlist = this%flowbudptr%budterm(this%idxbudroff)%nlist
565  call this%budobj%budterm(idx)%reset(nlist)
566  do j = 1, nlist
567  call this%lkt_roff_term(j, n1, n2, q)
568  call this%budobj%budterm(idx)%update_term(n1, n2, q)
569  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
570  end do
571  !
572  ! -- EXT-INFLOW
573  idx = idx + 1
574  nlist = this%flowbudptr%budterm(this%idxbudiflw)%nlist
575  call this%budobj%budterm(idx)%reset(nlist)
576  do j = 1, nlist
577  call this%lkt_iflw_term(j, n1, n2, q)
578  call this%budobj%budterm(idx)%update_term(n1, n2, q)
579  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
580  end do
581  !
582  ! -- WITHDRAWAL
583  idx = idx + 1
584  nlist = this%flowbudptr%budterm(this%idxbudwdrl)%nlist
585  call this%budobj%budterm(idx)%reset(nlist)
586  do j = 1, nlist
587  call this%lkt_wdrl_term(j, n1, n2, q)
588  call this%budobj%budterm(idx)%update_term(n1, n2, q)
589  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
590  end do
591  !
592  ! -- EXT-OUTFLOW
593  idx = idx + 1
594  nlist = this%flowbudptr%budterm(this%idxbudoutf)%nlist
595  call this%budobj%budterm(idx)%reset(nlist)
596  do j = 1, nlist
597  call this%lkt_outf_term(j, n1, n2, q)
598  call this%budobj%budterm(idx)%update_term(n1, n2, q)
599  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
600  end do

◆ lkt_get_nbudterms()

integer(i4b) function gwtlktmodule::lkt_get_nbudterms ( class(gwtlkttype this)

This overrides a function in the parent class.

Definition at line 420 of file gwt-lkt.f90.

421  ! -- modules
422  ! -- dummy
423  class(GwtLktType) :: this
424  ! -- return
425  integer(I4B) :: nbudterms
426  ! -- local
427  !
428  ! -- Number of budget terms is 6
429  nbudterms = 6

◆ lkt_iflw_term()

subroutine gwtlktmodule::lkt_iflw_term ( class(gwtlkttype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)

Accounts for mass flowing into a lake from a connected stream, for example.

Definition at line 779 of file gwt-lkt.f90.

781  ! -- dummy
782  class(GwtLktType) :: this
783  integer(I4B), intent(in) :: ientry
784  integer(I4B), intent(inout) :: n1
785  integer(I4B), intent(inout) :: n2
786  real(DP), intent(inout), optional :: rrate
787  real(DP), intent(inout), optional :: rhsval
788  real(DP), intent(inout), optional :: hcofval
789  ! -- local
790  real(DP) :: qbnd
791  real(DP) :: ctmp
792  !
793  n1 = this%flowbudptr%budterm(this%idxbudiflw)%id1(ientry)
794  n2 = this%flowbudptr%budterm(this%idxbudiflw)%id2(ientry)
795  qbnd = this%flowbudptr%budterm(this%idxbudiflw)%flow(ientry)
796  ctmp = this%conciflw(n1)
797  if (present(rrate)) rrate = ctmp * qbnd
798  if (present(rhsval)) rhsval = -rrate
799  if (present(hcofval)) hcofval = dzero

◆ lkt_outf_term()

subroutine gwtlktmodule::lkt_outf_term ( class(gwtlkttype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)

Accounts for the mass leaving a lake, for example, mass exiting a lake via a flow into a draining stream channel.

Definition at line 835 of file gwt-lkt.f90.

837  ! -- dummy
838  class(GwtLktType) :: this
839  integer(I4B), intent(in) :: ientry
840  integer(I4B), intent(inout) :: n1
841  integer(I4B), intent(inout) :: n2
842  real(DP), intent(inout), optional :: rrate
843  real(DP), intent(inout), optional :: rhsval
844  real(DP), intent(inout), optional :: hcofval
845  ! -- local
846  real(DP) :: qbnd
847  real(DP) :: ctmp
848  !
849  n1 = this%flowbudptr%budterm(this%idxbudoutf)%id1(ientry)
850  n2 = this%flowbudptr%budterm(this%idxbudoutf)%id2(ientry)
851  qbnd = this%flowbudptr%budterm(this%idxbudoutf)%flow(ientry)
852  ctmp = this%xnewpak(n1)
853  if (present(rrate)) rrate = ctmp * qbnd
854  if (present(rhsval)) rhsval = dzero
855  if (present(hcofval)) hcofval = qbnd

◆ lkt_rain_term()

subroutine gwtlktmodule::lkt_rain_term ( class(gwtlkttype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)

Definition at line 692 of file gwt-lkt.f90.

694  ! -- dummy
695  class(GwtLktType) :: this
696  integer(I4B), intent(in) :: ientry
697  integer(I4B), intent(inout) :: n1
698  integer(I4B), intent(inout) :: n2
699  real(DP), intent(inout), optional :: rrate
700  real(DP), intent(inout), optional :: rhsval
701  real(DP), intent(inout), optional :: hcofval
702  ! -- local
703  real(DP) :: qbnd
704  real(DP) :: ctmp
705  !
706  n1 = this%flowbudptr%budterm(this%idxbudrain)%id1(ientry)
707  n2 = this%flowbudptr%budterm(this%idxbudrain)%id2(ientry)
708  qbnd = this%flowbudptr%budterm(this%idxbudrain)%flow(ientry)
709  ctmp = this%concrain(n1)
710  if (present(rrate)) rrate = ctmp * qbnd
711  if (present(rhsval)) rhsval = -rrate
712  if (present(hcofval)) hcofval = dzero

◆ lkt_roff_term()

subroutine gwtlktmodule::lkt_roff_term ( class(gwtlkttype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)

Definition at line 751 of file gwt-lkt.f90.

753  ! -- dummy
754  class(GwtLktType) :: this
755  integer(I4B), intent(in) :: ientry
756  integer(I4B), intent(inout) :: n1
757  integer(I4B), intent(inout) :: n2
758  real(DP), intent(inout), optional :: rrate
759  real(DP), intent(inout), optional :: rhsval
760  real(DP), intent(inout), optional :: hcofval
761  ! -- local
762  real(DP) :: qbnd
763  real(DP) :: ctmp
764  !
765  n1 = this%flowbudptr%budterm(this%idxbudroff)%id1(ientry)
766  n2 = this%flowbudptr%budterm(this%idxbudroff)%id2(ientry)
767  qbnd = this%flowbudptr%budterm(this%idxbudroff)%flow(ientry)
768  ctmp = this%concroff(n1)
769  if (present(rrate)) rrate = ctmp * qbnd
770  if (present(rhsval)) rhsval = -rrate
771  if (present(hcofval)) hcofval = dzero

◆ lkt_rp_obs()

subroutine gwtlktmodule::lkt_rp_obs ( class(gwtlkttype), intent(inout)  this,
type(observetype), intent(inout)  obsrv,
logical, intent(inout)  found 
)

Method to process specific observations for this package.

Parameters
[in,out]thispackage class
[in,out]obsrvobservation object
[in,out]foundindicate whether observation was found

Definition at line 940 of file gwt-lkt.f90.

941  ! -- dummy
942  class(GwtLktType), intent(inout) :: this !< package class
943  type(ObserveType), intent(inout) :: obsrv !< observation object
944  logical, intent(inout) :: found !< indicate whether observation was found
945  ! -- local
946  !
947  found = .true.
948  select case (obsrv%ObsTypeId)
949  case ('RAINFALL')
950  call this%rp_obs_byfeature(obsrv)
951  case ('EVAPORATION')
952  call this%rp_obs_byfeature(obsrv)
953  case ('RUNOFF')
954  call this%rp_obs_byfeature(obsrv)
955  case ('EXT-INFLOW')
956  call this%rp_obs_byfeature(obsrv)
957  case ('WITHDRAWAL')
958  call this%rp_obs_byfeature(obsrv)
959  case ('EXT-OUTFLOW')
960  call this%rp_obs_byfeature(obsrv)
961  case ('TO-MVR')
962  call this%rp_obs_budterm(obsrv, &
963  this%flowbudptr%budterm(this%idxbudtmvr))
964  case default
965  found = .false.
966  end select

◆ lkt_set_stressperiod()

subroutine gwtlktmodule::lkt_set_stressperiod ( class(gwtlkttype), intent(inout)  this,
integer(i4b), intent(in)  itemno,
character(len=*), intent(in)  keyword,
logical, intent(inout)  found 
)

Definition at line 1014 of file gwt-lkt.f90.

1016  ! -- dummy
1017  class(GwtLktType), intent(inout) :: this
1018  integer(I4B), intent(in) :: itemno
1019  character(len=*), intent(in) :: keyword
1020  logical, intent(inout) :: found
1021  ! -- local
1022  character(len=LINELENGTH) :: text
1023  integer(I4B) :: ierr
1024  integer(I4B) :: jj
1025  real(DP), pointer :: bndElem => null()
1026  ! -- formats
1027  !
1028  ! RAINFALL <rainfall>
1029  ! EVAPORATION <evaporation>
1030  ! RUNOFF <runoff>
1031  ! EXT-INFLOW <inflow>
1032  ! WITHDRAWAL <withdrawal>
1033  !
1034  found = .true.
1035  select case (keyword)
1036  case ('RAINFALL')
1037  ierr = this%apt_check_valid(itemno)
1038  if (ierr /= 0) then
1039  goto 999
1040  end if
1041  call this%parser%GetString(text)
1042  jj = 1
1043  bndelem => this%concrain(itemno)
1044  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1045  this%packName, 'BND', this%tsManager, &
1046  this%iprpak, 'RAINFALL')
1047  case ('EVAPORATION')
1048  ierr = this%apt_check_valid(itemno)
1049  if (ierr /= 0) then
1050  goto 999
1051  end if
1052  call this%parser%GetString(text)
1053  jj = 1
1054  bndelem => this%concevap(itemno)
1055  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1056  this%packName, 'BND', this%tsManager, &
1057  this%iprpak, 'EVAPORATION')
1058  case ('RUNOFF')
1059  ierr = this%apt_check_valid(itemno)
1060  if (ierr /= 0) then
1061  goto 999
1062  end if
1063  call this%parser%GetString(text)
1064  jj = 1
1065  bndelem => this%concroff(itemno)
1066  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1067  this%packName, 'BND', this%tsManager, &
1068  this%iprpak, 'RUNOFF')
1069  case ('EXT-INFLOW')
1070  ierr = this%apt_check_valid(itemno)
1071  if (ierr /= 0) then
1072  goto 999
1073  end if
1074  call this%parser%GetString(text)
1075  jj = 1
1076  bndelem => this%conciflw(itemno)
1077  call read_value_or_time_series_adv(text, itemno, jj, bndelem, &
1078  this%packName, 'BND', this%tsManager, &
1079  this%iprpak, 'EXT-INFLOW')
1080  case default
1081  !
1082  ! -- keyword not recognized so return to caller with found = .false.
1083  found = .false.
1084  end select
1085  !
1086 999 continue
subroutine, public read_value_or_time_series_adv(textInput, ii, jj, bndElem, pkgName, auxOrBnd, tsManager, iprpak, varName)
Call this subroutine from advanced packages to define timeseries link for a variable (varName).
Here is the call graph for this function:

◆ lkt_setup_budobj()

subroutine gwtlktmodule::lkt_setup_budobj ( class(gwtlkttype this,
integer(i4b), intent(inout)  idx 
)

Definition at line 434 of file gwt-lkt.f90.

435  ! -- modules
436  use constantsmodule, only: lenbudtxt
437  ! -- dummy
438  class(GwtLktType) :: this
439  integer(I4B), intent(inout) :: idx
440  ! -- local
441  integer(I4B) :: maxlist, naux
442  character(len=LENBUDTXT) :: text
443  !
444  ! -- Addition of mass associated with rainfall directly on lake surface
445  text = ' RAINFALL'
446  idx = idx + 1
447  maxlist = this%flowbudptr%budterm(this%idxbudrain)%maxlist
448  naux = 0
449  call this%budobj%budterm(idx)%initialize(text, &
450  this%name_model, &
451  this%packName, &
452  this%name_model, &
453  this%packName, &
454  maxlist, .false., .false., &
455  naux)
456  !
457  ! -- Loss of dissolved mass associated with evaporation when a non-zero
458  ! evaporative concentration is specified
459  text = ' EVAPORATION'
460  idx = idx + 1
461  maxlist = this%flowbudptr%budterm(this%idxbudevap)%maxlist
462  naux = 0
463  call this%budobj%budterm(idx)%initialize(text, &
464  this%name_model, &
465  this%packName, &
466  this%name_model, &
467  this%packName, &
468  maxlist, .false., .false., &
469  naux)
470  !
471  ! -- Addition of mass associated with runoff that flows to the lake
472  text = ' RUNOFF'
473  idx = idx + 1
474  maxlist = this%flowbudptr%budterm(this%idxbudroff)%maxlist
475  naux = 0
476  call this%budobj%budterm(idx)%initialize(text, &
477  this%name_model, &
478  this%packName, &
479  this%name_model, &
480  this%packName, &
481  maxlist, .false., .false., &
482  naux)
483  !
484  ! -- Addition of mass associated with user-specified inflow to the lake
485  text = ' EXT-INFLOW'
486  idx = idx + 1
487  maxlist = this%flowbudptr%budterm(this%idxbudiflw)%maxlist
488  naux = 0
489  call this%budobj%budterm(idx)%initialize(text, &
490  this%name_model, &
491  this%packName, &
492  this%name_model, &
493  this%packName, &
494  maxlist, .false., .false., &
495  naux)
496  !
497  ! -- Removal of mass associated with user-specified withdrawal from lake
498  text = ' WITHDRAWAL'
499  idx = idx + 1
500  maxlist = this%flowbudptr%budterm(this%idxbudwdrl)%maxlist
501  naux = 0
502  call this%budobj%budterm(idx)%initialize(text, &
503  this%name_model, &
504  this%packName, &
505  this%name_model, &
506  this%packName, &
507  maxlist, .false., .false., &
508  naux)
509  !
510  ! -- Removal of heat associated with outflow from lake that leaves
511  ! model domain
512  text = ' EXT-OUTFLOW'
513  idx = idx + 1
514  maxlist = this%flowbudptr%budterm(this%idxbudoutf)%maxlist
515  naux = 0
516  call this%budobj%budterm(idx)%initialize(text, &
517  this%name_model, &
518  this%packName, &
519  this%name_model, &
520  this%packName, &
521  maxlist, .false., .false., &
522  naux)
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37

◆ lkt_solve()

subroutine gwtlktmodule::lkt_solve ( class(gwtlkttype this)

Definition at line 359 of file gwt-lkt.f90.

360  ! -- dummy
361  class(GwtLktType) :: this
362  ! -- local
363  integer(I4B) :: j
364  integer(I4B) :: n1, n2
365  real(DP) :: rrate
366  !
367  ! -- add rainfall contribution
368  if (this%idxbudrain /= 0) then
369  do j = 1, this%flowbudptr%budterm(this%idxbudrain)%nlist
370  call this%lkt_rain_term(j, n1, n2, rrate)
371  this%dbuff(n1) = this%dbuff(n1) + rrate
372  end do
373  end if
374  !
375  ! -- add evaporation contribution
376  if (this%idxbudevap /= 0) then
377  do j = 1, this%flowbudptr%budterm(this%idxbudevap)%nlist
378  call this%lkt_evap_term(j, n1, n2, rrate)
379  this%dbuff(n1) = this%dbuff(n1) + rrate
380  end do
381  end if
382  !
383  ! -- add runoff contribution
384  if (this%idxbudroff /= 0) then
385  do j = 1, this%flowbudptr%budterm(this%idxbudroff)%nlist
386  call this%lkt_roff_term(j, n1, n2, rrate)
387  this%dbuff(n1) = this%dbuff(n1) + rrate
388  end do
389  end if
390  !
391  ! -- add inflow contribution
392  if (this%idxbudiflw /= 0) then
393  do j = 1, this%flowbudptr%budterm(this%idxbudiflw)%nlist
394  call this%lkt_iflw_term(j, n1, n2, rrate)
395  this%dbuff(n1) = this%dbuff(n1) + rrate
396  end do
397  end if
398  !
399  ! -- add withdrawal contribution
400  if (this%idxbudwdrl /= 0) then
401  do j = 1, this%flowbudptr%budterm(this%idxbudwdrl)%nlist
402  call this%lkt_wdrl_term(j, n1, n2, rrate)
403  this%dbuff(n1) = this%dbuff(n1) + rrate
404  end do
405  end if
406  !
407  ! -- add outflow contribution
408  if (this%idxbudoutf /= 0) then
409  do j = 1, this%flowbudptr%budterm(this%idxbudoutf)%nlist
410  call this%lkt_outf_term(j, n1, n2, rrate)
411  this%dbuff(n1) = this%dbuff(n1) + rrate
412  end do
413  end if

◆ lkt_wdrl_term()

subroutine gwtlktmodule::lkt_wdrl_term ( class(gwtlkttype this,
integer(i4b), intent(in)  ientry,
integer(i4b), intent(inout)  n1,
integer(i4b), intent(inout)  n2,
real(dp), intent(inout), optional  rrate,
real(dp), intent(inout), optional  rhsval,
real(dp), intent(inout), optional  hcofval 
)

Accounts for mass associated with a withdrawal of water from a lake or group of lakes.

Definition at line 807 of file gwt-lkt.f90.

809  ! -- dummy
810  class(GwtLktType) :: this
811  integer(I4B), intent(in) :: ientry
812  integer(I4B), intent(inout) :: n1
813  integer(I4B), intent(inout) :: n2
814  real(DP), intent(inout), optional :: rrate
815  real(DP), intent(inout), optional :: rhsval
816  real(DP), intent(inout), optional :: hcofval
817  ! -- local
818  real(DP) :: qbnd
819  real(DP) :: ctmp
820  !
821  n1 = this%flowbudptr%budterm(this%idxbudwdrl)%id1(ientry)
822  n2 = this%flowbudptr%budterm(this%idxbudwdrl)%id2(ientry)
823  qbnd = this%flowbudptr%budterm(this%idxbudwdrl)%flow(ientry)
824  ctmp = this%xnewpak(n1)
825  if (present(rrate)) rrate = ctmp * qbnd
826  if (present(rhsval)) rhsval = dzero
827  if (present(hcofval)) hcofval = qbnd

Variable Documentation

◆ flowtype

character(len=*), parameter gwtlktmodule::flowtype = 'LAK'

Definition at line 52 of file gwt-lkt.f90.

52  character(len=*), parameter :: flowtype = 'LAK'

◆ ftype

character(len=*), parameter gwtlktmodule::ftype = 'LKT'

Definition at line 51 of file gwt-lkt.f90.

51  character(len=*), parameter :: ftype = 'LKT'

◆ text

character(len=16) gwtlktmodule::text = ' LKT'

Definition at line 53 of file gwt-lkt.f90.

53  character(len=16) :: text = ' LKT'