MODFLOW 6  version 6.9.0.dev0
USGS Modular Hydrologic Model
gwf-sto.f90
Go to the documentation of this file.
1 !> @brief This module contains the storage package methods
2 !!
3 !! This module contains the methods used to add the effects of storage
4 !! on the groundwater flow equation. The contribution of specific
5 !! storage and specific yield can be represented.
6 !!
7 !<
9 
10  use kindmodule, only: dp, i4b, lgp
11  use constantsmodule, only: dzero, dem6, dem4, dhalf, done, dtwo, &
13  use simvariablesmodule, only: errmsg
18  use basedismodule, only: disbasetype
21  use tvsmodule, only: tvstype, tvs_cr
27 
28  implicit none
29  public :: gwfstotype, sto_cr
30 
31  character(len=LENBUDTXT), dimension(2) :: budtxt = & !< text labels for budget terms
32  &[' STO-SS', ' STO-SY']
33 
34  type, extends(numericalpackagetype) :: gwfstotype
35  integer(I4B), pointer :: istor_coef => null() !< indicates if ss is the storage coefficient
36  integer(I4B), pointer :: iconf_ss => null() !< indicates if ss is 0 below the top of a layer
37  integer(I4B), pointer :: iorig_ss => null() !< indicates if the original storage specific storage formulation should be used
38  integer(I4B), pointer :: iss => null() !< steady state flag: 1 = steady, 0 = transient
39  integer(I4B), pointer :: iusesy => null() !< flag set if any cell is convertible (0, 1)
40  integer(I4B), dimension(:), pointer, contiguous :: iconvert => null() !< confined (0) or convertible (1)
41  real(dp), dimension(:), pointer, contiguous :: ss => null() !< specific storage or storage coefficient
42  real(dp), dimension(:), pointer, contiguous :: sy => null() !< specific yield
43  real(dp), dimension(:), pointer, contiguous :: strgss => null() !< vector of specific storage rates
44  real(dp), dimension(:), pointer, contiguous :: strgsy => null() !< vector of specific yield rates
45  integer(I4B), dimension(:), pointer, contiguous :: ibound => null() !< pointer to model ibound
46  real(dp), pointer :: satomega => null() !< newton-raphson saturation omega
47  integer(I4B), pointer :: integratechanges => null() !< indicates if mid-simulation ss and sy changes should be integrated via an additional matrix formulation term
48  integer(I4B), pointer :: intvs => null() !< TVS (time-varying storage) unit number (0 if unused)
49  type(tvstype), pointer :: tvs => null() !< TVS object
50  real(dp), dimension(:), pointer, contiguous, private :: oldss => null() !< previous time step specific storage
51  real(dp), dimension(:), pointer, contiguous, private :: oldsy => null() !< previous time step specific yield
52  integer(I4B), pointer :: iper => null() !< input context loaded period
53  character(len=:), pointer :: storage !< input context storage string
54 
55  integer(I4B), dimension(:), pointer, contiguous :: iformulation => null() !< active formulation for the connection (size: n)
56  !! with values 0 (= default) up to SIZE_STORAGE_FORM - 1
57  type(gwfstoformcontainertype), dimension(MAX_EXT_STO_FORMS), private :: &
58  sto_formulations !< alternative storage calculations by extension
59  class(gwfstoformulationtype), pointer :: default_form => null() !< default storage formulation
60  contains
61  procedure :: sto_ar
62  procedure :: sto_rp
63  procedure :: sto_ad
64  procedure :: sto_fc
65  procedure :: sto_fn
66  procedure :: sto_cq
67  procedure :: sto_bd
68  procedure :: sto_save_model_flows
69  procedure :: sto_da
70  procedure :: allocate_scalars
71  procedure :: add_sto_formulation
72  ! private
73  procedure, private :: allocate_arrays
74  procedure, private :: source_options
75  procedure, private :: source_data
76  procedure, private :: log_options
77  procedure, private :: save_old_ss_sy
78  procedure, private :: fc_default_sto
79  procedure, private :: fn_default_sto
80  procedure, private :: cq_default_sto
81 
82  end type
83 
84  !> @brief Default storage formulation
85  !!
86  !! Wraps the standard STO fill so it participates in the additive list of
87  !! storage formulations. Nodes claimed by an exclusive formulation are
88  !! skipped.
89  !<
91  class(gwfstotype), pointer :: sto => null() !< owning STO package
92  contains
93  procedure :: is_active => default_storage_is_active
94  procedure :: fc => default_storage_fc
95  procedure :: fn => default_storage_fn
96  procedure :: cq => default_storage_cq
97  procedure :: bd => default_storage_bd
98  procedure :: save_flows => default_storage_save_flows
100 
101 contains
102 
103  !> @ brief Create a new package object
104  !!
105  !! Create a new storage (STO) object
106  !!
107  !<
108  subroutine sto_cr(stoobj, name_model, mempath, inunit, iout)
109  ! -- dummy variables
110  type(gwfstotype), pointer :: stoobj !< GwfStoType object
111  character(len=*), intent(in) :: name_model !< name of model
112  character(len=*), intent(in) :: mempath !< input context mem path
113  integer(I4B), intent(in) :: inunit !< package input file unit
114  integer(I4B), intent(in) :: iout !< model listing file unit
115  !
116  ! -- Create the object
117  allocate (stoobj)
118  !
119  ! -- create name and memory path
120  call stoobj%set_names(1, name_model, 'STO', 'STO', mempath)
121  !
122  ! -- Allocate scalars
123  call stoobj%allocate_scalars()
124  !
125  ! -- Set variables
126  stoobj%inunit = inunit
127  stoobj%iout = iout
128  end subroutine sto_cr
129 
130  !> @ brief Allocate and read method for package
131  !!
132  !! Method to allocate and read static data for the STO package.
133  !!
134  !<
135  subroutine sto_ar(this, dis, ibound)
136  ! -- modules
139  ! -- dummy variables
140  class(gwfstotype) :: this !< GwfStoType object
141  class(disbasetype), pointer, intent(in) :: dis !< model discretization object
142  integer(I4B), dimension(:), pointer, contiguous :: ibound !< model ibound array
143  ! -- local variables
144  ! -- formats
145  character(len=*), parameter :: fmtsto = &
146  "(1x,/1x,'STO -- STORAGE PACKAGE, VERSION 1, 5/19/2014', &
147  &' INPUT READ FROM MEMPATH: ', A, //)"
148  !
149  ! --print a message identifying the storage package.
150  write (this%iout, fmtsto) this%input_mempath
151  !
152  ! -- store pointers to arguments that were passed in
153  this%dis => dis
154  this%ibound => ibound
155  !
156  ! -- set pointer to gwf iss
157  call mem_setptr(this%iss, 'ISS', create_mem_path(this%name_model))
158  !
159  ! -- Allocate arrays
160  call this%allocate_arrays(dis%nodes)
161  !!
162  !! -- Register side effect handlers
163  !call this%register_handlers()
164  !
165  ! -- Read storage options
166  call this%source_options()
167  !
168  ! -- read the data block
169  call this%source_data()
170  !
171  ! -- TVS
172  if (this%intvs /= 0) then
173  call this%tvs%ar(this%dis)
174  end if
175 
176  end subroutine sto_ar
177 
178  !> @ brief Read and prepare method for package
179  !!
180  !! Method to read and prepare stress period data for the STO package.
181  !!
182  !<
183  subroutine sto_rp(this)
184  ! -- modules
185  use tdismodule, only: kper
186  implicit none
187  ! -- dummy variables
188  class(gwfstotype) :: this !< GwfStoType object
189  ! -- local variables
190  character(len=16) :: css(0:1)
191  ! -- data
192  data css(0)/' TRANSIENT'/
193  data css(1)/' STEADY-STATE'/
194  !
195  ! -- Store ss and sy values from end of last stress period if needed
196  if (this%integratechanges /= 0) then
197  call this%save_old_ss_sy()
198  end if
199  !
200  ! -- confirm package is active
201  if (this%inunit <= 0) return
202  !
203  ! -- process STO period data if loaded for this period
204  if (this%iper == kper) then
205  write (this%iout, '(//,1x,a)') 'PROCESSING STORAGE PERIOD DATA'
206  !
207  ! -- set period iss
208  if (this%storage == 'STEADY-STATE') then
209  this%iss = 1
210  else if (this%storage == 'TRANSIENT') then
211  this%iss = 0
212  else
213  write (errmsg, '(a,a)') 'Unknown STORAGE data tag: ', &
214  trim(this%storage)
215  call store_error(errmsg)
216  call store_error_filename(this%input_fname)
217  end if
218  !
219  write (this%iout, '(1x,a)') 'END PROCESSING STORAGE PERIOD DATA'
220  !
221  write (this%iout, '(//1X,A,I0,A,A,/)') &
222  'STRESS PERIOD ', kper, ' IS ', trim(adjustl(css(this%iss)))
223  end if
224  !
225  ! -- TVS (has its own PERIOD blocks independent of STO)
226  if (this%intvs /= 0) then
227  call this%tvs%rp()
228  end if
229  end subroutine sto_rp
230 
231  !> @ brief Advance the package
232  !!
233  !! Advance data in the STO package.
234  !!
235  !<
236  subroutine sto_ad(this)
237  ! -- modules
238  use tdismodule, only: kstp
239  ! -- dummy variables
240  class(gwfstotype) :: this !< GwfStoType object
241  !
242  ! -- Store ss and sy values from end of last time step if needed
243  if (this%integratechanges /= 0 .and. kstp > 1) then
244  call this%save_old_ss_sy()
245  end if
246  !
247  ! -- TVS
248  if (this%intvs /= 0) then
249  call this%tvs%ad()
250  end if
251  end subroutine sto_ad
252 
253  !> @ brief Fill A and right-hand side for the package
254  !!
255  !! Fill the coefficient matrix and right-hand side with the STO package terms.
256  !!
257  !<
258  subroutine sto_fc(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
259  use tdismodule, only: delt
260  ! -- dummy variables
261  class(gwfstotype) :: this !< GwfStoType object
262  integer(I4B), intent(in) :: kiter !< outer iteration number
263  real(DP), intent(in), dimension(:) :: hold !< previous heads
264  real(DP), intent(in), dimension(:) :: hnew !< current heads
265  class(matrixbasetype), pointer :: matrix_sln !< A matrix
266  integer(I4B), intent(in), dimension(:) :: idxglo !< global index model to solution
267  real(DP), intent(inout), dimension(:) :: rhs !< right-hand side
268  ! -- local variables
269  integer(I4B) :: iform
270  ! -- formats
271  character(len=*), parameter :: fmtsperror = &
272  &"('DETECTED TIME STEP LENGTH OF ZERO. GWF STORAGE PACKAGE CANNOT BE ', &
273  &'USED UNLESS DELT IS NON-ZERO.')"
274  !
275  ! -- test if steady-state stress period
276  if (this%iss /= 0) return
277  !
278  ! -- Ensure time step length is not zero
279  if (delt == dzero) then
280  write (errmsg, fmtsperror)
281  call store_error(errmsg, terminate=.true.)
282  end if
283  !
284  ! -- Each active formulation runs over all cells and adds its storage
285  ! terms; the default storage formulation is always active.
286  call this%default_form%fc(kiter, matrix_sln, rhs, idxglo, hold, hnew)
287  do iform = 1, max_ext_sto_forms
288  if (this%sto_formulations(iform)%is_active) then
289  call this%sto_formulations(iform)%form%fc( &
290  kiter, matrix_sln, rhs, idxglo, hold, hnew)
291  end if
292  end do
293  end subroutine sto_fc
294 
295  !> @brief Fill coefficients for the default storage formulation
296  !!
297  !! Runs over all cells and fills the standard STO terms, skipping cells
298  !! claimed by an exclusive formulation.
299  !<
300  subroutine default_storage_fc(this, kiter, matrix_sln, rhs, &
301  idxglo, h_old, h_new)
302  class(defaultstorageformulationtype), intent(inout) :: this !< default formulation
303  integer(I4B), intent(in) :: kiter !< outer iteration number
304  class(matrixbasetype), pointer, intent(inout) :: matrix_sln !< A matrix
305  real(DP), dimension(:), intent(inout) :: rhs !< right-hand side
306  integer(I4B), dimension(:), intent(in) :: idxglo !< global index model to solution
307  real(DP), dimension(:), intent(in) :: h_old !< previous heads
308  real(DP), dimension(:), intent(in) :: h_new !< current heads
309  ! local
310  integer(I4B) :: n
311 
312  do n = 1, this%sto%dis%nodes
313  if (this%sto%ibound(n) < 1) cycle
314  ! skip cells claimed by an exclusive formulation
315  if (this%sto%iformulation(n) /= default_storage) cycle
316  call this%sto%fc_default_sto(n, matrix_sln, rhs, idxglo, h_old, h_new)
317  end do
318 
319  end subroutine default_storage_fc
320 
321  !> @brief Default storage FC
322  !<
323  subroutine fc_default_sto(this, n, matrix_sln, rhs, idxglo, hold, hnew)
324  use tdismodule, only: delt
325  class(gwfstotype) :: this !< GwfStoType object
326  integer(I4B), intent(in) :: n
327  class(matrixbasetype), pointer, intent(inout) :: matrix_sln
328  real(DP), dimension(:), intent(inout) :: rhs
329  integer(I4B), dimension(:), intent(in) :: idxglo
330  real(DP), dimension(:), intent(in) :: hold
331  real(DP), dimension(:), intent(in) :: hnew
332  ! local
333  integer(I4B) :: idiag
334  real(DP) :: tled
335  real(DP) :: sc1, sc2
336  real(DP) :: rho1, rho2
337  real(DP) :: sc1old, sc2old, rho1old, rho2old
338  real(DP) :: tp, bt
339  real(DP) :: snold, snnew
340  real(DP) :: aterm, rhsterm
341  !
342  ! -- set variables
343  tled = done / delt
344  idiag = this%dis%con%ia(n)
345  !
346  ! -- aquifer elevations and thickness
347  tp = this%dis%top(n)
348  bt = this%dis%bot(n)
349  !
350  ! -- aquifer saturation
351  if (this%iconvert(n) == 0) then
352  snold = done
353  snnew = done
354  else
355  snold = squadraticsaturation(tp, bt, hold(n), this%satomega)
356  snnew = squadraticsaturation(tp, bt, hnew(n), this%satomega)
357  end if
358  !
359  ! -- storage coefficients
360  sc1 = sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
361  rho1 = sc1 * tled
362  !
363  if (this%integratechanges /= 0) then
364  ! -- Integration of storage changes (e.g. when using TVS):
365  ! separate the old (start of time step) and new (end of time step)
366  ! primary storage capacities
367  sc1old = sscapacity(this%istor_coef, tp, bt, this%dis%area(n), &
368  this%oldss(n))
369  rho1old = sc1old * tled
370  else
371  ! -- No integration of storage changes: old and new values are
372  ! identical => normal MF6 storage formulation
373  rho1old = rho1
374  end if
375  !
376  ! -- calculate specific storage terms
377  call ssterms(this%iconvert(n), this%iorig_ss, this%iconf_ss, tp, bt, &
378  rho1, rho1old, snnew, snold, hnew(n), hold(n), &
379  aterm, rhsterm)
380  !
381  ! -- add specific storage terms to amat and rhs
382  call matrix_sln%add_value_pos(idxglo(idiag), aterm)
383  rhs(n) = rhs(n) + rhsterm
384  !
385  ! -- specific yield
386  if (this%iconvert(n) /= 0) then
387  rhsterm = dzero
388  !
389  ! -- secondary storage coefficient
390  sc2 = sycapacity(this%dis%area(n), this%sy(n))
391  rho2 = sc2 * tled
392  !
393  if (this%integratechanges /= 0) then
394  ! -- Integration of storage changes (e.g. when using TVS):
395  ! separate the old (start of time step) and new (end of time step)
396  ! secondary storage capacities
397  sc2old = sycapacity(this%dis%area(n), this%oldsy(n))
398  rho2old = sc2old * tled
399  else
400  ! -- No integration of storage changes: old and new values are
401  ! identical => normal MF6 storage formulation
402  rho2old = rho2
403  end if
404  !
405  ! -- calculate specific storage terms
406  call syterms(tp, bt, rho2, rho2old, snnew, snold, &
407  aterm, rhsterm)
408  !
409  ! -- add specific yield terms to amat and rhs
410  call matrix_sln%add_value_pos(idxglo(idiag), aterm)
411  rhs(n) = rhs(n) + rhsterm
412  end if
413 
414  end subroutine fc_default_sto
415 
416  !> @ brief Fill Newton-Raphson terms in A and right-hand side for the package
417  !!
418  !! Fill the coefficient matrix and right-hand side with STO package
419  !! with Newton-Raphson terms.
420  !!
421  !<
422  subroutine sto_fn(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
423  ! -- dummy variables
424  class(gwfstotype) :: this !< GwfStoType object
425  integer(I4B), intent(in) :: kiter !< outer iteration number
426  real(DP), intent(in), dimension(:) :: hold !< previous heads
427  real(DP), intent(in), dimension(:) :: hnew !< current heads
428  class(matrixbasetype), pointer :: matrix_sln !< A matrix
429  integer(I4B), intent(in), dimension(:) :: idxglo !< global index model to solution
430  real(DP), intent(inout), dimension(:) :: rhs !< right-hand side
431  ! -- local variables
432  integer(I4B) :: iform
433  !
434  ! -- test if steady-state stress period
435  if (this%iss /= 0) return
436  !
437  ! -- Each active formulation runs over all cells and adds its newton
438  ! terms; the default storage formulation is always active.
439  call this%default_form%fn(kiter, matrix_sln, rhs, idxglo, hold, hnew)
440  do iform = 1, max_ext_sto_forms
441  if (this%sto_formulations(iform)%is_active) then
442  call this%sto_formulations(iform)%form%fn( &
443  kiter, matrix_sln, rhs, idxglo, hold, hnew)
444  end if
445  end do
446  end subroutine sto_fn
447 
448  !> @brief Fill newton terms for the default storage formulation
449  !!
450  !! Runs over all cells and fills the standard STO newton terms, skipping
451  !! cells claimed by an exclusive formulation.
452  !<
453  subroutine default_storage_fn(this, kiter, matrix_sln, rhs, &
454  idxglo, h_old, h_new)
455  class(defaultstorageformulationtype), intent(inout) :: this !< default formulation
456  integer(I4B), intent(in) :: kiter !< outer iteration number
457  class(matrixbasetype), pointer, intent(inout) :: matrix_sln !< A matrix
458  real(DP), dimension(:), intent(inout) :: rhs !< right-hand side
459  integer(I4B), dimension(:), intent(in) :: idxglo !< global index model to solution
460  real(DP), dimension(:), intent(in) :: h_old !< previous heads
461  real(DP), dimension(:), intent(in) :: h_new !< current heads
462  ! local
463  integer(I4B) :: n
464 
465  do n = 1, this%sto%dis%nodes
466  if (this%sto%ibound(n) <= 0) cycle
467  ! skip cells claimed by an exclusive formulation
468  if (this%sto%iformulation(n) /= default_storage) cycle
469  call this%sto%fn_default_sto(n, matrix_sln, rhs, idxglo, h_old, h_new)
470  end do
471 
472  end subroutine default_storage_fn
473 
474  subroutine fn_default_sto(this, n, matrix_sln, rhs, idxglo, hold, hnew)
475  use tdismodule, only: delt
476  class(gwfstotype), intent(inout) :: this
477  integer(I4B), intent(in) :: n
478  class(matrixbasetype), pointer, intent(inout) :: matrix_sln
479  real(DP), dimension(:), intent(inout) :: rhs
480  integer(I4B), dimension(:), intent(in) :: idxglo
481  real(DP), dimension(:), intent(in) :: hold
482  real(DP), dimension(:), intent(in) :: hnew
483  ! local
484  integer(I4B) :: idiag
485  real(DP) :: tled
486  real(DP) :: sc1, sc2, rho1, rho2
487  real(DP) :: tp, bt
488  real(DP) :: tthk
489  real(DP) :: h
490  real(DP) :: snnew
491  real(DP) :: derv, rterm, drterm
492  !
493  ! set variables
494  tled = done / delt
495  idiag = this%dis%con%ia(n)
496  !
497  ! -- aquifer elevations and thickness
498  tp = this%dis%top(n)
499  bt = this%dis%bot(n)
500  tthk = tp - bt
501  h = hnew(n)
502  !
503  ! -- aquifer saturation
504  snnew = squadraticsaturation(tp, bt, h)
505  !
506  ! -- storage coefficients
507  sc1 = sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
508  sc2 = sycapacity(this%dis%area(n), this%sy(n))
509  rho1 = sc1 * tled
510  rho2 = sc2 * tled
511  !
512  ! -- calculate newton terms for specific storage
513  ! and specific yield
514  if (this%iconvert(n) /= 0) then
515  !
516  ! -- calculate saturation derivative
517  derv = squadraticsaturationderivative(tp, bt, h)
518  !
519  ! -- newton terms for specific storage
520  if (this%iconf_ss == 0) then
521  if (this%iorig_ss == 0) then
522  drterm = -rho1 * derv * (h - bt) + rho1 * tthk * snnew * derv
523  else
524  drterm = -(rho1 * derv * h)
525  end if
526  call matrix_sln%add_value_pos(idxglo(idiag), drterm)
527  rhs(n) = rhs(n) + drterm * h
528  end if
529  !
530  ! -- newton terms for specific yield
531  ! only calculated if the current saturation
532  ! is less than one
533  if (snnew < done) then
534  ! -- calculate newton terms for specific yield
535  if (snnew > dzero) then
536  rterm = -rho2 * tthk * snnew
537  drterm = -rho2 * tthk * derv
538  call matrix_sln%add_value_pos(idxglo(idiag), drterm + rho2)
539  rhs(n) = rhs(n) - rterm + drterm * h + rho2 * bt
540  end if
541  end if
542  end if
543 
544  end subroutine fn_default_sto
545 
546  !> @ brief Calculate flows for package
547  !!
548  !! Flow calculation for the STO package components. Components include
549  !! specific storage and specific yield storage.
550  !!
551  !<
552  subroutine sto_cq(this, flowja, hnew, hold)
553  ! -- dummy variables
554  class(gwfstotype) :: this !< GwfStoType object
555  real(DP), dimension(:), contiguous, intent(inout) :: flowja !< connection flows
556  real(DP), dimension(:), contiguous, intent(in) :: hnew !< current head
557  real(DP), dimension(:), contiguous, intent(in) :: hold !< previous head
558  ! -- local variables
559  integer(I4B) :: n
560  integer(I4B) :: iform
561  !
562  ! -- reset storage rates
563  do n = 1, this%dis%nodes
564  this%strgss(n) = dzero
565  this%strgsy(n) = dzero
566  end do
567  !
568  if (this%iss == 1) return !< no storage for steady state period
569  !
570  ! -- Each active formulation runs over all cells and adds its storage
571  ! change; the default storage formulation is always active.
572  call this%default_form%cq(flowja, hnew, hold)
573  do iform = 1, max_ext_sto_forms
574  if (this%sto_formulations(iform)%is_active) then
575  call this%sto_formulations(iform)%form%cq(flowja, hnew, hold)
576  end if
577  end do
578  end subroutine sto_cq
579 
580  !> @brief Calculate flows for the default storage formulation
581  !!
582  !! Runs over all cells and stores the standard STO change in storage,
583  !! skipping cells claimed by an exclusive formulation.
584  !<
585  subroutine default_storage_cq(this, flowja, h_new, h_old)
586  class(defaultstorageformulationtype), intent(inout) :: this !< default formulation
587  real(DP), dimension(:), intent(inout) :: flowja !< connection flows
588  real(DP), dimension(:), intent(in) :: h_new !< current head
589  real(DP), dimension(:), intent(in) :: h_old !< previous head
590  ! local
591  integer(I4B) :: n
592 
593  do n = 1, this%sto%dis%nodes
594  if (this%sto%ibound(n) <= 0) cycle
595  ! skip cells claimed by an exclusive formulation
596  if (this%sto%iformulation(n) /= default_storage) cycle
597  call this%sto%cq_default_sto(n, flowja, h_new, h_old)
598  end do
599 
600  end subroutine default_storage_cq
601 
602  !> @brief The default formulation uses the claim mask, not is_active
603  !<
604  function default_storage_is_active(this, n) result(is_active)
605  class(defaultstorageformulationtype), intent(inout) :: this !< default formulation
606  integer(I4B), intent(in) :: n !< node number
607  logical(LGP) :: is_active !< always false for the default formulation
608  is_active = .false.
609  end function default_storage_is_active
610 
611  !> @brief Default storage budget is handled directly by sto_bd
612  !<
613  subroutine default_storage_bd(this, isuppress_output, model_budget)
614  use budgetmodule, only: budgettype
615  class(defaultstorageformulationtype), intent(inout) :: this !< default formulation
616  integer(I4B), intent(in) :: isuppress_output !< flag to suppress model output
617  type(budgettype), intent(inout) :: model_budget !< model budget object
618  end subroutine default_storage_bd
619 
620  !> @brief Default storage flows are saved directly by sto_save_model_flows
621  !<
622  subroutine default_storage_save_flows(this, iprint, ibinun)
623  class(defaultstorageformulationtype), intent(inout) :: this !< default formulation
624  integer(I4B), intent(in) :: iprint !< print flag
625  integer(I4B), intent(in) :: ibinun !< cell-by-cell file unit number
626  end subroutine default_storage_save_flows
627 
628  !> @brief Standard flow calculation for the storage
629  !<
630  subroutine cq_default_sto(this, n, flowja, hnew, hold)
631  use tdismodule, only: delt
632  class(gwfstotype), intent(inout) :: this
633  integer(I4B), intent(in) :: n
634  real(DP), dimension(:), intent(inout) :: flowja
635  real(DP), dimension(:), intent(in) :: hnew
636  real(DP), dimension(:), intent(in) :: hold
637  ! local
638  integer(I4B) :: idiag
639  real(DP) :: rate
640  real(DP) :: tled
641  real(DP) :: sc1, sc2, rho1, rho2
642  real(DP) :: sc1old, sc2old, rho1old, rho2old
643  real(DP) :: tp, bt
644  real(DP) :: snold, snnew
645  real(DP) :: aterm, rhsterm
646  !
647  tled = done / delt
648  !
649  ! -- aquifer elevations and thickness
650  tp = this%dis%top(n)
651  bt = this%dis%bot(n)
652  !
653  ! -- aquifer saturation
654  if (this%iconvert(n) == 0) then
655  snold = done
656  snnew = done
657  else
658  snold = squadraticsaturation(tp, bt, hold(n), this%satomega)
659  snnew = squadraticsaturation(tp, bt, hnew(n), this%satomega)
660  end if
661  !
662  ! -- primary storage coefficient
663  sc1 = sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
664  rho1 = sc1 * tled
665  !
666  if (this%integratechanges /= 0) then
667  ! -- Integration of storage changes (e.g. when using TVS):
668  ! separate the old (start of time step) and new (end of time step)
669  ! primary storage capacities
670  sc1old = sscapacity(this%istor_coef, tp, bt, this%dis%area(n), &
671  this%oldss(n))
672  rho1old = sc1old * tled
673  else
674  ! -- No integration of storage changes: old and new values are
675  ! identical => normal MF6 storage formulation
676  rho1old = rho1
677  end if
678  !
679  ! -- calculate specific storage terms and rate
680  call ssterms(this%iconvert(n), this%iorig_ss, this%iconf_ss, tp, bt, &
681  rho1, rho1old, snnew, snold, hnew(n), hold(n), &
682  aterm, rhsterm, rate)
683  !
684  ! -- save rate
685  this%strgss(n) = rate
686  !
687  ! -- add storage term to flowja
688  idiag = this%dis%con%ia(n)
689  flowja(idiag) = flowja(idiag) + rate
690  !
691  ! -- specific yield
692  rate = dzero
693  if (this%iconvert(n) /= 0) then
694  !
695  ! -- secondary storage coefficient
696  sc2 = sycapacity(this%dis%area(n), this%sy(n))
697  rho2 = sc2 * tled
698  !
699  if (this%integratechanges /= 0) then
700  ! -- Integration of storage changes (e.g. when using TVS):
701  ! separate the old (start of time step) and new (end of time
702  ! step) secondary storage capacities
703  sc2old = sycapacity(this%dis%area(n), this%oldsy(n))
704  rho2old = sc2old * tled
705  else
706  ! -- No integration of storage changes: old and new values are
707  ! identical => normal MF6 storage formulation
708  rho2old = rho2
709  end if
710  !
711  ! -- calculate specific yield storage terms and rate
712  call syterms(tp, bt, rho2, rho2old, snnew, snold, &
713  aterm, rhsterm, rate)
714 
715  end if
716  this%strgsy(n) = rate
717  !
718  ! -- add storage term to flowja
719  idiag = this%dis%con%ia(n)
720  flowja(idiag) = flowja(idiag) + rate
721 
722  end subroutine cq_default_sto
723 
724  !> @ brief Model budget calculation for package
725  !!
726  !! Budget calculation for the STO package components. Components include
727  !! specific storage and specific yield storage.
728  !!
729  !<
730  subroutine sto_bd(this, isuppress_output, model_budget)
731  ! -- modules
732  use tdismodule, only: delt
734  ! -- dummy variables
735  class(gwfstotype) :: this !< GwfStoType object
736  integer(I4B), intent(in) :: isuppress_output !< flag to suppress model output
737  type(budgettype), intent(inout) :: model_budget !< model budget object
738  ! -- local variables
739  integer(I4B) :: i
740  real(DP) :: rin
741  real(DP) :: rout
742  !
743  ! -- Add external storage rates to model budget
744  do i = 1, max_ext_sto_forms
745  if (this%sto_formulations(i)%is_active) then
746  call this%sto_formulations(i)%form%bd(isuppress_output, model_budget)
747  end if
748  end do
749  !
750  ! -- Add confined storage rates to model budget
751  call rate_accumulator(this%strgss, rin, rout)
752  call model_budget%addentry(rin, rout, delt, budtxt(1), &
753  isuppress_output, ' STORAGE')
754  !
755  ! -- Add unconfined storage rates to model budget (TODO_UZR: extension as a separate entry?)
756  if (this%iusesy == 1) then
757  call rate_accumulator(this%strgsy, rin, rout)
758  call model_budget%addentry(rin, rout, delt, budtxt(2), &
759  isuppress_output, ' STORAGE')
760  end if
761  end subroutine sto_bd
762 
763  !> @ brief Save model flows for package
764  !!
765  !! Save cell-by-cell budget terms for the STO package.
766  !!
767  !<
768  subroutine sto_save_model_flows(this, icbcfl, icbcun)
769  ! -- dummy variables
770  class(gwfstotype) :: this !< GwfStoType object
771  integer(I4B), intent(in) :: icbcfl !< flag to output budget data
772  integer(I4B), intent(in) :: icbcun !< cell-by-cell file unit number
773  ! -- local variables
774  integer(I4B) :: iform
775  integer(I4B) :: ibinun
776  integer(I4B) :: iprint, nvaluesp, nwidthp
777  character(len=1) :: cdatafmp = ' ', editdesc = ' '
778  real(DP) :: dinact
779  !
780  ! -- Set unit number for binary output
781  if (this%ipakcb < 0) then
782  ibinun = icbcun
783  elseif (this%ipakcb == 0) then
784  ibinun = 0
785  else
786  ibinun = this%ipakcb
787  end if
788  if (icbcfl == 0) ibinun = 0
789  !
790  ! -- Record the storage rates if requested
791  if (ibinun /= 0) then
792  iprint = 0
793  dinact = dzero
794  !
795  ! -- external formulations first
796  do iform = 1, max_ext_sto_forms
797  if (this%sto_formulations(iform)%is_active) then
798  call this%sto_formulations(iform)%form%save_flows(iprint, ibinun)
799  end if
800  end do
801  !
802  ! -- storage(ss)
803  call this%dis%record_array(this%strgss, this%iout, iprint, -ibinun, &
804  budtxt(1), cdatafmp, nvaluesp, &
805  nwidthp, editdesc, dinact)
806  !
807  ! -- storage(sy)
808  if (this%iusesy == 1) then
809  call this%dis%record_array(this%strgsy, this%iout, iprint, -ibinun, &
810  budtxt(2), cdatafmp, nvaluesp, &
811  nwidthp, editdesc, dinact)
812  end if
813  end if
814  end subroutine sto_save_model_flows
815 
816  !> @ brief Deallocate package memory
817  !!
818  !! Deallocate STO package scalars and arrays.
819  !!
820  !<
821  subroutine sto_da(this)
822  ! -- modules
824  ! -- dummy variables
825  class(gwfstotype) :: this !< GwfStoType object
826  !
827  ! -- TVS
828  if (this%intvs /= 0) then
829  call this%tvs%da()
830  deallocate (this%tvs)
831  end if
832  !
833  ! -- Deallocate arrays if package is active
834  if (this%inunit > 0) then
835  call mem_deallocate(this%iconvert)
836  call mem_deallocate(this%ss)
837  call mem_deallocate(this%sy)
838  call mem_deallocate(this%strgss)
839  call mem_deallocate(this%strgsy)
840  call mem_deallocate(this%iformulation)
841  !
842  ! -- deallocate the default storage formulation
843  if (associated(this%default_form)) then
844  deallocate (this%default_form)
845  this%default_form => null()
846  end if
847  !
848  ! -- deallocate TVS arrays
849  if (associated(this%oldss)) then
850  call mem_deallocate(this%oldss)
851  end if
852  if (associated(this%oldsy)) then
853  call mem_deallocate(this%oldsy)
854  end if
855  !
856  ! -- nullify input context pointers
857  nullify (this%iper)
858  nullify (this%storage)
859  end if
860  !
861  ! -- Deallocate scalars
862  call mem_deallocate(this%istor_coef)
863  call mem_deallocate(this%iconf_ss)
864  call mem_deallocate(this%iorig_ss)
865  call mem_deallocate(this%iusesy)
866  call mem_deallocate(this%satomega)
867  call mem_deallocate(this%integratechanges)
868  call mem_deallocate(this%intvs)
869  !
870  ! -- deallocate parent
871  call this%NumericalPackageType%da()
872  end subroutine sto_da
873 
874  !> @ brief Allocate scalars
875  !!
876  !! Allocate and initialize scalars for the STO package. The base numerical
877  !! package allocate scalars method is also called.
878  !!
879  !<
880  subroutine allocate_scalars(this)
881  ! -- modules
883  ! -- dummy variables
884  class(gwfstotype) :: this !< GwfStoType object
885  !
886  ! -- allocate scalars in NumericalPackageType
887  call this%NumericalPackageType%allocate_scalars()
888  !
889  ! -- allocate scalars
890  call mem_allocate(this%istor_coef, 'ISTOR_COEF', this%memoryPath)
891  call mem_allocate(this%iconf_ss, 'ICONF_SS', this%memoryPath)
892  call mem_allocate(this%iorig_ss, 'IORIG_SS', this%memoryPath)
893  call mem_allocate(this%iusesy, 'IUSESY', this%memoryPath)
894  call mem_allocate(this%satomega, 'SATOMEGA', this%memoryPath)
895  call mem_allocate(this%integratechanges, 'INTEGRATECHANGES', &
896  this%memoryPath)
897  call mem_allocate(this%intvs, 'INTVS', this%memoryPath)
898  !
899  ! -- initialize scalars
900  this%istor_coef = 0
901  this%iconf_ss = 0
902  this%iorig_ss = 0
903  this%iusesy = 0
904  this%satomega = dzero
905  this%integratechanges = 0
906  this%intvs = 0
907  end subroutine allocate_scalars
908 
909  !> @ brief Allocate package arrays
910  !!
911  !! Allocate and initialize STO package arrays.
912  !!
913  !<
914  subroutine allocate_arrays(this, nodes)
915  ! -- modules
917  ! -- dummy variables
918  class(gwfstotype), target :: this !< GwfStoType object
919  integer(I4B), intent(in) :: nodes !< active model nodes
920  ! -- local variables
921  integer(I4B) :: n
922  !
923  ! -- Allocate arrays
924  call mem_allocate(this%iconvert, nodes, 'ICONVERT', this%memoryPath)
925  call mem_allocate(this%ss, nodes, 'SS', this%memoryPath)
926  call mem_allocate(this%sy, nodes, 'SY', this%memoryPath)
927  call mem_allocate(this%strgss, nodes, 'STRGSS', this%memoryPath)
928  call mem_allocate(this%strgsy, nodes, 'STRGSY', this%memoryPath)
929  call mem_allocate(this%iformulation, nodes, 'IFORM', this%memoryPath)
930  !
931  ! -- set input context pointers
932  if (this%inunit > 0) then
933  call mem_setptr(this%iper, 'IPER', this%input_mempath)
934  call mem_setptr(this%storage, 'STORAGE', this%input_mempath)
935  end if
936  !
937  ! -- Initialize arrays
938  this%iss = 0
939  do n = 1, nodes
940  this%iconvert(n) = 1
941  this%ss(n) = dzero
942  this%sy(n) = dzero
943  this%strgss(n) = dzero
944  this%strgsy(n) = dzero
945  if (this%integratechanges /= 0) then
946  this%oldss(n) = dzero
947  if (this%iusesy /= 0) then
948  this%oldsy(n) = dzero
949  end if
950  end if
951 
952  this%iformulation(n) = default_storage
953  end do
954  !
955  ! -- create the default storage formulation and point it at this package
956  allocate (defaultstorageformulationtype :: this%default_form)
957  select type (form => this%default_form)
959  form%sto => this
960  end select
961  end subroutine allocate_arrays
962 
963  !> @ brief Source input options for package
964  !!
965  !! Source options block parameters for STO package.
966  !!
967  !<
968  subroutine source_options(this)
969  ! -- modules
970  use constantsmodule, only: lenmempath
976  ! -- dummy variables
977  class(gwfstotype) :: this !< GwfStoType object
978  ! -- local variables
979  type(gwfstoparamfoundtype) :: found
980  type(characterstringtype), dimension(:), pointer, contiguous :: tvs6_mempaths
981  character(len=LINELENGTH) :: tvs6_filename
982  character(len=LENMEMPATH) :: tvs6_mempath
983  !
984  ! -- source package input
985  call mem_set_value(this%ipakcb, 'IPAKCB', this%input_mempath, found%ipakcb)
986  call mem_set_value(this%istor_coef, 'ISTOR_COEF', this%input_mempath, &
987  found%istor_coef)
988  call mem_set_value(this%iconf_ss, 'SS_CONFINED_ONLY', this%input_mempath, &
989  found%ss_confined_only)
990  call mem_set_value(this%iorig_ss, 'IORIG_SS', this%input_mempath, &
991  found%iorig_ss)
992  call mem_set_value(this%iconf_ss, 'ICONF_SS', this%input_mempath, &
993  found%iconf_ss)
994  !
995  if (found%ipakcb) then
996  this%ipakcb = -1
997  end if
998  !
999  if (found%ss_confined_only) then
1000  this%iorig_ss = 0
1001  end if
1002  !
1003  ! -- TVS6 subpackage
1004  if (filein_fname(tvs6_filename, 'TVS6_FILENAME', &
1005  this%input_mempath, this%input_fname)) then
1006  call mem_setptr(tvs6_mempaths, 'TVS6_MEMPATH', this%input_mempath)
1007  tvs6_mempath = tvs6_mempaths(1)
1008  this%intvs = 1 ! tvs active
1009  call tvs_cr(this%tvs, this%name_model, tvs6_mempath, this%intvs, this%iout)
1010  end if
1011  !
1012  if (found%iconf_ss) then
1013  this%iorig_ss = 0
1014  end if
1015  !
1016  ! -- log found options
1017  call this%log_options(found)
1018  !
1019  ! -- set omega value used for saturation calculations
1020  if (this%inewton > 0) then
1021  this%satomega = dem6
1022  end if
1023  end subroutine source_options
1024 
1025  !> @ brief Log found options for package
1026  !!
1027  !! Log options block for STO package.
1028  !!
1029  !<
1030  subroutine log_options(this, found)
1031  ! -- modules
1034  ! -- dummy variables
1035  class(gwfstotype) :: this !< GwfStoType object
1036  type(gwfstoparamfoundtype), intent(in) :: found
1037  ! -- local variables
1038  ! -- formats
1039  character(len=*), parameter :: fmtisvflow = &
1040  "(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY FILE &
1041  &WHENEVER ICBCFL IS NOT ZERO.')"
1042  character(len=*), parameter :: fmtflow = &
1043  &"(4x, 'FLOWS WILL BE SAVED TO FILE: ', a, /4x, 'OPENED ON UNIT: ', I7)"
1044  character(len=*), parameter :: fmtorigss = &
1045  "(4X,'ORIGINAL_SPECIFIC_STORAGE OPTION:',/, &
1046  &1X,'The original specific storage formulation will be used')"
1047  character(len=*), parameter :: fmtstoc = &
1048  "(4X,'STORAGECOEFFICIENT OPTION:',/, &
1049  &1X,'Read storage coefficient rather than specific storage')"
1050  character(len=*), parameter :: fmtconfss = &
1051  "(4X,'SS_CONFINED_ONLY OPTION:',/, &
1052  &1X,'Specific storage changes only occur under confined conditions')"
1053  !
1054  write (this%iout, '(1x,a)') 'PROCESSING STORAGE OPTIONS'
1055  !
1056  if (found%ipakcb) then
1057  write (this%iout, fmtisvflow)
1058  end if
1059  !
1060  if (found%istor_coef) then
1061  write (this%iout, fmtstoc)
1062  end if
1063  !
1064  if (found%ss_confined_only) then
1065  write (this%iout, fmtconfss)
1066  end if
1067  !
1068  if (found%iorig_ss) then
1069  write (this%iout, fmtorigss)
1070  end if
1071  !
1072  if (found%iconf_ss) then
1073  write (this%iout, fmtconfss)
1074  end if
1075  !
1076  write (this%iout, '(1x,a)') 'END OF STORAGE OPTIONS'
1077  end subroutine log_options
1078 
1079  !> @ brief Source input data for package
1080  !!
1081  !! Source griddata block parameters for STO package.
1082  !!
1083  !<
1084  subroutine source_data(this)
1085  ! -- modules
1088  ! -- dummy variables
1089  class(gwfstotype) :: this !< GwfStoType object
1090  ! -- local variables
1091  character(len=LINELENGTH) :: cellstr
1092  logical(LGP) :: isconv
1093  character(len=24), dimension(4) :: aname
1094  integer(I4B) :: n
1095  integer(I4B), dimension(:), pointer, contiguous :: map
1096  type(gwfstoparamfoundtype) :: found
1097  !
1098  ! -- initialize data
1099  data aname(1)/' ICONVERT'/
1100  data aname(2)/' SPECIFIC STORAGE'/
1101  data aname(3)/' SPECIFIC YIELD'/
1102  !
1103  ! -- set map to reduce data input arrays
1104  map => null()
1105  if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1106  !
1107  ! -- copy data from input context
1108  call mem_set_value(this%iconvert, 'ICONVERT', this%input_mempath, map, &
1109  found%iconvert)
1110  call mem_set_value(this%ss, 'SS', this%input_mempath, map, found%ss)
1111  call mem_set_value(this%sy, 'SY', this%input_mempath, map, found%sy)
1112  !
1113  ! -- Check for ICONVERT
1114  if (found%iconvert) then
1115  isconv = .false.
1116  do n = 1, this%dis%nodes
1117  if (this%iconvert(n) /= 0) then
1118  isconv = .true.
1119  this%iusesy = 1
1120  exit
1121  end if
1122  end do
1123  else
1124  write (errmsg, '(a, a, a)') 'Error in GRIDDATA block: ', &
1125  trim(adjustl(aname(1))), ' not found.'
1126  call store_error(errmsg)
1127  end if
1128  !
1129  ! -- Check for SS
1130  if (found%ss) then
1131  ! no-op
1132  else
1133  write (errmsg, '(a, a, a)') 'Error in GRIDDATA block: ', &
1134  trim(adjustl(aname(2))), ' not found.'
1135  call store_error(errmsg)
1136  end if
1137  !
1138  ! -- Check for SY
1139  if (found%sy) then
1140  ! no-op
1141  else
1142  if (isconv) then
1143  write (errmsg, '(a, a, a)') 'Error in GRIDDATA block: ', &
1144  trim(adjustl(aname(3))), ' not found.'
1145  call store_error(errmsg)
1146  end if
1147  end if
1148  !
1149  if (count_errors() > 0) then
1150  call store_error_filename(this%input_fname)
1151  end if
1152  !
1153  ! -- Check SS and SY for negative values
1154  do n = 1, this%dis%nodes
1155  if (this%ss(n) < dzero) then
1156  call this%dis%noder_to_string(n, cellstr)
1157  write (errmsg, '(a,2(1x,a),1x,g0,1x,a)') &
1158  'Error in SS DATA: SS value in cell', trim(adjustl(cellstr)), &
1159  'is less than zero (', this%ss(n), ').'
1160  call store_error(errmsg)
1161  end if
1162  if (found%sy) then
1163  if (this%sy(n) < dzero) then
1164  call this%dis%noder_to_string(n, cellstr)
1165  write (errmsg, '(a,2(1x,a),1x,g0,1x,a)') &
1166  'Error in SY DATA: SY value in cell', trim(adjustl(cellstr)), &
1167  'is less than zero (', this%sy(n), ').'
1168  call store_error(errmsg)
1169  end if
1170  end if
1171  end do
1172  end subroutine source_data
1173 
1174  !> @ brief Save old storage property values
1175  !!
1176  !! Save ss and sy values from the previous time step for use with storage
1177  !! integration when integratechanges is non-zero.
1178  !!
1179  !<
1180  subroutine save_old_ss_sy(this)
1181  ! -- modules
1183  ! -- dummy variables
1184  class(gwfstotype) :: this !< GwfStoType object
1185  ! -- local variables
1186  integer(I4B) :: n
1187  !
1188  ! -- Allocate TVS arrays if needed
1189  if (.not. associated(this%oldss)) then
1190  call mem_allocate(this%oldss, this%dis%nodes, 'OLDSS', this%memoryPath)
1191  end if
1192  if (this%iusesy == 1 .and. .not. associated(this%oldsy)) then
1193  call mem_allocate(this%oldsy, this%dis%nodes, 'OLDSY', this%memoryPath)
1194  end if
1195  !
1196  ! -- Save current specific storage
1197  do n = 1, this%dis%nodes
1198  this%oldss(n) = this%ss(n)
1199  end do
1200  !
1201  ! -- Save current specific yield, if used
1202  if (this%iusesy == 1) then
1203  do n = 1, this%dis%nodes
1204  this%oldsy(n) = this%sy(n)
1205  end do
1206  end if
1207  end subroutine save_old_ss_sy
1208 
1209  subroutine add_sto_formulation(this, sto_form, form_id)
1210  class(gwfstotype), intent(inout) :: this !< this NPF instance
1211  class(gwfstoformulationtype), pointer :: sto_form !< the alternative storage calculator
1212  integer(I4B) :: form_id !< the id for the flow formulation
1213 
1214  this%sto_formulations(form_id)%is_active = .true.
1215  this%sto_formulations(form_id)%form => sto_form
1216 
1217  end subroutine add_sto_formulation
1218 
1219 end module gwfstomodule
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:634
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
real(dp), parameter dhalf
real constant 1/2
Definition: Constants.f90:68
real(dp), parameter dem4
real constant 1e-4
Definition: Constants.f90:107
real(dp), parameter dem6
real constant 1e-6
Definition: Constants.f90:109
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
real(dp), parameter dtwo
real constant 2
Definition: Constants.f90:79
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition: Constants.f90:27
real(dp), parameter done
real constant 1
Definition: Constants.f90:76
integer(i4b), parameter, public max_ext_sto_forms
'cause default is not part of the (external) storage formulations
Definition: GwfStoExt.f90:11
integer(i4b), parameter, public default_storage
Definition: GwfStoExt.f90:8
This module contains the storage package methods.
Definition: gwf-sto.f90:8
subroutine, public sto_cr(stoobj, name_model, mempath, inunit, iout)
@ brief Create a new package object
Definition: gwf-sto.f90:109
subroutine sto_bd(this, isuppress_output, model_budget)
@ brief Model budget calculation for package
Definition: gwf-sto.f90:731
subroutine add_sto_formulation(this, sto_form, form_id)
Definition: gwf-sto.f90:1210
subroutine default_storage_fn(this, kiter, matrix_sln, rhs, idxglo, h_old, h_new)
Fill newton terms for the default storage formulation.
Definition: gwf-sto.f90:455
subroutine source_data(this)
@ brief Source input data for package
Definition: gwf-sto.f90:1085
subroutine sto_ar(this, dis, ibound)
@ brief Allocate and read method for package
Definition: gwf-sto.f90:136
subroutine sto_da(this)
@ brief Deallocate package memory
Definition: gwf-sto.f90:822
subroutine sto_fc(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
@ brief Fill A and right-hand side for the package
Definition: gwf-sto.f90:259
subroutine default_storage_save_flows(this, iprint, ibinun)
Default storage flows are saved directly by sto_save_model_flows.
Definition: gwf-sto.f90:623
subroutine log_options(this, found)
@ brief Log found options for package
Definition: gwf-sto.f90:1031
subroutine default_storage_cq(this, flowja, h_new, h_old)
Calculate flows for the default storage formulation.
Definition: gwf-sto.f90:586
subroutine default_storage_bd(this, isuppress_output, model_budget)
Default storage budget is handled directly by sto_bd.
Definition: gwf-sto.f90:614
logical(lgp) function default_storage_is_active(this, n)
The default formulation uses the claim mask, not is_active.
Definition: gwf-sto.f90:605
subroutine sto_fn(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
@ brief Fill Newton-Raphson terms in A and right-hand side for the package
Definition: gwf-sto.f90:423
subroutine sto_rp(this)
@ brief Read and prepare method for package
Definition: gwf-sto.f90:184
subroutine sto_cq(this, flowja, hnew, hold)
@ brief Calculate flows for package
Definition: gwf-sto.f90:553
subroutine cq_default_sto(this, n, flowja, hnew, hold)
Standard flow calculation for the storage.
Definition: gwf-sto.f90:631
subroutine save_old_ss_sy(this)
@ brief Save old storage property values
Definition: gwf-sto.f90:1181
subroutine fn_default_sto(this, n, matrix_sln, rhs, idxglo, hold, hnew)
Definition: gwf-sto.f90:475
subroutine sto_save_model_flows(this, icbcfl, icbcun)
@ brief Save model flows for package
Definition: gwf-sto.f90:769
subroutine default_storage_fc(this, kiter, matrix_sln, rhs, idxglo, h_old, h_new)
Fill coefficients for the default storage formulation.
Definition: gwf-sto.f90:302
subroutine allocate_scalars(this)
@ brief Allocate scalars
Definition: gwf-sto.f90:881
subroutine allocate_arrays(this, nodes)
@ brief Allocate package arrays
Definition: gwf-sto.f90:915
subroutine sto_ad(this)
@ brief Advance the package
Definition: gwf-sto.f90:237
character(len=lenbudtxt), dimension(2) budtxt
Definition: gwf-sto.f90:31
subroutine fc_default_sto(this, n, matrix_sln, rhs, idxglo, hold, hnew)
Default storage FC.
Definition: gwf-sto.f90:324
subroutine source_options(this)
@ brief Source input options for package
Definition: gwf-sto.f90:969
This module contains stateless storage subroutines and functions.
pure real(dp) function, public sycapacity(area, sy)
Calculate the specific yield capacity.
pure subroutine, public syterms(top, bot, rho2, rho2old, snnew, snold, aterm, rhsterm, rate)
Calculate the specific yield storage terms.
pure subroutine, public ssterms(iconvert, iorig_ss, iconf_ss, top, bot, rho1, rho1old, snnew, snold, hnew, hold, aterm, rhsterm, rate)
Calculate the specific storage terms.
pure real(dp) function, public sscapacity(istor_coef, top, bot, area, ss)
Calculate the specific storage capacity.
This module defines variable data types.
Definition: kind.f90:8
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
This module contains the base numerical package type.
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:204
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=maxcharlen) errmsg
error message string
real(dp) function squadraticsaturation(top, bot, x, eps)
@ brief sQuadraticSaturation
real(dp) function slinearsaturation(top, bot, x)
@ brief sLinearSaturation
real(dp) function squadraticsaturationderivative(top, bot, x, eps)
@ brief Derivative of the quadratic saturation function
real(dp) function sqsaturation(top, bot, x, c1, c2)
@ brief sQSaturation
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:27
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:26
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:32
This module contains the time-varying storage package methods.
Definition: gwf-tvs.f90:8
subroutine, public tvs_cr(tvs, name_model, mempath, inunit, iout)
Create a new TvsType object.
Definition: gwf-tvs.f90:52
Derived type for the Budget object.
Definition: Budget.f90:40
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Container to allow arrays of polymorphic extension pointers.
Definition: GwfStoExt.f90:25
Default storage formulation.
Definition: gwf-sto.f90:90