MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
gweestmodule Module Reference

– @ brief Energy Storage and Transfer (EST) Module More...

Data Types

type  gweesttype
 @ brief Energy storage and transfer More...
 

Functions/Subroutines

subroutine, public est_cr (estobj, name_model, inunit, iout, fmi, eqnsclfac, gwecommon)
 @ brief Create a new EST package object More...
 
subroutine est_ar (this, dis, ibound)
 @ brief Allocate and read method for package More...
 
subroutine est_fc (this, nodes, cold, nja, matrix_sln, idxglo, cnew, rhs, kiter)
 @ brief Fill coefficient method for package More...
 
subroutine est_fc_sto (this, nodes, cold, nja, matrix_sln, idxglo, rhs)
 @ brief Fill storage coefficient method for package More...
 
subroutine est_fc_dcy (this, nodes, cold, cnew, nja, matrix_sln, idxglo, rhs, kiter)
 @ brief Fill decay coefficient method for package More...
 
subroutine est_cq (this, nodes, cnew, cold, flowja)
 @ brief Calculate flows for package More...
 
subroutine est_cq_sto (this, nodes, cnew, cold, flowja)
 @ brief Calculate storage terms for package More...
 
subroutine est_cq_dcy (this, nodes, cnew, cold, flowja)
 @ brief Calculate decay terms for package More...
 
subroutine est_bd (this, isuppress_output, model_budget)
 @ brief Calculate budget terms for package More...
 
subroutine est_ot_flow (this, icbcfl, icbcun)
 @ brief Output flow terms for package More...
 
subroutine est_da (this)
 Deallocate memory. More...
 
subroutine allocate_scalars (this)
 @ brief Allocate scalar variables for package More...
 
subroutine allocate_arrays (this, nodes)
 @ brief Allocate arrays for package More...
 
subroutine read_options (this)
 @ brief Read options for package More...
 
subroutine read_data (this)
 @ brief Read data for package More...
 
subroutine read_packagedata (this)
 @ brief Read data for package More...
 
real(dp) function get_zero_order_decay (decay_rate_usr, decay_rate_last, kiter, cold, cnew, delt)
 @ brief Calculate zero-order decay rate and constrain if necessary More...
 

Variables

integer(i4b), parameter nbditems = 2
 
