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

Data Types

type  tspapttype
 

Functions/Subroutines

subroutine apt_ac (this, moffset, sparse)
 Add package connection to matrix. More...
 
subroutine apt_mc (this, moffset, matrix_sln)
 Advanced package transport map package connections to matrix. More...
 
subroutine apt_ar (this)
 Advanced package transport allocate and read (ar) routine. More...
 
subroutine apt_rp (this)
 Advanced package transport read and prepare (rp) routine. More...
 
subroutine apt_ad_chk (this)
 
integer(i4b) function apt_check_valid (this, itemno)
 Advanced package transport routine. More...
 
real(dp) function, dimension(:), pointer, contiguous get_mvr_depvar (this)
 Advanced package transport utility function. More...
 
subroutine apt_ad (this)
 Advanced package transport routine. More...
 
subroutine apt_ad_resync (this)
 Per-timestep TS re-sync and state update. More...
 
subroutine apt_ad_ts (this)
 Virtual hook: called every timestep, after the time series manager advances, before apt_ad_chk. No-op extension point for packages to override. More...
 
real(dp) function apt_setting_value (this, itemno, key)
 Virtual hook: value for a package-specific PERIOD setting. Override in individual packages to supply the already-resolved value for a PERIOD field beyond STATUS, CONCENTRATION/TEMPERATURE, and AUXILIARY, so the shared apt_rp table echo can print it. More...
 
subroutine apt_reset (this)
 Override bnd reset for custom mover logic. More...
 
subroutine apt_fc (this, rhs, ia, idxglo, matrix_sln)
 
subroutine apt_fc_nonexpanded (this, rhs, ia, idxglo, matrix_sln)
 Advanced package transport fill coefficient (fc) method. More...
 
subroutine apt_fc_expanded (this, rhs, ia, idxglo, matrix_sln)
 Advanced package transport fill coefficient (fc) method. More...
 
subroutine pak_fc_expanded (this, rhs, ia, idxglo, matrix_sln)
 Advanced package transport fill coefficient (fc) method. More...
 
subroutine apt_cfupdate (this)
 Advanced package transport routine. More...
 
subroutine apt_cq (this, x, flowja, iadv)
 Advanced package transport calculate flows (cq) routine. More...
 
subroutine apt_ot_package_flows (this, icbcfl, ibudfl)
 Save advanced package flows routine. More...
 
subroutine apt_ot_dv (this, idvsave, idvprint)
 
subroutine apt_ot_bdsummary (this, kstp, kper, iout, ibudfl)
 Print advanced package transport dependent variables. More...
 
subroutine allocate_scalars (this)
 @ brief Allocate scalars More...
 
subroutine apt_allocate_index_arrays (this)
 @ brief Allocate index arrays More...
 
subroutine apt_allocate_arrays (this)
 @ brief Allocate arrays More...
 
subroutine apt_checkin_deprecated_names (this)
 Alias deprecated advanced transport variable names. More...
 
subroutine apt_da (this)
 @ brief Deallocate memory More...
 
subroutine find_apt_package (this)
 Find corresponding advanced package transport package. More...
 
subroutine apt_source_options (this)
 Source OPTIONS block from the input context. More...
 
subroutine apt_source_dimensions (this)
 Source DIMENSIONS from the flow package; allocate package arrays. More...
 
subroutine apt_source_cvs (this)
 Source PACKAGEDATA feature information from the input context. More...
 
subroutine apt_read_initial_attr (this)
 Read the initial parameters for an advanced package. More...
 
subroutine apt_solve (this)
 Add terms specific to advanced package transport to the explicit solve. More...
 
subroutine pak_solve (this)
 Add terms specific to advanced package transport features to the explicit solve routine. More...
 
subroutine apt_accumulate_ccterm (this, ilak, rrate, ccratin, ccratout)
 Accumulate constant concentration (or temperature) terms for budget. More...
 
subroutine define_listlabel (this)
 Define the list heading that is written to iout when PRINT_INPUT option is used. More...
 
subroutine apt_set_pointers (this, neq, ibound, xnew, xold, flowja)
 Set pointers to model arrays and variables so that a package has access to these items. More...
 
subroutine apt_get_volumes (this, icv, vnew, vold, delt)
 Return the feature new volume and old volume. More...
 
integer(i4b) function pak_get_nbudterms (this)
 Function to return the number of budget terms just for this package. More...
 
subroutine apt_setup_budobj (this)
 Set up the budget object that stores advanced package flow terms. More...
 
subroutine pak_setup_budobj (this, idx)
 Set up a budget object that stores an advanced package flows. More...
 
subroutine apt_fill_budobj (this, x, flowja)
 Copy flow terms into thisbudobj. More...
 
subroutine pak_fill_budobj (this, idx, x, flowja, ccratin, ccratout)
 Copy flow terms into thisbudobj, must be overridden. More...
 
subroutine apt_stor_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Account for mass or energy storage in advanced package features. More...
 
subroutine apt_tmvr_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Account for mass or energy transferred to the MVR package. More...
 
subroutine apt_fmvr_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Account for mass or energy transferred to this package from the MVR package. More...
 
subroutine apt_fjf_term (this, ientry, n1, n2, rrate, rhsval, hcofval)
 Go through each "within apt-apt" connection (e.g., lkt-lkt, or sft-sft) and accumulate total mass (or energy) in dbuff mass. More...
 
subroutine apt_copy2flowp (this)
 Copy concentrations (or temperatures) into flow package aux variable. More...
 
logical function apt_obs_supported (this)
 Determine whether an obs type is supported. More...
 
subroutine apt_df_obs (this)
 Define observation type. More...
 
subroutine pak_df_obs (this)
 Define apt observation type. More...
 
subroutine pak_rp_obs (this, obsrv, found)
 Process package specific obs. More...
 
subroutine rp_obs_byfeature (this, obsrv)
 Prepare observation. More...
 
subroutine rp_obs_budterm (this, obsrv, budterm)
 Prepare observation. More...
 
subroutine rp_obs_flowjaface (this, obsrv, budterm)
 Prepare observation. More...
 
subroutine apt_rp_obs (this)
 Read and prepare apt-related observations. More...
 
subroutine apt_bd_obs (this)
 Calculate observation values. More...
 
subroutine pak_bd_obs (this, obstypeid, jj, v, found)
 Check if observation exists in an advanced package. More...
 
subroutine, public apt_process_obsid (obsrv, dis, inunitobs, iout)
 Process observation IDs for an advanced package. More...
 
subroutine, public apt_process_obsid12 (obsrv, dis, inunitobs, iout)
 Process observation IDs for a package. More...
 
subroutine apt_setup_tableobj (this)
 Setup a table object an advanced package. More...
 

Variables

character(len=lenftype) ftype = 'APT'
 
character(len=lenvarname) text = ' APT'
 

Function/Subroutine Documentation

◆ allocate_scalars()

subroutine tspaptmodule::allocate_scalars ( class(tspapttype)  this)

Allocate scalar variables for an advanced package

Definition at line 1016 of file tsp-apt.f90.

1017  ! -- modules
1019  ! -- dummy
1020  class(TspAptType) :: this
1021  ! -- local
1022  !
1023  ! -- allocate scalars in BndExtType
1024  call this%BndExtType%allocate_scalars()
1025  !
1026  ! -- Allocate
1027  call mem_allocate(this%iauxfpconc, 'IAUXFPCONC', this%memoryPath)
1028  call mem_allocate(this%imatrows, 'IMATROWS', this%memoryPath)
1029  call mem_allocate(this%iprconc, 'IPRCONC', this%memoryPath)
1030  call mem_allocate(this%iconcout, 'ICONCOUT', this%memoryPath)
1031  call mem_allocate(this%ibudgetout, 'IBUDGETOUT', this%memoryPath)
1032  call mem_allocate(this%ibudcsv, 'IBUDCSV', this%memoryPath)
1033  call mem_allocate(this%igwfaptpak, 'IGWFAPTPAK', this%memoryPath)
1034  call mem_allocate(this%ncv, 'NCV', this%memoryPath)
1035  call mem_allocate(this%idxbudfjf, 'IDXBUDFJF', this%memoryPath)
1036  call mem_allocate(this%idxbudgwf, 'IDXBUDGWF', this%memoryPath)
1037  call mem_allocate(this%idxbudsto, 'IDXBUDSTO', this%memoryPath)
1038  call mem_allocate(this%idxbudtmvr, 'IDXBUDTMVR', this%memoryPath)
1039  call mem_allocate(this%idxbudfmvr, 'IDXBUDFMVR', this%memoryPath)
1040  call mem_allocate(this%idxbudaux, 'IDXBUDAUX', this%memoryPath)
1041  call mem_allocate(this%nconcbudssm, 'NCONCBUDSSM', this%memoryPath)
1042  call mem_allocate(this%idxprepak, 'IDXPREPAK', this%memoryPath)
1043  call mem_allocate(this%idxlastpak, 'IDXLASTPAK', this%memoryPath)
1044  !
1045  ! -- Initialize
1046  this%iauxfpconc = 0
1047  this%imatrows = 1
1048  this%iprconc = 0
1049  this%iconcout = 0
1050  this%ibudgetout = 0
1051  this%ibudcsv = 0
1052  this%igwfaptpak = 0
1053  this%ncv = 0
1054  this%idxbudfjf = 0
1055  this%idxbudgwf = 0
1056  this%idxbudsto = 0
1057  this%idxbudtmvr = 0
1058  this%idxbudfmvr = 0
1059  this%idxbudaux = 0
1060  this%nconcbudssm = 0
1061  this%idxprepak = 0
1062  this%idxlastpak = 0
1063  !
1064  ! -- set this package as causing asymmetric matrix terms
1065  this%iasym = 1

◆ apt_ac()

subroutine tspaptmodule::apt_ac ( class(tspapttype), intent(inout)  this,
integer(i4b), intent(in)  moffset,
type(sparsematrix), intent(inout)  sparse 
)

Definition at line 201 of file tsp-apt.f90.

203  use sparsemodule, only: sparsematrix
204  ! -- dummy
205  class(TspAptType), intent(inout) :: this
206  integer(I4B), intent(in) :: moffset
207  type(sparsematrix), intent(inout) :: sparse
208  ! -- local
209  integer(I4B) :: i, n
210  integer(I4B) :: jj, jglo
211  integer(I4B) :: nglo
212  ! -- format
213  !
214  ! -- Add package rows to sparse
215  if (this%imatrows /= 0) then
216  !
217  ! -- diagonal
218  do n = 1, this%ncv
219  nglo = moffset + this%dis%nodes + this%ioffset + n
220  call sparse%addconnection(nglo, nglo, 1)
221  end do
222  !
223  ! -- apt-gwf connections
224  do i = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
225  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(i)
226  jj = this%flowbudptr%budterm(this%idxbudgwf)%id2(i)
227  nglo = moffset + this%dis%nodes + this%ioffset + n
228  jglo = jj + moffset
229  call sparse%addconnection(nglo, jglo, 1)
230  call sparse%addconnection(jglo, nglo, 1)
231  end do
232  !
233  ! -- apt-apt connections
234  if (this%idxbudfjf /= 0) then
235  do i = 1, this%flowbudptr%budterm(this%idxbudfjf)%maxlist
236  n = this%flowbudptr%budterm(this%idxbudfjf)%id1(i)
237  jj = this%flowbudptr%budterm(this%idxbudfjf)%id2(i)
238  nglo = moffset + this%dis%nodes + this%ioffset + n
239  jglo = moffset + this%dis%nodes + this%ioffset + jj
240  call sparse%addconnection(nglo, jglo, 1)
241  end do
242  end if
243  end if

◆ apt_accumulate_ccterm()

subroutine tspaptmodule::apt_accumulate_ccterm ( class(tspapttype)  this,
integer(i4b), intent(in)  ilak,
real(dp), intent(in)  rrate,
real(dp), intent(inout)  ccratin,
real(dp), intent(inout)  ccratout 
)

Definition at line 1676 of file tsp-apt.f90.

1677  ! -- dummy
1678  class(TspAptType) :: this
1679  integer(I4B), intent(in) :: ilak
1680  real(DP), intent(in) :: rrate
1681  real(DP), intent(inout) :: ccratin
1682  real(DP), intent(inout) :: ccratout
1683  ! -- locals
1684  real(DP) :: q
1685  ! format
1686  ! code
1687  !
1688  if (this%iboundpak(ilak) < 0) then
1689  q = -rrate
1690  this%ccterm(ilak) = this%ccterm(ilak) + q
1691  !
1692  ! -- See if flow is into lake or out of lake.
1693  if (q < dzero) then
1694  !
1695  ! -- Flow is out of lake subtract rate from ratout.
1696  ccratout = ccratout - q
1697  else
1698  !
1699  ! -- Flow is into lake; add rate to ratin.
1700  ccratin = ccratin + q
1701  end if
1702  end if

◆ apt_ad()

subroutine tspaptmodule::apt_ad ( class(tspapttype)  this)

Add package connections to matrix

Definition at line 569 of file tsp-apt.f90.

570  ! -- dummy
571  class(TspAptType) :: this
572  !
573  ! -- sync PACKAGEDATA AUX TS and advance observations
574  call this%BndExtType%bnd_ad()
575  !
576  call this%apt_ad_resync()

◆ apt_ad_chk()

subroutine tspaptmodule::apt_ad_chk ( class(tspapttype), intent(inout)  this)

Definition at line 526 of file tsp-apt.f90.

527  ! -- dummy
528  class(TspAptType), intent(inout) :: this
529  ! function available for override by packages

◆ apt_ad_resync()

subroutine tspaptmodule::apt_ad_resync ( class(tspapttype)  this)

Called directly by packages that override bnd_ad (e.g. SFT/SFE) so apt_ad_ts/apt_ad_chk still dispatch to their own overrides.

Definition at line 584 of file tsp-apt.f90.

585  ! -- modules
587  use tdismodule, only: kstp
588  ! -- dummy
589  class(TspAptType) :: this
590  ! -- local
591  integer(I4B) :: n
592  integer(I4B) :: j, iaux
593  !
594  ! -- re-sync period TS; package-specific fields via apt_ad_ts
595  if (this%ts_active) then
596  call this%apt_ad_ts()
597  end if
598  !
599  ! -- update auxiliary variables by copying from featureauxvar into
600  ! bndpackage auxvar for GWF budget file output; featureauxvar can
601  ! only have changed at period start (kstp==1) or, when TS-active,
602  ! this timestep's apt_ad_ts() call above
603  if (this%naux > 0 .and. (kstp == 1 .or. this%ts_active)) then
604  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
605  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
606  do iaux = 1, this%naux
607  this%auxvar(iaux, j) = this%featureauxvar(iaux, n)
608  end do
609  end do
610  end if
611  !
612  ! -- copy xnew into xold and set xnewpak to specified concentration (or
613  ! temperature) for constant concentration/temperature features
614  if (ifailedstepretry == 0) then
615  do n = 1, this%ncv
616  this%xoldpak(n) = this%xnewpak(n)
617  if (this%iboundpak(n) < 0) then
618  this%xnewpak(n) = this%concfeat(n)
619  end if
620  end do
621  else
622  do n = 1, this%ncv
623  this%xnewpak(n) = this%xoldpak(n)
624  if (this%iboundpak(n) < 0) then
625  this%xnewpak(n) = this%concfeat(n)
626  end if
627  end do
628  end if
629  !
630  ! -- run package-specific checks
631  call this%apt_ad_chk()
This module contains simulation variables.
Definition: SimVariables.f90:9
integer(i4b) ifailedstepretry
current retry for this time step
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:27

