MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
gwectpmodule Module Reference

Data Types

type  gwectptype
 

Functions/Subroutines

subroutine, public ctp_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, depvartype, mempath)
 Create a new constant temperature package. More...
 
subroutine ctp_allocate_arrays (this, nodelist, auxvar)
 Allocate arrays specific to the constant temperature package. More...
 
subroutine ctp_rp (this)
 Constant temperature read and prepare (rp) routine. More...
 
subroutine ctp_ad (this)
 Constant temperature package advance routine. More...
 
subroutine ctp_ck (this)
 Check constant temperature boundary condition data. More...
 
subroutine ctp_fc (this, rhs, ia, idxglo, matrix_sln)
 Override bnd_fc and do nothing. More...
 
subroutine ctp_cq (this, x, flowja, iadv)
 Calculate flow associated with constant temperature boundary. More...
 
subroutine ctp_bd (this, model_budget)
 Add package ratin/ratout to model budget. More...
 
subroutine ctp_da (this)
 Deallocate memory. More...
 
subroutine define_listlabel (this)
 Define labels used in list file. More...
 
logical function ctp_obs_supported (this)
 Procedure related to observation processing. More...
 
subroutine ctp_df_obs (this)
 Procedure related to observation processing. More...
 
subroutine ctp_rp_ts (this)
 Procedure related to time series. More...
 
real(dp) function temp_mult (this, row)
 Apply auxiliary multiplier to specified temperature if. More...
 
real(dp) function ctp_bound_value (this, col, row)
 @ brief Return a bound value More...
 

Variables

character(len=lenftype) ftype = 'CTP'
 
character(len=lenpackagename) text = ' CTP'
 

Function/Subroutine Documentation

◆ ctp_ad()