character(len=lenbudtxt), dimension(nbditemsbudtxt
 

Detailed Description

The GweEstModule contains the GweEstType, which is related to GwtEstModule; however, there are some important differences owing to the fact that a sorbed phase is not considered. Instead, a single temperature is simulated for each grid cell and is representative of both the aqueous and solid phases (i.e., instantaneous thermal equilibrium is assumed). Also, "thermal bleeding" is accommodated, where conductive processes can transport into, through, or out of dry cells that are part of the active domain.

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine gweestmodule::allocate_arrays ( class(gweesttype this,
integer(i4b), intent(in)  nodes 
)

Method to allocate arrays for the package.

Parameters
thisGweEstType object
[in]nodesnumber of nodes

Definition at line 607 of file gwe-est.f90.

608  ! -- modules
610  use constantsmodule, only: dzero
611  ! -- dummy
612  class(GweEstType) :: this !< GweEstType object
613  integer(I4B), intent(in) :: nodes !< number of nodes
614  ! -- local
615  integer(I4B) :: n
616  !
617  ! -- Allocate
618  ! -- sto
619  call mem_allocate(this%porosity, nodes, 'POROSITY', this%memoryPath)
620  call mem_allocate(this%ratesto, nodes, 'RATESTO', this%memoryPath)
621  call mem_allocate(this%cps, nodes, 'CPS', this%memoryPath)
622  call mem_allocate(this%rhos, nodes, 'RHOS', this%memoryPath)
623  !
624  ! -- dcy
625  if (this%idcy == 0) then
626  call mem_allocate(this%ratedcy, 1, 'RATEDCY', this%memoryPath)
627  call mem_allocate(this%decay, 1, 'DECAY', this%memoryPath)
628  call mem_allocate(this%decaylast, 1, 'DECAYLAST', this%memoryPath)
629  else
630  call mem_allocate(this%ratedcy, this%dis%nodes, 'RATEDCY', this%memoryPath)
631  call mem_allocate(this%decay, nodes, 'DECAY', this%memoryPath)
632  call mem_allocate(this%decaylast, nodes, 'DECAYLAST', this%memoryPath)
633  end if
634  !
635  ! -- Initialize
636  do n = 1, nodes
637  this%porosity(n) = dzero
638  this%ratesto(n) = dzero
639  this%cps(n) = dzero
640  this%rhos(n) = dzero
641  end do
642  do n = 1, size(this%decay)
643  this%decay(n) = dzero
644  this%ratedcy(n) = dzero
645  this%decaylast(n) = dzero
646  end do
647  !
648  ! -- Return
649  return
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:64

◆ allocate_scalars()

subroutine gweestmodule::allocate_scalars ( class(gweesttype this)

Method to allocate scalar variables for the package.

Parameters
thisGweEstType object

Definition at line 575 of file gwe-est.f90.

576  ! -- modules
578  ! -- dummy
579  class(GweEstType) :: this !< GweEstType object
580  ! -- local
581  !
582  ! -- Allocate scalars in NumericalPackageType
583  call this%NumericalPackageType%allocate_scalars()
584  !
585  ! -- Allocate
586  call mem_allocate(this%cpw, 'CPW', this%memoryPath)
587  call mem_allocate(this%rhow, 'RHOW', this%memoryPath)
588  call mem_allocate(this%latheatvap, 'LATHEATVAP', this%memoryPath)
589  call mem_allocate(this%idcy, 'IDCY', this%memoryPath)
590  call mem_allocate(this%ilhv, 'ILHV', this%memoryPath)
591  !
592  ! -- Initialize
593  this%cpw = dzero
594  this%rhow = dzero
595  this%latheatvap = dzero
596  this%idcy = 0
597  this%ilhv = 0
598  !
599  ! -- Return
600  return

◆ est_ar()

subroutine gweestmodule::est_ar ( class(gweesttype), intent(inout)  this,
class(disbasetype), intent(in), pointer  dis,
integer(i4b), dimension(:), pointer, contiguous  ibound 
)

Method to allocate and read static data for the package.

Parameters
[in,out]thisGweEstType object
[in]dispointer to dis package
iboundpointer to GWE ibound array

Definition at line 125 of file gwe-est.f90.

126  ! -- modules
128  ! -- dummy
129  class(GweEstType), intent(inout) :: this !< GweEstType object
130  class(DisBaseType), pointer, intent(in) :: dis !< pointer to dis package
131  integer(I4B), dimension(:), pointer, contiguous :: ibound !< pointer to GWE ibound array
132  ! -- local
133  ! -- formats
134  character(len=*), parameter :: fmtest = &
135  "(1x,/1x,'EST -- ENERGY STORAGE AND TRANSFER PACKAGE, VERSION 1, &
136  &7/29/2020 INPUT READ FROM UNIT ', i0, //)"
137  !
138  ! --print a message identifying the energy storage and transfer package.
139  write (this%iout, fmtest) this%inunit
140  !
141  ! -- Read options
142  call this%read_options()
143  !
144  ! -- store pointers to arguments that were passed in
145  this%dis => dis
146  this%ibound => ibound
147  !
148  ! -- Allocate arrays
149  call this%allocate_arrays(dis%nodes)
150  !
151  ! -- read the gridded data
152  call this%read_data()
153  !
154  ! -- read package data that is not gridded
155  call this%read_packagedata()
156  !
157  ! -- set pointers for data required by other packages
158  if (this%ilhv == 1) then
159  call this%gwecommon%set_gwe_dat_ptrs(this%rhow, this%cpw, this%rhow, &
160  this%cpw, this%latheatvap)
161  else
162  call this%gwecommon%set_gwe_dat_ptrs(this%rhow, this%cpw, this%rhow, &
163  this%cpw)
164  end if
165  !
166  ! -- Return
167  return
subroutine, public set_gwe_dat_ptrs(this, gwerhow, gwecpw, gwerhos, gwecps, gwelatheatvap)
Allocate and read data from EST.
Here is the call graph for this function:

◆ est_bd()

subroutine gweestmodule::est_bd ( class(gweesttype this,
integer(i4b), intent(in)  isuppress_output,
type(budgettype), intent(inout)  model_budget 
)

Method to calculate budget terms for the package.

Parameters
thisGweEstType object
[in]isuppress_outputflag to suppress output
[in,out]model_budgetmodel budget object

Definition at line 459 of file gwe-est.f90.

460  ! -- modules
461  use tdismodule, only: delt
463  ! -- dummy
464  class(GweEstType) :: this !< GweEstType object
465  integer(I4B), intent(in) :: isuppress_output !< flag to suppress output
466  type(BudgetType), intent(inout) :: model_budget !< model budget object
467  ! -- local
468  real(DP) :: rin
469  real(DP) :: rout
470  !
471  ! -- sto
472  call rate_accumulator(this%ratesto, rin, rout)
473  call model_budget%addentry(rin, rout, delt, budtxt(1), &
474  isuppress_output, rowlabel=this%packName)
475  !
476  ! -- dcy
477  if (this%idcy /= 0) then
478  call rate_accumulator(this%ratedcy, rin, rout)
479  call model_budget%addentry(rin, rout, delt, budtxt(2), &
480  isuppress_output, rowlabel=this%packName)
481  end if
482  !
483  ! -- Return
484  return
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:664
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:

◆ est_cq()

subroutine gweestmodule::est_cq ( class(gweesttype this,
integer(i4b), intent(in)  nodes,
real(dp), dimension(nodes), intent(in)  cnew,
real(dp), dimension(nodes), intent(in)  cold,
real(dp), dimension(:), intent(inout), contiguous  flowja 
)

Method to calculate flows for the package.

Parameters
thisGweEstType object
[in]nodesnumber of nodes
[in]cnewtemperature at end of this time step
[in]coldtemperature at end of last time step
[in,out]flowjaflow between two connected control volumes

Definition at line 320 of file gwe-est.f90.

321  ! -- modules
322  ! -- dummy
323  class(GweEstType) :: this !< GweEstType object
324  integer(I4B), intent(in) :: nodes !< number of nodes
325  real(DP), intent(in), dimension(nodes) :: cnew !< temperature at end of this time step
326  real(DP), intent(in), dimension(nodes) :: cold !< temperature at end of last time step
327  real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
328  ! -- local
329  !
330  ! - storage
331  call this%est_cq_sto(nodes, cnew, cold, flowja)
332  !
333  ! -- decay
334  if (this%idcy /= 0) then
335  call this%est_cq_dcy(nodes, cnew, cold, flowja)
336  end if
337  !
338  ! -- Return
339  return

◆ est_cq_dcy()

subroutine gweestmodule::est_cq_dcy ( class(gweesttype this,
integer(i4b), intent(in)  nodes,
real(dp), dimension(nodes), intent(in)  cnew,
real(dp), dimension(nodes), intent(in)  cold,
real(dp), dimension(:), intent(inout), contiguous  flowja 
)

Method to calculate decay terms for the package.

Parameters
thisGweEstType object
[in]nodesnumber of nodes
[in]cnewtemperature at end of this time step
[in]coldtemperature at end of last time step
[in,out]flowjaflow between two connected control volumes

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

402  ! -- modules
403  use tdismodule, only: delt
404  ! -- dummy
405  class(GweEstType) :: this !< GweEstType object
406  integer(I4B), intent(in) :: nodes !< number of nodes
407  real(DP), intent(in), dimension(nodes) :: cnew !< temperature at end of this time step
408  real(DP), intent(in), dimension(nodes) :: cold !< temperature at end of last time step
409  real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
410  ! -- local
411  integer(I4B) :: n
412  integer(I4B) :: idiag
413  real(DP) :: rate
414  real(DP) :: swtpdt
415  real(DP) :: hhcof, rrhs
416  real(DP) :: vcell
417  real(DP) :: decay_rate
418  !
419  ! -- initialize
420  !
421  ! -- Calculate decay change
422  do n = 1, nodes
423  !
424  ! -- skip if transport inactive
425  this%ratedcy(n) = dzero
426  if (this%ibound(n) <= 0) cycle
427  !
428  ! -- calculate new and old water volumes
429  vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
430  swtpdt = this%fmi%gwfsat(n)
431  !
432  ! -- calculate decay gains and losses
433  rate = dzero
434  hhcof = dzero
435  rrhs = dzero
436  if (this%idcy == 1) then ! Important note: do we need/want first-order decay for temperature???
437  hhcof = -this%decay(n) * vcell * swtpdt * this%porosity(n) &
438  * this%eqnsclfac
439  elseif (this%idcy == 2) then
440  decay_rate = get_zero_order_decay(this%decay(n), this%decaylast(n), &
441  0, cold(n), cnew(n), delt)
442  rrhs = decay_rate * vcell * swtpdt * this%porosity(n) ! Important note: this term does NOT get multiplied by eqnsclfac for cq purposes because it should already be a rate of energy
443  end if
444  rate = hhcof * cnew(n) - rrhs
445  this%ratedcy(n) = rate
446  idiag = this%dis%con%ia(n)
447  flowja(idiag) = flowja(idiag) + rate
448  !
449  end do
450  !
451  ! -- Return
452  return
Here is the call graph for this function:

◆ est_cq_sto()

subroutine gweestmodule::est_cq_sto ( class(gweesttype this,
integer(i4b), intent(in)  nodes,
real(dp), dimension(nodes), intent(in)  cnew,
real(dp), dimension(nodes), intent(in)  cold,
real(dp), dimension(:), intent(inout), contiguous  flowja 
)

Method to calculate storage terms for the package.

Parameters
thisGweEstType object
[in]nodesnumber of nodes
[in]cnewtemperature at end of this time step
[in]coldtemperature at end of last time step
[in,out]flowjaflow between two connected control volumes

Definition at line 346 of file gwe-est.f90.

347  ! -- modules
348  use tdismodule, only: delt
349  ! -- dummy
350  class(GweEstType) :: this !< GweEstType object
351  integer(I4B), intent(in) :: nodes !< number of nodes
352  real(DP), intent(in), dimension(nodes) :: cnew !< temperature at end of this time step
353  real(DP), intent(in), dimension(nodes) :: cold !< temperature at end of last time step
354  real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
355  ! -- local
356  integer(I4B) :: n
357  integer(I4B) :: idiag
358  real(DP) :: rate
359  real(DP) :: tled
360  real(DP) :: vwatnew, vwatold, vcell, vsolid, term
361  real(DP) :: hhcof, rrhs
362  !
363  ! -- initialize
364  tled = done / delt
365  !
366  ! -- Calculate storage change
367  do n = 1, nodes
368  this%ratesto(n) = dzero
369  !
370  ! -- skip if transport inactive
371  if (this%ibound(n) <= 0) cycle
372  !
373  ! -- calculate new and old water volumes and solid volume
374  vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
375  vwatnew = vcell * this%fmi%gwfsat(n) * this%porosity(n)
376  vwatold = vwatnew
377  if (this%fmi%igwfstrgss /= 0) vwatold = vwatold + this%fmi%gwfstrgss(n) &
378  * delt
379  if (this%fmi%igwfstrgsy /= 0) vwatold = vwatold + this%fmi%gwfstrgsy(n) &
380  * delt
381  vsolid = vcell * (done - this%porosity(n))
382  !
383  ! -- calculate rate
384  term = (this%rhos(n) * this%cps(n)) * vsolid
385  hhcof = -(this%eqnsclfac * vwatnew + term) * tled
386  rrhs = -(this%eqnsclfac * vwatold + term) * tled * cold(n)
387  rate = hhcof * cnew(n) - rrhs
388  this%ratesto(n) = rate
389  idiag = this%dis%con%ia(n)
390  flowja(idiag) = flowja(idiag) + rate
391  end do
392  !
393  ! -- Return
394  return

◆ est_cr()

subroutine, public gweestmodule::est_cr ( type(gweesttype), pointer  estobj,
character(len=*), intent(in)  name_model,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
type(tspfmitype), intent(in), target  fmi,
real(dp), intent(in), pointer  eqnsclfac,
type(gweinputdatatype), intent(in), target  gwecommon 
)

Create a new EST package

Parameters
estobjunallocated new est object to create
[in]name_modelname of the model
[in]inunitunit number of WEL package input file
[in]ioutunit number of model listing file
[in]fmifmi package for this GWE model
[in]eqnsclfacgoverning equation scale factor
[in]gwecommonshared data container for use by multiple GWE packages

Definition at line 88 of file gwe-est.f90.

89  ! -- dummy
90  type(GweEstType), pointer :: estobj !< unallocated new est object to create
91  character(len=*), intent(in) :: name_model !< name of the model
92  integer(I4B), intent(in) :: inunit !< unit number of WEL package input file
93  integer(I4B), intent(in) :: iout !< unit number of model listing file
94  type(TspFmiType), intent(in), target :: fmi !< fmi package for this GWE model
95  real(DP), intent(in), pointer :: eqnsclfac !< governing equation scale factor
96  type(GweInputDataType), intent(in), target :: gwecommon !< shared data container for use by multiple GWE packages
97  !
98  ! -- Create the object
99  allocate (estobj)
100  !
101  ! -- create name and memory path
102  call estobj%set_names(1, name_model, 'EST', 'EST')
103  !
104  ! -- Allocate scalars
105  call estobj%allocate_scalars()
106  !
107  ! -- Set variables
108  estobj%inunit = inunit
109  estobj%iout = iout
110  estobj%fmi => fmi
111  estobj%eqnsclfac => eqnsclfac
112  estobj%gwecommon => gwecommon
113  !
114  ! -- Initialize block parser
115  call estobj%parser%Initialize(estobj%inunit, estobj%iout)
116  !
117  ! -- Return
118  return
Here is the caller graph for this function:

◆ est_da()

subroutine gweestmodule::est_da ( class(gweesttype this)

Method to deallocate memory for the package.

Parameters
thisGweEstType object

Definition at line 538 of file gwe-est.f90.

539  ! -- modules
541  ! -- dummy
542  class(GweEstType) :: this !< GweEstType object
543  !
544  ! -- Deallocate arrays if package was active
545  if (this%inunit > 0) then
546  call mem_deallocate(this%porosity)
547  call mem_deallocate(this%ratesto)
548  call mem_deallocate(this%idcy)
549  call mem_deallocate(this%ilhv)
550  call mem_deallocate(this%decay)
551  call mem_deallocate(this%ratedcy)
552  call mem_deallocate(this%decaylast)
553  call mem_deallocate(this%cpw)
554  call mem_deallocate(this%cps)
555  call mem_deallocate(this%rhow)
556  call mem_deallocate(this%rhos)
557  call mem_deallocate(this%latheatvap)
558  this%ibound => null()
559  this%fmi => null()
560  end if
561  !
562  ! -- Scalars
563  !
564  ! -- deallocate parent
565  call this%NumericalPackageType%da()
566  !
567  ! -- Return
568  return

◆ est_fc()

subroutine gweestmodule::est_fc ( class(gweesttype this,
integer, intent(in)  nodes,
real(dp), dimension(nodes), intent(in)  cold,
integer(i4b), intent(in)  nja,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(nja), intent(in)  idxglo,
real(dp), dimension(nodes), intent(in)  cnew,
real(dp), dimension(nodes), intent(inout)  rhs,
integer(i4b), intent(in)  kiter 
)

Method to calculate and fill coefficients for the package.

Parameters
thisGweEstType object
[in]nodesnumber of nodes
[in]coldtemperature at end of last time step
[in]njanumber of GWE connections
matrix_slnsolution matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model
[in]cnewtemperature at end of this time step
[in]kitersolution outer iteration number

Definition at line 174 of file gwe-est.f90.

176  ! -- modules
177  ! -- dummy
178  class(GweEstType) :: this !< GweEstType object
179  integer, intent(in) :: nodes !< number of nodes
180  real(DP), intent(in), dimension(nodes) :: cold !< temperature at end of last time step
181  integer(I4B), intent(in) :: nja !< number of GWE connections
182  class(MatrixBaseType), pointer :: matrix_sln !< solution matrix
183  integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
184  real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
185  real(DP), intent(in), dimension(nodes) :: cnew !< temperature at end of this time step
186  integer(I4B), intent(in) :: kiter !< solution outer iteration number
187  ! -- local
188  !
189  ! -- storage contribution
190  call this%est_fc_sto(nodes, cold, nja, matrix_sln, idxglo, rhs)
191  !
192  ! -- decay contribution
193  if (this%idcy /= 0) then
194  call this%est_fc_dcy(nodes, cold, cnew, nja, matrix_sln, idxglo, &
195  rhs, kiter)
196  end if
197  !
198  ! -- Return
199  return

◆ est_fc_dcy()

subroutine gweestmodule::est_fc_dcy ( class(gweesttype this,
integer, intent(in)  nodes,
real(dp), dimension(nodes), intent(in)  cold,
real(dp), dimension(nodes), intent(in)  cnew,
integer(i4b), intent(in)  nja,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(nja), intent(in)  idxglo,
real(dp), dimension(nodes), intent(inout)  rhs,
integer(i4b), intent(in)  kiter 
)

Method to calculate and fill decay coefficients for the package.

Parameters
thisGweEstType object
[in]nodesnumber of nodes
[in]coldtemperature at end of last time step
[in]cnewtemperature at end of this time step
[in]njanumber of GWE connections
matrix_slnsolution coefficient matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model
[in]kitersolution outer iteration number

Definition at line 257 of file gwe-est.f90.

259  ! -- modules
260  use tdismodule, only: delt
261  ! -- dummy
262  class(GweEstType) :: this !< GweEstType object
263  integer, intent(in) :: nodes !< number of nodes
264  real(DP), intent(in), dimension(nodes) :: cold !< temperature at end of last time step
265  real(DP), intent(in), dimension(nodes) :: cnew !< temperature at end of this time step
266  integer(I4B), intent(in) :: nja !< number of GWE connections
267  class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
268  integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
269  real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
270  integer(I4B), intent(in) :: kiter !< solution outer iteration number
271  ! -- local
272  integer(I4B) :: n, idiag
273  real(DP) :: hhcof, rrhs
274  real(DP) :: swtpdt
275  real(DP) :: vcell
276  real(DP) :: decay_rate
277  !
278  ! -- loop through and calculate decay contribution to hcof and rhs
279  do n = 1, this%dis%nodes
280  !
281  ! -- skip if transport inactive
282  if (this%ibound(n) <= 0) cycle
283  !
284  ! -- calculate new and old water volumes
285  vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
286  swtpdt = this%fmi%gwfsat(n)
287  !
288  ! -- add decay rate terms to accumulators
289  idiag = this%dis%con%ia(n)
290  if (this%idcy == 1) then
291  !
292  ! -- first order decay rate is a function of temperature, so add ! note: May want to remove first-order decay for temperature and support only zero-order
293  ! to left hand side
294  hhcof = -this%decay(n) * vcell * swtpdt * this%porosity(n) &
295  * this%eqnsclfac
296  call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
297  elseif (this%idcy == 2) then
298  !
299  ! -- Call function to get zero-order decay rate, which may be changed
300  ! from the user-specified rate to prevent negative temperatures ! Important note: still need to think through negative temps
301  decay_rate = get_zero_order_decay(this%decay(n), this%decaylast(n), &
302  kiter, cold(n), cnew(n), delt)
303  ! -- This term does get divided by eqnsclfac for fc purposes because it
304  ! should start out being a rate of energy
305  this%decaylast(n) = decay_rate
306  rrhs = decay_rate * vcell * swtpdt * this%porosity(n)
307  rhs(n) = rhs(n) + rrhs
308  end if
309  !
310  end do
311  !
312  ! -- Return
313  return
Here is the call graph for this function:

◆ est_fc_sto()

subroutine gweestmodule::est_fc_sto ( class(gweesttype this,
integer, intent(in)  nodes,
real(dp), dimension(nodes), intent(in)  cold,
integer(i4b), intent(in)  nja,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(nja), intent(in)  idxglo,
real(dp), dimension(nodes), intent(inout)  rhs 
)

Method to calculate and fill storage coefficients for the package.

Parameters
thisGweEstType object
[in]nodesnumber of nodes
[in]coldtemperature at end of last time step
[in]njanumber of GWE connections
matrix_slnsolution coefficient matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model

Definition at line 206 of file gwe-est.f90.

207  ! -- modules
208  use tdismodule, only: delt
209  ! -- dummy
210  class(GweEstType) :: this !< GweEstType object
211  integer, intent(in) :: nodes !< number of nodes
212  real(DP), intent(in), dimension(nodes) :: cold !< temperature at end of last time step
213  integer(I4B), intent(in) :: nja !< number of GWE connections
214  class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
215  integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
216  real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
217  ! -- local
218  integer(I4B) :: n, idiag
219  real(DP) :: tled
220  real(DP) :: hhcof, rrhs
221  real(DP) :: vnew, vold, vcell, vsolid, term
222  !
223  ! -- set variables
224  tled = done / delt
225  !
226  ! -- loop through and calculate storage contribution to hcof and rhs
227  do n = 1, this%dis%nodes
228  !
229  ! -- skip if transport inactive
230  if (this%ibound(n) <= 0) cycle
231  !
232  ! -- calculate new and old water volumes and solid volume
233  vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
234  vnew = vcell * this%fmi%gwfsat(n) * this%porosity(n)
235  vold = vnew
236  if (this%fmi%igwfstrgss /= 0) vold = vold + this%fmi%gwfstrgss(n) * delt
237  if (this%fmi%igwfstrgsy /= 0) vold = vold + this%fmi%gwfstrgsy(n) * delt
238  vsolid = vcell * (done - this%porosity(n))
239  !
240  ! -- add terms to diagonal and rhs accumulators
241  term = (this%rhos(n) * this%cps(n)) * vsolid
242  hhcof = -(this%eqnsclfac * vnew + term) * tled
243  rrhs = -(this%eqnsclfac * vold + term) * tled * cold(n)
244  idiag = this%dis%con%ia(n)
245  call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
246  rhs(n) = rhs(n) + rrhs
247  end do
248  !
249  ! -- Return
250  return

◆ est_ot_flow()

subroutine gweestmodule::est_ot_flow ( class(gweesttype this,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  icbcun 
)

Method to output terms for the package.

Parameters
thisGweEstType object
[in]icbcflflag and unit number for cell-by-cell output
[in]icbcunflag indication if cell-by-cell data should be saved

Definition at line 491 of file gwe-est.f90.

492  ! -- dummy
493  class(GweEstType) :: this !< GweEstType object
494  integer(I4B), intent(in) :: icbcfl !< flag and unit number for cell-by-cell output
495  integer(I4B), intent(in) :: icbcun !< flag indication if cell-by-cell data should be saved
496  ! -- local
497  integer(I4B) :: ibinun
498  !character(len=16), dimension(2) :: aname
499  integer(I4B) :: iprint, nvaluesp, nwidthp
500  character(len=1) :: cdatafmp = ' ', editdesc = ' '
501  real(DP) :: dinact
502  !
503  ! -- Set unit number for binary output
504  if (this%ipakcb < 0) then
505  ibinun = icbcun
506  elseif (this%ipakcb == 0) then
507  ibinun = 0
508  else
509  ibinun = this%ipakcb
510  end if
511  if (icbcfl == 0) ibinun = 0
512  !
513  ! -- Record the storage rate if requested
514  if (ibinun /= 0) then
515  iprint = 0
516  dinact = dzero
517  !
518  ! -- sto
519  call this%dis%record_array(this%ratesto, this%iout, iprint, -ibinun, &
520  budtxt(1), cdatafmp, nvaluesp, &
521  nwidthp, editdesc, dinact)
522  !
523  ! -- dcy
524  if (this%idcy /= 0) &
525  call this%dis%record_array(this%ratedcy, this%iout, iprint, -ibinun, &
526  budtxt(2), cdatafmp, nvaluesp, &
527  nwidthp, editdesc, dinact)
528  end if
529  !
530  ! -- Return
531  return

◆ get_zero_order_decay()

real(dp) function gweestmodule::get_zero_order_decay ( real(dp), intent(in)  decay_rate_usr,
real(dp), intent(in)  decay_rate_last,
integer(i4b), intent(in)  kiter,
real(dp), intent(in)  cold,
real(dp), intent(in)  cnew,
real(dp), intent(in)  delt 
)

Function to calculate the zero-order decay rate from the user specified decay rate. If the decay rate is positive, then the decay rate must be constrained so that more energy is not removed than is available. Without this constraint, negative temperatures could result from zero-order decay (no freezing).

Parameters
[in]decay_rate_usruser-entered decay rate
[in]decay_rate_lastdecay rate used for last iteration
[in]kiterPicard iteration counter
[in]coldtemperature at end of last time step
[in]cnewtemperature at end of this time step
[in]deltlength of time step
Returns
returned value for decay rate

Definition at line 874 of file gwe-est.f90.

876  ! -- dummy
877  real(DP), intent(in) :: decay_rate_usr !< user-entered decay rate
878  real(DP), intent(in) :: decay_rate_last !< decay rate used for last iteration
879  integer(I4B), intent(in) :: kiter !< Picard iteration counter
880  real(DP), intent(in) :: cold !< temperature at end of last time step
881  real(DP), intent(in) :: cnew !< temperature at end of this time step
882  real(DP), intent(in) :: delt !< length of time step
883  ! -- Return
884  real(DP) :: decay_rate !< returned value for decay rate
885  !
886  ! -- Return user rate if production, otherwise constrain, if necessary
887  if (decay_rate_usr < dzero) then
888  !
889  ! -- Production, no need to limit rate
890  decay_rate = decay_rate_usr
891  else
892  !
893  ! -- Need to ensure decay does not result in negative
894  ! temperature, so reduce the rate if it would result in
895  ! removing more energy than is in the cell. ! kluge note: think through
896  if (kiter == 1) then
897  decay_rate = min(decay_rate_usr, cold / delt) ! kluge note: actually want to use rhow*cpw*cold and rhow*cpw*cnew for rates here and below
898  else
899  decay_rate = decay_rate_last
900  if (cnew < dzero) then
901  decay_rate = decay_rate_last + cnew / delt
902  else if (cnew > cold) then
903  decay_rate = decay_rate_last + cnew / delt
904  end if
905  decay_rate = min(decay_rate_usr, decay_rate)
906  end if
907  decay_rate = max(decay_rate, dzero)
908  end if
909  return
Here is the caller graph for this function:

◆ read_data()

subroutine gweestmodule::read_data ( class(gweesttype this)

Method to read data for the package.

Parameters
thisGweEstType object

Definition at line 718 of file gwe-est.f90.

719  ! -- modules
720  use constantsmodule, only: linelength
722  ! -- dummy
723  class(GweEstType) :: this !< GweEstType object
724  ! -- local
725  character(len=LINELENGTH) :: keyword
726  character(len=:), allocatable :: line
727  integer(I4B) :: istart, istop, lloc, ierr
728  logical :: isfound, endOfBlock
729  logical, dimension(4) :: lname
730  character(len=24), dimension(4) :: aname
731  ! -- formats
732  ! -- data
733  data aname(1)/' MOBILE DOMAIN POROSITY'/
734  data aname(2)/' DECAY RATE'/
735  data aname(3)/' HEAT CAPACITY OF SOLIDS'/
736  data aname(4)/' DENSITY OF SOLIDS'/
737  !
738  ! -- initialize
739  isfound = .false.
740  lname(:) = .false.
741  !
742  ! -- get griddata block
743  call this%parser%GetBlock('GRIDDATA', isfound, ierr)
744  if (isfound) then
745  write (this%iout, '(1x,a)') 'PROCESSING GRIDDATA'
746  do
747  call this%parser%GetNextLine(endofblock)
748  if (endofblock) exit
749  call this%parser%GetStringCaps(keyword)
750  call this%parser%GetRemainingLine(line)
751  lloc = 1
752  select case (keyword)
753  case ('POROSITY')
754  call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, &
755  this%parser%iuactive, this%porosity, &
756  aname(1))
757  lname(1) = .true.
758  case ('DECAY')
759  if (this%idcy == 0) &
760  call mem_reallocate(this%decay, this%dis%nodes, 'DECAY', &
761  trim(this%memoryPath))
762  call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, &
763  this%parser%iuactive, this%decay, &
764  aname(2))
765  lname(2) = .true.
766  case ('CPS')
767  call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, &
768  this%parser%iuactive, this%cps, &
769  aname(3))
770  lname(3) = .true.
771  case ('RHOS')
772  call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, &
773  this%parser%iuactive, this%rhos, &
774  aname(4))
775  lname(4) = .true.
776  case default
777  write (errmsg, '(a,a)') 'UNKNOWN GRIDDATA TAG: ', trim(keyword)
778  call store_error(errmsg)
779  call this%parser%StoreErrorUnit()
780  end select
781  end do
782  write (this%iout, '(1x,a)') 'END PROCESSING GRIDDATA'
783  else
784  write (errmsg, '(a)') 'REQUIRED GRIDDATA BLOCK NOT FOUND.'
785  call store_error(errmsg)
786  call this%parser%StoreErrorUnit()
787  end if
788  !
789  ! -- Check for required porosity
790  if (.not. lname(1)) then
791  write (errmsg, '(a)') 'POROSITY NOT SPECIFIED IN GRIDDATA BLOCK.'
792  call store_error(errmsg)
793  end if
794  if (.not. lname(3)) then
795  write (errmsg, '(a)') 'CPS NOT SPECIFIED IN GRIDDATA BLOCK.'
796  call store_error(errmsg)
797  end if
798  if (.not. lname(4)) then
799  write (errmsg, '(a)') 'RHOS NOT SPECIFIED IN GRIDDATA BLOCK.'
800  call store_error(errmsg)
801  end if
802  !
803  ! -- Check for required decay/production rate coefficients
804  if (this%idcy > 0) then
805  if (.not. lname(2)) then
806  write (errmsg, '(a)') 'FIRST OR ZERO ORDER DECAY IS &
807  &ACTIVE BUT THE FIRST RATE COEFFICIENT IS NOT SPECIFIED. DECAY &
808  &MUST BE SPECIFIED IN GRIDDATA BLOCK.'
809  call store_error(errmsg)
810  end if
811  else
812  if (lname(2)) then
813  write (warnmsg, '(a)') 'FIRST OR ZERO ORER DECAY &
814  &IS NOT ACTIVE BUT DECAY WAS SPECIFIED. DECAY WILL &
815  &HAVE NO AFFECT ON SIMULATION RESULTS.'
816  call store_warning(warnmsg)
817  write (this%iout, '(1x,a)') 'WARNING. '//warnmsg
818  end if
819  end if
820  !
821  ! -- terminate if errors
822  if (count_errors() > 0) then
823  call this%parser%StoreErrorUnit()
824  end if
825  !
826  ! -- Return
827  return
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
Here is the call graph for this function:

◆ read_options()

subroutine gweestmodule::read_options ( class(gweesttype this)

Method to read options for the package.

Parameters
thisGweEstType object

Definition at line 656 of file gwe-est.f90.

657  ! -- modules
658  use constantsmodule, only: linelength
659  ! -- dummy
660  class(GweEstType) :: this !< GweEstType object
661  ! -- local
662  character(len=LINELENGTH) :: keyword
663  integer(I4B) :: ierr
664  logical :: isfound, endOfBlock
665  ! -- formats
666  character(len=*), parameter :: fmtisvflow = &
667  &"(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY "// &
668  &"FILE WHENEVER ICBCFL IS NOT ZERO.')"
669  character(len=*), parameter :: fmtidcy1 = &
670  "(4x,'FIRST-ORDER DECAY IS ACTIVE. ')"
671  character(len=*), parameter :: fmtidcy2 = &
672  "(4x,'ZERO-ORDER DECAY IS ACTIVE. ')"
673  character(len=*), parameter :: fmtilhv = &
674  "(4x,'LATENT HEAT OF VAPORIZATION WILL BE &
675  &USED IN EVAPORATION CALCULATIONS.')"
676  !
677  ! -- get options block
678  call this%parser%GetBlock('OPTIONS', isfound, ierr, blockrequired=.false., &
679  supportopenclose=.true.)
680  !
681  ! -- parse options block if detected
682  if (isfound) then
683  write (this%iout, '(1x,a)') 'PROCESSING ENERGY STORAGE AND TRANSFER OPTIONS'
684  do
685  call this%parser%GetNextLine(endofblock)
686  if (endofblock) exit
687  call this%parser%GetStringCaps(keyword)
688  select case (keyword)
689  case ('SAVE_FLOWS')
690  this%ipakcb = -1
691  write (this%iout, fmtisvflow)
692  case ('FIRST_ORDER_DECAY')
693  this%idcy = 1
694  write (this%iout, fmtidcy1)
695  case ('ZERO_ORDER_DECAY')
696  this%idcy = 2
697  write (this%iout, fmtidcy2)
698  case ('LATENT_HEAT_VAPORIZATION')
699  this%ilhv = 1
700  write (this%iout, fmtilhv)
701  case default
702  write (errmsg, '(a,a)') 'UNKNOWN EST OPTION: ', trim(keyword)
703  call store_error(errmsg)
704  call this%parser%StoreErrorUnit()
705  end select
706  end do
707  write (this%iout, '(1x,a)') 'END OF ENERGY STORAGE AND TRANSFER OPTIONS'
708  end if
709  !
710  ! -- Return
711  return
Here is the call graph for this function:

◆ read_packagedata()

subroutine gweestmodule::read_packagedata ( class(gweesttype this)

Method to read data for the package.

Parameters
thisGweEstType object

Definition at line 834 of file gwe-est.f90.

835  ! -- modules
836  ! -- dummy
837  class(GweEstType) :: this !< GweEstType object
838  ! -- local
839  logical :: isfound
840  logical :: endOfBlock
841  integer(I4B) :: ierr
842  !
843  call this%parser%GetBlock('PACKAGEDATA', isfound, ierr, &
844  supportopenclose=.true.)
845  !
846  ! -- parse locations block if detected
847  if (isfound) then
848  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%packName))// &
849  ' PACKAGEDATA'
850  do
851  call this%parser%GetNextLine(endofblock)
852  if (endofblock) then
853  exit
854  end if
855  !
856  ! -- get fluid constants
857  this%cpw = this%parser%GetDouble()
858  this%rhow = this%parser%GetDouble()
859  end do
860  end if
861  !
862  ! -- Return
863  return

Variable Documentation

◆ budtxt

character(len=lenbudtxt), dimension(nbditems) gweestmodule::budtxt

Definition at line 31 of file gwe-est.f90.

31  character(len=LENBUDTXT), dimension(NBDITEMS) :: budtxt

◆ nbditems

integer(i4b), parameter gweestmodule::nbditems = 2

Definition at line 30 of file gwe-est.f90.

30  integer(I4B), parameter :: NBDITEMS = 2