◆ apt_ad_ts()

subroutine tspaptmodule::apt_ad_ts ( class(tspapttype), intent(inout)  this)

Definition at line 638 of file tsp-apt.f90.

639  ! -- dummy
640  class(TspAptType), intent(inout) :: this

◆ apt_allocate_arrays()

subroutine tspaptmodule::apt_allocate_arrays ( class(tspapttype), intent(inout)  this)

Allocate advanced package transport arrays

Definition at line 1129 of file tsp-apt.f90.

1130  ! -- modules
1132  ! -- dummy
1133  class(TspAptType), intent(inout) :: this
1134  ! -- local
1135  integer(I4B) :: n
1136  !
1137  ! -- call standard BndExtType allocate arrays
1138  call this%BndExtType%allocate_arrays()
1139  !
1140  ! -- Allocate
1141  !
1142  ! -- allocate and initialize dbuff
1143  if (this%iconcout > 0) then
1144  call mem_allocate(this%dbuff, this%ncv, 'DBUFF', this%memoryPath)
1145  do n = 1, this%ncv
1146  this%dbuff(n) = dzero
1147  end do
1148  else
1149  call mem_allocate(this%dbuff, 0, 'DBUFF', this%memoryPath)
1150  end if
1151  !
1152  ! -- allocate character array for status
1153  allocate (this%status(this%ncv))
1154  !
1155  ! -- alias into the input context's permanent, feature-indexed
1156  ! CONCENTRATION/TEMPERATURE array (allocated and DZERO-initialized by
1157  ! the input context)
1158  call mem_setptr(this%concfeat, trim(this%depvartype), this%input_mempath)
1159  !
1160  ! -- budget terms
1161  call mem_allocate(this%qsto, this%ncv, 'QSTO', this%memoryPath)
1162  call mem_allocate(this%ccterm, this%ncv, 'CCTERM', this%memoryPath)
1163  !
1164  ! -- concentration for budget terms
1165  call mem_allocate(this%concbudssm, this%nconcbudssm, this%ncv, &
1166  'CONCBUDSSM', this%memoryPath)
1167  !
1168  ! -- mass (or energy) added from the mover transport package
1169  call mem_allocate(this%qmfrommvr, this%ncv, 'QMFROMMVR', this%memoryPath)
1170  !
1171  ! -- initialize arrays
1172  do n = 1, this%ncv
1173  this%status(n) = 'ACTIVE'
1174  this%qsto(n) = dzero
1175  this%ccterm(n) = dzero
1176  this%qmfrommvr(n) = dzero
1177  this%concbudssm(:, n) = dzero
1178  end do

◆ apt_allocate_index_arrays()

subroutine tspaptmodule::apt_allocate_index_arrays ( class(tspapttype), intent(inout)  this)

Allocate arrays that map to locations in the numerical solution

Definition at line 1072 of file tsp-apt.f90.

1073  ! -- modules
1075  ! -- dummy
1076  class(TspAptType), intent(inout) :: this
1077  ! -- local
1078  integer(I4B) :: n
1079  !
1080  if (this%imatrows /= 0) then
1081  !
1082  ! -- count number of flow-ja-face connections
1083  n = 0
1084  if (this%idxbudfjf /= 0) then
1085  n = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1086  end if
1087  !
1088  ! -- allocate pointers to global matrix
1089  call mem_allocate(this%idxlocnode, this%ncv, 'IDXLOCNODE', &
1090  this%memoryPath)
1091  call mem_allocate(this%idxpakdiag, this%ncv, 'IDXPAKDIAG', &
1092  this%memoryPath)
1093  call mem_allocate(this%idxdglo, this%maxbound, 'IDXGLO', &
1094  this%memoryPath)
1095  call mem_allocate(this%idxoffdglo, this%maxbound, 'IDXOFFDGLO', &
1096  this%memoryPath)
1097  call mem_allocate(this%idxsymdglo, this%maxbound, 'IDXSYMDGLO', &
1098  this%memoryPath)
1099  call mem_allocate(this%idxsymoffdglo, this%maxbound, 'IDXSYMOFFDGLO', &
1100  this%memoryPath)
1101  call mem_allocate(this%idxfjfdglo, n, 'IDXFJFDGLO', &
1102  this%memoryPath)
1103  call mem_allocate(this%idxfjfoffdglo, n, 'IDXFJFOFFDGLO', &
1104  this%memoryPath)
1105  else
1106  call mem_allocate(this%idxlocnode, 0, 'IDXLOCNODE', &
1107  this%memoryPath)
1108  call mem_allocate(this%idxpakdiag, 0, 'IDXPAKDIAG', &
1109  this%memoryPath)
1110  call mem_allocate(this%idxdglo, 0, 'IDXGLO', &
1111  this%memoryPath)
1112  call mem_allocate(this%idxoffdglo, 0, 'IDXOFFDGLO', &
1113  this%memoryPath)
1114  call mem_allocate(this%idxsymdglo, 0, 'IDXSYMDGLO', &
1115  this%memoryPath)
1116  call mem_allocate(this%idxsymoffdglo, 0, 'IDXSYMOFFDGLO', &
1117  this%memoryPath)
1118  call mem_allocate(this%idxfjfdglo, 0, 'IDXFJFDGLO', &
1119  this%memoryPath)
1120  call mem_allocate(this%idxfjfoffdglo, 0, 'IDXFJFOFFDGLO', &
1121  this%memoryPath)
1122  end if

◆ apt_ar()

subroutine tspaptmodule::apt_ar ( class(tspapttype), intent(inout)  this)

Definition at line 309 of file tsp-apt.f90.

310  ! -- modules
311  ! -- dummy
312  class(TspAptType), intent(inout) :: this
313  ! -- local
314  integer(I4B) :: j
315  logical :: found
316  ! -- formats
317  character(len=*), parameter :: fmtapt = &
318  "(1x,/1x,'APT -- ADVANCED PACKAGE TRANSPORT, VERSION 1, 3/5/2020', &
319  &' INPUT READ FROM UNIT ', i0, //)"
320  !
321  ! -- Get obs setup
322  call this%obs%obs_ar()
323  !
324  ! --print a message identifying the apt package.
325  write (this%iout, fmtapt) this%inunit
326  !
327  ! -- Allocate arrays
328  call this%apt_allocate_arrays()
329  !
330  ! -- alias deprecated variable names
331  call this%apt_checkin_deprecated_names()
332  !
333  ! -- read optional initial package parameters
334  call this%read_initial_attr()
335  !
336  ! -- Find the package index in the GWF model or GWF budget file
337  ! for the corresponding apt flow package
338  call this%fmi%get_package_index(this%flowpackagename, this%igwfaptpak)
339  !
340  ! -- Tell fmi that this package is being handled by APT, otherwise
341  ! SSM would handle the flows into GWT from this pack. Then point the
342  ! fmi data for an advanced package to xnewpak and qmfrommvr
343  this%fmi%iatp(this%igwfaptpak) = 1
344  this%fmi%datp(this%igwfaptpak)%concpack => this%get_mvr_depvar()
345  this%fmi%datp(this%igwfaptpak)%qmfrommvr => this%qmfrommvr
346  !
347  ! -- If there is an associated flow package and the user wishes to put
348  ! simulated concentrations (or temperatures) into a aux variable
349  ! column, then find the column number.
350  if (associated(this%flowpackagebnd)) then
351  if (this%cauxfpconc /= '') then
352  found = .false.
353  do j = 1, this%flowpackagebnd%naux
354  if (this%flowpackagebnd%auxname(j) == this%cauxfpconc) then
355  this%iauxfpconc = j
356  found = .true.
357  exit
358  end if
359  end do
360  if (this%iauxfpconc == 0) then
361  errmsg = 'Could not find auxiliary variable '// &
362  trim(adjustl(this%cauxfpconc))//' in flow package '// &
363  trim(adjustl(this%flowpackagename))
364  call store_error(errmsg)
365  call store_error_filename(this%input_fname)
366  else
367  ! -- tell package not to update this auxiliary variable
368  this%flowpackagebnd%noupdateauxvar(this%iauxfpconc) = 1
369  call this%apt_copy2flowp()
370  end if
371  end if
372  end if
Here is the call graph for this function:

◆ apt_bd_obs()

subroutine tspaptmodule::apt_bd_obs ( class(tspapttype)  this)

Routine calculates observations common to SFT/LKT/MWT/UZT (or SFE/LKE/MWE/UZE) for as many TspAptType observations that are common among the advanced transport packages

Definition at line 2621 of file tsp-apt.f90.

2622  ! -- modules
2623  ! -- dummy
2624  class(TspAptType) :: this
2625  ! -- local
2626  integer(I4B) :: i
2627  integer(I4B) :: igwfnode
2628  integer(I4B) :: j
2629  integer(I4B) :: jj
2630  integer(I4B) :: n
2631  integer(I4B) :: n1
2632  integer(I4B) :: n2
2633  real(DP) :: v
2634  type(ObserveType), pointer :: obsrv => null()
2635  logical :: found
2636  !
2637  ! -- Write simulated values for all Advanced Package observations
2638  if (this%obs%npakobs > 0) then
2639  call this%obs%obs_bd_clear()
2640  do i = 1, this%obs%npakobs
2641  obsrv => this%obs%pakobs(i)%obsrv
2642  do j = 1, obsrv%indxbnds_count
2643  v = dnodata
2644  jj = obsrv%indxbnds(j)
2645  select case (obsrv%ObsTypeId)
2646  case ('CONCENTRATION', 'TEMPERATURE')
2647  if (this%iboundpak(jj) /= 0) then
2648  v = this%xnewpak(jj)
2649  end if
2650  case ('LKT', 'SFT', 'MWT', 'UZT', 'LKE', 'SFE', 'MWE', 'UZE')
2651  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(jj)
2652  if (this%iboundpak(n) /= 0) then
2653  igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(jj)
2654  v = this%hcof(jj) * this%xnew(igwfnode) - this%rhs(jj)
2655  v = -v
2656  end if
2657  case ('FLOW-JA-FACE')
2658  n = this%flowbudptr%budterm(this%idxbudfjf)%id1(jj)
2659  if (this%iboundpak(n) /= 0) then
2660  call this%apt_fjf_term(jj, n1, n2, v)
2661  end if
2662  case ('STORAGE')
2663  if (this%iboundpak(jj) /= 0) then
2664  v = this%qsto(jj)
2665  end if
2666  case ('CONSTANT')
2667  if (this%iboundpak(jj) /= 0) then
2668  v = this%ccterm(jj)
2669  end if
2670  case ('FROM-MVR')
2671  if (this%iboundpak(jj) /= 0 .and. this%idxbudfmvr > 0) then
2672  call this%apt_fmvr_term(jj, n1, n2, v)
2673  end if
2674  case ('TO-MVR')
2675  if (this%idxbudtmvr > 0) then
2676  n = this%flowbudptr%budterm(this%idxbudtmvr)%id1(jj)
2677  if (this%iboundpak(n) /= 0) then
2678  call this%apt_tmvr_term(jj, n1, n2, v)
2679  end if
2680  end if
2681  case default
2682  found = .false.
2683  !
2684  ! -- check the child package for any specific obs
2685  call this%pak_bd_obs(obsrv%ObsTypeId, jj, v, found)
2686  !
2687  ! -- if none found then terminate with an error
2688  if (.not. found) then
2689  errmsg = 'Unrecognized observation type "'// &
2690  trim(obsrv%ObsTypeId)//'" for '// &
2691  trim(adjustl(this%text))//' package '// &
2692  trim(this%packName)
2693  call store_error(errmsg, terminate=.true.)
2694  end if
2695  end select
2696  call this%obs%SaveOneSimval(obsrv, v)
2697  end do
2698  end do
2699  !
2700  ! -- write summary of error messages
2701  if (count_errors() > 0) then
2702  call store_error_unit(this%obs%inunitobs)
2703  end if
2704  end if
Here is the call graph for this function:

◆ apt_cfupdate()

subroutine tspaptmodule::apt_cfupdate ( class(tspapttype)  this)

Calculate advanced package transport hcof and rhs so transport budget is calculated.

Definition at line 849 of file tsp-apt.f90.

850  ! -- modules
851  ! -- dummy
852  class(TspAptType) :: this
853  ! -- local
854  integer(I4B) :: j, n
855  real(DP) :: qbnd
856  real(DP) :: omega
857  !
858  ! -- Calculate hcof and rhs terms so GWF exchanges are calculated correctly
859  ! -- go through each apt-gwf connection and calculate
860  ! rhs and hcof terms for gwt/gwe matrix rows
861  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
862  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
863  this%hcof(j) = dzero
864  this%rhs(j) = dzero
865  if (this%iboundpak(n) /= 0) then
866  qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
867  omega = dzero
868  if (qbnd < dzero) omega = done
869  this%hcof(j) = -(done - omega) * qbnd * this%eqnsclfac
870  this%rhs(j) = omega * qbnd * this%xnewpak(n) * this%eqnsclfac
871  end if
872  end do

◆ apt_check_valid()

integer(i4b) function tspaptmodule::apt_check_valid ( class(tspapttype), intent(inout)  this,
integer(i4b), intent(in)  itemno 
)

Determine if a valid feature number has been specified.

Definition at line 536 of file tsp-apt.f90.

537  ! -- return
538  integer(I4B) :: ierr
539  ! -- dummy
540  class(TspAptType), intent(inout) :: this
541  integer(I4B), intent(in) :: itemno
542  ! -- formats
543  ierr = 0
544  if (itemno < 1 .or. itemno > this%ncv) then
545  write (errmsg, '(a,1x,i6,1x,a,1x,i6)') &
546  'Featureno ', itemno, 'must be > 0 and <= ', this%ncv
547  call store_error(errmsg)
548  ierr = 1
549  end if
Here is the call graph for this function:

◆ apt_checkin_deprecated_names()

subroutine tspaptmodule::apt_checkin_deprecated_names ( class(tspapttype), intent(inout)  this)

IDM integration moved the feature concentration (or temperature) and auxiliary arrays into the input context, renaming both. These aliases share memory with the relocated variables so that programs addressing them through the API by their old package-path names continue to resolve; each use is reported as deprecated. Each package overrides this routine to alias its own deprecated names and must call this base routine first; a package without an override only gets the names aliased here.

