27 character(len=LENBUDTXT),
dimension(2) ::
budtxt = & !< text labels for budget terms
28 &[
' STO-SS',
' STO-SY']
31 integer(I4B),
pointer :: istor_coef => null()
32 integer(I4B),
pointer :: iconf_ss => null()
33 integer(I4B),
pointer :: iorig_ss => null()
34 integer(I4B),
pointer :: iss => null()
35 integer(I4B),
pointer :: iusesy => null()
36 integer(I4B),
dimension(:),
pointer,
contiguous :: iconvert => null()
37 real(dp),
dimension(:),
pointer,
contiguous :: ss => null()
38 real(dp),
dimension(:),
pointer,
contiguous :: sy => null()
39 real(dp),
dimension(:),
pointer,
contiguous :: strgss => null()
40 real(dp),
dimension(:),
pointer,
contiguous :: strgsy => null()
41 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
42 real(dp),
pointer :: satomega => null()
43 integer(I4B),
pointer :: integratechanges => null()
44 integer(I4B),
pointer :: intvs => null()
46 real(dp),
dimension(:),
pointer,
contiguous,
private :: oldss => null()
47 real(dp),
dimension(:),
pointer,
contiguous,
private :: oldsy => null()
48 integer(I4B),
pointer :: iper => null()
49 character(len=:),
pointer :: storage
76 subroutine sto_cr(stoobj, name_model, mempath, inunit, iout)
79 character(len=*),
intent(in) :: name_model
80 character(len=*),
intent(in) :: mempath
81 integer(I4B),
intent(in) :: inunit
82 integer(I4B),
intent(in) :: iout
88 call stoobj%set_names(1, name_model,
'STO',
'STO', mempath)
91 call stoobj%allocate_scalars()
94 stoobj%inunit = inunit
110 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
113 character(len=*),
parameter :: fmtsto = &
114 "(1x,/1x,'STO -- STORAGE PACKAGE, VERSION 1, 5/19/2014', &
115 &' INPUT READ FROM MEMPATH: ', A, //)"
118 write (this%iout, fmtsto) this%input_mempath
122 this%ibound => ibound
128 call this%allocate_arrays(dis%nodes)
134 call this%source_options()
137 call this%source_data()
140 if (this%intvs /= 0)
then
141 call this%tvs%ar(this%dis)
157 character(len=16) :: css(0:1)
159 data css(0)/
' TRANSIENT'/
160 data css(1)/
' STEADY-STATE'/
163 if (this%integratechanges /= 0)
then
164 call this%save_old_ss_sy()
168 if (this%inunit <= 0)
return
171 if (this%iper /=
kper)
return
173 write (this%iout,
'(//,1x,a)')
'PROCESSING STORAGE PERIOD DATA'
176 if (this%storage ==
'STEADY-STATE')
then
178 else if (this%storage ==
'TRANSIENT')
then
181 write (
errmsg,
'(a,a)')
'Unknown STORAGE data tag: ', &
187 write (this%iout,
'(1x,a)')
'END PROCESSING STORAGE PERIOD DATA'
189 write (this%iout,
'(//1X,A,I0,A,A,/)') &
190 'STRESS PERIOD ',
kper,
' IS ', trim(adjustl(css(this%iss)))
193 if (this%intvs /= 0)
then
210 if (this%integratechanges /= 0 .and.
kstp > 1)
then
211 call this%save_old_ss_sy()
215 if (this%intvs /= 0)
then
225 subroutine sto_fc(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
230 integer(I4B),
intent(in) :: kiter
231 real(DP),
intent(in),
dimension(:) :: hold
232 real(DP),
intent(in),
dimension(:) :: hnew
234 integer(I4B),
intent(in),
dimension(:) :: idxglo
235 real(DP),
intent(inout),
dimension(:) :: rhs
238 integer(I4B) :: idiag
255 character(len=*),
parameter :: fmtsperror = &
256 &
"('DETECTED TIME STEP LENGTH OF ZERO. GWF STORAGE PACKAGE CANNOT BE ', &
257 &'USED UNLESS DELT IS NON-ZERO.')"
260 if (this%iss /= 0)
return
264 write (
errmsg, fmtsperror)
272 do n = 1, this%dis%nodes
273 idiag = this%dis%con%ia(n)
274 if (this%ibound(n) < 1) cycle
281 if (this%iconvert(n) == 0)
then
290 sc1 =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
293 if (this%integratechanges /= 0)
then
297 sc1old =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), &
299 rho1old = sc1old * tled
307 call ssterms(this%iconvert(n), this%iorig_ss, this%iconf_ss, tp, bt, &
308 rho1, rho1old, snnew, snold, hnew(n), hold(n), &
312 call matrix_sln%add_value_pos(idxglo(idiag), aterm)
313 rhs(n) = rhs(n) + rhsterm
316 if (this%iconvert(n) /= 0)
then
320 sc2 =
sycapacity(this%dis%area(n), this%sy(n))
323 if (this%integratechanges /= 0)
then
327 sc2old =
sycapacity(this%dis%area(n), this%oldsy(n))
328 rho2old = sc2old * tled
336 call syterms(tp, bt, rho2, rho2old, snnew, snold, &
340 call matrix_sln%add_value_pos(idxglo(idiag), aterm)
341 rhs(n) = rhs(n) + rhsterm
352 subroutine sto_fn(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
357 integer(I4B),
intent(in) :: kiter
358 real(DP),
intent(in),
dimension(:) :: hold
359 real(DP),
intent(in),
dimension(:) :: hnew
361 integer(I4B),
intent(in),
dimension(:) :: idxglo
362 real(DP),
intent(inout),
dimension(:) :: rhs
365 integer(I4B) :: idiag
381 if (this%iss /= 0)
return
387 do n = 1, this%dis%nodes
388 idiag = this%dis%con%ia(n)
389 if (this%ibound(n) <= 0) cycle
401 sc1 =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
402 sc2 =
sycapacity(this%dis%area(n), this%sy(n))
408 if (this%iconvert(n) /= 0)
then
414 if (this%iconf_ss == 0)
then
415 if (this%iorig_ss == 0)
then
416 drterm = -rho1 * derv * (h - bt) + rho1 * tthk * snnew * derv
418 drterm = -(rho1 * derv * h)
420 call matrix_sln%add_value_pos(idxglo(idiag), drterm)
421 rhs(n) = rhs(n) + drterm * h
427 if (snnew <
done)
then
429 if (snnew >
dzero)
then
430 rterm = -rho2 * tthk * snnew
431 drterm = -rho2 * tthk * derv
432 call matrix_sln%add_value_pos(idxglo(idiag), drterm + rho2)
433 rhs(n) = rhs(n) - rterm + drterm * h + rho2 * bt
446 subroutine sto_cq(this, flowja, hnew, hold)
451 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
452 real(DP),
dimension(:),
contiguous,
intent(in) :: hnew
453 real(DP),
dimension(:),
contiguous,
intent(in) :: hold
456 integer(I4B) :: idiag
475 do n = 1, this%dis%nodes
476 this%strgss(n) =
dzero
477 this%strgsy(n) =
dzero
481 if (this%iss == 0)
then
487 do n = 1, this%dis%nodes
488 if (this%ibound(n) <= 0) cycle
494 if (this%iconvert(n) == 0)
then
503 sc1 =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
506 if (this%integratechanges /= 0)
then
510 sc1old =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), &
512 rho1old = sc1old * tled
520 call ssterms(this%iconvert(n), this%iorig_ss, this%iconf_ss, tp, bt, &
521 rho1, rho1old, snnew, snold, hnew(n), hold(n), &
522 aterm, rhsterm, rate)
525 this%strgss(n) = rate
528 idiag = this%dis%con%ia(n)
529 flowja(idiag) = flowja(idiag) + rate
533 if (this%iconvert(n) /= 0)
then
536 sc2 =
sycapacity(this%dis%area(n), this%sy(n))
539 if (this%integratechanges /= 0)
then
543 sc2old =
sycapacity(this%dis%area(n), this%oldsy(n))
544 rho2old = sc2old * tled
552 call syterms(tp, bt, rho2, rho2old, snnew, snold, &
553 aterm, rhsterm, rate)
556 this%strgsy(n) = rate
559 idiag = this%dis%con%ia(n)
560 flowja(idiag) = flowja(idiag) + rate
571 subroutine sto_bd(this, isuppress_output, model_budget)
577 integer(I4B),
intent(in) :: isuppress_output
578 type(
budgettype),
intent(inout) :: model_budget
585 call model_budget%addentry(rin, rout,
delt,
budtxt(1), &
586 isuppress_output,
' STORAGE')
589 if (this%iusesy == 1)
then
591 call model_budget%addentry(rin, rout,
delt,
budtxt(2), &
592 isuppress_output,
' STORAGE')
604 integer(I4B),
intent(in) :: icbcfl
605 integer(I4B),
intent(in) :: icbcun
607 integer(I4B) :: ibinun
608 integer(I4B) :: iprint, nvaluesp, nwidthp
609 character(len=1) :: cdatafmp =
' ', editdesc =
' '
613 if (this%ipakcb < 0)
then
615 elseif (this%ipakcb == 0)
then
620 if (icbcfl == 0) ibinun = 0
623 if (ibinun /= 0)
then
628 call this%dis%record_array(this%strgss, this%iout, iprint, -ibinun, &
629 budtxt(1), cdatafmp, nvaluesp, &
630 nwidthp, editdesc, dinact)
633 if (this%iusesy == 1)
then
634 call this%dis%record_array(this%strgsy, this%iout, iprint, -ibinun, &
635 budtxt(2), cdatafmp, nvaluesp, &
636 nwidthp, editdesc, dinact)
653 if (this%intvs /= 0)
then
655 deallocate (this%tvs)
659 if (this%inunit > 0)
then
667 if (
associated(this%oldss))
then
670 if (
associated(this%oldsy))
then
676 nullify (this%storage)
689 call this%NumericalPackageType%da()
705 call this%NumericalPackageType%allocate_scalars()
708 call mem_allocate(this%istor_coef,
'ISTOR_COEF', this%memoryPath)
709 call mem_allocate(this%iconf_ss,
'ICONF_SS', this%memoryPath)
710 call mem_allocate(this%iorig_ss,
'IORIG_SS', this%memoryPath)
711 call mem_allocate(this%iusesy,
'IUSESY', this%memoryPath)
712 call mem_allocate(this%satomega,
'SATOMEGA', this%memoryPath)
713 call mem_allocate(this%integratechanges,
'INTEGRATECHANGES', &
722 this%satomega =
dzero
723 this%integratechanges = 0
737 integer(I4B),
intent(in) :: nodes
742 call mem_allocate(this%iconvert, nodes,
'ICONVERT', this%memoryPath)
743 call mem_allocate(this%ss, nodes,
'SS', this%memoryPath)
744 call mem_allocate(this%sy, nodes,
'SY', this%memoryPath)
745 call mem_allocate(this%strgss, nodes,
'STRGSS', this%memoryPath)
746 call mem_allocate(this%strgsy, nodes,
'STRGSY', this%memoryPath)
749 if (this%inunit > 0)
then
750 call mem_setptr(this%iper,
'IPER', this%input_mempath)
751 call mem_setptr(this%storage,
'STORAGE', this%input_mempath)
760 this%strgss(n) =
dzero
761 this%strgsy(n) =
dzero
762 if (this%integratechanges /= 0)
then
763 this%oldss(n) =
dzero
764 if (this%iusesy /= 0)
then
765 this%oldsy(n) =
dzero
789 character(len=LINELENGTH) :: tvs6_filename
790 character(len=LENMEMPATH) :: tvs6_mempath
793 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
794 call mem_set_value(this%istor_coef,
'ISTOR_COEF', this%input_mempath, &
796 call mem_set_value(this%iconf_ss,
'SS_CONFINED_ONLY', this%input_mempath, &
797 found%ss_confined_only)
798 call mem_set_value(this%iorig_ss,
'IORIG_SS', this%input_mempath, &
800 call mem_set_value(this%iconf_ss,
'ICONF_SS', this%input_mempath, &
803 if (found%ipakcb)
then
807 if (found%ss_confined_only)
then
813 this%input_mempath, this%input_fname))
then
814 call mem_setptr(tvs6_mempaths,
'TVS6_MEMPATH', this%input_mempath)
815 tvs6_mempath = tvs6_mempaths(1)
817 call tvs_cr(this%tvs, this%name_model, tvs6_mempath, this%intvs, this%iout)
820 if (found%iconf_ss)
then
825 call this%log_options(found)
828 if (this%inewton > 0)
then
847 character(len=*),
parameter :: fmtisvflow = &
848 "(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY FILE &
849 &WHENEVER ICBCFL IS NOT ZERO.')"
850 character(len=*),
parameter :: fmtflow = &
851 &
"(4x, 'FLOWS WILL BE SAVED TO FILE: ', a, /4x, 'OPENED ON UNIT: ', I7)"
852 character(len=*),
parameter :: fmtorigss = &
853 "(4X,'ORIGINAL_SPECIFIC_STORAGE OPTION:',/, &
854 &1X,'The original specific storage formulation will be used')"
855 character(len=*),
parameter :: fmtstoc = &
856 "(4X,'STORAGECOEFFICIENT OPTION:',/, &
857 &1X,'Read storage coefficient rather than specific storage')"
858 character(len=*),
parameter :: fmtconfss = &
859 "(4X,'SS_CONFINED_ONLY OPTION:',/, &
860 &1X,'Specific storage changes only occur under confined conditions')"
862 write (this%iout,
'(1x,a)')
'PROCESSING STORAGE OPTIONS'
864 if (found%ipakcb)
then
865 write (this%iout, fmtisvflow)
868 if (found%istor_coef)
then
869 write (this%iout, fmtstoc)
872 if (found%ss_confined_only)
then
873 write (this%iout, fmtconfss)
876 if (found%iorig_ss)
then
877 write (this%iout, fmtorigss)
880 if (found%iconf_ss)
then
881 write (this%iout, fmtconfss)
884 write (this%iout,
'(1x,a)')
'END OF STORAGE OPTIONS'
899 character(len=LINELENGTH) :: cellstr
900 logical(LGP) :: isconv
901 character(len=24),
dimension(4) :: aname
903 integer(I4B),
dimension(:),
pointer,
contiguous :: map
907 data aname(1)/
' ICONVERT'/
908 data aname(2)/
' SPECIFIC STORAGE'/
909 data aname(3)/
' SPECIFIC YIELD'/
913 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
916 call mem_set_value(this%iconvert,
'ICONVERT', this%input_mempath, map, &
918 call mem_set_value(this%ss,
'SS', this%input_mempath, map, found%ss)
919 call mem_set_value(this%sy,
'SY', this%input_mempath, map, found%sy)
922 if (found%iconvert)
then
924 do n = 1, this%dis%nodes
925 if (this%iconvert(n) /= 0)
then
932 write (
errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
933 trim(adjustl(aname(1))),
' not found.'
941 write (
errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
942 trim(adjustl(aname(2))),
' not found.'
951 write (
errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
952 trim(adjustl(aname(3))),
' not found.'
962 do n = 1, this%dis%nodes
963 if (this%ss(n) <
dzero)
then
964 call this%dis%noder_to_string(n, cellstr)
965 write (
errmsg,
'(a,2(1x,a),1x,g0,1x,a)') &
966 'Error in SS DATA: SS value in cell', trim(adjustl(cellstr)), &
967 'is less than zero (', this%ss(n),
').'
971 if (this%sy(n) <
dzero)
then
972 call this%dis%noder_to_string(n, cellstr)
973 write (
errmsg,
'(a,2(1x,a),1x,g0,1x,a)') &
974 'Error in SY DATA: SY value in cell', trim(adjustl(cellstr)), &
975 'is less than zero (', this%sy(n),
').'
997 if (.not.
associated(this%oldss))
then
998 call mem_allocate(this%oldss, this%dis%nodes,
'OLDSS', this%memoryPath)
1000 if (this%iusesy == 1 .and. .not.
associated(this%oldsy))
then
1001 call mem_allocate(this%oldsy, this%dis%nodes,
'OLDSY', this%memoryPath)
1005 do n = 1, this%dis%nodes
1006 this%oldss(n) = this%ss(n)
1010 if (this%iusesy == 1)
then
1011 do n = 1, this%dis%nodes
1012 this%oldsy(n) = this%sy(n)
This module contains the BudgetModule.
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dem4
real constant 1e-4
real(dp), parameter dem6
real constant 1e-6
real(dp), parameter dzero
real constant zero
real(dp), parameter dtwo
real constant 2
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter done
real constant 1
This module contains the storage package methods.
subroutine, public sto_cr(stoobj, name_model, mempath, inunit, iout)
@ brief Create a new package object
subroutine sto_bd(this, isuppress_output, model_budget)
@ brief Model budget calculation for package
subroutine source_data(this)
@ brief Source input data for package
subroutine sto_ar(this, dis, ibound)
@ brief Allocate and read method for package
subroutine sto_da(this)
@ brief Deallocate package memory
subroutine sto_fc(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
@ brief Fill A and right-hand side for the package
subroutine log_options(this, found)
@ brief Log found options for package
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
subroutine sto_rp(this)
@ brief Read and prepare method for package
subroutine sto_cq(this, flowja, hnew, hold)
@ brief Calculate flows for package
subroutine save_old_ss_sy(this)
@ brief Save old storage property values
subroutine sto_save_model_flows(this, icbcfl, icbcun)
@ brief Save model flows for package
subroutine allocate_scalars(this)
@ brief Allocate scalars
subroutine allocate_arrays(this, nodes)
@ brief Allocate package arrays
subroutine sto_ad(this)
@ brief Advance the package
character(len=lenbudtxt), dimension(2) budtxt
subroutine source_options(this)
@ brief Source input options for package
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.
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.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
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.
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
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
This module contains the time-varying storage package methods.
subroutine, public tvs_cr(tvs, name_model, mempath, inunit, iout)
Create a new TvsType object.
Derived type for the Budget object.
This class is used to store a single deferred-length character string. It was designed to work in an ...