subroutine gwectpmodule::ctp_ad ( class(gwectptype this)

Add package connections to matrix

Definition at line 178 of file gwe-ctp.f90.

179  ! -- dummy
180  class(GweCtpType) :: this
181  ! -- local
182  integer(I4B) :: i, node
183  real(DP) :: cb
184  !
185  ! -- Advance the time series
186  call this%TsManager%ad()
187  !
188  ! -- Process each entry in the constant temperature cell list
189  do i = 1, this%nbound
190  node = this%nodelist(i)
191  cb = this%temp_mult(i)
192  !
193  this%xnew(node) = cb
194  this%xold(node) = this%xnew(node)
195  end do
196  !
197  ! -- For each observation, push simulated value and corresponding
198  ! simulation time from "current" to "preceding" and reset
199  ! "current" value.
200  call this%obs%obs_ad()

◆ ctp_allocate_arrays()

subroutine gwectpmodule::ctp_allocate_arrays ( class(gwectptype this,
integer(i4b), dimension(:), optional, pointer, contiguous  nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous  auxvar 
)
private

Definition at line 98 of file gwe-ctp.f90.

99  ! -- modules
101  ! -- dummy
102  class(GweCtpType) :: this
103  integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist
104  real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar
105  ! -- local
106  integer(I4B) :: i
107  !
108  ! -- call standard BndType allocate scalars
109  call this%BndExtType%allocate_arrays(nodelist, auxvar)
110  !
111  ! -- allocate ratectpex
112  call mem_allocate(this%ratectpin, this%maxbound, 'RATECTPIN', this%memoryPath)
113  call mem_allocate(this%ratectpout, this%maxbound, 'RATECTPOUT', &
114  this%memoryPath)
115  do i = 1, this%maxbound
116  this%ratectpin(i) = dzero
117  this%ratectpout(i) = dzero
118  end do
119  ! -- set constant head array input context pointer
120  call mem_setptr(this%tspvar, 'TSPVAR', this%input_mempath)
121  !
122  ! -- checkin constant head array input context pointer
123  call mem_checkin(this%tspvar, 'TSPVAR', this%memoryPath, &
124  'TSPVAR', this%input_mempath)
125  !

◆ ctp_bd()

subroutine gwectpmodule::ctp_bd ( class(gwectptype this,
type(budgettype), intent(inout)  model_budget 
)
private

Definition at line 314 of file gwe-ctp.f90.

315  ! -- modules
316  use tdismodule, only: delt
318  ! -- dummy
319  class(GweCtpType) :: this
320  ! -- local
321  type(BudgetType), intent(inout) :: model_budget
322  real(DP) :: ratin
323  real(DP) :: ratout
324  real(DP) :: dum
325  integer(I4B) :: isuppress_output
326  !
327  isuppress_output = 0
328  call rate_accumulator(this%ratectpin(1:this%nbound), ratin, dum)
329  call rate_accumulator(this%ratectpout(1:this%nbound), ratout, dum)
330  call model_budget%addentry(ratin, ratout, delt, this%text, &
331  isuppress_output, this%packName)
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:632
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:29
Derived type for the Budget object.
Definition: Budget.f90:39
Here is the call graph for this function:

◆ ctp_bound_value()

real(dp) function gwectpmodule::ctp_bound_value ( class(gwectptype), intent(inout)  this,
integer(i4b), intent(in)  col,
integer(i4b), intent(in)  row 
)

Return a bound value associated with an ncolbnd index and row.

Definition at line 460 of file gwe-ctp.f90.

461  ! -- modules
462  use constantsmodule, only: dzero
463  ! -- dummy variables
464  class(GweCtpType), intent(inout) :: this
465  integer(I4B), intent(in) :: col
466  integer(I4B), intent(in) :: row
467  ! -- result
468  real(DP) :: bndval
469  !
470  select case (col)
471  case (1)
472  bndval = this%temp_mult(row)
473  case default
474  write (errmsg, '(3a)') 'Programming error. ', &
475  & adjustl(trim(this%filtyp)), ' bound value requested column '&
476  &'outside range of ncolbnd (1).'
477  call store_error(errmsg)
478  call store_error_filename(this%input_fname)
479  end select
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
Here is the call graph for this function:

◆ ctp_ck()

subroutine gwectpmodule::ctp_ck ( class(gwectptype), intent(inout)  this)
private

Definition at line 205 of file gwe-ctp.f90.

206  ! -- dummy
207  class(GweCtpType), intent(inout) :: this
208  ! -- local
209  character(len=30) :: nodestr
210  integer(I4B) :: i
211  integer(I4B) :: node
212  ! -- formats
213  character(len=*), parameter :: fmtctperr = &
214  &"('Specified dependent variable boundary ',i0, &
215  &' temperature (',g0,') is less than zero for cell', a)"
216  !
217  ! -- check stress period data
218  do i = 1, this%nbound
219  node = this%nodelist(i)
220  ! -- accumulate errors
221  if (this%temp_mult(i) < dzero) then
222  call this%dis%noder_to_string(node, nodestr)
223  write (errmsg, fmt=fmtctperr) i, this%tspvar(i), trim(nodestr)
224  call store_error(errmsg)
225  end if
226  end do
227  !
228  ! -- write summary of ctp package error messages
229  if (count_errors() > 0) then
230  call store_error_filename(this%input_fname)
231  end if
Here is the call graph for this function:

◆ ctp_cq()

subroutine gwectpmodule::ctp_cq ( class(gwectptype), intent(inout)  this,
real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(inout), contiguous  flowja,
integer(i4b), intent(in), optional  iadv 
)
private

This method overrides bnd_cq()

Definition at line 252 of file gwe-ctp.f90.

253  ! -- dummy
254  class(GweCtpType), intent(inout) :: this
255  real(DP), dimension(:), intent(in) :: x
256  real(DP), dimension(:), contiguous, intent(inout) :: flowja
257  integer(I4B), optional, intent(in) :: iadv
258  ! -- local
259  integer(I4B) :: i
260  integer(I4B) :: ipos
261  integer(I4B) :: node
262  integer(I4B) :: n2
263  integer(I4B) :: idiag
264  real(DP) :: rate
265  real(DP) :: ratein, rateout
266  real(DP) :: q
267  !
268  ! -- If no boundaries, skip flow calculations.
269  if (this%nbound > 0) then
270  !
271  ! -- Loop through each boundary calculating flow.
272  do i = 1, this%nbound
273  node = this%nodelist(i)
274  idiag = this%dis%con%ia(node)
275  rate = dzero
276  ratein = dzero
277  rateout = dzero
278  !
279  ! -- Calculate the flow rate into the cell.
280  do ipos = this%dis%con%ia(node) + 1, &
281  this%dis%con%ia(node + 1) - 1
282  q = flowja(ipos)
283  rate = rate - q
284  ! -- Only accumulate chin and chout for active
285  ! connected cells
286  n2 = this%dis%con%ja(ipos)
287  if (this%ibound(n2) > 0) then
288  if (q < dzero) then
289  ratein = ratein - q
290  else
291  rateout = rateout + q
292  end if
293  end if
294  end do
295  !
296  ! -- For CTP, store total flow in rhs so it is available for other
297  ! calculations
298  this%rhs(i) = -rate
299  this%hcof(i) = dzero
300  !
301  ! -- Save simulated value to simvals array.
302  this%simvals(i) = rate
303  this%ratectpin(i) = ratein
304  this%ratectpout(i) = rateout
305  flowja(idiag) = flowja(idiag) + rate
306  !
307  end do
308  !
309  end if

◆ ctp_create()

subroutine, public gwectpmodule::ctp_create ( class(bndtype), pointer  packobj,
integer(i4b), intent(in)  id,
integer(i4b), intent(in)  ibcnum,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
character(len=*), intent(in)  namemodel,
character(len=*), intent(in)  pakname,
character(len=lenvarname), intent(in)  depvartype,
character(len=*), intent(in)  mempath 
)

Routine points packobj to the newly created package

Definition at line 55 of file gwe-ctp.f90.

57  ! -- dummy
58  class(BndType), pointer :: packobj
59  integer(I4B), intent(in) :: id
60  integer(I4B), intent(in) :: ibcnum
61  integer(I4B), intent(in) :: inunit
62  integer(I4B), intent(in) :: iout
63  character(len=*), intent(in) :: namemodel
64  character(len=*), intent(in) :: pakname
65  character(len=LENVARNAME), intent(in) :: depvartype
66  character(len=*), intent(in) :: mempath
67  ! -- local
68  type(GweCtpType), pointer :: ctpobj
69  !
70  ! -- allocate the object and assign values to object variables
71  allocate (ctpobj)
72  packobj => ctpobj
73  !
74  ! -- create name and memory path
75  call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
76  packobj%text = text
77  !
78  ! -- allocate scalars
79  call ctpobj%allocate_scalars()
80  !
81  ! -- initialize package
82  call packobj%pack_initialize()
83  !
84  ! -- store values
85  packobj%inunit = inunit
86  packobj%iout = iout
87  packobj%id = id
88  packobj%ibcnum = ibcnum
89  packobj%ncolbnd = 1
90  packobj%iscloc = 1
91  !
92  ! -- Store the appropriate label based on the dependent variable
93  ctpobj%depvartype = depvartype
Here is the caller graph for this function:

◆ ctp_da()

subroutine gwectpmodule::ctp_da ( class(gwectptype this)

Method to deallocate memory for the package.

Definition at line 338 of file gwe-ctp.f90.

339  ! -- modules
341  ! -- dummy
342  class(GweCtpType) :: this
343  !
344  ! -- Deallocate parent package
345  call this%BndExtType%bnd_da()
346  !
347  ! -- arrays
348  call mem_deallocate(this%ratectpin)
349  call mem_deallocate(this%ratectpout)
350  call mem_deallocate(this%tspvar, 'TSPVAR', this%memoryPath)

◆ ctp_df_obs()

subroutine gwectpmodule::ctp_df_obs ( class(gwectptype this)
private

This routine:

  • defines observations
  • stores observation types supported by either of the SDV packages (CTP or CTP),
  • overrides BndExtTypebnd_df_obs

Definition at line 401 of file gwe-ctp.f90.

402  ! -- dummy
403  class(GweCtpType) :: this
404  ! -- local
405  integer(I4B) :: indx
406  !
407  call this%obs%StoreObsType(this%filtyp, .true., indx)
408  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
Here is the call graph for this function:

◆ ctp_fc()

subroutine gwectpmodule::ctp_fc ( class(gwectptype this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)
private

For constant temperature boundary type, the call to bnd_fc needs to be overwritten to prevent logic found in bnd from being executed

Definition at line 239 of file gwe-ctp.f90.

240  ! -- dummy
241  class(GweCtpType) :: this
242  real(DP), dimension(:), intent(inout) :: rhs
243  integer(I4B), dimension(:), intent(in) :: ia
244  integer(I4B), dimension(:), intent(in) :: idxglo
245  class(MatrixBaseType), pointer :: matrix_sln

◆ ctp_obs_supported()

logical function gwectpmodule::ctp_obs_supported ( class(gwectptype this)
private

This routine:

  • returns true because the SDV package supports observations,
  • overrides packagetype_obs_supported()

Definition at line 386 of file gwe-ctp.f90.

387  ! -- dummy
388  class(GweCtpType) :: this
389  !
390  ctp_obs_supported = .true.

◆ ctp_rp()

subroutine gwectpmodule::ctp_rp ( class(gwectptype), intent(inout)  this)

Definition at line 130 of file gwe-ctp.f90.

131  ! -- modules
132  use simmodule, only: store_error
133  use inputoutputmodule, only: lowcase
134  implicit none
135  ! -- dummy
136  class(GweCtpType), intent(inout) :: this
137  ! -- local
138  integer(I4B) :: i, node, ibd, ierr
139  character(len=30) :: nodestr
140  character(len=LENVARNAME) :: dvtype
141  !
142  ! -- Reset previous CTPs to active cell
143  do i = 1, this%nbound
144  node = this%nodelist(i)
145  this%ibound(node) = this%ibcnum
146  end do
147  !
148  ! -- Call the parent class read and prepare
149  call this%BndExtType%bnd_rp()
150  !
151  ! -- Set ibound to -(ibcnum + 1) for constant temperature cells
152  ierr = 0
153  do i = 1, this%nbound
154  node = this%nodelist(i)
155  ibd = this%ibound(node)
156  if (ibd < 0) then
157  call this%dis%noder_to_string(node, nodestr)
158  dvtype = trim(this%depvartype)
159  call lowcase(dvtype)
160  call store_error('Cell is already a constant ' &
161  //dvtype//': '//trim(adjustl(nodestr)))
162  ierr = ierr + 1
163  else
164  this%ibound(node) = -this%ibcnum
165  end if
166  end do
167  !
168  ! -- Stop if errors detected
169  if (ierr > 0) then
170  call store_error_filename(this%input_fname)
171  end if
subroutine, public lowcase(word)
Convert to lower case.
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
Here is the call graph for this function:

◆ ctp_rp_ts()

subroutine gwectpmodule::ctp_rp_ts ( class(gwectptype), intent(inout)  this)
private

Assign tsLinkText appropriately for all time series in use by package. For the constant temperature packages, the dependent variable can also be controlled by a time series.

Definition at line 419 of file gwe-ctp.f90.

420  ! -- dummy
421  class(GweCtpType), intent(inout) :: this
422  ! -- local
423  integer(I4B) :: i, nlinks
424  type(TimeSeriesLinkType), pointer :: tslink => null()
425  !
426  nlinks = this%TsManager%boundtslinks%Count()
427  do i = 1, nlinks
428  tslink => gettimeserieslinkfromlist(this%TsManager%boundtslinks, i)
429  if (associated(tslink)) then
430  select case (tslink%JCol)
431  case (1)
432  tslink%Text = trim(this%depvartype)
433  end select
434  end if
435  end do
Here is the call graph for this function:

◆ define_listlabel()

subroutine gwectpmodule::define_listlabel ( class(gwectptype), intent(inout)  this)

Define the list heading that is written to iout when PRINT_INPUT option is used.

Definition at line 358 of file gwe-ctp.f90.

359  ! -- dummy
360  class(GweCtpType), intent(inout) :: this
361  !
362  ! -- create the header list label
363  this%listlabel = trim(this%filtyp)//' NO.'
364  if (this%dis%ndim == 3) then
365  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
366  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
367  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
368  elseif (this%dis%ndim == 2) then
369  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
370  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
371  else
372  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
373  end if
374  write (this%listlabel, '(a, a16)') trim(this%listlabel), &
375  trim(this%depvartype)
376  if (this%inamedbound == 1) then
377  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
378  end if

◆ temp_mult()

real(dp) function gwectpmodule::temp_mult ( class(gwectptype), intent(inout)  this,
integer(i4b), intent(in)  row 
)
private

Definition at line 440 of file gwe-ctp.f90.

441  ! -- modules
442  use constantsmodule, only: dzero
443  ! -- dummy
444  class(GweCtpType), intent(inout) :: this
445  integer(I4B), intent(in) :: row
446  ! -- result
447  real(DP) :: temp
448  !
449  if (this%iauxmultcol > 0) then
450  temp = this%tspvar(row) * this%auxvar(this%iauxmultcol, row)
451  else
452  temp = this%tspvar(row)
453  end if

Variable Documentation

◆ ftype

character(len=lenftype) gwectpmodule::ftype = 'CTP'
private

Definition at line 21 of file gwe-ctp.f90.

21  character(len=LENFTYPE) :: ftype = 'CTP'

◆ text

character(len=lenpackagename) gwectpmodule::text = ' CTP'
private

Definition at line 22 of file gwe-ctp.f90.

22  character(len=LENPACKAGENAME) :: text = ' CTP'