Definition at line 1191 of file tsp-apt.f90.

1192  ! -- modules
1195  ! -- dummy
1196  class(TspAptType), intent(inout) :: this
1197  ! -- local
1198  real(DP), dimension(:, :), pointer, contiguous :: aux => null()
1199  integer(I4B) :: isize
1200  ! -- code
1201  !
1202  ! -- feature concentration (GWT) or temperature (GWE)
1203  call mem_alias_deprecated(this%concfeat, 'CONCFEAT', this%memoryPath, &
1204  trim(this%depvartype), this%input_mempath, &
1205  '6.8.2')
1206  !
1207  ! -- feature auxiliary values, present (possibly empty) in the input context
1208  call get_isize('AUX', this%input_mempath, isize)
1209  if (isize >= 0) then
1210  call mem_setptr(aux, 'AUX', this%input_mempath)
1211  call mem_alias_deprecated(aux, 'LAUXVAR', this%memoryPath, &
1212  'AUX', this%input_mempath, '6.8.2')
1213  end if
Previous variable names checked in as deprecated aliases.
Definition: MemoryAlias.f90:7
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Here is the call graph for this function:

◆ apt_copy2flowp()

subroutine tspaptmodule::apt_copy2flowp ( class(tspapttype)  this)

Definition at line 2267 of file tsp-apt.f90.

2268  ! -- modules
2269  ! -- dummy
2270  class(TspAptType) :: this
2271  ! -- local
2272  integer(I4B) :: n, j
2273  !
2274  ! -- copy
2275  if (this%iauxfpconc /= 0) then
2276  !
2277  ! -- go through each apt-gwf connection
2278  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2279  !
2280  ! -- set n to feature number and process if active feature
2281  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2282  this%flowpackagebnd%auxvar(this%iauxfpconc, j) = this%xnewpak(n)
2283  end do
2284  end if

◆ apt_cq()

subroutine tspaptmodule::apt_cq ( class(tspapttype), intent(inout)  this,
real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(inout), contiguous  flowja,
integer(i4b), intent(in), optional  iadv 
)

Calculate flows for the advanced package transport feature

Definition at line 879 of file tsp-apt.f90.

880  ! -- modules
881  ! -- dummy
882  class(TspAptType), intent(inout) :: this
883  real(DP), dimension(:), intent(in) :: x
884  real(DP), dimension(:), contiguous, intent(inout) :: flowja
885  integer(I4B), optional, intent(in) :: iadv
886  ! -- local
887  integer(I4B) :: n, n1, n2
888  real(DP) :: rrate
889  !
890  ! -- Solve the feature concentrations (or temperatures) again or update
891  ! the feature hcof and rhs terms
892  if (this%imatrows == 0) then
893  call this%apt_solve()
894  else
895  call this%apt_cfupdate()
896  end if
897  !
898  ! -- call base functionality in bnd_cq
899  call this%BndType%bnd_cq(x, flowja)
900  !
901  ! -- calculate storage term
902  do n = 1, this%ncv
903  rrate = dzero
904  if (this%iboundpak(n) > 0) then
905  call this%apt_stor_term(n, n1, n2, rrate)
906  end if
907  this%qsto(n) = rrate
908  end do
909  !
910  ! -- Copy concentrations (or temperatures) into the flow package auxiliary variable
911  call this%apt_copy2flowp()
912  !
913  ! -- fill the budget object
914  call this%apt_fill_budobj(x, flowja)

◆ apt_da()

subroutine tspaptmodule::apt_da ( class(tspapttype)  this)

Deallocate memory associated with this package

Definition at line 1220 of file tsp-apt.f90.

1221  ! -- modules
1223  ! -- dummy
1224  class(TspAptType) :: this
1225  ! -- local
1226  !
1227  ! -- deallocate arrays
1228  call mem_deallocate(this%dbuff)
1229  call mem_deallocate(this%qsto)
1230  call mem_deallocate(this%ccterm)
1231  call mem_deallocate(this%strt)
1232  call mem_deallocate(this%xoldpak)
1233  if (this%imatrows == 0) then
1234  call mem_deallocate(this%iboundpak)
1235  call mem_deallocate(this%xnewpak)
1236  end if
1237  call mem_deallocate(this%concbudssm)
1238  nullify (this%concfeat) ! input-context-owned alias, not package-allocated
1239  call mem_deallocate(this%qmfrommvr)
1240  deallocate (this%status)
1241  deallocate (this%featname)
1242  !
1243  ! -- budobj
1244  call this%budobj%budgetobject_da()
1245  deallocate (this%budobj)
1246  nullify (this%budobj)
1247  !
1248  ! -- conc table
1249  if (this%iprconc > 0) then
1250  call this%dvtab%table_da()
1251  deallocate (this%dvtab)
1252  nullify (this%dvtab)
1253  end if
1254  !
1255  ! -- index pointers
1256  call mem_deallocate(this%idxlocnode)
1257  call mem_deallocate(this%idxpakdiag)
1258  call mem_deallocate(this%idxdglo)
1259  call mem_deallocate(this%idxoffdglo)
1260  call mem_deallocate(this%idxsymdglo)
1261  call mem_deallocate(this%idxsymoffdglo)
1262  call mem_deallocate(this%idxfjfdglo)
1263  call mem_deallocate(this%idxfjfoffdglo)
1264  !
1265  ! -- deallocate scalars
1266  call mem_deallocate(this%iauxfpconc)
1267  call mem_deallocate(this%imatrows)
1268  call mem_deallocate(this%iprconc)
1269  call mem_deallocate(this%iconcout)
1270  call mem_deallocate(this%ibudgetout)
1271  call mem_deallocate(this%ibudcsv)
1272  call mem_deallocate(this%igwfaptpak)
1273  call mem_deallocate(this%ncv)
1274  call mem_deallocate(this%idxbudfjf)
1275  call mem_deallocate(this%idxbudgwf)
1276  call mem_deallocate(this%idxbudsto)
1277  call mem_deallocate(this%idxbudtmvr)
1278  call mem_deallocate(this%idxbudfmvr)
1279  call mem_deallocate(this%idxbudaux)
1280  call mem_deallocate(this%idxbudssm)
1281  call mem_deallocate(this%nconcbudssm)
1282  call mem_deallocate(this%idxprepak)
1283  call mem_deallocate(this%idxlastpak)
1284  !
1285  ! -- deallocate scalars in BndExtType
1286  call this%BndExtType%bnd_da()

◆ apt_df_obs()

subroutine tspaptmodule::apt_df_obs ( class(tspapttype)  this)

This routine:

  • stores observation types supported by APT package.
  • overrides BndTypebnd_df_obs

Definition at line 2308 of file tsp-apt.f90.

2309  ! -- modules
2310  ! -- dummy
2311  class(TspAptType) :: this
2312  ! -- local
2313  !
2314  ! -- call additional specific observations for lkt, sft, mwt, and uzt
2315  call this%pak_df_obs()

◆ apt_fc()

subroutine tspaptmodule::apt_fc ( class(tspapttype)  this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)

Definition at line 668 of file tsp-apt.f90.

669  ! -- modules
670  ! -- dummy
671  class(TspAptType) :: this
672  real(DP), dimension(:), intent(inout) :: rhs
673  integer(I4B), dimension(:), intent(in) :: ia
674  integer(I4B), dimension(:), intent(in) :: idxglo
675  class(MatrixBaseType), pointer :: matrix_sln
676  ! -- local
677  !
678  ! -- Call fc depending on whether or not a matrix is expanded or not
679  if (this%imatrows == 0) then
680  call this%apt_fc_nonexpanded(rhs, ia, idxglo, matrix_sln)
681  else
682  call this%apt_fc_expanded(rhs, ia, idxglo, matrix_sln)
683  end if

◆ apt_fc_expanded()

subroutine tspaptmodule::apt_fc_expanded ( class(tspapttype)  this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)

Routine to formulate the expanded matrix case in which new rows are added to the system of equations for each advanced package transport feature

Definition at line 720 of file tsp-apt.f90.

721  ! -- modules
722  ! -- dummy
723  class(TspAptType) :: this
724  real(DP), dimension(:), intent(inout) :: rhs
725  integer(I4B), dimension(:), intent(in) :: ia
726  integer(I4B), dimension(:), intent(in) :: idxglo
727  class(MatrixBaseType), pointer :: matrix_sln
728  ! -- local
729  integer(I4B) :: j, n, n1, n2
730  integer(I4B) :: iloc
731  integer(I4B) :: iposd, iposoffd
732  integer(I4B) :: ipossymd, ipossymoffd
733  real(DP) :: cold
734  real(DP) :: qbnd, qbnd_scaled
735  real(DP) :: omega
736  real(DP) :: rrate
737  real(DP) :: rhsval
738  real(DP) :: hcofval
739  !
740  ! -- call the specific method for the advanced transport package, such as
741  ! what would be overridden by
742  ! GwtLktType, GwtSftType, GwtMwtType, GwtUztType
743  ! This routine will add terms for rainfall, runoff, or other terms
744  ! specific to the package
745  call this%pak_fc_expanded(rhs, ia, idxglo, matrix_sln)
746  !
747  ! -- mass (or energy) storage in features
748  do n = 1, this%ncv
749  cold = this%xoldpak(n)
750  iloc = this%idxlocnode(n)
751  iposd = this%idxpakdiag(n)
752  call this%apt_stor_term(n, n1, n2, rrate, rhsval, hcofval)
753  call matrix_sln%add_value_pos(iposd, hcofval)
754  rhs(iloc) = rhs(iloc) + rhsval
755  end do
756  !
757  ! -- add to mover contribution
758  if (this%idxbudtmvr /= 0) then
759  do j = 1, this%flowbudptr%budterm(this%idxbudtmvr)%nlist
760  call this%apt_tmvr_term(j, n1, n2, rrate, rhsval, hcofval)
761  iloc = this%idxlocnode(n1)
762  iposd = this%idxpakdiag(n1)
763  call matrix_sln%add_value_pos(iposd, hcofval)
764  rhs(iloc) = rhs(iloc) + rhsval
765  end do
766  end if
767  !
768  ! -- add from mover contribution
769  if (this%idxbudfmvr /= 0) then
770  do n = 1, this%ncv
771  rhsval = this%qmfrommvr(n) ! this will already be in terms of energy for heat transport
772  iloc = this%idxlocnode(n)
773  rhs(iloc) = rhs(iloc) - rhsval
774  end do
775  end if
776  !
777  ! -- go through each apt-gwf connection
778  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
779  !
780  ! -- set n to feature number and process if active feature
781  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
782  if (this%iboundpak(n) /= 0) then
783  !
784  ! -- set acoef and rhs to negative so they are relative to apt and not gwt
785  qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
786  omega = dzero
787  if (qbnd < dzero) omega = done
788  qbnd_scaled = qbnd * this%eqnsclfac
789  !
790  ! -- add to apt row
791  iposd = this%idxdglo(j)
792  iposoffd = this%idxoffdglo(j)
793  call matrix_sln%add_value_pos(iposd, omega * qbnd_scaled)
794  call matrix_sln%add_value_pos(iposoffd, (done - omega) * qbnd_scaled)
795  !
796  ! -- add to gwf row for apt connection
797  ipossymd = this%idxsymdglo(j)
798  ipossymoffd = this%idxsymoffdglo(j)
799  call matrix_sln%add_value_pos(ipossymd, -(done - omega) * qbnd_scaled)
800  call matrix_sln%add_value_pos(ipossymoffd, -omega * qbnd_scaled)
801  end if
802  end do
803  !
804  ! -- go through each apt-apt connection
805  if (this%idxbudfjf /= 0) then
806  do j = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
807  n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(j)
808  n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(j)
809  qbnd = this%flowbudptr%budterm(this%idxbudfjf)%flow(j)
810  if (qbnd <= dzero) then
811  omega = done
812  else
813  omega = dzero
814  end if
815  qbnd_scaled = qbnd * this%eqnsclfac
816  iposd = this%idxfjfdglo(j)
817  iposoffd = this%idxfjfoffdglo(j)
818  call matrix_sln%add_value_pos(iposd, omega * qbnd_scaled)
819  call matrix_sln%add_value_pos(iposoffd, (done - omega) * qbnd_scaled)
820  end do
821  end if

◆ apt_fc_nonexpanded()

subroutine tspaptmodule::apt_fc_nonexpanded ( class(tspapttype)  this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)

Routine to formulate the nonexpanded matrix case in which feature concentrations (or temperatures) are solved explicitly

Definition at line 691 of file tsp-apt.f90.

692  ! -- modules
693  ! -- dummy
694  class(TspAptType) :: this
695  real(DP), dimension(:), intent(inout) :: rhs
696  integer(I4B), dimension(:), intent(in) :: ia
697  integer(I4B), dimension(:), intent(in) :: idxglo
698  class(MatrixBaseType), pointer :: matrix_sln
699  ! -- local
700  integer(I4B) :: j, igwfnode, idiag
701  !
702  ! -- solve for concentration (or temperatures) in the features
703  call this%apt_solve()
704  !
705  ! -- add hcof and rhs terms (from apt_solve) to the gwf matrix
706  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
707  igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
708  if (this%ibound(igwfnode) < 1) cycle
709  idiag = idxglo(ia(igwfnode))
710  call matrix_sln%add_value_pos(idiag, this%hcof(j))
711  rhs(igwfnode) = rhs(igwfnode) + this%rhs(j)
712  end do

◆ apt_fill_budobj()

subroutine tspaptmodule::apt_fill_budobj ( class(tspapttype)  this,
real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(inout), contiguous  flowja 
)

Definition at line 2000 of file tsp-apt.f90.

