MODFLOW 6  version 6.6.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 183 of file gwe-ctp.f90.

184  ! -- dummy
185  class(GweCtpType) :: this
186  ! -- local
187  integer(I4B) :: i, node
188  real(DP) :: cb
189  !
190  ! -- Advance the time series
191  call this%TsManager%ad()
192  !
193  ! -- Process each entry in the constant temperature cell list
194  do i = 1, this%nbound
195  node = this%nodelist(i)
196  cb = this%temp_mult(i)
197  !
198  this%xnew(node) = cb
199  this%xold(node) = this%xnew(node)
200  end do
201  !
202  ! -- For each observation, push simulated value and corresponding
203  ! simulation time from "current" to "preceding" and reset
204  ! "current" value.
205  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 319 of file gwe-ctp.f90.

320  ! -- modules
321  use tdismodule, only: delt
323  ! -- dummy
324  class(GweCtpType) :: this
325  ! -- local
326  type(BudgetType), intent(inout) :: model_budget
327  real(DP) :: ratin
328  real(DP) :: ratout
329  real(DP) :: dum
330  integer(I4B) :: isuppress_output
331  !
332  isuppress_output = 0
333  call rate_accumulator(this%ratectpin(1:this%nbound), ratin, dum)
334  call rate_accumulator(this%ratectpout(1:this%nbound), ratout, dum)
335  call model_budget%addentry(ratin, ratout, delt, this%text, &
336  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.

Parameters
[in,out]thisBndExtType object

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

466  ! -- modules
467  use constantsmodule, only: dzero
468  ! -- dummy variables
469  class(GweCtpType), intent(inout) :: this !< BndExtType object
470  integer(I4B), intent(in) :: col
471  integer(I4B), intent(in) :: row
472  ! -- result
473  real(DP) :: bndval
474  !
475  select case (col)
476  case (1)
477  bndval = this%temp_mult(row)
478  case default
479  write (errmsg, '(3a)') 'Programming error. ', &
480  & adjustl(trim(this%filtyp)), ' bound value requested column '&
481  &'outside range of ncolbnd (1).'
482  call store_error(errmsg)
483  call store_error_filename(this%input_fname)
484  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 210 of file gwe-ctp.f90.

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

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

344  ! -- modules
346  ! -- dummy
347  class(GweCtpType) :: this
348  !
349  ! -- Deallocate parent package
350  call this%BndExtType%bnd_da()
351  !
352  ! -- arrays
353  call mem_deallocate(this%ratectpin)
354  call mem_deallocate(this%ratectpout)
355  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 406 of file gwe-ctp.f90.

407  ! -- dummy
408  class(GweCtpType) :: this
409  ! -- local
410  integer(I4B) :: indx
411  !
412  call this%obs%StoreObsType(this%filtyp, .true., indx)
413  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 244 of file gwe-ctp.f90.

245  ! -- dummy
246  class(GweCtpType) :: this
247  real(DP), dimension(:), intent(inout) :: rhs
248  integer(I4B), dimension(:), intent(in) :: ia
249  integer(I4B), dimension(:), intent(in) :: idxglo
250  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 391 of file gwe-ctp.f90.

392  ! -- dummy
393  class(GweCtpType) :: this
394  !
395  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
172  !
173  ! -- Write the list to iout if requested
174  if (this%iprpak /= 0) then
175  call this%write_list()
176  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 424 of file gwe-ctp.f90.

425  ! -- dummy
426  class(GweCtpType), intent(inout) :: this
427  ! -- local
428  integer(I4B) :: i, nlinks
429  type(TimeSeriesLinkType), pointer :: tslink => null()
430  !
431  nlinks = this%TsManager%boundtslinks%Count()
432  do i = 1, nlinks
433  tslink => gettimeserieslinkfromlist(this%TsManager%boundtslinks, i)
434  if (associated(tslink)) then
435  select case (tslink%JCol)
436  case (1)
437  tslink%Text = trim(this%depvartype)
438  end select
439  end if
440  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 363 of file gwe-ctp.f90.

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

◆ temp_mult()

real(dp) function gwectpmodule::temp_mult ( class(gwectptype), intent(inout)  this,
integer(i4b), intent(in)  row 
)
private
Parameters
[in,out]thisBndExtType object

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

446  ! -- modules
447  use constantsmodule, only: dzero
448  ! -- dummy
449  class(GweCtpType), intent(inout) :: this !< BndExtType object
450  integer(I4B), intent(in) :: row
451  ! -- result
452  real(DP) :: temp
453  !
454  if (this%iauxmultcol > 0) then
455  temp = this%tspvar(row) * this%auxvar(this%iauxmultcol, row)
456  else
457  temp = this%tspvar(row)
458  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'