31 character(len=LENBUDTXT),
dimension(NBDITEMS) ::
budtxt
32 data budtxt/
' STORAGE-AQUEOUS',
' DECAY-AQUEOUS', &
33 ' STORAGE-SORBED',
' DECAY-SORBED'/
52 real(dp),
dimension(:),
pointer,
contiguous :: porosity => null()
53 real(dp),
dimension(:),
pointer,
contiguous :: thetam => null()
54 real(dp),
dimension(:),
pointer,
contiguous :: volfracim => null()
55 real(dp),
dimension(:),
pointer,
contiguous :: ratesto => null()
58 integer(I4B),
pointer :: idcy => null()
59 real(dp),
dimension(:),
pointer,
contiguous :: decay => null()
60 real(dp),
dimension(:),
pointer,
contiguous :: decay_sorbed => null()
61 real(dp),
dimension(:),
pointer,
contiguous :: ratedcy => null()
62 real(dp),
dimension(:),
pointer,
contiguous :: decaylast => null()
63 real(dp),
dimension(:),
pointer,
contiguous :: decayslast => null()
66 integer(I4B),
pointer :: isrb => null()
67 integer(I4B),
pointer :: ioutsorbate => null()
68 real(dp),
dimension(:),
pointer,
contiguous :: bulk_density => null()
69 real(dp),
dimension(:),
pointer,
contiguous :: distcoef => null()
70 real(dp),
dimension(:),
pointer,
contiguous :: sp2 => null()
71 real(dp),
dimension(:),
pointer,
contiguous :: ratesrb => null()
72 real(dp),
dimension(:),
pointer,
contiguous :: ratedcys => null()
73 real(dp),
dimension(:),
pointer,
contiguous :: csrb => null()
76 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound => null()
114 subroutine mst_cr(mstobj, name_model, input_mempath, inunit, iout, fmi)
117 character(len=*),
intent(in) :: name_model
118 character(len=*),
intent(in) :: input_mempath
119 integer(I4B),
intent(in) :: inunit
120 integer(I4B),
intent(in) :: iout
127 call mstobj%set_names(1, name_model,
'MST',
'MST', input_mempath)
130 call mstobj%allocate_scalars()
133 mstobj%inunit = inunit
147 integer(I4B),
dimension(:),
pointer,
contiguous :: ibound
150 character(len=*),
parameter :: fmtmst = &
151 "(1x,/1x,'MST -- MOBILE STORAGE AND TRANSFER PACKAGE, VERSION 1, &
152 &7/29/2020 INPUT READ FROM MEMPATH: ', A, //)"
155 write (this%iout, fmtmst) this%input_mempath
158 call this%source_options()
162 this%ibound => ibound
165 call this%allocate_arrays(dis%nodes)
168 call this%source_data()
178 subroutine mst_fc(this, nodes, cold, nja, matrix_sln, idxglo, cnew, &
183 integer,
intent(in) :: nodes
184 real(DP),
intent(in),
dimension(nodes) :: cold
185 integer(I4B),
intent(in) :: nja
187 integer(I4B),
intent(in),
dimension(nja) :: idxglo
188 real(DP),
intent(inout),
dimension(nodes) :: rhs
189 real(DP),
intent(in),
dimension(nodes) :: cnew
190 integer(I4B),
intent(in) :: kiter
193 call this%mst_fc_sto(nodes, cold, nja, matrix_sln, idxglo, rhs)
197 call this%mst_fc_dcy(nodes, cold, cnew, nja, matrix_sln, idxglo, &
203 call this%mst_fc_srb(nodes, cold, nja, matrix_sln, idxglo, rhs, cnew)
208 call this%mst_fc_dcy_srb(nodes, cold, nja, matrix_sln, idxglo, rhs, &
217 subroutine mst_fc_sto(this, nodes, cold, nja, matrix_sln, idxglo, rhs)
222 integer,
intent(in) :: nodes
223 real(DP),
intent(in),
dimension(nodes) :: cold
224 integer(I4B),
intent(in) :: nja
226 integer(I4B),
intent(in),
dimension(nja) :: idxglo
227 real(DP),
intent(inout),
dimension(nodes) :: rhs
229 integer(I4B) :: n, idiag
231 real(DP) :: hhcof, rrhs
232 real(DP) :: vnew, vold
238 do n = 1, this%dis%nodes
241 if (this%ibound(n) <= 0) cycle
244 vnew = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n)) * &
245 this%fmi%gwfsat(n) * this%thetam(n)
247 if (this%fmi%igwfstrgss /= 0) vold = vold + this%fmi%gwfstrgss(n) *
delt
248 if (this%fmi%igwfstrgsy /= 0) vold = vold + this%fmi%gwfstrgsy(n) *
delt
252 rrhs = -vold * tled * cold(n)
253 idiag = this%dis%con%ia(n)
254 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
255 rhs(n) = rhs(n) + rrhs
263 subroutine mst_fc_dcy(this, nodes, cold, cnew, nja, matrix_sln, &
269 integer,
intent(in) :: nodes
270 real(DP),
intent(in),
dimension(nodes) :: cold
271 real(DP),
intent(in),
dimension(nodes) :: cnew
272 integer(I4B),
intent(in) :: nja
274 integer(I4B),
intent(in),
dimension(nja) :: idxglo
275 real(DP),
intent(inout),
dimension(nodes) :: rhs
276 integer(I4B),
intent(in) :: kiter
278 integer(I4B) :: n, idiag
279 real(DP) :: hhcof, rrhs
282 real(DP) :: decay_rate
285 do n = 1, this%dis%nodes
288 if (this%ibound(n) <= 0) cycle
291 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
292 swtpdt = this%fmi%gwfsat(n)
295 idiag = this%dis%con%ia(n)
296 select case (this%idcy)
301 if (cnew(n) >
dzero)
then
302 hhcof = -this%decay(n) * vcell * swtpdt * this%thetam(n)
303 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
310 kiter, cold(n), cnew(n),
delt)
311 this%decaylast(n) = decay_rate
312 rrhs = decay_rate * vcell * swtpdt * this%thetam(n)
313 rhs(n) = rhs(n) + rrhs
323 subroutine mst_fc_srb(this, nodes, cold, nja, matrix_sln, idxglo, rhs, &
329 integer,
intent(in) :: nodes
330 real(DP),
intent(in),
dimension(nodes) :: cold
331 integer(I4B),
intent(in) :: nja
333 integer(I4B),
intent(in),
dimension(nja) :: idxglo
334 real(DP),
intent(inout),
dimension(nodes) :: rhs
335 real(DP),
intent(in),
dimension(nodes) :: cnew
337 integer(I4B) :: n, idiag
339 real(DP) :: hhcof, rrhs
343 real(DP) :: sat_new, sat_old
349 do n = 1, this%dis%nodes
352 if (this%ibound(n) <= 0) cycle
355 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
356 volfracm = this%get_volfracm(n)
357 rhobm = this%bulk_density(n)
358 sat_new = this%fmi%gwfsat(n)
359 sat_old = this%fmi%gwfsatold(n,
delt)
362 hhcof = -volfracm * rhobm * sat_new * this%isotherm%derivative(cnew, n) &
364 idiag = this%dis%con%ia(n)
365 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
368 rrhs = -volfracm * rhobm * sat_new * this%isotherm%derivative(cnew, n) &
369 * cnew(n) * vcell * tled
370 rhs(n) = rhs(n) + rrhs
372 rrhs = volfracm * rhobm * sat_new * this%isotherm%value(cnew, n) * &
374 rhs(n) = rhs(n) + rrhs
377 rrhs = -volfracm * rhobm * sat_old * this%isotherm%value(cold, n) * &
379 rhs(n) = rhs(n) + rrhs
394 integer,
intent(in) :: nodes
395 real(DP),
intent(in),
dimension(nodes) :: cold
396 integer(I4B),
intent(in) :: nja
398 integer(I4B),
intent(in),
dimension(nja) :: idxglo
399 real(DP),
intent(inout),
dimension(nodes) :: rhs
400 real(DP),
intent(in),
dimension(nodes) :: cnew
401 integer(I4B),
intent(in) :: kiter
403 integer(I4B) :: n, idiag
404 real(DP) :: hhcof, rrhs
412 real(DP) :: decay_rate
417 do n = 1, this%dis%nodes
420 if (this%ibound(n) <= 0) cycle
425 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
426 swnew = this%fmi%gwfsat(n)
427 distcoef = this%distcoef(n)
428 idiag = this%dis%con%ia(n)
429 volfracm = this%get_volfracm(n)
430 rhobm = this%bulk_density(n)
431 term = this%decay_sorbed(n) * volfracm * rhobm * swnew * vcell
434 select case (this%idcy)
436 select case (this%isrb)
441 if (cnew(n) >
dzero)
then
442 hhcof = -term * distcoef
447 csrb = this%isotherm%value(cnew, n)
452 csrb = this%isotherm%value(cnew, n)
459 if (distcoef >
dzero)
then
460 csrbold = this%isotherm%value(cold, n)
461 csrbnew = this%isotherm%value(cnew, n)
464 this%decayslast(n), &
465 kiter, csrbold, csrbnew,
delt)
466 this%decayslast(n) = decay_rate
467 rrhs = decay_rate * volfracm * rhobm * swnew * vcell
472 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
473 rhs(n) = rhs(n) + rrhs
482 subroutine mst_cq(this, nodes, cnew, cold, flowja)
485 integer(I4B),
intent(in) :: nodes
486 real(DP),
intent(in),
dimension(nodes) :: cnew
487 real(DP),
intent(in),
dimension(nodes) :: cold
488 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
491 call this%mst_cq_sto(nodes, cnew, cold, flowja)
495 call this%mst_cq_dcy(nodes, cnew, cold, flowja)
500 call this%mst_cq_srb(nodes, cnew, cold, flowja)
505 call this%mst_cq_dcy_srb(nodes, cnew, cold, flowja)
510 call this%mst_calc_csrb(cnew)
523 integer(I4B),
intent(in) :: nodes
524 real(DP),
intent(in),
dimension(nodes) :: cnew
525 real(DP),
intent(in),
dimension(nodes) :: cold
526 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
529 integer(I4B) :: idiag
532 real(DP) :: vnew, vold
533 real(DP) :: hhcof, rrhs
540 this%ratesto(n) =
dzero
543 if (this%ibound(n) <= 0) cycle
546 vnew = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n)) * &
547 this%fmi%gwfsat(n) * this%thetam(n)
549 if (this%fmi%igwfstrgss /= 0) vold = vold + this%fmi%gwfstrgss(n) *
delt
550 if (this%fmi%igwfstrgsy /= 0) vold = vold + this%fmi%gwfstrgsy(n) *
delt
554 rrhs = -vold * tled * cold(n)
555 rate = hhcof * cnew(n) - rrhs
556 this%ratesto(n) = rate
557 idiag = this%dis%con%ia(n)
558 flowja(idiag) = flowja(idiag) + rate
571 integer(I4B),
intent(in) :: nodes
572 real(DP),
intent(in),
dimension(nodes) :: cnew
573 real(DP),
intent(in),
dimension(nodes) :: cold
574 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
577 integer(I4B) :: idiag
580 real(DP) :: hhcof, rrhs
582 real(DP) :: decay_rate
590 this%ratedcy(n) =
dzero
591 if (this%ibound(n) <= 0) cycle
594 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
595 swtpdt = this%fmi%gwfsat(n)
602 if (cnew(n) >
dzero)
then
603 hhcof = -this%decay(n) * vcell * swtpdt * this%thetam(n)
607 0, cold(n), cnew(n),
delt)
608 rrhs = decay_rate * vcell * swtpdt * this%thetam(n)
610 rate = hhcof * cnew(n) - rrhs
611 this%ratedcy(n) = rate
612 idiag = this%dis%con%ia(n)
613 flowja(idiag) = flowja(idiag) + rate
627 integer(I4B),
intent(in) :: nodes
628 real(DP),
intent(in),
dimension(nodes) :: cnew
629 real(DP),
intent(in),
dimension(nodes) :: cold
630 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
633 integer(I4B) :: idiag
639 real(DP) :: sat_new, sat_old
640 real(DP) :: contribution
649 this%ratesrb(n) =
dzero
653 if (this%ibound(n) <= 0) cycle
656 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
658 rhobm = this%bulk_density(n)
659 volfracm = this%get_volfracm(n)
660 sat_new = this%fmi%gwfsat(n)
661 sat_old = this%fmi%gwfsatold(n,
delt)
664 contribution = -volfracm * rhobm * sat_new &
665 * this%isotherm%derivative(cnew, n) * cnew(n) * vcell * tled
666 rate = rate + contribution
670 contribution = -volfracm * rhobm * sat_new * &
671 this%isotherm%derivative(cnew, n) * cnew(n) * vcell * tled
672 rate = rate - contribution
674 contribution = volfracm * rhobm * sat_new * this%isotherm%value(cnew, n) &
676 rate = rate - contribution
679 contribution = -volfracm * rhobm * sat_old * this%isotherm%value(cold, n) &
681 rate = rate - contribution
683 this%ratesrb(n) = rate
684 idiag = this%dis%con%ia(n)
685 flowja(idiag) = flowja(idiag) + rate
699 integer(I4B),
intent(in) :: nodes
700 real(DP),
intent(in),
dimension(nodes) :: cnew
701 real(DP),
intent(in),
dimension(nodes) :: cold
702 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
705 integer(I4B) :: idiag
707 real(DP) :: hhcof, rrhs
717 real(DP) :: decay_rate
724 this%ratedcys(n) =
dzero
727 if (this%ibound(n) <= 0) cycle
732 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
733 swnew = this%fmi%gwfsat(n)
734 distcoef = this%distcoef(n)
735 volfracm = this%get_volfracm(n)
736 rhobm = this%bulk_density(n)
737 term = this%decay_sorbed(n) * volfracm * rhobm * swnew * vcell
740 select case (this%idcy)
744 select case (this%isrb)
749 if (cnew(n) >
dzero)
then
750 hhcof = -term * distcoef
755 csrb = this%isotherm%value(cnew, n)
760 csrb = this%isotherm%value(cnew, n)
767 if (distcoef >
dzero)
then
768 csrbold = this%isotherm%value(cold, n)
769 csrbnew = this%isotherm%value(cnew, n)
772 this%decayslast(n), &
773 0, csrbold, csrbnew,
delt)
774 rrhs = decay_rate * volfracm * rhobm * swnew * vcell
779 rate = hhcof * cnew(n) - rrhs
780 this%ratedcys(n) = rate
781 idiag = this%dis%con%ia(n)
782 flowja(idiag) = flowja(idiag) + rate
792 real(DP),
intent(in),
dimension(:) :: cnew
800 if (this%ibound(n) > 0 .and. this%isrb /=
sorption_off)
then
801 csrb = this%isotherm%value(cnew, n)
810 subroutine mst_bd(this, isuppress_output, model_budget)
816 integer(I4B),
intent(in) :: isuppress_output
817 type(
budgettype),
intent(inout) :: model_budget
824 call model_budget%addentry(rin, rout,
delt,
budtxt(1), &
825 isuppress_output, rowlabel=this%packName)
830 call model_budget%addentry(rin, rout,
delt,
budtxt(2), &
831 isuppress_output, rowlabel=this%packName)
837 call model_budget%addentry(rin, rout,
delt,
budtxt(3), &
838 isuppress_output, rowlabel=this%packName)
844 call model_budget%addentry(rin, rout,
delt,
budtxt(4), &
845 isuppress_output, rowlabel=this%packName)
856 integer(I4B),
intent(in) :: icbcfl
857 integer(I4B),
intent(in) :: icbcun
859 integer(I4B) :: ibinun
860 integer(I4B) :: iprint, nvaluesp, nwidthp
861 character(len=1) :: cdatafmp =
' ', editdesc =
' '
865 if (this%ipakcb < 0)
then
867 elseif (this%ipakcb == 0)
then
872 if (icbcfl == 0) ibinun = 0
875 if (ibinun /= 0)
then
880 call this%dis%record_array(this%ratesto, this%iout, iprint, -ibinun, &
881 budtxt(1), cdatafmp, nvaluesp, &
882 nwidthp, editdesc, dinact)
886 call this%dis%record_array(this%ratedcy, this%iout, iprint, -ibinun, &
887 budtxt(2), cdatafmp, nvaluesp, &
888 nwidthp, editdesc, dinact)
892 call this%dis%record_array(this%ratesrb, this%iout, iprint, -ibinun, &
893 budtxt(3), cdatafmp, nvaluesp, &
894 nwidthp, editdesc, dinact)
898 call this%dis%record_array(this%ratedcys, this%iout, iprint, -ibinun, &
899 budtxt(4), cdatafmp, nvaluesp, &
900 nwidthp, editdesc, dinact)
909 integer(I4B),
intent(in) :: idvsave
911 character(len=1) :: cdatafmp =
' ', editdesc =
' '
912 integer(I4B) :: ibinun
913 integer(I4B) :: iprint
914 integer(I4B) :: nvaluesp
915 integer(I4B) :: nwidthp
919 if (this%ioutsorbate /= 0)
then
924 if (idvsave == 0) ibinun = 0
927 if (ibinun /= 0)
then
930 if (this%ioutsorbate /= 0)
then
931 ibinun = this%ioutsorbate
932 call this%dis%record_array(this%csrb, this%iout, iprint, ibinun, &
933 ' SORBATE', cdatafmp, nvaluesp, &
934 nwidthp, editdesc, dinact)
951 if (this%inunit > 0)
then
970 this%ibound => null()
977 if (
associated(this%isotherm))
then
978 deallocate (this%isotherm)
979 nullify (this%isotherm)
983 call this%NumericalPackageType%da()
997 call this%NumericalPackageType%allocate_scalars()
1001 call mem_allocate(this%ioutsorbate,
'IOUTSORBATE', this%memoryPath)
1006 this%ioutsorbate = 0
1020 integer(I4B),
intent(in) :: nodes
1026 call mem_allocate(this%porosity, nodes,
'POROSITY', this%memoryPath)
1027 call mem_allocate(this%thetam, nodes,
'THETAM', this%memoryPath)
1028 call mem_allocate(this%volfracim, nodes,
'VOLFRACIM', this%memoryPath)
1029 call mem_allocate(this%ratesto, nodes,
'RATESTO', this%memoryPath)
1033 call mem_allocate(this%ratedcy, 1,
'RATEDCY', this%memoryPath)
1034 call mem_allocate(this%decay, 1,
'DECAY', this%memoryPath)
1035 call mem_allocate(this%decaylast, 1,
'DECAYLAST', this%memoryPath)
1037 call mem_allocate(this%ratedcy, this%dis%nodes,
'RATEDCY', this%memoryPath)
1038 call mem_allocate(this%decay, nodes,
'DECAY', this%memoryPath)
1039 call mem_allocate(this%decaylast, nodes,
'DECAYLAST', this%memoryPath)
1042 call mem_allocate(this%ratedcys, this%dis%nodes,
'RATEDCYS', &
1044 call mem_allocate(this%decayslast, this%dis%nodes,
'DECAYSLAST', &
1047 call mem_allocate(this%ratedcys, 1,
'RATEDCYS', this%memoryPath)
1048 call mem_allocate(this%decayslast, 1,
'DECAYSLAST', this%memoryPath)
1050 call mem_allocate(this%decay_sorbed, 1,
'DECAY_SORBED', &
1055 call mem_allocate(this%bulk_density, 1,
'BULK_DENSITY', this%memoryPath)
1057 call mem_allocate(this%distcoef, 1,
'DISTCOEF', this%memoryPath)
1058 call mem_allocate(this%ratesrb, 1,
'RATESRB', this%memoryPath)
1059 call mem_allocate(this%csrb, 1,
'CSRB', this%memoryPath)
1061 call mem_allocate(this%bulk_density, nodes,
'BULK_DENSITY', this%memoryPath)
1062 call mem_allocate(this%distcoef, nodes,
'DISTCOEF', this%memoryPath)
1063 call mem_allocate(this%ratesrb, nodes,
'RATESRB', this%memoryPath)
1064 call mem_allocate(this%csrb, nodes,
'CSRB', this%memoryPath)
1068 call mem_allocate(this%sp2, nodes,
'SP2', this%memoryPath)
1074 this%porosity(n) =
dzero
1075 this%thetam(n) =
dzero
1076 this%volfracim(n) =
dzero
1077 this%ratesto(n) =
dzero
1079 do n = 1,
size(this%decay)
1080 this%decay(n) =
dzero
1081 this%ratedcy(n) =
dzero
1082 this%decaylast(n) =
dzero
1084 do n = 1,
size(this%bulk_density)
1085 this%bulk_density(n) =
dzero
1086 this%distcoef(n) =
dzero
1087 this%ratesrb(n) =
dzero
1088 this%csrb(n) =
dzero
1090 do n = 1,
size(this%sp2)
1093 do n = 1,
size(this%ratedcys)
1094 this%ratedcys(n) =
dzero
1095 this%decayslast(n) =
dzero
1114 character(len=LENVARNAME),
dimension(3) :: sorption_method = &
1115 &[character(len=LENVARNAME) ::
'LINEAR',
'FREUNDLICH',
'LANGMUIR']
1116 character(len=linelength) :: fname
1119 call mem_set_value(this%ipakcb,
'SAVE_FLOWS', this%input_mempath, &
1121 call mem_set_value(this%idcy,
'ORDER1_DECAY', this%input_mempath, &
1123 call mem_set_value(this%idcy,
'ORDER0_DECAY', this%input_mempath, &
1125 call mem_set_value(this%isrb,
'SORPTION', this%input_mempath, &
1126 sorption_method, found%sorption)
1127 call mem_set_value(fname,
'SORBATEFILE', this%input_mempath, &
1131 if (found%save_flows) this%ipakcb = -1
1134 if (found%sorption)
then
1135 if (this%isrb == izero)
then
1136 call store_error(
'Unknown sorption type was specified. &
1137 &Sorption must be specified as LINEAR, &
1138 &FREUNDLICH, or LANGMUIR.')
1142 if (found%sorbatefile)
then
1144 call openfile(this%ioutsorbate, this%iout, fname,
'DATA(BINARY)', &
1149 if (this%iout > 0)
then
1150 call this%log_options(found, fname)
1160 character(len=*),
intent(in) :: sorbate_fname
1162 character(len=*),
parameter :: fmtisvflow = &
1163 "(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY FILE &
1164 &WHENEVER ICBCFL IS NOT ZERO.')"
1165 character(len=*),
parameter :: fmtlinear = &
1166 &
"(4x,'LINEAR SORPTION IS ACTIVE. ')"
1167 character(len=*),
parameter :: fmtfreundlich = &
1168 &
"(4x,'FREUNDLICH SORPTION IS ACTIVE. ')"
1169 character(len=*),
parameter :: fmtlangmuir = &
1170 &
"(4x,'LANGMUIR SORPTION IS ACTIVE. ')"
1171 character(len=*),
parameter :: fmtidcy1 = &
1172 &
"(4x,'FIRST-ORDER DECAY IS ACTIVE. ')"
1173 character(len=*),
parameter :: fmtidcy2 = &
1174 &
"(4x,'ZERO-ORDER DECAY IS ACTIVE. ')"
1175 character(len=*),
parameter :: fmtfileout = &
1176 "(4x,'MST ',1x,a,1x,' WILL BE SAVED TO FILE: ',a,/4x,&
1177 &'OPENED ON UNIT: ',I7)"
1179 write (this%iout,
'(1x,a)')
'PROCESSING MOBILE STORAGE AND TRANSFER OPTIONS'
1180 if (found%save_flows)
then
1181 write (this%iout, fmtisvflow)
1183 if (found%order1_decay)
then
1184 write (this%iout, fmtidcy1)
1186 if (found%order0_decay)
then
1187 write (this%iout, fmtidcy2)
1189 if (found%sorption)
then
1190 select case (this%isrb)
1192 write (this%iout, fmtlinear)
1194 write (this%iout, fmtfreundlich)
1196 write (this%iout, fmtlangmuir)
1199 if (found%sorbatefile)
then
1200 write (this%iout, fmtfileout) &
1201 'SORBATE', sorbate_fname, this%ioutsorbate
1203 write (this%iout,
'(1x,a)')
'END OF MOBILE STORAGE AND TRANSFER OPTIONS'
1218 character(len=LINELENGTH) :: errmsg
1220 integer(I4B) :: n, asize
1221 integer(I4B),
dimension(:),
pointer,
contiguous :: map
1225 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1229 call get_isize(
'BULK_DENSITY', this%input_mempath, asize)
1232 'BULK_DENSITY', this%memoryPath)
1233 call get_isize(
'DISTCOEF', this%input_mempath, asize)
1239 call get_isize(
'DECAY', this%input_mempath, asize)
1241 call mem_reallocate(this%decay, this%dis%nodes,
'DECAY', this%memoryPath)
1243 call get_isize(
'DECAY_SORBED', this%input_mempath, asize)
1246 'DECAY_SORBED', this%memoryPath)
1249 call get_isize(
'SP2', this%input_mempath, asize)
1251 call mem_reallocate(this%sp2, this%dis%nodes,
'SP2', this%memoryPath)
1255 call mem_set_value(this%porosity,
'POROSITY', this%input_mempath, map, &
1257 call mem_set_value(this%decay,
'DECAY', this%input_mempath, map, &
1259 call mem_set_value(this%decay_sorbed,
'DECAY_SORBED', this%input_mempath, &
1260 map, found%decay_sorbed)
1261 call mem_set_value(this%bulk_density,
'BULK_DENSITY', this%input_mempath, &
1262 map, found%bulk_density)
1263 call mem_set_value(this%distcoef,
'DISTCOEF', this%input_mempath, map, &
1265 call mem_set_value(this%sp2,
'SP2', this%input_mempath, map, &
1269 if (this%iout > 0)
then
1270 call this%log_data(found)
1274 if (.not. found%porosity)
then
1275 write (errmsg,
'(a)')
'POROSITY not specified in GRIDDATA block.'
1282 if (.not. found%bulk_density)
then
1283 write (errmsg,
'(a)')
'Sorption is active but BULK_DENSITY &
1284 ¬ specified. BULK_DENSITY must be specified in GRIDDATA block.'
1287 if (.not. found%distcoef)
then
1288 write (errmsg,
'(a)')
'Sorption is active but distribution &
1289 &coefficient not specified. DISTCOEF must be specified in &
1294 if (.not. found%sp2)
then
1295 write (errmsg,
'(a)')
'Freundlich or langmuir sorption is active &
1296 &but SP2 not specified. SP2 must be specified in &
1302 if (found%bulk_density)
then
1303 write (
warnmsg,
'(a)')
'Sorption is not active but &
1304 &BULK_DENSITY was specified. BULK_DENSITY will have no affect on &
1305 &simulation results.'
1307 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1309 if (found%distcoef)
then
1310 write (
warnmsg,
'(a)')
'Sorption is not active but &
1311 &distribution coefficient was specified. DISTCOEF will have &
1312 &no affect on simulation results.'
1314 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1317 write (
warnmsg,
'(a)')
'Sorption is not active but &
1318 &SP2 was specified. SP2 will have &
1319 &no affect on simulation results.'
1321 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1327 if (.not. found%decay)
then
1328 write (errmsg,
'(a)')
'First or zero order decay is &
1329 &active but the first rate coefficient is not specified. DECAY &
1330 &must be specified in GRIDDATA block.'
1333 if (.not. found%decay_sorbed)
then
1339 write (errmsg,
'(a)')
'DECAY_SORBED not provided in GRIDDATA &
1340 &block but decay and sorption are active. Specify DECAY_SORBED &
1341 &in GRIDDATA block.'
1346 if (found%decay)
then
1347 write (
warnmsg,
'(a)')
'First- or zero-order decay &
1348 &is not active but decay was specified. DECAY will &
1349 &have no affect on simulation results.'
1351 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1353 if (found%decay_sorbed)
then
1354 write (
warnmsg,
'(a)')
'First- or zero-order decay &
1355 &is not active but DECAY_SORBED was specified. &
1356 &DECAY_SORBED will have no affect on simulation results.'
1358 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1368 do n = 1,
size(this%porosity)
1369 this%thetam(n) = this%porosity(n)
1380 write (this%iout,
'(1x,a)')
'PROCESSING GRIDDATA'
1381 if (found%porosity)
then
1382 write (this%iout,
'(4x,a)')
'MOBILE DOMAIN POROSITY set from input file'
1384 if (found%decay)
then
1385 write (this%iout,
'(4x,a)')
'DECAY RATE set from input file'
1387 if (found%decay_sorbed)
then
1388 write (this%iout,
'(4x,a)')
'DECAY SORBED RATE set from input file'
1390 if (found%bulk_density)
then
1391 write (this%iout,
'(4x,a)')
'BULK DENSITY set from input file'
1393 if (found%distcoef)
then
1394 write (this%iout,
'(4x,a)')
'DISTRIBUTION COEFFICIENT set from input file'
1397 write (this%iout,
'(4x,a)')
'SECOND SORPTION PARAM set from input file'
1399 write (this%iout,
'(1x,a)')
'END PROCESSING GRIDDATA'
1410 real(DP),
dimension(:),
intent(in) :: volfracim
1415 do n = 1, this%dis%nodes
1416 this%volfracim(n) = this%volfracim(n) + volfracim(n)
1421 do n = 1, this%dis%nodes
1422 this%thetam(n) = this%get_volfracm(n) * this%porosity(n)
1433 integer(I4B),
intent(in) :: node
1435 real(dp) :: volfracm
1437 volfracm =
done - this%volfracim(node)
1449 cold, cnew, delt)
result(decay_rate)
1451 real(dp),
intent(in) :: decay_rate_usr
1452 real(dp),
intent(in) :: decay_rate_last
1453 integer(I4B),
intent(in) :: kiter
1454 real(dp),
intent(in) :: cold
1455 real(dp),
intent(in) :: cnew
1456 real(dp),
intent(in) :: delt
1458 real(dp) :: decay_rate
1461 if (decay_rate_usr <
dzero)
then
1464 decay_rate = decay_rate_usr
1470 if (kiter == 1)
then
1471 decay_rate = min(decay_rate_usr, cold / delt)
1473 decay_rate = decay_rate_last
1474 if (cnew <
dzero)
then
1475 decay_rate = decay_rate_last + cnew / delt
1476 else if (cnew > cold)
then
1477 decay_rate = decay_rate_last + cnew / delt
1479 decay_rate = min(decay_rate_usr, decay_rate)
1481 decay_rate = max(decay_rate,
dzero)
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
@ mnormal
normal output mode
real(dp), parameter dhnoflo
real no flow constant
integer(i4b), parameter lenvarname
maximum length of a variable name
real(dp), parameter dhalf
real constant 1/2
integer(i4b), parameter izero
integer constant zero
real(dp), parameter dzero
real constant zero
integer(i4b), parameter maxcharlen
maximum length of char string
real(dp), parameter dtwo
real constant 2
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
real(dp), parameter done
real constant 1
– @ brief Mobile Storage and Transfer (MST) Module
subroutine mst_cq_srb(this, nodes, cnew, cold, flowja)
@ brief Calculate sorption terms for package
subroutine mst_calc_csrb(this, cnew)
@ brief Calculate sorbed concentration
subroutine addto_volfracim(this, volfracim)
@ brief Add volfrac values to volfracim
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
character(len=lenbudtxt), dimension(nbditems) budtxt
subroutine mst_cq(this, nodes, cnew, cold, flowja)
@ brief Calculate flows for package
@ decay_zero_order
Zeroth-order decay.
@ decay_first_order
First-order decay.
@ decay_off
Decay (or production) of mass inactive (default)
subroutine mst_bd(this, isuppress_output, model_budget)
@ brief Calculate budget terms for package
subroutine allocate_arrays(this, nodes)
@ brief Allocate arrays for package
subroutine mst_cq_dcy_srb(this, nodes, cnew, cold, flowja)
@ brief Calculate decay-sorption terms for package
subroutine, public mst_cr(mstobj, name_model, input_mempath, inunit, iout, fmi)
@ brief Create a new package object
real(dp) function get_volfracm(this, node)
@ brief Return mobile domain volume fraction
subroutine mst_ot_dv(this, idvsave)
Save sorbate concentration array to binary file.
subroutine mst_ot_flow(this, icbcfl, icbcun)
@ brief Output flow terms for package
subroutine mst_ar(this, dis, ibound)
@ brief Allocate and read method for package
subroutine mst_fc_srb(this, nodes, cold, nja, matrix_sln, idxglo, rhs, cnew)
@ brief Fill sorption coefficient method for package
subroutine mst_cq_dcy(this, nodes, cnew, cold, flowja)
@ brief Calculate decay terms for package
subroutine allocate_scalars(this)
@ brief Allocate scalar variables for package
subroutine log_options(this, found, sorbate_fname)
Log user options to list file.
subroutine source_options(this)
@ brief Source options for package
subroutine mst_fc_dcy_srb(this, nodes, cold, nja, matrix_sln, idxglo, rhs, cnew, kiter)
@ brief Fill sorption-decay coefficient method for package
subroutine source_data(this)
@ brief Source data for package
subroutine log_data(this, found)
Log user data to list file.
subroutine mst_da(this)
@ brief Deallocate
subroutine mst_fc_dcy(this, nodes, cold, cnew, nja, matrix_sln, idxglo, rhs, kiter)
@ brief Fill decay coefficient method for package
integer(i4b), parameter nbditems
subroutine mst_fc(this, nodes, cold, nja, matrix_sln, idxglo, cnew, rhs, kiter)
@ brief Fill coefficient method for package
subroutine mst_fc_sto(this, nodes, cold, nja, matrix_sln, idxglo, rhs)
@ brief Fill storage coefficient method for package
subroutine mst_cq_sto(this, nodes, cnew, cold, flowja)
@ brief Calculate storage terms for package
class(isothermtype) function, pointer, public create_isotherm(isotherm_type, distcoef, sp2)
Create an isotherm object based on type and parameters.
This module defines variable data types.
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_warning(msg, substring)
Store warning message.
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
character(len=maxcharlen) warnmsg
warning message string
real(dp), pointer, public delt
length of the current time step
Derived type for the Budget object.
@ brief Mobile storage and transfer