2001  ! -- modules
2002  use tdismodule, only: delt
2003  ! -- dummy
2004  class(TspAptType) :: this
2005  real(DP), dimension(:), intent(in) :: x
2006  real(DP), dimension(:), contiguous, intent(inout) :: flowja
2007  ! -- local
2008  integer(I4B) :: naux
2009  real(DP), dimension(:), allocatable :: auxvartmp
2010  integer(I4B) :: i, j, n1, n2
2011  integer(I4B) :: idx
2012  integer(I4B) :: nlen
2013  integer(I4B) :: nlist
2014  integer(I4B) :: igwfnode
2015  real(DP) :: q
2016  real(DP) :: v0, v1
2017  real(DP) :: ccratin, ccratout
2018  ! -- formats
2019  !
2020  ! -- initialize counter
2021  idx = 0
2022  !
2023  ! -- initialize ccterm, which is used to sum up all mass (or energy) flows
2024  ! into a constant concentration (or temperature) cell
2025  ccratin = dzero
2026  ccratout = dzero
2027  do n1 = 1, this%ncv
2028  this%ccterm(n1) = dzero
2029  end do
2030  !
2031  ! -- FLOW JA FACE
2032  nlen = 0
2033  if (this%idxbudfjf /= 0) then
2034  nlen = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
2035  end if
2036  if (nlen > 0) then
2037  idx = idx + 1
2038  nlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
2039  call this%budobj%budterm(idx)%reset(nlist)
2040  q = dzero
2041  do j = 1, nlist
2042  call this%apt_fjf_term(j, n1, n2, q)
2043  call this%budobj%budterm(idx)%update_term(n1, n2, q)
2044  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2045  end do
2046  end if
2047  !
2048  ! -- GWF (LEAKAGE)
2049  idx = idx + 1
2050  call this%budobj%budterm(idx)%reset(this%maxbound)
2051  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
2052  q = dzero
2053  n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
2054  igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
2055  if (this%iboundpak(n1) /= 0) then
2056  q = this%hcof(j) * x(igwfnode) - this%rhs(j)
2057  q = -q ! flip sign so relative to advanced package feature
2058  end if
2059  call this%budobj%budterm(idx)%update_term(n1, igwfnode, q)
2060  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2061  end do
2062  !
2063  ! -- skip individual package terms for now and process them last
2064  ! -- in case they depend on the other terms (as for uze)
2065  idx = this%idxlastpak
2066  !
2067  ! -- STORAGE
2068  idx = idx + 1
2069  call this%budobj%budterm(idx)%reset(this%ncv)
2070  allocate (auxvartmp(1))
2071  do n1 = 1, this%ncv
2072  call this%apt_get_volumes(n1, v1, v0, delt)
2073  auxvartmp(1) = v1 * this%xnewpak(n1) ! Note: When GWE is added, check if this needs a factor of eqnsclfac
2074  q = this%qsto(n1)
2075  call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2076  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2077  end do
2078  deallocate (auxvartmp)
2079  !
2080  ! -- TO MOVER
2081  if (this%idxbudtmvr /= 0) then
2082  idx = idx + 1
2083  nlist = this%flowbudptr%budterm(this%idxbudtmvr)%nlist
2084  call this%budobj%budterm(idx)%reset(nlist)
2085  do j = 1, nlist
2086  call this%apt_tmvr_term(j, n1, n2, q)
2087  call this%budobj%budterm(idx)%update_term(n1, n2, q)
2088  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2089  end do
2090  end if
2091  !
2092  ! -- FROM MOVER
2093  if (this%idxbudfmvr /= 0) then
2094  idx = idx + 1
2095  nlist = this%ncv
2096  call this%budobj%budterm(idx)%reset(nlist)
2097  do j = 1, nlist
2098  call this%apt_fmvr_term(j, n1, n2, q)
2099  call this%budobj%budterm(idx)%update_term(n1, n1, q)
2100  call this%apt_accumulate_ccterm(n1, q, ccratin, ccratout)
2101  end do
2102  end if
2103  !
2104  ! -- CONSTANT FLOW
2105  idx = idx + 1
2106  call this%budobj%budterm(idx)%reset(this%ncv)
2107  do n1 = 1, this%ncv
2108  q = this%ccterm(n1)
2109  call this%budobj%budterm(idx)%update_term(n1, n1, q)
2110  end do
2111  !
2112  ! -- AUXILIARY VARIABLES
2113  naux = this%naux
2114  if (naux > 0) then
2115  idx = idx + 1
2116  allocate (auxvartmp(naux))
2117  call this%budobj%budterm(idx)%reset(this%ncv)
2118  do n1 = 1, this%ncv
2119  q = dzero
2120  do i = 1, naux
2121  auxvartmp(i) = this%featureauxvar(i, n1)
2122  end do
2123  call this%budobj%budterm(idx)%update_term(n1, n1, q, auxvartmp)
2124  end do
2125  deallocate (auxvartmp)
2126  end if
2127  !
2128  ! -- individual package terms processed last
2129  idx = this%idxprepak
2130  call this%pak_fill_budobj(idx, x, flowja, ccratin, ccratout)
2131  !
2132  ! --Terms are filled, now accumulate them for this time step
2133  call this%budobj%accumulate_terms()
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:32

◆ apt_fjf_term()

