28 character(len=LENBUDTXT),
dimension(2) ::
budtxt = & !< text labels for budget terms
29 &[
' STO-SS',
' STO-SY']
32 integer(I4B),
pointer :: istor_coef => null()
33 integer(I4B),
pointer :: iconf_ss => null()
34 integer(I4B),
pointer :: iorig_ss => null()
35 integer(I4B),
pointer :: iss => null()
36 integer(I4B),
pointer :: iusesy => null()
37 integer(I4B),
dimension(:),
pointer,
contiguous :: iconvert => null()
38 real(dp),
dimension(:),
pointer,
contiguous :: ss => null()
39 real(dp),
dimension(:),
pointer,
contiguous :: sy => null()
40 real(dp),
dimension(:),
pointer,
contiguous :: strgss => null()
41 real(dp),
dimension(:),
pointer,
contiguous :: strgsy => null()
42 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
43 real(dp),
pointer :: satomega => null()
44 integer(I4B),
pointer :: integratechanges => null()
45 integer(I4B),
pointer :: intvs => null()
47 real(dp),
dimension(:),
pointer,
contiguous,
private :: oldss => null()
48 real(dp),
dimension(:),
pointer,
contiguous,
private :: oldsy => null()
49 integer(I4B),
pointer :: iper => null()
50 character(len=:),
pointer :: storage
77 subroutine sto_cr(stoobj, name_model, mempath, inunit, iout)
80 character(len=*),
intent(in) :: name_model
81 character(len=*),
intent(in) :: mempath
82 integer(I4B),
intent(in) :: inunit
83 integer(I4B),
intent(in) :: iout
89 call stoobj%set_names(1, name_model,
'STO',
'STO', mempath)
92 call stoobj%allocate_scalars()
95 stoobj%inunit = inunit
111 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
114 character(len=*),
parameter :: fmtsto = &
115 "(1x,/1x,'STO -- STORAGE PACKAGE, VERSION 1, 5/19/2014', &
116 &' INPUT READ FROM MEMPATH: ', A, //)"
119 write (this%iout, fmtsto) this%input_mempath
123 this%ibound => ibound
129 call this%allocate_arrays(dis%nodes)
135 call this%source_options()
138 call this%source_data()
141 if (this%intvs /= 0)
then
142 call this%tvs%ar(this%dis)
158 character(len=16) :: css(0:1)
160 data css(0)/
' TRANSIENT'/
161 data css(1)/
' STEADY-STATE'/
164 if (this%integratechanges /= 0)
then
165 call this%save_old_ss_sy()
169 if (this%inunit <= 0)
return
172 if (this%iper /=
kper)
return
174 write (this%iout,
'(//,1x,a)')
'PROCESSING STORAGE PERIOD DATA'
177 if (this%storage ==
'STEADY-STATE')
then
179 else if (this%storage ==
'TRANSIENT')
then
182 write (
errmsg,
'(a,a)')
'Unknown STORAGE data tag: ', &
188 write (this%iout,
'(1x,a)')
'END PROCESSING STORAGE PERIOD DATA'
190 write (this%iout,
'(//1X,A,I0,A,A,/)') &
191 'STRESS PERIOD ',
kper,
' IS ', trim(adjustl(css(this%iss)))
194 if (this%intvs /= 0)
then
211 if (this%integratechanges /= 0 .and.
kstp > 1)
then
212 call this%save_old_ss_sy()
216 if (this%intvs /= 0)
then
226 subroutine sto_fc(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
231 integer(I4B),
intent(in) :: kiter
232 real(DP),
intent(in),
dimension(:) :: hold
233 real(DP),
intent(in),
dimension(:) :: hnew
235 integer(I4B),
intent(in),
dimension(:) :: idxglo
236 real(DP),
intent(inout),
dimension(:) :: rhs
239 integer(I4B) :: idiag
256 character(len=*),
parameter :: fmtsperror = &
257 &
"('DETECTED TIME STEP LENGTH OF ZERO. GWF STORAGE PACKAGE CANNOT BE ', &
258 &'USED UNLESS DELT IS NON-ZERO.')"
261 if (this%iss /= 0)
return
265 write (
errmsg, fmtsperror)
273 do n = 1, this%dis%nodes
274 idiag = this%dis%con%ia(n)
275 if (this%ibound(n) < 1) cycle
282 if (this%iconvert(n) == 0)
then
291 sc1 =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
294 if (this%integratechanges /= 0)
then
298 sc1old =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), &
300 rho1old = sc1old * tled
308 call ssterms(this%iconvert(n), this%iorig_ss, this%iconf_ss, tp, bt, &
309 rho1, rho1old, snnew, snold, hnew(n), hold(n), &
313 call matrix_sln%add_value_pos(idxglo(idiag), aterm)
314 rhs(n) = rhs(n) + rhsterm
317 if (this%iconvert(n) /= 0)
then
321 sc2 =
sycapacity(this%dis%area(n), this%sy(n))
324 if (this%integratechanges /= 0)
then
328 sc2old =
sycapacity(this%dis%area(n), this%oldsy(n))
329 rho2old = sc2old * tled
337 call syterms(tp, bt, rho2, rho2old, snnew, snold, &
341 call matrix_sln%add_value_pos(idxglo(idiag), aterm)
342 rhs(n) = rhs(n) + rhsterm
353 subroutine sto_fn(this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
358 integer(I4B),
intent(in) :: kiter
359 real(DP),
intent(in),
dimension(:) :: hold
360 real(DP),
intent(in),
dimension(:) :: hnew
362 integer(I4B),
intent(in),
dimension(:) :: idxglo
363 real(DP),
intent(inout),
dimension(:) :: rhs
366 integer(I4B) :: idiag
382 if (this%iss /= 0)
return
388 do n = 1, this%dis%nodes
389 idiag = this%dis%con%ia(n)
390 if (this%ibound(n) <= 0) cycle
402 sc1 =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
403 sc2 =
sycapacity(this%dis%area(n), this%sy(n))
409 if (this%iconvert(n) /= 0)
then
415 if (this%iconf_ss == 0)
then
416 if (this%iorig_ss == 0)
then
417 drterm = -rho1 * derv * (h - bt) + rho1 * tthk * snnew * derv
419 drterm = -(rho1 * derv * h)
421 call matrix_sln%add_value_pos(idxglo(idiag), drterm)
422 rhs(n) = rhs(n) + drterm * h
428 if (snnew <
done)
then
430 if (snnew >
dzero)
then
431 rterm = -rho2 * tthk * snnew
432 drterm = -rho2 * tthk * derv
433 call matrix_sln%add_value_pos(idxglo(idiag), drterm + rho2)
434 rhs(n) = rhs(n) - rterm + drterm * h + rho2 * bt
447 subroutine sto_cq(this, flowja, hnew, hold)
452 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
453 real(DP),
dimension(:),
contiguous,
intent(in) :: hnew
454 real(DP),
dimension(:),
contiguous,
intent(in) :: hold
457 integer(I4B) :: idiag
476 do n = 1, this%dis%nodes
477 this%strgss(n) =
dzero
478 this%strgsy(n) =
dzero
482 if (this%iss == 0)
then
488 do n = 1, this%dis%nodes
489 if (this%ibound(n) <= 0) cycle
495 if (this%iconvert(n) == 0)
then
504 sc1 =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), this%ss(n))
507 if (this%integratechanges /= 0)
then
511 sc1old =
sscapacity(this%istor_coef, tp, bt, this%dis%area(n), &
513 rho1old = sc1old * tled
521 call ssterms(this%iconvert(n), this%iorig_ss, this%iconf_ss, tp, bt, &
522 rho1, rho1old, snnew, snold, hnew(n), hold(n), &
523 aterm, rhsterm, rate)
526 this%strgss(n) = rate
529 idiag = this%dis%con%ia(n)
530 flowja(idiag) = flowja(idiag) + rate
534 if (this%iconvert(n) /= 0)
then
537 sc2 =
sycapacity(this%dis%area(n), this%sy(n))
540 if (this%integratechanges /= 0)
then
544 sc2old =
sycapacity(this%dis%area(n), this%oldsy(n))
545 rho2old = sc2old * tled
553 call syterms(tp, bt, rho2, rho2old, snnew, snold, &
554 aterm, rhsterm, rate)
557 this%strgsy(n) = rate
560 idiag = this%dis%con%ia(n)
561 flowja(idiag) = flowja(idiag) + rate
572 subroutine sto_bd(this, isuppress_output, model_budget)
578 integer(I4B),
intent(in) :: isuppress_output
579 type(
budgettype),
intent(inout) :: model_budget
586 call model_budget%addentry(rin, rout,
delt,
budtxt(1), &
587 isuppress_output,
' STORAGE')
590 if (this%iusesy == 1)
then
592 call model_budget%addentry(rin, rout,
delt,
budtxt(2), &
593 isuppress_output,
' STORAGE')
605 integer(I4B),
intent(in) :: icbcfl
606 integer(I4B),
intent(in) :: icbcun
608 integer(I4B) :: ibinun
609 integer(I4B) :: iprint, nvaluesp, nwidthp
610 character(len=1) :: cdatafmp =
' ', editdesc =
' '
614 if (this%ipakcb < 0)
then
616 elseif (this%ipakcb == 0)
then
621 if (icbcfl == 0) ibinun = 0
624 if (ibinun /= 0)
then
629 call this%dis%record_array(this%strgss, this%iout, iprint, -ibinun, &
630 budtxt(1), cdatafmp, nvaluesp, &
631 nwidthp, editdesc, dinact)
634 if (this%iusesy == 1)
then
635 call this%dis%record_array(this%strgsy, this%iout, iprint, -ibinun, &
636 budtxt(2), cdatafmp, nvaluesp, &
637 nwidthp, editdesc, dinact)
654 if (this%intvs /= 0)
then
656 deallocate (this%tvs)
660 if (this%inunit > 0)
then
668 if (
associated(this%oldss))
then
671 if (
associated(this%oldsy))
then
677 nullify (this%storage)
690 call this%NumericalPackageType%da()
706 call this%NumericalPackageType%allocate_scalars()
709 call mem_allocate(this%istor_coef,
'ISTOR_COEF', this%memoryPath)
710 call mem_allocate(this%iconf_ss,
'ICONF_SS', this%memoryPath)
711 call mem_allocate(this%iorig_ss,
'IORIG_SS', this%memoryPath)
712 call mem_allocate(this%iusesy,
'IUSESY', this%memoryPath)
713 call mem_allocate(this%satomega,
'SATOMEGA', this%memoryPath)
714 call mem_allocate(this%integratechanges,
'INTEGRATECHANGES', &
723 this%satomega =
dzero
724 this%integratechanges = 0
738 integer(I4B),
intent(in) :: nodes
743 call mem_allocate(this%iconvert, nodes,
'ICONVERT', this%memoryPath)
744 call mem_allocate(this%ss, nodes,
'SS', this%memoryPath)
745 call mem_allocate(this%sy, nodes,
'SY', this%memoryPath)
746 call mem_allocate(this%strgss, nodes,
'STRGSS', this%memoryPath)
747 call mem_allocate(this%strgsy, nodes,
'STRGSY', this%memoryPath)
750 if (this%inunit > 0)
then
751 call mem_setptr(this%iper,
'IPER', this%input_mempath)
752 call mem_setptr(this%storage,
'STORAGE', this%input_mempath)
761 this%strgss(n) =
dzero
762 this%strgsy(n) =
dzero
763 if (this%integratechanges /= 0)
then
764 this%oldss(n) =
dzero
765 if (this%iusesy /= 0)
then
766 this%oldsy(n) =
dzero
787 character(len=LENMEMPATH) :: tvs6_mempath
788 character(len=LINELENGTH) :: fname
791 call mem_set_value(this%ipakcb,
'IPAKCB', this%input_mempath, found%ipakcb)
792 call mem_set_value(this%istor_coef,
'ISTOR_COEF', this%input_mempath, &
794 call mem_set_value(this%iconf_ss,
'SS_CONFINED_ONLY', this%input_mempath, &
795 found%ss_confined_only)
796 call mem_set_value(tvs6_mempath,
'TVS6_MEMPATH', this%input_mempath, &
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
812 if (
filein_fname(fname,
'TVS6_FILENAME', this%input_mempath, &
813 this%input_fname))
then
815 call openfile(this%intvs, this%iout, fname,
'TVS')
816 call tvs_cr(this%tvs, this%name_model, this%intvs, this%iout)
819 if (found%iconf_ss)
then
824 call this%log_options(found)
827 if (this%inewton > 0)
then
846 character(len=*),
parameter :: fmtisvflow = &
847 "(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY FILE &
848 &WHENEVER ICBCFL IS NOT ZERO.')"
849 character(len=*),
parameter :: fmtflow = &
850 &
"(4x, 'FLOWS WILL BE SAVED TO FILE: ', a, /4x, 'OPENED ON UNIT: ', I7)"
851 character(len=*),
parameter :: fmtorigss = &
852 "(4X,'ORIGINAL_SPECIFIC_STORAGE OPTION:',/, &
853 &1X,'The original specific storage formulation will be used')"
854 character(len=*),
parameter :: fmtstoc = &
855 "(4X,'STORAGECOEFFICIENT OPTION:',/, &
856 &1X,'Read storage coefficient rather than specific storage')"
857 character(len=*),
parameter :: fmtconfss = &
858 "(4X,'SS_CONFINED_ONLY OPTION:',/, &
859 &1X,'Specific storage changes only occur under confined conditions')"
861 write (this%iout,
'(1x,a)')
'PROCESSING STORAGE OPTIONS'
863 if (found%ipakcb)
then
864 write (this%iout, fmtisvflow)
867 if (found%istor_coef)
then
868 write (this%iout, fmtstoc)
871 if (found%ss_confined_only)
then
872 write (this%iout, fmtconfss)
875 if (found%iorig_ss)
then
876 write (this%iout, fmtorigss)
879 if (found%iconf_ss)
then
880 write (this%iout, fmtconfss)
883 write (this%iout,
'(1x,a)')
'END OF STORAGE OPTIONS'
898 character(len=LINELENGTH) :: cellstr
899 logical(LGP) :: isconv
900 character(len=24),
dimension(4) :: aname
902 integer(I4B),
dimension(:),
pointer,
contiguous :: map
906 data aname(1)/
' ICONVERT'/
907 data aname(2)/
' SPECIFIC STORAGE'/
908 data aname(3)/
' SPECIFIC YIELD'/
912 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
915 call mem_set_value(this%iconvert,
'ICONVERT', this%input_mempath, map, &
917 call mem_set_value(this%ss,
'SS', this%input_mempath, map, found%ss)
918 call mem_set_value(this%sy,
'SY', this%input_mempath, map, found%sy)
921 if (found%iconvert)
then
923 do n = 1, this%dis%nodes
924 if (this%iconvert(n) /= 0)
then
931 write (
errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
932 trim(adjustl(aname(1))),
' not found.'
940 write (
errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
941 trim(adjustl(aname(2))),
' not found.'
950 write (
errmsg,
'(a, a, a)')
'Error in GRIDDATA block: ', &
951 trim(adjustl(aname(3))),
' not found.'
961 do n = 1, this%dis%nodes
962 if (this%ss(n) <
dzero)
then
963 call this%dis%noder_to_string(n, cellstr)
964 write (
errmsg,
'(a,2(1x,a),1x,g0,1x,a)') &
965 'Error in SS DATA: SS value in cell', trim(adjustl(cellstr)), &
966 'is less than zero (', this%ss(n),
').'
970 if (this%sy(n) <
dzero)
then
971 call this%dis%noder_to_string(n, cellstr)
972 write (
errmsg,
'(a,2(1x,a),1x,g0,1x,a)') &
973 'Error in SY DATA: SY value in cell', trim(adjustl(cellstr)), &
974 'is less than zero (', this%sy(n),
').'
996 if (.not.
associated(this%oldss))
then
997 call mem_allocate(this%oldss, this%dis%nodes,
'OLDSS', this%memoryPath)
999 if (this%iusesy == 1 .and. .not.
associated(this%oldsy))
then
1000 call mem_allocate(this%oldsy, this%dis%nodes,
'OLDSY', this%memoryPath)
1004 do n = 1, this%dis%nodes
1005 this%oldss(n) = this%ss(n)
1009 if (this%iusesy == 1)
then
1010 do n = 1, this%dis%nodes
1011 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
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, inunit, iout)
Create a new TvsType object.
Derived type for the Budget object.