subroutine tspaptmodule::apt_fjf_term ( class(tspapttype)  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 2236 of file tsp-apt.f90.

2238  ! -- modules
2239  ! -- dummy
2240  class(TspAptType) :: this
2241  integer(I4B), intent(in) :: ientry
2242  integer(I4B), intent(inout) :: n1
2243  integer(I4B), intent(inout) :: n2
2244  real(DP), intent(inout), optional :: rrate
2245  real(DP), intent(inout), optional :: rhsval
2246  real(DP), intent(inout), optional :: hcofval
2247  ! -- local
2248  real(DP) :: qbnd
2249  real(DP) :: ctmp
2250  !
2251  n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(ientry)
2252  n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(ientry)
2253  qbnd = this%flowbudptr%budterm(this%idxbudfjf)%flow(ientry)
2254  if (qbnd <= 0) then
2255  ctmp = this%xnewpak(n1)
2256  else
2257  ctmp = this%xnewpak(n2)
2258  end if
2259  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2260  if (present(rhsval)) rhsval = -rrate * this%eqnsclfac
2261  if (present(hcofval)) hcofval = dzero

◆ apt_fmvr_term()

subroutine tspaptmodule::apt_fmvr_term ( class(tspapttype)  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 2213 of file tsp-apt.f90.

2215  ! -- modules
2216  ! -- dummy
2217  class(TspAptType) :: this
2218  integer(I4B), intent(in) :: ientry
2219  integer(I4B), intent(inout) :: n1
2220  integer(I4B), intent(inout) :: n2
2221  real(DP), intent(inout), optional :: rrate
2222  real(DP), intent(inout), optional :: rhsval
2223  real(DP), intent(inout), optional :: hcofval
2224  !
2225  ! -- Calculate MVR-related terms
2226  n1 = ientry
2227  n2 = n1
2228  if (present(rrate)) rrate = this%qmfrommvr(n1) ! NOTE: When bringing in GWE, ensure this is in terms of energy. Might need to apply eqnsclfac here.
2229  if (present(rhsval)) rhsval = this%qmfrommvr(n1)
2230  if (present(hcofval)) hcofval = dzero

◆ apt_get_volumes()

subroutine tspaptmodule::apt_get_volumes ( class(tspapttype)  this,
integer(i4b), intent(in)  icv,
real(dp), intent(inout)  vnew,
real(dp), intent(inout)  vold,
real(dp), intent(in)  delt 
)

Definition at line 1758 of file tsp-apt.f90.

1759  ! -- modules
1760  ! -- dummy
1761  class(TspAptType) :: this
1762  integer(I4B), intent(in) :: icv
1763  real(DP), intent(inout) :: vnew, vold
1764  real(DP), intent(in) :: delt
1765  ! -- local
1766  real(DP) :: qss
1767  !
1768  ! -- get volumes
1769  vold = dzero
1770  vnew = vold
1771  if (this%idxbudsto /= 0) then
1772  qss = this%flowbudptr%budterm(this%idxbudsto)%flow(icv)
1773  vnew = this%flowbudptr%budterm(this%idxbudsto)%auxvar(1, icv)
1774  vold = vnew + qss * delt
1775  end if

◆ apt_mc()

subroutine tspaptmodule::apt_mc ( class(tspapttype), intent(inout)  this,
integer(i4b), intent(in)  moffset,
class(matrixbasetype), pointer  matrix_sln 
)

Definition at line 248 of file tsp-apt.f90.

249  use sparsemodule, only: sparsematrix
250  ! -- dummy
251  class(TspAptType), intent(inout) :: this
252  integer(I4B), intent(in) :: moffset
253  class(MatrixBaseType), pointer :: matrix_sln
254  ! -- local
255  integer(I4B) :: n, j, iglo, jglo
256  integer(I4B) :: ipos
257  ! -- format
258  !
259  ! -- allocate memory for index arrays
260  call this%apt_allocate_index_arrays()
261  !
262  ! -- store index positions
263  if (this%imatrows /= 0) then
264  !
265  ! -- Find the position of each connection in the global ia, ja structure
266  ! and store them in idxglo. idxglo allows this model to insert or
267  ! retrieve values into or from the global A matrix
268  ! -- apt rows
269  do n = 1, this%ncv
270  this%idxlocnode(n) = this%dis%nodes + this%ioffset + n
271  iglo = moffset + this%dis%nodes + this%ioffset + n
272  this%idxpakdiag(n) = matrix_sln%get_position_diag(iglo)
273  end do
274  do ipos = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
275  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(ipos)
276  j = this%flowbudptr%budterm(this%idxbudgwf)%id2(ipos)
277  iglo = moffset + this%dis%nodes + this%ioffset + n
278  jglo = j + moffset
279  this%idxdglo(ipos) = matrix_sln%get_position_diag(iglo)
280  this%idxoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
281  end do
282  !
283  ! -- apt contributions to gwf portion of global matrix
284  do ipos = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
285  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(ipos)
286  j = this%flowbudptr%budterm(this%idxbudgwf)%id2(ipos)
287  iglo = j + moffset
288  jglo = moffset + this%dis%nodes + this%ioffset + n
289  this%idxsymdglo(ipos) = matrix_sln%get_position_diag(iglo)
290  this%idxsymoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
291  end do
292  !
293  ! -- apt-apt contributions to gwf portion of global matrix
294  if (this%idxbudfjf /= 0) then
295  do ipos = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
296  n = this%flowbudptr%budterm(this%idxbudfjf)%id1(ipos)
297  j = this%flowbudptr%budterm(this%idxbudfjf)%id2(ipos)
298  iglo = moffset + this%dis%nodes + this%ioffset + n
299  jglo = moffset + this%dis%nodes + this%ioffset + j
300  this%idxfjfdglo(ipos) = matrix_sln%get_position_diag(iglo)
301  this%idxfjfoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
302  end do
303  end if
304  end if

◆ apt_obs_supported()

logical function tspaptmodule::apt_obs_supported ( class(tspapttype)  this)

This function:

  • returns true if APT package supports named observation.
  • overrides BndTypebnd_obs_supported()

Definition at line 2293 of file tsp-apt.f90.

2294  ! -- modules
2295  ! -- dummy
2296  class(TspAptType) :: this
2297  !
2298  ! -- Set to true
2299  apt_obs_supported = .true.

◆ apt_ot_bdsummary()

subroutine tspaptmodule::apt_ot_bdsummary ( class(tspapttype)  this,
integer(i4b), intent(in)  kstp,
integer(i4b), intent(in)  kper,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  ibudfl 
)
Parameters
thisTspAptType object
[in]kstptime step number
[in]kperperiod number
[in]ioutflag and unit number for the model listing file
[in]ibudflflag indicating budget should be written

Definition at line 999 of file tsp-apt.f90.

1000  ! -- module
1001  use tdismodule, only: totim, delt
1002  ! -- dummy
1003  class(TspAptType) :: this !< TspAptType object
1004  integer(I4B), intent(in) :: kstp !< time step number
1005  integer(I4B), intent(in) :: kper !< period number
1006  integer(I4B), intent(in) :: iout !< flag and unit number for the model listing file
1007  integer(I4B), intent(in) :: ibudfl !< flag indicating budget should be written
1008  !
1009  call this%budobj%write_budtable(kstp, kper, iout, ibudfl, totim, delt)
real(dp), pointer, public totim
time relative to start of simulation
Definition: tdis.f90:35

◆ apt_ot_dv()

subroutine tspaptmodule::apt_ot_dv ( class(tspapttype)  this,
integer(i4b), intent(in)  idvsave,
integer(i4b), intent(in)  idvprint 
)

Definition at line 943 of file tsp-apt.f90.

944  ! -- modules
945  use constantsmodule, only: lenbudtxt
946  use tdismodule, only: kstp, kper, pertim, totim
948  use inputoutputmodule, only: ulasav
949  ! -- dummy
950  class(TspAptType) :: this
951  integer(I4B), intent(in) :: idvsave
952  integer(I4B), intent(in) :: idvprint
953  ! -- local
954  integer(I4B) :: ibinun
955  integer(I4B) :: n
956  real(DP) :: c
957  character(len=LENBUDTXT) :: text
958  !
959  ! -- set unit number for binary dependent variable output
960  ibinun = 0
961  if (this%iconcout /= 0) then
962  ibinun = this%iconcout
963  end if
964  if (idvsave == 0) ibinun = 0
965  !
966  ! -- write binary output
967  if (ibinun > 0) then
968  do n = 1, this%ncv
969  c = this%xnewpak(n)
970  if (this%iboundpak(n) == 0) then
971  c = dhnoflo
972  end if
973  this%dbuff(n) = c
974  end do
975  write (text, '(a)') str_pad_left(this%depvartype, lenvarname)
976  call ulasav(this%dbuff, text, kstp, kper, pertim, totim, &
977  this%ncv, 1, 1, ibinun)
978  end if
979  !
980  ! -- write apt conc table
981  if (idvprint /= 0 .and. this%iprconc /= 0) then
982  !
983  ! -- set table kstp and kper
984  call this%dvtab%set_kstpkper(kstp, kper)
985  !
986  ! -- fill concentration data
987  do n = 1, this%ncv
988  if (this%inamedbound == 1) then
989  call this%dvtab%add_term(this%featname(n))
990  end if
991  call this%dvtab%add_term(n)
992  call this%dvtab%add_term(this%xnewpak(n))
993  end do
994  end if
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dhdry
real dry cell constant
Definition: Constants.f90:94
real(dp), parameter dhnoflo
real no flow constant
Definition: Constants.f90:93
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37
subroutine, public ulasav(buf, text, kstp, kper, pertim, totim, ncol, nrow, ilay, ichn)
Save 1 layer array on disk.
real(dp), pointer, public pertim
time relative to start of stress period
Definition: tdis.f90:33
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:26
Here is the call graph for this function:

◆ apt_ot_package_flows()

subroutine tspaptmodule::apt_ot_package_flows ( class(tspapttype)  this,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  ibudfl 
)

Definition at line 919 of file tsp-apt.f90.

920  use tdismodule, only: kstp, kper, delt, pertim, totim
921  class(TspAptType) :: this
922  integer(I4B), intent(in) :: icbcfl
923  integer(I4B), intent(in) :: ibudfl
924  integer(I4B) :: ibinun
925  !
926  ! -- write the flows from the budobj
927  ibinun = 0
928  if (this%ibudgetout /= 0) then
929  ibinun = this%ibudgetout
930  end if
931  if (icbcfl == 0) ibinun = 0
932  if (ibinun > 0) then
933  call this%budobj%save_flows(this%dis, ibinun, kstp, kper, delt, &
934  pertim, totim, this%iout)
935  end if
936  !
937  ! -- Print lake flows table
938  if (ibudfl /= 0 .and. this%iprflow /= 0) then
939  call this%budobj%write_flowtable(this%dis, kstp, kper)
940  end if

◆ apt_process_obsid()

subroutine, public tspaptmodule::apt_process_obsid ( type(observetype), intent(inout)  obsrv,
class(disbasetype), intent(in)  dis,
integer(i4b), intent(in)  inunitobs,
integer(i4b), intent(in)  iout 
)

Method to process observation ID strings for an APT package. This processor is only for observation types that support ID1 and not ID2.

Parameters
[in,out]obsrvObservation object
[in]disDiscretization object
[in]inunitobsfile unit number for the package observation file
[in]ioutmodel listing file unit number

Definition at line 2728 of file tsp-apt.f90.

2729  ! -- dummy variables
2730  type(ObserveType), intent(inout) :: obsrv !< Observation object
2731  class(DisBaseType), intent(in) :: dis !< Discretization object
2732  integer(I4B), intent(in) :: inunitobs !< file unit number for the package observation file
2733  integer(I4B), intent(in) :: iout !< model listing file unit number
2734  ! -- local variables
2735  integer(I4B) :: nn1
2736  integer(I4B) :: icol
2737  integer(I4B) :: istart
2738  integer(I4B) :: istop
2739  character(len=LINELENGTH) :: string
2740  character(len=LENBOUNDNAME) :: bndname
2741  !
2742  ! -- initialize local variables
2743  string = obsrv%IDstring
2744  !
2745  ! -- Extract reach number from string and store it.
2746  ! If 1st item is not an integer(I4B), it should be a
2747  ! boundary name--deal with it.
2748  icol = 1
2749  !
2750  ! -- get reach number or boundary name
2751  call extract_idnum_or_bndname(string, icol, istart, istop, nn1, bndname)
2752  if (nn1 == namedboundflag) then
2753  obsrv%FeatureName = bndname
2754  end if
2755  !
2756  ! -- store reach number (NodeNumber)
2757  obsrv%NodeNumber = nn1
2758  !
2759  ! -- store NodeNumber2 as 1 so that this can be used
2760  ! as the iconn value for SFT. This works for SFT
2761  ! because there is only one reach per GWT connection.
2762  obsrv%NodeNumber2 = 1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ apt_process_obsid12()

subroutine, public tspaptmodule::apt_process_obsid12 ( type(observetype), intent(inout)  obsrv,
class(disbasetype), intent(in)  dis,
integer(i4b), intent(in)  inunitobs,
integer(i4b), intent(in)  iout 
)

Method to process observation ID strings for an APT package. This processor is for the case where if ID1 is an integer then ID2 must be provided.

Parameters
[in,out]obsrvObservation object
[in]disDiscretization object
[in]inunitobsfile unit number for the package observation file
[in]ioutmodel listing file unit number

Definition at line 2771 of file tsp-apt.f90.

2772  ! -- dummy variables
2773  type(ObserveType), intent(inout) :: obsrv !< Observation object
2774  class(DisBaseType), intent(in) :: dis !< Discretization object
2775  integer(I4B), intent(in) :: inunitobs !< file unit number for the package observation file
2776  integer(I4B), intent(in) :: iout !< model listing file unit number
2777  ! -- local variables
2778  integer(I4B) :: nn1
2779  integer(I4B) :: iconn
2780  integer(I4B) :: icol
2781  integer(I4B) :: istart
2782  integer(I4B) :: istop
2783  character(len=LINELENGTH) :: string
2784  character(len=LENBOUNDNAME) :: bndname
2785  !
2786  ! -- initialize local variables
2787  string = obsrv%IDstring
2788  !
2789  ! -- Extract reach number from string and store it.
2790  ! If 1st item is not an integer(I4B), it should be a
2791  ! boundary name--deal with it.
2792  icol = 1
2793  !
2794  ! -- get reach number or boundary name
2795  call extract_idnum_or_bndname(string, icol, istart, istop, nn1, bndname)
2796  if (nn1 == namedboundflag) then
2797  obsrv%FeatureName = bndname
2798  else
2799  call extract_idnum_or_bndname(string, icol, istart, istop, iconn, bndname)
2800  if (len_trim(bndname) < 1 .and. iconn < 0) then
2801  write (errmsg, '(a,1x,a,a,1x,a,1x,a)') &
2802  'For observation type', trim(adjustl(obsrv%ObsTypeId)), &
2803  ', ID given as an integer and not as boundname,', &
2804  'but ID2 is missing. Either change ID to valid', &
2805  'boundname or supply valid entry for ID2.'
2806  call store_error(errmsg)
2807  end if
2808  obsrv%NodeNumber2 = iconn
2809  end if
2810  !
2811  ! -- store reach number (NodeNumber)
2812  obsrv%NodeNumber = nn1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ apt_read_initial_attr()

subroutine tspaptmodule::apt_read_initial_attr ( class(tspapttype), intent(inout)  this)

Definition at line 1528 of file tsp-apt.f90.

1529  use constantsmodule, only: linelength
1530  use budgetmodule, only: budget_cr
1531  ! -- dummy
1532  class(TspAptType), intent(inout) :: this
1533  ! -- local
1534  !character(len=LINELENGTH) :: text
1535  integer(I4B) :: j, n
1536 
1537  !
1538  ! -- initialize xnewpak and set feature concentration (or temperature)
1539  ! -- todo: this should be a time series?
1540  do n = 1, this%ncv
1541  this%xnewpak(n) = this%strt(n)
1542  !
1543  ! -- todo: read aux
1544  !
1545  ! -- todo: read boundname
1546  end do
1547  !
1548  ! -- initialize status (iboundpak) of lakes to active
1549  do n = 1, this%ncv
1550  if (this%status(n) == 'CONSTANT') then
1551  this%iboundpak(n) = -1
1552  else if (this%status(n) == 'INACTIVE') then
1553  this%iboundpak(n) = 0
1554  else if (this%status(n) == 'ACTIVE ') then
1555  this%iboundpak(n) = 1
1556  end if
1557  end do
1558  !
1559  ! -- set boundname for each connection
1560  if (this%inamedbound /= 0) then
1561  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
1562  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
1563  this%boundname(j) = this%featname(n)
1564  end do
1565  end if
1566  !
1567  ! -- copy boundname into boundname_cst
1568  call this%copy_boundname()
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public budget_cr(this, name_model)
@ brief Create a new budget object
Definition: Budget.f90:85
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
Here is the call graph for this function:

◆ apt_reset()

subroutine tspaptmodule::apt_reset ( class(tspapttype)  this)
Parameters
thisGwtAptType object

Definition at line 658 of file tsp-apt.f90.

659  class(TspAptType) :: this !< GwtAptType object
660  ! local
661  integer(I4B) :: i
662  !
663  do i = 1, size(this%qmfrommvr)
664  this%qmfrommvr(i) = dzero
665  end do

◆ apt_rp()

subroutine tspaptmodule::apt_rp ( class(tspapttype), intent(inout)  this)

This subroutine calls the attached packages' read and prepare routines.

Definition at line 379 of file tsp-apt.f90.

380  use tdismodule, only: kper
381  use constantsmodule, only: lenvarname
382  ! -- dummy
383  class(TspAptType), intent(inout) :: this
384  ! -- local
385  integer(I4B) :: n, itemno, igwfnode, isize
386  integer(I4B), pointer :: nbound => null()
387  integer(I4B), dimension(:), pointer, contiguous :: ifno => null()
388  type(CharacterStringType), dimension(:), pointer, contiguous :: &
389  setting => null()
390  type(CharacterStringType), dimension(:), pointer, contiguous :: &
391  status => null()
392  type(CharacterStringType), dimension(:), pointer, contiguous :: &
393  auxname => null()
394  real(DP), dimension(:), pointer, contiguous :: auxval => null()
395  character(len=LINELENGTH) :: str
396  character(len=LENVARNAME) :: key
397  character(len=LINELENGTH) :: title
398  character(len=LINELENGTH) :: text
399  character(len=LENVARNAME) :: auxnamestr
400  character(len=*), parameter :: fmtlsp = &
401  "(1X,/1X,'REUSING ',A,'S FROM LAST &
402  &STRESS PERIOD')"
403  !
404  ! -- set nbound to maxbound
405  this%nbound = this%maxbound
406  !
407  ! -- check if the input context has data for this stress period
408  if (this%iper == kper) then
409  !
410  ! -- get period data arrays
411  call mem_setptr(nbound, 'NBOUND', this%input_mempath)
412  !
413  ! -- setup table to echo period data
414  if (this%iprpak /= 0) then
415  title = trim(adjustl(this%text))//' PACKAGE ('// &
416  trim(adjustl(this%packName))//') DATA FOR PERIOD'
417  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
418  call table_cr(this%inputtab, this%packName, title)
419  call this%inputtab%table_df(1, 4, this%iout, finalize=.false.)
420  text = 'NUMBER'
421  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
422  text = 'KEYWORD'
423  call this%inputtab%initialize_column(text, 20, alignment=tableft)
424  do n = 1, 2
425  write (text, '(a,1x,i6)') 'VALUE', n
426  call this%inputtab%initialize_column(text, 15, alignment=tabcenter)
427  end do
428  end if
429  !
430  if (nbound > 0) then
431  call mem_setptr(ifno, 'IFNO', this%input_mempath)
432  call mem_setptr(setting, 'SETTING', this%input_mempath)
433  call mem_setptr(status, 'STATUS', this%input_mempath)
434  if (this%naux > 0) then
435  call get_isize('AUXVAL', this%input_mempath, isize)
436  if (isize > 0) then
437  call mem_setptr(auxname, 'AUXNAME', this%input_mempath)
438  call mem_setptr(auxval, 'AUXVAL', this%input_mempath)
439  end if
440  end if
441  !
442  do n = 1, nbound
443  itemno = ifno(n)
444  if (this%apt_check_valid(itemno) /= 0) cycle
445  key = setting(n)
446  !
447  ! -- STATUS (string; not TS-capable)
448  if (trim(key) == 'STATUS') then
449  str = status(n)
450  select case (trim(str))
451  case ('CONSTANT')
452  this%iboundpak(itemno) = -1
453  case ('INACTIVE')
454  this%iboundpak(itemno) = 0
455  case ('ACTIVE')
456  this%iboundpak(itemno) = 1
457  case default
458  write (errmsg, '(a,a)') &
459  'Unknown '//trim(this%text)//' status keyword: ', &
460  trim(str)//'.'
461  call store_error(errmsg)
462  end select
463  this%status(itemno) = trim(str)
464  if (this%iprpak /= 0) then
465  call this%inputtab%add_term(itemno)
466  call this%inputtab%add_term(trim(key))
467  call this%inputtab%add_term(trim(str))
468  call this%inputtab%add_term(' ')
469  end if
470  !
471  ! -- CONCENTRATION/TEMPERATURE: value already resolved by the
472  ! input context; echo it directly
473  else if (trim(key) == trim(this%depvartype)) then
474  if (this%iprpak /= 0) then
475  call this%inputtab%add_term(itemno)
476  call this%inputtab%add_term(trim(key))
477  call this%inputtab%add_term(this%concfeat(itemno))
478  call this%inputtab%add_term(' ')
479  end if
480  !
481  ! -- AUXILIARY: value already resolved by the input context;
482  ! echo the raw auxname and resolved auxval for this row
483  else if (trim(key) == 'PERIOD_AUXILIARY') then
484  if (this%iprpak /= 0) then
485  auxnamestr = auxname(n)
486  call this%inputtab%add_term(itemno)
487  call this%inputtab%add_term('AUXILIARY')
488  call this%inputtab%add_term(trim(auxnamestr))
489  call this%inputtab%add_term(auxval(n))
490  end if
491  !
492  ! -- package-specific setting; value already resolved by the
493  ! input context, package supplies it for the table
494  else
495  if (this%iprpak /= 0) then
496  call this%inputtab%add_term(itemno)
497  call this%inputtab%add_term(trim(key))
498  call this%inputtab%add_term(this%apt_setting_value(itemno, key))
499  call this%inputtab%add_term(' ')
500  end if
501  end if
502  end do
503  end if
504  !
505  if (this%iprpak /= 0) then
506  call this%inputtab%finalize_table()
507  end if
508  !
509  else
510  write (this%iout, fmtlsp) trim(this%filtyp)
511  end if
512  !
513  ! -- write summary of stress period error messages
514  if (count_errors() > 0) then
515  call store_error_filename(this%input_fname)
516  end if
517  !
518  ! -- fill nodelist every period; non-vertical connections are not updated
519  ! by cf so must be set here
520  do n = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
521  igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
522  this%nodelist(n) = igwfnode
523  end do
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition: Constants.f90:17
Here is the call graph for this function:

◆ apt_rp_obs()

subroutine tspaptmodule::apt_rp_obs ( class(tspapttype), intent(inout)  this)

Method to process specific observations for an apt package

Definition at line 2543 of file tsp-apt.f90.

2544  ! -- modules
2545  use tdismodule, only: kper
2546  ! -- dummy
2547  class(TspAptType), intent(inout) :: this
2548  ! -- local
2549  integer(I4B) :: i
2550  logical :: found
2551  class(ObserveType), pointer :: obsrv => null()
2552  !
2553  if (kper == 1) then
2554  do i = 1, this%obs%npakobs
2555  obsrv => this%obs%pakobs(i)%obsrv
2556  select case (obsrv%ObsTypeId)
2557  case ('CONCENTRATION', 'TEMPERATURE')
2558  call this%rp_obs_byfeature(obsrv)
2559  !
2560  ! -- catch non-cumulative observation assigned to observation defined
2561  ! by a boundname that is assigned to more than one element
2562  if (obsrv%indxbnds_count > 1) then
2563  write (errmsg, '(a, a, a, a)') &
2564  trim(adjustl(this%depvartype))// &
2565  ' for observation', trim(adjustl(obsrv%Name)), &
2566  ' must be assigned to a feature with a unique boundname.'
2567  call store_error(errmsg)
2568  end if
2569  case ('LKT', 'SFT', 'MWT', 'UZT', 'LKE', 'SFE', 'MWE', 'UZE')
2570  call this%rp_obs_budterm(obsrv, &
2571  this%flowbudptr%budterm(this%idxbudgwf))
2572  case ('FLOW-JA-FACE')
2573  if (this%idxbudfjf > 0) then
2574  call this%rp_obs_flowjaface(obsrv, &
2575  this%flowbudptr%budterm(this%idxbudfjf))
2576  else
2577  write (errmsg, '(7a)') &
2578  'Observation ', trim(obsrv%Name), ' of type ', &
2579  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2580  trim(this%packName), &
2581  ' cannot be processed because there are no flow connections.'
2582  call store_error(errmsg)
2583  end if
2584  case ('STORAGE')
2585  call this%rp_obs_byfeature(obsrv)
2586  case ('CONSTANT')
2587  call this%rp_obs_byfeature(obsrv)
2588  case ('FROM-MVR')
2589  call this%rp_obs_byfeature(obsrv)
2590  case default
2591  !
2592  ! -- check the child package for any specific obs
2593  found = .false.
2594  call this%pak_rp_obs(obsrv, found)
2595  !
2596  ! -- if none found then terminate with an error
2597  if (.not. found) then
2598  errmsg = 'Unrecognized observation type "'// &
2599  trim(obsrv%ObsTypeId)//'" for '// &
2600  trim(adjustl(this%text))//' package '// &
2601  trim(this%packName)
2602  call store_error(errmsg, terminate=.true.)
2603  end if
2604  end select
2605 
2606  end do
2607  !
2608  ! -- check for errors
2609  if (count_errors() > 0) then
2610  call store_error_unit(this%obs%inunitobs)
2611  end if
2612  end if
Here is the call graph for this function:

◆ apt_set_pointers()

subroutine tspaptmodule::apt_set_pointers ( class(tspapttype)  this,
integer(i4b), pointer  neq,
integer(i4b), dimension(:), pointer, contiguous  ibound,
real(dp), dimension(:), pointer, contiguous  xnew,
real(dp), dimension(:), pointer, contiguous  xold,
real(dp), dimension(:), pointer, contiguous  flowja 
)

Definition at line 1732 of file tsp-apt.f90.

1733  class(TspAptType) :: this
1734  integer(I4B), pointer :: neq
1735  integer(I4B), dimension(:), pointer, contiguous :: ibound
1736  real(DP), dimension(:), pointer, contiguous :: xnew
1737  real(DP), dimension(:), pointer, contiguous :: xold
1738  real(DP), dimension(:), pointer, contiguous :: flowja
1739  ! -- local
1740  integer(I4B) :: istart, iend
1741  !
1742  ! -- call base BndType set_pointers
1743  call this%BndType%set_pointers(neq, ibound, xnew, xold, flowja)
1744  !
1745  ! -- Set the pointers
1746  !
1747  ! -- set package pointers
1748  if (this%imatrows /= 0) then
1749  istart = this%dis%nodes + this%ioffset + 1
1750  iend = istart + this%ncv - 1
1751  this%iboundpak => this%ibound(istart:iend)
1752  this%xnewpak => this%xnew(istart:iend)
1753  end if

◆ apt_setting_value()

real(dp) function tspaptmodule::apt_setting_value ( class(tspapttype), intent(inout)  this,
integer(i4b), intent(in)  itemno,
character(len=*), intent(in)  key 
)
Parameters
[in]itemnofeature number
[in]keySETTING dispatch key

Definition at line 648 of file tsp-apt.f90.

649  ! -- dummy
650  class(TspAptType), intent(inout) :: this
651  integer(I4B), intent(in) :: itemno !< feature number
652  character(len=*), intent(in) :: key !< SETTING dispatch key
653  real(DP) :: val
654  val = dzero

◆ apt_setup_budobj()

subroutine tspaptmodule::apt_setup_budobj ( class(tspapttype)  this)

Definition at line 1798 of file tsp-apt.f90.

1799  ! -- modules
1800  use constantsmodule, only: lenbudtxt
1801  ! -- dummy
1802  class(TspAptType) :: this
1803  ! -- local
1804  integer(I4B) :: nbudterm
1805  integer(I4B) :: nlen
1806  integer(I4B) :: n, n1, n2
1807  integer(I4B) :: maxlist, naux
1808  integer(I4B) :: idx
1809  logical :: ordered_id1
1810  real(DP) :: q
1811  character(len=LENBUDTXT) :: bddim_opt
1812  character(len=LENBUDTXT) :: text, textt
1813  character(len=LENBUDTXT), dimension(1) :: auxtxt
1814  !
1815  ! -- initialize nbudterm
1816  nbudterm = 0
1817  !
1818  ! -- Determine if there are flow-ja-face terms
1819  nlen = 0
1820  if (this%idxbudfjf /= 0) then
1821  nlen = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1822  end if
1823  !
1824  ! -- Determine the number of budget terms associated with apt.
1825  ! These are fixed for the simulation and cannot change
1826  !
1827  ! -- add one if flow-ja-face present
1828  if (this%idxbudfjf /= 0) nbudterm = nbudterm + 1
1829  !
1830  ! -- All the APT packages have GWF, STORAGE, and CONSTANT
1831  nbudterm = nbudterm + 3
1832  !
1833  ! -- add terms for the specific package
1834  nbudterm = nbudterm + this%pak_get_nbudterms()
1835  !
1836  ! -- add for mover terms and auxiliary
1837  if (this%idxbudtmvr /= 0) nbudterm = nbudterm + 1
1838  if (this%idxbudfmvr /= 0) nbudterm = nbudterm + 1
1839  if (this%naux > 0) nbudterm = nbudterm + 1
1840  !
1841  ! -- set up budobj
1842  call budgetobject_cr(this%budobj, this%packName)
1843  !
1844  bddim_opt = this%depvarunitabbrev
1845  call this%budobj%budgetobject_df(this%ncv, nbudterm, 0, 0, &
1846  bddim_opt=bddim_opt, ibudcsv=this%ibudcsv)
1847  idx = 0
1848  !
1849  ! -- Go through and set up each budget term
1850  if (nlen > 0) then
1851  text = ' FLOW-JA-FACE'
1852  idx = idx + 1
1853  maxlist = this%flowbudptr%budterm(this%idxbudfjf)%maxlist
1854  naux = 0
1855  ordered_id1 = this%flowbudptr%budterm(this%idxbudfjf)%ordered_id1
1856  call this%budobj%budterm(idx)%initialize(text, &
1857  this%name_model, &
1858  this%packName, &
1859  this%name_model, &
1860  this%packName, &
1861  maxlist, .false., .false., &
1862  naux, ordered_id1=ordered_id1)
1863  !
1864  ! -- store outlet connectivity
1865  call this%budobj%budterm(idx)%reset(maxlist)
1866  q = dzero
1867  do n = 1, maxlist
1868  n1 = this%flowbudptr%budterm(this%idxbudfjf)%id1(n)
1869  n2 = this%flowbudptr%budterm(this%idxbudfjf)%id2(n)
1870  call this%budobj%budterm(idx)%update_term(n1, n2, q)
1871  end do
1872  end if
1873  !
1874  ! --
1875  text = ' GWF'
1876  idx = idx + 1
1877  maxlist = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
1878  naux = 0
1879  call this%budobj%budterm(idx)%initialize(text, &
1880  this%name_model, &
1881  this%packName, &
1882  this%name_model, &
1883  this%name_model, &
1884  maxlist, .false., .true., &
1885  naux)
1886  call this%budobj%budterm(idx)%reset(maxlist)
1887  q = dzero
1888  do n = 1, maxlist
1889  n1 = this%flowbudptr%budterm(this%idxbudgwf)%id1(n)
1890  n2 = this%flowbudptr%budterm(this%idxbudgwf)%id2(n)
1891  call this%budobj%budterm(idx)%update_term(n1, n2, q)
1892  end do
1893  !
1894  ! -- Reserve space for the package specific terms
1895  this%idxprepak = idx
1896  call this%pak_setup_budobj(idx)
1897  this%idxlastpak = idx
1898  !
1899  ! --
1900  text = ' STORAGE'
1901  idx = idx + 1
1902  maxlist = this%flowbudptr%budterm(this%idxbudsto)%maxlist
1903  naux = 1
1904  write (textt, '(a)') str_pad_left(this%depvarunit, 16)
1905  auxtxt(1) = textt ! ' MASS' or ' ENERGY'
1906  call this%budobj%budterm(idx)%initialize(text, &
1907  this%name_model, &
1908  this%packName, &
1909  this%name_model, &
1910  this%packName, &
1911  maxlist, .false., .false., &
1912  naux, auxtxt)
1913  if (this%idxbudtmvr /= 0) then
1914  !
1915  ! --
1916  text = ' TO-MVR'
1917  idx = idx + 1
1918  maxlist = this%flowbudptr%budterm(this%idxbudtmvr)%maxlist
1919  naux = 0
1920  ordered_id1 = this%flowbudptr%budterm(this%idxbudtmvr)%ordered_id1
1921  call this%budobj%budterm(idx)%initialize(text, &
1922  this%name_model, &
1923  this%packName, &
1924  this%name_model, &
1925  this%packName, &
1926  maxlist, .false., .false., &
1927  naux, ordered_id1=ordered_id1)
1928  end if
1929  if (this%idxbudfmvr /= 0) then
1930  !
1931  ! --
1932  text = ' FROM-MVR'
1933  idx = idx + 1
1934  maxlist = this%ncv
1935  naux = 0
1936  call this%budobj%budterm(idx)%initialize(text, &
1937  this%name_model, &
1938  this%packName, &
1939  this%name_model, &
1940  this%packName, &
1941  maxlist, .false., .false., &
1942  naux)
1943  end if
1944  !
1945  ! --
1946  text = ' CONSTANT'
1947  idx = idx + 1
1948  maxlist = this%ncv
1949  naux = 0
1950  call this%budobj%budterm(idx)%initialize(text, &
1951  this%name_model, &
1952  this%packName, &
1953  this%name_model, &
1954  this%packName, &
1955  maxlist, .false., .false., &
1956  naux)
1957 
1958  !
1959  ! --
1960  naux = this%naux
1961  if (naux > 0) then
1962  !
1963  ! --
1964  text = ' AUXILIARY'
1965  idx = idx + 1
1966  maxlist = this%ncv
1967  call this%budobj%budterm(idx)%initialize(text, &
1968  this%name_model, &
1969  this%packName, &
1970  this%name_model, &
1971  this%packName, &
1972  maxlist, .false., .false., &
1973  naux, this%auxname)
1974  end if
1975  !
1976  ! -- if flow for each control volume are written to the listing file
1977  if (this%iprflow /= 0) then
1978  call this%budobj%flowtable_df(this%iout)
1979  end if
Here is the call graph for this function:

◆ apt_setup_tableobj()

subroutine tspaptmodule::apt_setup_tableobj ( class(tspapttype)  this)

Set up the table object that is used to write the apt concentration (or temperature) data. The terms listed here must correspond in the apt_ot method.

Definition at line 2821 of file tsp-apt.f90.

2822  ! -- modules
2824  ! -- dummy
2825  class(TspAptType) :: this
2826  ! -- local
2827  integer(I4B) :: nterms
2828  character(len=LINELENGTH) :: title
2829  character(len=LINELENGTH) :: text_temp
2830  !
2831  ! -- setup well head table
2832  if (this%iprconc > 0) then
2833  !
2834  ! -- Determine the number of head table columns
2835  nterms = 2
2836  if (this%inamedbound == 1) nterms = nterms + 1
2837  !
2838  ! -- set up table title
2839  title = trim(adjustl(this%text))//' PACKAGE ('// &
2840  trim(adjustl(this%packName))// &
2841  ') '//trim(adjustl(this%depvartype))// &
2842  &' FOR EACH CONTROL VOLUME'
2843  !
2844  ! -- set up dv tableobj
2845  call table_cr(this%dvtab, this%packName, title)
2846  call this%dvtab%table_df(this%ncv, nterms, this%iout, &
2847  transient=.true.)
2848  !
2849  ! -- Go through and set up table budget term
2850  if (this%inamedbound == 1) then
2851  text_temp = 'NAME'
2852  call this%dvtab%initialize_column(text_temp, 20, alignment=tableft)
2853  end if
2854  !
2855  ! -- feature number
2856  text_temp = 'NUMBER'
2857  call this%dvtab%initialize_column(text_temp, 10, alignment=tabcenter)
2858  !
2859  ! -- feature conc
2860  text_temp = this%depvartype(1:4)
2861  call this%dvtab%initialize_column(text_temp, 12, alignment=tabcenter)
2862  end if
Here is the call graph for this function:

◆ apt_solve()

subroutine tspaptmodule::apt_solve ( class(tspapttype)  this)

Explicit solve for concentration (or temperature) in advaced package features, which is an alternative to the iterative implicit solve.

Definition at line 1577 of file tsp-apt.f90.

1578  use constantsmodule, only: linelength
1579  ! -- dummy
1580  class(TspAptType) :: this
1581  ! -- local
1582  integer(I4B) :: n, j, igwfnode
1583  integer(I4B) :: n1, n2
1584  real(DP) :: rrate
1585  real(DP) :: ctmp
1586  real(DP) :: c1, qbnd
1587  real(DP) :: hcofval, rhsval
1588  !
1589  ! -- initialize dbuff
1590  do n = 1, this%ncv
1591  this%dbuff(n) = dzero
1592  end do
1593  !
1594  ! -- call the individual package routines to add terms specific to the
1595  ! advanced transport package
1596  call this%pak_solve()
1597  !
1598  ! -- add to mover contribution
1599  if (this%idxbudtmvr /= 0) then
1600  do j = 1, this%flowbudptr%budterm(this%idxbudtmvr)%nlist
1601  call this%apt_tmvr_term(j, n1, n2, rrate)
1602  this%dbuff(n1) = this%dbuff(n1) + rrate
1603  end do
1604  end if
1605  !
1606  ! -- add from mover contribution
1607  if (this%idxbudfmvr /= 0) then
1608  do n1 = 1, size(this%qmfrommvr)
1609  rrate = this%qmfrommvr(n1) ! Will be in terms of energy for heat transport
1610  this%dbuff(n1) = this%dbuff(n1) + rrate
1611  end do
1612  end if
1613  !
1614  ! -- go through each gwf connection and accumulate
1615  ! total mass (or energy) in dbuff mass
1616  do j = 1, this%flowbudptr%budterm(this%idxbudgwf)%nlist
1617  n = this%flowbudptr%budterm(this%idxbudgwf)%id1(j)
1618  this%hcof(j) = dzero
1619  this%rhs(j) = dzero
1620  igwfnode = this%flowbudptr%budterm(this%idxbudgwf)%id2(j)
1621  qbnd = this%flowbudptr%budterm(this%idxbudgwf)%flow(j)
1622  if (qbnd <= dzero) then
1623  ctmp = this%xnewpak(n)
1624  this%rhs(j) = qbnd * ctmp * this%eqnsclfac
1625  else
1626  ctmp = this%xnew(igwfnode)
1627  this%hcof(j) = -qbnd * this%eqnsclfac
1628  end if
1629  c1 = qbnd * ctmp * this%eqnsclfac
1630  this%dbuff(n) = this%dbuff(n) + c1
1631  end do
1632  !
1633  ! -- go through each "within apt-apt" connection (e.g., lak-lak) and
1634  ! accumulate total mass (or energy) in dbuff mass
1635  if (this%idxbudfjf /= 0) then
1636  do j = 1, this%flowbudptr%budterm(this%idxbudfjf)%nlist
1637  call this%apt_fjf_term(j, n1, n2, rrate)
1638  c1 = rrate
1639  this%dbuff(n1) = this%dbuff(n1) + c1
1640  end do
1641  end if
1642  !
1643  ! -- calculate the feature concentration/temperature
1644  do n = 1, this%ncv
1645  call this%apt_stor_term(n, n1, n2, rrate, rhsval, hcofval)
1646  !
1647  ! -- at this point, dbuff has q * c for all sources, so now
1648  ! add Vold / dt * Cold
1649  this%dbuff(n) = this%dbuff(n) - rhsval
1650  !
1651  ! -- Now to calculate c, need to divide dbuff by hcofval
1652  c1 = -this%dbuff(n) / hcofval
1653  if (this%iboundpak(n) > 0) then
1654  this%xnewpak(n) = c1
1655  end if
1656  end do

◆ apt_source_cvs()

subroutine tspaptmodule::apt_source_cvs ( class(tspapttype), intent(inout)  this)

Definition at line 1445 of file tsp-apt.f90.

1446  ! -- dummy
1447  class(TspAptType), intent(inout) :: this
1448  ! -- local
1449  character(len=LENBOUNDNAME) :: bndName
1450  character(len=9) :: cno
1451  integer(I4B) :: n, itemno, isize, nfeat
1452  integer(I4B), allocatable, dimension(:) :: nboundchk
1453  real(DP), dimension(:), pointer, contiguous :: strt_ptr => null()
1454  type(CharacterStringType), dimension(:), pointer, contiguous :: &
1455  boundname_ptr => null()
1456  !
1457  ! -- allocate package simulation arrays
1458  call mem_allocate(this%strt, this%ncv, 'STRT', this%memoryPath)
1459  if (this%imatrows == 0) then
1460  call mem_allocate(this%iboundpak, this%ncv, 'IBOUND', this%memoryPath)
1461  call mem_allocate(this%xnewpak, this%ncv, 'XNEWPAK', this%memoryPath)
1462  end if
1463  call mem_allocate(this%xoldpak, this%ncv, 'XOLDPAK', this%memoryPath)
1464  allocate (this%featname(this%ncv))
1465  !
1466  ! -- initialize arrays
1467  do n = 1, this%ncv
1468  this%strt(n) = dep20
1469  this%xoldpak(n) = dep20
1470  if (this%imatrows == 0) then
1471  this%iboundpak(n) = 1
1472  this%xnewpak(n) = dep20
1473  end if
1474  end do
1475  !
1476  ! -- set up featureauxvar; allocate_featureauxvar also sets pkg_ifno
1477  ! from PACKAGEDATA_IFNO
1478  call this%allocate_featureauxvar()
1479  !
1480  ! -- validate PACKAGEDATA specifies IFNO exactly once for every feature
1481  nfeat = size(this%pkg_ifno)
1482  allocate (nboundchk(this%ncv))
1483  nboundchk = 0
1484  do n = 1, nfeat
1485  itemno = this%validate_ifno(this%pkg_ifno(n), this%ncv, nboundchk, 'IFNO', &
1486  trim(adjustl(this%text))//' PACKAGEDATA')
1487  end do
1488  call this%report_ifno_coverage(nboundchk, this%ncv, 'feature', &
1489  trim(adjustl(this%text))//' PACKAGEDATA')
1490  deallocate (nboundchk)
1491  if (count_errors() > 0) then
1492  call store_error_filename(this%input_fname)
1493  end if
1494  !
1495  ! -- source STRT from the input context
1496  call mem_setptr(strt_ptr, 'STRT', this%input_mempath)
1497  do n = 1, nfeat
1498  itemno = this%pkg_ifno(n)
1499  this%strt(itemno) = strt_ptr(n)
1500  end do
1501  call memorystore_release('STRT', this%input_mempath)
1502  !
1503  ! -- set default feature names then override with BOUNDNAME if present
1504  do n = 1, this%ncv
1505  write (cno, '(i9.9)') n
1506  this%featname(n) = 'Feature'//cno
1507  end do
1508  if (this%inamedbound /= 0) then
1509  call get_isize('BOUNDNAME', this%input_mempath, isize)
1510  if (isize > 0) then
1511  call mem_setptr(boundname_ptr, 'BOUNDNAME', this%input_mempath)
1512  do n = 1, nfeat
1513  itemno = this%pkg_ifno(n)
1514  if (itemno < 1 .or. itemno > this%ncv) cycle
1515  bndname = boundname_ptr(n)
1516  if (trim(bndname) /= '') this%featname(itemno) = trim(bndname)
1517  end do
1518  end if
1519  end if
1520  call memorystore_release('BOUNDNAME', this%input_mempath)
1521  !
1522  write (this%iout, '(/1x,a)') 'END OF '//trim(adjustl(this%text))// &
1523  ' PACKAGEDATA'
Here is the call graph for this function:

◆ apt_source_dimensions()

subroutine tspaptmodule::apt_source_dimensions ( class(tspapttype), intent(inout)  this)

Definition at line 1392 of file tsp-apt.f90.

1393  ! -- dummy
1394  class(TspAptType), intent(inout) :: this
1395  ! -- local
1396  integer(I4B) :: ierr
1397  !
1398  ! -- default flow package name to package name if not specified in OPTIONS
1399  if (this%flowpackagename == '') then
1400  this%flowpackagename = this%packName
1401  write (this%iout, '(4x,a)') &
1402  'THE FLOW PACKAGE NAME FOR '//trim(adjustl(this%text))//' WAS NOT &
1403  &SPECIFIED. SETTING FLOW PACKAGE NAME TO '// &
1404  trim(adjustl(this%flowpackagename))
1405  end if
1406  call this%find_apt_package()
1407  !
1408  ! -- derive dimensions from the corresponding GWF advanced package
1409  this%ncv = this%flowbudptr%ncv
1410  this%maxbound = this%flowbudptr%budterm(this%idxbudgwf)%maxlist
1411  this%nbound = this%maxbound
1412  write (this%iout, '(a, a)') 'SETTING DIMENSIONS FOR PACKAGE ', this%packName
1413  write (this%iout, '(2x,a,i0)') 'NUMBER OF CONTROL VOLUMES = ', this%ncv
1414  write (this%iout, '(2x,a,i0)') 'MAXBOUND = ', this%maxbound
1415  write (this%iout, '(2x,a,i0)') 'NBOUND = ', this%nbound
1416  if (this%imatrows /= 0) then
1417  this%npakeq = this%ncv
1418  write (this%iout, '(2x,a)') trim(adjustl(this%text))// &
1419  ' SOLVED AS PART OF GWT MATRIX EQUATIONS'
1420  else
1421  write (this%iout, '(2x,a)') trim(adjustl(this%text))// &
1422  ' SOLVED SEPARATELY FROM GWT MATRIX EQUATIONS '
1423  end if
1424  write (this%iout, '(a, //)') 'DONE SETTING DIMENSIONS FOR '// &
1425  trim(adjustl(this%text))
1426  !
1427  if (this%ncv < 0) then
1428  write (errmsg, '(a)') &
1429  'Number of control volumes could not be determined correctly.'
1430  call store_error(errmsg)
1431  end if
1432  ierr = count_errors()
1433  if (ierr > 0) call store_error_filename(this%input_fname)
1434  !
1435  ! -- source packagedata from the input context
1436  call this%apt_source_cvs()
1437  !
1438  call this%define_listlabel()
1439  call this%apt_setup_budobj()
1440  call this%apt_setup_tableobj()
Here is the call graph for this function:

◆ apt_source_options()

subroutine tspaptmodule::apt_source_options ( class(tspapttype), intent(inout)  this)

Definition at line 1305 of file tsp-apt.f90.

1306  ! -- dummy
1307  class(TspAptType), intent(inout) :: this
1308  ! -- local
1309  character(len=LINELENGTH) :: fname
1310  logical :: found
1311  ! -- formats
1312  character(len=*), parameter :: fmtaptbin = &
1313  "(4x, a, 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, &
1314  &/4x, 'OPENED ON UNIT: ', I0)"
1315  !
1316  ! -- call base class for AUXILIARY/BOUNDNAMES/PRINT_INPUT/PRINT_FLOWS/
1317  ! SAVE_FLOWS/OBS6/TS6 options
1318  call this%BndExtType%source_options()
1319  !
1320  write (this%iout, '(1x,a)') &
1321  'PROCESSING '//trim(adjustl(this%text))//' OPTIONS'
1322  !
1323  ! -- FLOW_PKG_NAME (DFN: flow_package_name)
1324  call mem_set_value(this%flowpackagename, 'FLOW_PKG_NAME', &
1325  this%input_mempath, found)
1326  if (found) then
1327  write (this%iout, '(4x,a)') &
1328  'THIS '//trim(adjustl(this%text))//' PACKAGE CORRESPONDS TO A GWF &
1329  &PACKAGE WITH THE NAME '//trim(adjustl(this%flowpackagename))
1330  end if
1331  !
1332  ! -- FP_AUX_NAME (DFN: flow_package_auxiliary_name)
1333  call mem_set_value(this%cauxfpconc, 'FP_AUX_NAME', &
1334  this%input_mempath, found)
1335  if (found) then
1336  write (this%iout, '(4x,a)') &
1337  'SIMULATED CONCENTRATIONS WILL BE COPIED INTO THE FLOW PACKAGE &
1338  &AUXILIARY VARIABLE WITH THE NAME '//trim(adjustl(this%cauxfpconc))
1339  end if
1340  !
1341  ! -- DEV_NONEXPANDING_MATRIX is intentionally not sourced: this
1342  ! package's imatrows=0 solve path divides by a per-feature
1343  ! storage term that is zero without a stage-volume table.
1344  !
1345  ! -- IPRCONC (DFN: print_concentration or print_temperature)
1346  call mem_set_value(this%iprconc, 'IPRCONC', this%input_mempath, found)
1347  if (found) then
1348  write (this%iout, '(4x,a)') trim(adjustl(this%text))// &
1349  ' '//trim(adjustl(this%depvartype))//'S WILL BE PRINTED TO LISTING FILE.'
1350  end if
1351  !
1352  ! -- concentration/temperature output file: 'CONCFILE' (GWT) or 'TEMPFILE' (GWE)
1353  if (this%depvartype == 'CONCENTRATION') then
1354  call mem_set_value(fname, 'CONCFILE', this%input_mempath, found)
1355  else
1356  call mem_set_value(fname, 'TEMPFILE', this%input_mempath, found)
1357  end if
1358  if (found) then
1359  call assign_iounit(this%iconcout, this%inunit, &
1360  trim(this%depvartype)//" fileout")
1361  call openfile(this%iconcout, this%iout, fname, 'DATA(BINARY)', &
1362  form, access, 'REPLACE', mode_opt=mnormal)
1363  write (this%iout, fmtaptbin) trim(adjustl(this%text)), &
1364  trim(adjustl(this%depvartype)), trim(fname), this%iconcout
1365  end if
1366  !
1367  ! -- BUDGET FILEOUT
1368  call mem_set_value(fname, 'BUDGETFILE', this%input_mempath, found)
1369  if (found) then
1370  call assign_iounit(this%ibudgetout, this%inunit, "BUDGET fileout")
1371  call openfile(this%ibudgetout, this%iout, fname, 'DATA(BINARY)', &
1372  form, access, 'REPLACE', mode_opt=mnormal)
1373  write (this%iout, fmtaptbin) trim(adjustl(this%text)), 'BUDGET', &
1374  trim(fname), this%ibudgetout
1375  end if
1376  !
1377  ! -- BUDGETCSV FILEOUT
1378  call mem_set_value(fname, 'BUDGETCSVFILE', this%input_mempath, found)
1379  if (found) then
1380  call assign_iounit(this%ibudcsv, this%inunit, "BUDGETCSV fileout")
1381  call openfile(this%ibudcsv, this%iout, fname, 'CSV', filstat_opt='REPLACE')
1382  write (this%iout, fmtaptbin) trim(adjustl(this%text)), 'BUDGET CSV', &
1383  trim(fname), this%ibudcsv
1384  end if
1385  !
1386  write (this%iout, '(1x,a)') &
1387  'END OF '//trim(adjustl(this%text))//' OPTIONS'
Here is the call graph for this function:

◆ apt_stor_term()

subroutine tspaptmodule::apt_stor_term ( class(tspapttype)  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 2157 of file tsp-apt.f90.

2159  use tdismodule, only: delt
2160  class(TspAptType) :: this
2161  integer(I4B), intent(in) :: ientry
2162  integer(I4B), intent(inout) :: n1
2163  integer(I4B), intent(inout) :: n2
2164  real(DP), intent(inout), optional :: rrate
2165  real(DP), intent(inout), optional :: rhsval
2166  real(DP), intent(inout), optional :: hcofval
2167  real(DP) :: v0, v1
2168  real(DP) :: c0, c1
2169  !
2170  n1 = ientry
2171  n2 = ientry
2172  call this%apt_get_volumes(n1, v1, v0, delt)
2173  c0 = this%xoldpak(n1)
2174  c1 = this%xnewpak(n1)
2175  if (present(rrate)) then
2176  rrate = (-c1 * v1 / delt + c0 * v0 / delt) * this%eqnsclfac
2177  end if
2178  !
2179  if (present(rhsval)) rhsval = -c0 * v0 * this%eqnsclfac / delt
2180  if (present(hcofval)) hcofval = -v1 * this%eqnsclfac / delt

◆ apt_tmvr_term()

subroutine tspaptmodule::apt_tmvr_term ( class(tspapttype)  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 2185 of file tsp-apt.f90.

2187  ! -- modules
2188  ! -- dummy
2189  class(TspAptType) :: this
2190  integer(I4B), intent(in) :: ientry
2191  integer(I4B), intent(inout) :: n1
2192  integer(I4B), intent(inout) :: n2
2193  real(DP), intent(inout), optional :: rrate
2194  real(DP), intent(inout), optional :: rhsval
2195  real(DP), intent(inout), optional :: hcofval
2196  ! -- local
2197  real(DP) :: qbnd
2198  real(DP) :: ctmp
2199  !
2200  ! -- Calculate MVR-related terms
2201  n1 = this%flowbudptr%budterm(this%idxbudtmvr)%id1(ientry)
2202  n2 = this%flowbudptr%budterm(this%idxbudtmvr)%id2(ientry)
2203  qbnd = this%flowbudptr%budterm(this%idxbudtmvr)%flow(ientry)
2204  ctmp = this%xnewpak(n1)
2205  if (present(rrate)) rrate = ctmp * qbnd * this%eqnsclfac
2206  if (present(rhsval)) rhsval = dzero
2207  if (present(hcofval)) hcofval = qbnd * this%eqnsclfac

◆ define_listlabel()

subroutine tspaptmodule::define_listlabel ( class(tspapttype), intent(inout)  this)

Definition at line 1708 of file tsp-apt.f90.

1709  class(TspAptType), intent(inout) :: this
1710  !
1711  ! -- create the header list label
1712  this%listlabel = trim(this%filtyp)//' NO.'
1713  if (this%dis%ndim == 3) then
1714  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
1715  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
1716  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
1717  elseif (this%dis%ndim == 2) then
1718  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
1719  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
1720  else
1721  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
1722  end if
1723  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'STRESS RATE'
1724  if (this%inamedbound == 1) then
1725  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
1726  end if

◆ find_apt_package()

subroutine tspaptmodule::find_apt_package ( class(tspapttype)  this)

Definition at line 1291 of file tsp-apt.f90.

1292  ! -- modules
1294  ! -- dummy
1295  class(TspAptType) :: this
1296  ! -- local
1297  !
1298  ! -- this routine should never be called
1299  call store_error('Program error: pak_solve not implemented.', &
1300  terminate=.true.)
Here is the call graph for this function:

◆ get_mvr_depvar()

real(dp) function, dimension(:), pointer, contiguous tspaptmodule::get_mvr_depvar ( class(tspapttype)  this)

Set the concentration (or temperature) to be used by either MVT or MVE

Definition at line 556 of file tsp-apt.f90.

557  ! -- dummy
558  class(TspAptType) :: this
559  ! -- return
560  real(dp), dimension(:), contiguous, pointer :: get_mvr_depvar
561  !
562  get_mvr_depvar => this%xnewpak

◆ pak_bd_obs()

subroutine tspaptmodule::pak_bd_obs ( class(tspapttype), 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 2709 of file tsp-apt.f90.

2710  ! -- dummy
2711  class(TspAptType), intent(inout) :: this
2712  character(len=*), intent(in) :: obstypeid
2713  integer(I4B), intent(in) :: jj
2714  real(DP), intent(inout) :: v
2715  logical, intent(inout) :: found
2716  ! -- local
2717  !
2718  ! -- set found = .false. because obstypeid is not known
2719  found = .false.

◆ pak_df_obs()

subroutine tspaptmodule::pak_df_obs ( class(tspapttype)  this)

This routine:

  • stores observations supported by the APT package
  • must be overridden by child class

Definition at line 2323 of file tsp-apt.f90.

2324  ! -- modules
2325  ! -- dummy
2326  class(TspAptType) :: this
2327  ! -- local
2328  !
2329  ! -- this routine should never be called
2330  call store_error('Program error: pak_df_obs not implemented.', &
2331  terminate=.true.)
Here is the call graph for this function:

◆ pak_fc_expanded()

subroutine tspaptmodule::pak_fc_expanded ( class(tspapttype)  this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)

Routine to allow a subclass advanced transport package to inject terms into the matrix assembly. This method must be overridden.

Definition at line 829 of file tsp-apt.f90.

830  ! -- modules
831  ! -- dummy
832  class(TspAptType) :: this
833  real(DP), dimension(:), intent(inout) :: rhs
834  integer(I4B), dimension(:), intent(in) :: ia
835  integer(I4B), dimension(:), intent(in) :: idxglo
836  class(MatrixBaseType), pointer :: matrix_sln
837  ! -- local
838  !
839  ! -- this routine should never be called
840  call store_error('Program error: pak_fc_expanded not implemented.', &
841  terminate=.true.)
Here is the call graph for this function:

◆ pak_fill_budobj()

subroutine tspaptmodule::pak_fill_budobj ( class(tspapttype)  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 2138 of file tsp-apt.f90.

2139  ! -- modules
2140  ! -- dummy
2141  class(TspAptType) :: this
2142  integer(I4B), intent(inout) :: idx
2143  real(DP), dimension(:), intent(in) :: x
2144  real(DP), dimension(:), contiguous, intent(inout) :: flowja
2145  real(DP), intent(inout) :: ccratin
2146  real(DP), intent(inout) :: ccratout
2147  ! -- local
2148  ! -- formats
2149  !
2150  ! -- this routine should never be called
2151  call store_error('Program error: pak_fill_budobj not implemented.', &
2152  terminate=.true.)
Here is the call graph for this function:

◆ pak_get_nbudterms()

integer(i4b) function tspaptmodule::pak_get_nbudterms ( class(tspapttype)  this)

This function must be overridden.

Definition at line 1782 of file tsp-apt.f90.

1783  ! -- modules
1784  ! -- dummy
1785  class(TspAptType) :: this
1786  ! -- return
1787  integer(I4B) :: nbudterms
1788  ! -- local
1789  !
1790  ! -- this routine should never be called
1791  call store_error('Program error: pak_get_nbudterms not implemented.', &
1792  terminate=.true.)
1793  nbudterms = 0
Here is the call graph for this function:

◆ pak_rp_obs()

subroutine tspaptmodule::pak_rp_obs ( class(tspapttype), 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 2338 of file tsp-apt.f90.

2339  ! -- dummy
2340  class(TspAptType), intent(inout) :: this !< package class
2341  type(ObserveType), intent(inout) :: obsrv !< observation object
2342  logical, intent(inout) :: found !< indicate whether observation was found
2343  ! -- local
2344  !
2345  ! -- this routine should never be called
2346  call store_error('Program error: pak_rp_obs not implemented.', &
2347  terminate=.true.)
Here is the call graph for this function:

◆ pak_setup_budobj()

subroutine tspaptmodule::pak_setup_budobj ( class(tspapttype)  this,
integer(i4b), intent(inout)  idx 
)

Individual packages set up their budget terms. Must be overridden.

Definition at line 1986 of file tsp-apt.f90.

1987  ! -- modules
1988  ! -- dummy
1989  class(TspAptType) :: this
1990  integer(I4B), intent(inout) :: idx
1991  ! -- local
1992  !
1993  ! -- this routine should never be called
1994  call store_error('Program error: pak_setup_budobj not implemented.', &
1995  terminate=.true.)
Here is the call graph for this function:

◆ pak_solve()

subroutine tspaptmodule::pak_solve ( class(tspapttype)  this)

This routine must be overridden by the specific apt package

Definition at line 1664 of file tsp-apt.f90.

1665  ! -- dummy
1666  class(TspAptType) :: this
1667  ! -- local
1668  !
1669  ! -- this routine should never be called
1670  call store_error('Program error: pak_solve not implemented.', &
1671  terminate=.true.)
Here is the call graph for this function:

◆ rp_obs_budterm()

subroutine tspaptmodule::rp_obs_budterm ( class(tspapttype), intent(inout)  this,
type(observetype), intent(inout)  obsrv,
type(budgettermtype), intent(in)  budterm 
)

Find the indices for this observation assuming they are first indexed by feature number and secondly by a connection number

Parameters
[in,out]thisobject
[in,out]obsrvobservation
[in]budtermbudget term

Definition at line 2398 of file tsp-apt.f90.

2399  class(TspAptType), intent(inout) :: this !< object
2400  type(ObserveType), intent(inout) :: obsrv !< observation
2401  type(BudgetTermType), intent(in) :: budterm !< budget term
2402  integer(I4B) :: nn1
2403  integer(I4B) :: iconn
2404  integer(I4B) :: icv
2405  integer(I4B) :: idx
2406  integer(I4B) :: j
2407  logical :: jfound
2408  character(len=*), parameter :: fmterr = &
2409  "('Boundary ', a, ' for observation ', a, &
2410  &' is invalid in package ', a)"
2411  nn1 = obsrv%NodeNumber
2412  if (nn1 == namedboundflag) then
2413  jfound = .false.
2414  do j = 1, budterm%nlist
2415  icv = budterm%id1(j)
2416  if (this%featname(icv) == obsrv%FeatureName) then
2417  jfound = .true.
2418  call obsrv%AddObsIndex(j)
2419  end if
2420  end do
2421  if (.not. jfound) then
2422  write (errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2423  trim(this%packName)
2424  call store_error(errmsg)
2425  end if
2426  else
2427  !
2428  ! -- ensure nn1 is > 0 and < ncv
2429  if (nn1 < 0 .or. nn1 > this%ncv) then
2430  write (errmsg, '(7a, i0, a, i0, a)') &
2431  'Observation ', trim(obsrv%Name), ' of type ', &
2432  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2433  trim(this%packName), ' was assigned ID = ', nn1, &
2434  '. ID must be >= 1 and <= ', this%ncv, '.'
2435  call store_error(errmsg)
2436  end if
2437  iconn = obsrv%NodeNumber2
2438  do j = 1, budterm%nlist
2439  if (budterm%id1(j) == nn1) then
2440  ! -- Look for the first occurrence of nn1, then set indxbnds
2441  ! to the iconn record after that
2442  idx = j + iconn - 1
2443  call obsrv%AddObsIndex(idx)
2444  exit
2445  end if
2446  end do
2447  if (idx < 1 .or. idx > budterm%nlist) then
2448  write (errmsg, '(7a, i0, a, i0, a)') &
2449  'Observation ', trim(obsrv%Name), ' of type ', &
2450  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2451  trim(this%packName), ' specifies iconn = ', iconn, &
2452  ', but this is not a valid connection for ID ', nn1, '.'
2453  call store_error(errmsg)
2454  else if (budterm%id1(idx) /= nn1) then
2455  write (errmsg, '(7a, i0, a, i0, a)') &
2456  'Observation ', trim(obsrv%Name), ' of type ', &
2457  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2458  trim(this%packName), ' specifies iconn = ', iconn, &
2459  ', but this is not a valid connection for ID ', nn1, '.'
2460  call store_error(errmsg)
2461  end if
2462  end if
Here is the call graph for this function:

◆ rp_obs_byfeature()

subroutine tspaptmodule::rp_obs_byfeature ( class(tspapttype), intent(inout)  this,
type(observetype), intent(inout)  obsrv 
)

Find the indices for this observation assuming they are indexed by feature number

Parameters
[in,out]thisobject
[in,out]obsrvobservation

Definition at line 2355 of file tsp-apt.f90.

2356  class(TspAptType), intent(inout) :: this !< object
2357  type(ObserveType), intent(inout) :: obsrv !< observation
2358  integer(I4B) :: nn1
2359  integer(I4B) :: j
2360  logical :: jfound
2361  character(len=*), parameter :: fmterr = &
2362  "('Boundary ', a, ' for observation ', a, &
2363  &' is invalid in package ', a)"
2364  nn1 = obsrv%NodeNumber
2365  if (nn1 == namedboundflag) then
2366  jfound = .false.
2367  do j = 1, this%ncv
2368  if (this%featname(j) == obsrv%FeatureName) then
2369  jfound = .true.
2370  call obsrv%AddObsIndex(j)
2371  end if
2372  end do
2373  if (.not. jfound) then
2374  write (errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2375  trim(this%packName)
2376  call store_error(errmsg)
2377  end if
2378  else
2379  !
2380  ! -- ensure nn1 is > 0 and < ncv
2381  if (nn1 < 0 .or. nn1 > this%ncv) then
2382  write (errmsg, '(7a, i0, a, i0, a)') &
2383  'Observation ', trim(obsrv%Name), ' of type ', &
2384  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2385  trim(this%packName), ' was assigned ID = ', nn1, &
2386  '. ID must be >= 1 and <= ', this%ncv, '.'
2387  call store_error(errmsg)
2388  end if
2389  call obsrv%AddObsIndex(nn1)
2390  end if
Here is the call graph for this function:

◆ rp_obs_flowjaface()

subroutine tspaptmodule::rp_obs_flowjaface ( class(tspapttype), intent(inout)  this,
type(observetype), intent(inout)  obsrv,
type(budgettermtype), intent(in)  budterm 
)

Find the indices for this observation assuming they are first indexed by a feature number and secondly by a second feature number

Parameters
[in,out]thisobject
[in,out]obsrvobservation
[in]budtermbudget term

Definition at line 2470 of file tsp-apt.f90.

2471  class(TspAptType), intent(inout) :: this !< object
2472  type(ObserveType), intent(inout) :: obsrv !< observation
2473  type(BudgetTermType), intent(in) :: budterm !< budget term
2474  integer(I4B) :: nn1
2475  integer(I4B) :: nn2
2476  integer(I4B) :: icv
2477  integer(I4B) :: j
2478  logical :: jfound
2479  character(len=*), parameter :: fmterr = &
2480  "('Boundary ', a, ' for observation ', a, &
2481  &' is invalid in package ', a)"
2482  nn1 = obsrv%NodeNumber
2483  if (nn1 == namedboundflag) then
2484  jfound = .false.
2485  do j = 1, budterm%nlist
2486  icv = budterm%id1(j)
2487  if (this%featname(icv) == obsrv%FeatureName) then
2488  jfound = .true.
2489  call obsrv%AddObsIndex(j)
2490  end if
2491  end do
2492  if (.not. jfound) then
2493  write (errmsg, fmterr) trim(obsrv%FeatureName), trim(obsrv%Name), &
2494  trim(this%packName)
2495  call store_error(errmsg)
2496  end if
2497  else
2498  !
2499  ! -- ensure nn1 is > 0 and < ncv
2500  if (nn1 < 0 .or. nn1 > this%ncv) then
2501  write (errmsg, '(7a, i0, a, i0, a)') &
2502  'Observation ', trim(obsrv%Name), ' of type ', &
2503  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2504  trim(this%packName), ' was assigned ID = ', nn1, &
2505  '. ID must be >= 1 and <= ', this%ncv, '.'
2506  call store_error(errmsg)
2507  end if
2508  nn2 = obsrv%NodeNumber2
2509  !
2510  ! -- ensure nn2 is > 0 and < ncv
2511  if (nn2 < 0 .or. nn2 > this%ncv) then
2512  write (errmsg, '(7a, i0, a, i0, a)') &
2513  'Observation ', trim(obsrv%Name), ' of type ', &
2514  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2515  trim(this%packName), ' was assigned ID2 = ', nn2, &
2516  '. ID must be >= 1 and <= ', this%ncv, '.'
2517  call store_error(errmsg)
2518  end if
2519  ! -- Look for nn1 and nn2 in id1 and id2
2520  jfound = .false.
2521  do j = 1, budterm%nlist
2522  if (budterm%id1(j) == nn1 .and. budterm%id2(j) == nn2) then
2523  call obsrv%AddObsIndex(j)
2524  jfound = .true.
2525  end if
2526  end do
2527  if (.not. jfound) then
2528  write (errmsg, '(7a, i0, a, i0, a)') &
2529  'Observation ', trim(obsrv%Name), ' of type ', &
2530  trim(adjustl(obsrv%ObsTypeId)), ' in package ', &
2531  trim(this%packName), &
2532  ' specifies a connection between feature ', nn1, &
2533  ' feature ', nn2, ', but these features are not connected.'
2534  call store_error(errmsg)
2535  end if
2536  end if
Here is the call graph for this function:

Variable Documentation

◆ ftype

character(len=lenftype) tspaptmodule::ftype = 'APT'

Definition at line 70 of file tsp-apt.f90.

70  character(len=LENFTYPE) :: ftype = 'APT'

◆ text

character(len=lenvarname) tspaptmodule::text = ' APT'

Definition at line 71 of file tsp-apt.f90.

71  character(len=LENVARNAME) :: text = ' APT'