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),
dimension(nodes) :: c_half
344 real(DP) :: cbar_derv_half
345 real(DP) :: cbar_new, cbar_half, cbar_old
346 real(DP) :: sat_new, sat_half, sat_old
350 c_half = 0.5_dp * (cold + cnew)
353 do n = 1, this%dis%nodes
356 if (this%ibound(n) <= 0) cycle
359 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
360 volfracm = this%get_volfracm(n)
361 rhobm = this%bulk_density(n)
362 sat_new = this%fmi%gwfsat(n)
363 sat_old = this%fmi%gwfsatold(n,
delt)
366 cbar_new = this%isotherm%value(cnew, n)
367 cbar_old = this%isotherm%value(cold, n)
368 cbar_half = 0.5 * (cbar_new + cbar_old)
370 sat_half = 0.5 * (sat_new + sat_old)
371 cbar_derv_half = this%isotherm%derivative(c_half, n)
373 hhcof = -volfracm * rhobm * cbar_derv_half * sat_half * vcell * tled
374 idiag = this%dis%con%ia(n)
375 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
377 rrhs = -volfracm * rhobm * cbar_derv_half * sat_half * cold(n) &
379 rhs(n) = rhs(n) + rrhs
381 rrhs = volfracm * rhobm * cbar_half * (sat_new - sat_old) * vcell * tled
382 rhs(n) = rhs(n) + rrhs
397 integer,
intent(in) :: nodes
398 real(DP),
intent(in),
dimension(nodes) :: cold
399 integer(I4B),
intent(in) :: nja
401 integer(I4B),
intent(in),
dimension(nja) :: idxglo
402 real(DP),
intent(inout),
dimension(nodes) :: rhs
403 real(DP),
intent(in),
dimension(nodes) :: cnew
404 integer(I4B),
intent(in) :: kiter
406 integer(I4B) :: n, idiag
407 real(DP) :: hhcof, rrhs
415 real(DP) :: decay_rate
420 do n = 1, this%dis%nodes
423 if (this%ibound(n) <= 0) cycle
428 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
429 swnew = this%fmi%gwfsat(n)
430 distcoef = this%distcoef(n)
431 idiag = this%dis%con%ia(n)
432 volfracm = this%get_volfracm(n)
433 rhobm = this%bulk_density(n)
434 term = this%decay_sorbed(n) * volfracm * rhobm * swnew * vcell
437 select case (this%idcy)
439 select case (this%isrb)
444 if (cnew(n) >
dzero)
then
445 hhcof = -term * distcoef
450 csrb = this%isotherm%value(cnew, n)
455 csrb = this%isotherm%value(cnew, n)
462 if (distcoef >
dzero)
then
463 csrbold = this%isotherm%value(cold, n)
464 csrbnew = this%isotherm%value(cnew, n)
467 this%decayslast(n), &
468 kiter, csrbold, csrbnew,
delt)
469 this%decayslast(n) = decay_rate
470 rrhs = decay_rate * volfracm * rhobm * swnew * vcell
475 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
476 rhs(n) = rhs(n) + rrhs
485 subroutine mst_cq(this, nodes, cnew, cold, flowja)
488 integer(I4B),
intent(in) :: nodes
489 real(DP),
intent(in),
dimension(nodes) :: cnew
490 real(DP),
intent(in),
dimension(nodes) :: cold
491 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
494 call this%mst_cq_sto(nodes, cnew, cold, flowja)
498 call this%mst_cq_dcy(nodes, cnew, cold, flowja)
503 call this%mst_cq_srb(nodes, cnew, cold, flowja)
508 call this%mst_cq_dcy_srb(nodes, cnew, cold, flowja)
513 call this%mst_calc_csrb(cnew)
526 integer(I4B),
intent(in) :: nodes
527 real(DP),
intent(in),
dimension(nodes) :: cnew
528 real(DP),
intent(in),
dimension(nodes) :: cold
529 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
532 integer(I4B) :: idiag
535 real(DP) :: vnew, vold
536 real(DP) :: hhcof, rrhs
543 this%ratesto(n) =
dzero
546 if (this%ibound(n) <= 0) cycle
549 vnew = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n)) * &
550 this%fmi%gwfsat(n) * this%thetam(n)
552 if (this%fmi%igwfstrgss /= 0) vold = vold + this%fmi%gwfstrgss(n) *
delt
553 if (this%fmi%igwfstrgsy /= 0) vold = vold + this%fmi%gwfstrgsy(n) *
delt
557 rrhs = -vold * tled * cold(n)
558 rate = hhcof * cnew(n) - rrhs
559 this%ratesto(n) = rate
560 idiag = this%dis%con%ia(n)
561 flowja(idiag) = flowja(idiag) + rate
574 integer(I4B),
intent(in) :: nodes
575 real(DP),
intent(in),
dimension(nodes) :: cnew
576 real(DP),
intent(in),
dimension(nodes) :: cold
577 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
580 integer(I4B) :: idiag
583 real(DP) :: hhcof, rrhs
585 real(DP) :: decay_rate
593 this%ratedcy(n) =
dzero
594 if (this%ibound(n) <= 0) cycle
597 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
598 swtpdt = this%fmi%gwfsat(n)
605 if (cnew(n) >
dzero)
then
606 hhcof = -this%decay(n) * vcell * swtpdt * this%thetam(n)
610 0, cold(n), cnew(n),
delt)
611 rrhs = decay_rate * vcell * swtpdt * this%thetam(n)
613 rate = hhcof * cnew(n) - rrhs
614 this%ratedcy(n) = rate
615 idiag = this%dis%con%ia(n)
616 flowja(idiag) = flowja(idiag) + rate
630 integer(I4B),
intent(in) :: nodes
631 real(DP),
intent(in),
dimension(nodes) :: cnew
632 real(DP),
intent(in),
dimension(nodes) :: cold
633 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
636 integer(I4B) :: idiag
642 real(DP),
dimension(nodes) :: c_half
643 real(DP) :: cbar_derv_half
644 real(DP) :: cbar_new, cbar_half, cbar_old
645 real(DP) :: sat_new, sat_half, sat_old
649 c_half = 0.5_dp * (cold + cnew)
655 this%ratesrb(n) =
dzero
659 if (this%ibound(n) <= 0) cycle
662 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
664 rhobm = this%bulk_density(n)
665 volfracm = this%get_volfracm(n)
666 sat_new = this%fmi%gwfsat(n)
667 sat_old = this%fmi%gwfsatold(n,
delt)
670 cbar_new = this%isotherm%value(cnew, n)
671 cbar_old = this%isotherm%value(cold, n)
672 cbar_half = 0.5 * (cbar_new + cbar_old)
674 sat_half = 0.5 * (sat_new + sat_old)
675 cbar_derv_half = this%isotherm%derivative(c_half, n)
677 rate = -volfracm * rhobm * cbar_derv_half * sat_half * cnew(n) &
679 rate = rate + volfracm * rhobm * cbar_derv_half * sat_half * cold(n) &
681 rate = rate - volfracm * rhobm * cbar_half * (sat_new - sat_old) &
684 this%ratesrb(n) = rate
685 idiag = this%dis%con%ia(n)
686 flowja(idiag) = flowja(idiag) + rate
700 integer(I4B),
intent(in) :: nodes
701 real(DP),
intent(in),
dimension(nodes) :: cnew
702 real(DP),
intent(in),
dimension(nodes) :: cold
703 real(DP),
dimension(:),
contiguous,
intent(inout) :: flowja
706 integer(I4B) :: idiag
708 real(DP) :: hhcof, rrhs
718 real(DP) :: decay_rate
725 this%ratedcys(n) =
dzero
728 if (this%ibound(n) <= 0) cycle
733 vcell = this%dis%area(n) * (this%dis%top(n) - this%dis%bot(n))
734 swnew = this%fmi%gwfsat(n)
735 distcoef = this%distcoef(n)
736 volfracm = this%get_volfracm(n)
737 rhobm = this%bulk_density(n)
738 term = this%decay_sorbed(n) * volfracm * rhobm * swnew * vcell
741 select case (this%idcy)
745 select case (this%isrb)
750 if (cnew(n) >
dzero)
then
751 hhcof = -term * distcoef
756 csrb = this%isotherm%value(cnew, n)
761 csrb = this%isotherm%value(cnew, n)
768 if (distcoef >
dzero)
then
769 csrbold = this%isotherm%value(cold, n)
770 csrbnew = this%isotherm%value(cnew, n)
773 this%decayslast(n), &
774 0, csrbold, csrbnew,
delt)
775 rrhs = decay_rate * volfracm * rhobm * swnew * vcell
780 rate = hhcof * cnew(n) - rrhs
781 this%ratedcys(n) = rate
782 idiag = this%dis%con%ia(n)
783 flowja(idiag) = flowja(idiag) + rate
793 real(DP),
intent(in),
dimension(:) :: cnew
801 if (this%ibound(n) > 0 .and. this%isrb /=
sorption_off)
then
802 csrb = this%isotherm%value(cnew, n)
811 subroutine mst_bd(this, isuppress_output, model_budget)
817 integer(I4B),
intent(in) :: isuppress_output
818 type(
budgettype),
intent(inout) :: model_budget
825 call model_budget%addentry(rin, rout,
delt,
budtxt(1), &
826 isuppress_output, rowlabel=this%packName)
831 call model_budget%addentry(rin, rout,
delt,
budtxt(2), &
832 isuppress_output, rowlabel=this%packName)
838 call model_budget%addentry(rin, rout,
delt,
budtxt(3), &
839 isuppress_output, rowlabel=this%packName)
845 call model_budget%addentry(rin, rout,
delt,
budtxt(4), &
846 isuppress_output, rowlabel=this%packName)
857 integer(I4B),
intent(in) :: icbcfl
858 integer(I4B),
intent(in) :: icbcun
860 integer(I4B) :: ibinun
861 integer(I4B) :: iprint, nvaluesp, nwidthp
862 character(len=1) :: cdatafmp =
' ', editdesc =
' '
866 if (this%ipakcb < 0)
then
868 elseif (this%ipakcb == 0)
then
873 if (icbcfl == 0) ibinun = 0
876 if (ibinun /= 0)
then
881 call this%dis%record_array(this%ratesto, this%iout, iprint, -ibinun, &
882 budtxt(1), cdatafmp, nvaluesp, &
883 nwidthp, editdesc, dinact)
887 call this%dis%record_array(this%ratedcy, this%iout, iprint, -ibinun, &
888 budtxt(2), cdatafmp, nvaluesp, &
889 nwidthp, editdesc, dinact)
893 call this%dis%record_array(this%ratesrb, this%iout, iprint, -ibinun, &
894 budtxt(3), cdatafmp, nvaluesp, &
895 nwidthp, editdesc, dinact)
899 call this%dis%record_array(this%ratedcys, this%iout, iprint, -ibinun, &
900 budtxt(4), cdatafmp, nvaluesp, &
901 nwidthp, editdesc, dinact)
910 integer(I4B),
intent(in) :: idvsave
912 character(len=1) :: cdatafmp =
' ', editdesc =
' '
913 integer(I4B) :: ibinun
914 integer(I4B) :: iprint
915 integer(I4B) :: nvaluesp
916 integer(I4B) :: nwidthp
920 if (this%ioutsorbate /= 0)
then
925 if (idvsave == 0) ibinun = 0
928 if (ibinun /= 0)
then
931 if (this%ioutsorbate /= 0)
then
932 ibinun = this%ioutsorbate
933 call this%dis%record_array(this%csrb, this%iout, iprint, ibinun, &
934 ' SORBATE', cdatafmp, nvaluesp, &
935 nwidthp, editdesc, dinact)
952 if (this%inunit > 0)
then
971 this%ibound => null()
978 if (
associated(this%isotherm))
then
979 deallocate (this%isotherm)
980 nullify (this%isotherm)
984 call this%NumericalPackageType%da()
998 call this%NumericalPackageType%allocate_scalars()
1002 call mem_allocate(this%ioutsorbate,
'IOUTSORBATE', this%memoryPath)
1007 this%ioutsorbate = 0
1021 integer(I4B),
intent(in) :: nodes
1027 call mem_allocate(this%porosity, nodes,
'POROSITY', this%memoryPath)
1028 call mem_allocate(this%thetam, nodes,
'THETAM', this%memoryPath)
1029 call mem_allocate(this%volfracim, nodes,
'VOLFRACIM', this%memoryPath)
1030 call mem_allocate(this%ratesto, nodes,
'RATESTO', this%memoryPath)
1034 call mem_allocate(this%ratedcy, 1,
'RATEDCY', this%memoryPath)
1035 call mem_allocate(this%decay, 1,
'DECAY', this%memoryPath)
1036 call mem_allocate(this%decaylast, 1,
'DECAYLAST', this%memoryPath)
1038 call mem_allocate(this%ratedcy, this%dis%nodes,
'RATEDCY', this%memoryPath)
1039 call mem_allocate(this%decay, nodes,
'DECAY', this%memoryPath)
1040 call mem_allocate(this%decaylast, nodes,
'DECAYLAST', this%memoryPath)
1043 call mem_allocate(this%ratedcys, this%dis%nodes,
'RATEDCYS', &
1045 call mem_allocate(this%decayslast, this%dis%nodes,
'DECAYSLAST', &
1048 call mem_allocate(this%ratedcys, 1,
'RATEDCYS', this%memoryPath)
1049 call mem_allocate(this%decayslast, 1,
'DECAYSLAST', this%memoryPath)
1051 call mem_allocate(this%decay_sorbed, 1,
'DECAY_SORBED', &
1056 call mem_allocate(this%bulk_density, 1,
'BULK_DENSITY', this%memoryPath)
1058 call mem_allocate(this%distcoef, 1,
'DISTCOEF', this%memoryPath)
1059 call mem_allocate(this%ratesrb, 1,
'RATESRB', this%memoryPath)
1060 call mem_allocate(this%csrb, 1,
'CSRB', this%memoryPath)
1062 call mem_allocate(this%bulk_density, nodes,
'BULK_DENSITY', this%memoryPath)
1063 call mem_allocate(this%distcoef, nodes,
'DISTCOEF', this%memoryPath)
1064 call mem_allocate(this%ratesrb, nodes,
'RATESRB', this%memoryPath)
1065 call mem_allocate(this%csrb, nodes,
'CSRB', this%memoryPath)
1069 call mem_allocate(this%sp2, nodes,
'SP2', this%memoryPath)
1075 this%porosity(n) =
dzero
1076 this%thetam(n) =
dzero
1077 this%volfracim(n) =
dzero
1078 this%ratesto(n) =
dzero
1080 do n = 1,
size(this%decay)
1081 this%decay(n) =
dzero
1082 this%ratedcy(n) =
dzero
1083 this%decaylast(n) =
dzero
1085 do n = 1,
size(this%bulk_density)
1086 this%bulk_density(n) =
dzero
1087 this%distcoef(n) =
dzero
1088 this%ratesrb(n) =
dzero
1089 this%csrb(n) =
dzero
1091 do n = 1,
size(this%sp2)
1094 do n = 1,
size(this%ratedcys)
1095 this%ratedcys(n) =
dzero
1096 this%decayslast(n) =
dzero
1115 character(len=LENVARNAME),
dimension(3) :: sorption_method = &
1116 &[character(len=LENVARNAME) ::
'LINEAR',
'FREUNDLICH',
'LANGMUIR']
1117 character(len=linelength) :: fname
1120 call mem_set_value(this%ipakcb,
'SAVE_FLOWS', this%input_mempath, &
1122 call mem_set_value(this%idcy,
'ORDER1_DECAY', this%input_mempath, &
1124 call mem_set_value(this%idcy,
'ORDER0_DECAY', this%input_mempath, &
1126 call mem_set_value(this%isrb,
'SORPTION', this%input_mempath, &
1127 sorption_method, found%sorption)
1128 call mem_set_value(fname,
'SORBATEFILE', this%input_mempath, &
1132 if (found%save_flows) this%ipakcb = -1
1135 if (found%sorption)
then
1136 if (this%isrb == izero)
then
1137 call store_error(
'Unknown sorption type was specified. &
1138 &Sorption must be specified as LINEAR, &
1139 &FREUNDLICH, or LANGMUIR.')
1143 if (found%sorbatefile)
then
1145 call openfile(this%ioutsorbate, this%iout, fname,
'DATA(BINARY)', &
1150 if (this%iout > 0)
then
1151 call this%log_options(found, fname)
1161 character(len=*),
intent(in) :: sorbate_fname
1163 character(len=*),
parameter :: fmtisvflow = &
1164 "(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY FILE &
1165 &WHENEVER ICBCFL IS NOT ZERO.')"
1166 character(len=*),
parameter :: fmtlinear = &
1167 &
"(4x,'LINEAR SORPTION IS ACTIVE. ')"
1168 character(len=*),
parameter :: fmtfreundlich = &
1169 &
"(4x,'FREUNDLICH SORPTION IS ACTIVE. ')"
1170 character(len=*),
parameter :: fmtlangmuir = &
1171 &
"(4x,'LANGMUIR SORPTION IS ACTIVE. ')"
1172 character(len=*),
parameter :: fmtidcy1 = &
1173 &
"(4x,'FIRST-ORDER DECAY IS ACTIVE. ')"
1174 character(len=*),
parameter :: fmtidcy2 = &
1175 &
"(4x,'ZERO-ORDER DECAY IS ACTIVE. ')"
1176 character(len=*),
parameter :: fmtfileout = &
1177 "(4x,'MST ',1x,a,1x,' WILL BE SAVED TO FILE: ',a,/4x,&
1178 &'OPENED ON UNIT: ',I7)"
1180 write (this%iout,
'(1x,a)')
'PROCESSING MOBILE STORAGE AND TRANSFER OPTIONS'
1181 if (found%save_flows)
then
1182 write (this%iout, fmtisvflow)
1184 if (found%order1_decay)
then
1185 write (this%iout, fmtidcy1)
1187 if (found%order0_decay)
then
1188 write (this%iout, fmtidcy2)
1190 if (found%sorption)
then
1191 select case (this%isrb)
1193 write (this%iout, fmtlinear)
1195 write (this%iout, fmtfreundlich)
1197 write (this%iout, fmtlangmuir)
1200 if (found%sorbatefile)
then
1201 write (this%iout, fmtfileout) &
1202 'SORBATE', sorbate_fname, this%ioutsorbate
1204 write (this%iout,
'(1x,a)')
'END OF MOBILE STORAGE AND TRANSFER OPTIONS'
1219 character(len=LINELENGTH) :: errmsg
1221 integer(I4B) :: n, asize
1222 integer(I4B),
dimension(:),
pointer,
contiguous :: map
1226 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1230 call get_isize(
'BULK_DENSITY', this%input_mempath, asize)
1233 'BULK_DENSITY', this%memoryPath)
1234 call get_isize(
'DISTCOEF', this%input_mempath, asize)
1240 call get_isize(
'DECAY', this%input_mempath, asize)
1242 call mem_reallocate(this%decay, this%dis%nodes,
'DECAY', this%memoryPath)
1244 call get_isize(
'DECAY_SORBED', this%input_mempath, asize)
1247 'DECAY_SORBED', this%memoryPath)
1250 call get_isize(
'SP2', this%input_mempath, asize)
1252 call mem_reallocate(this%sp2, this%dis%nodes,
'SP2', this%memoryPath)
1256 call mem_set_value(this%porosity,
'POROSITY', this%input_mempath, map, &
1258 call mem_set_value(this%decay,
'DECAY', this%input_mempath, map, &
1260 call mem_set_value(this%decay_sorbed,
'DECAY_SORBED', this%input_mempath, &
1261 map, found%decay_sorbed)
1262 call mem_set_value(this%bulk_density,
'BULK_DENSITY', this%input_mempath, &
1263 map, found%bulk_density)
1264 call mem_set_value(this%distcoef,
'DISTCOEF', this%input_mempath, map, &
1266 call mem_set_value(this%sp2,
'SP2', this%input_mempath, map, &
1270 if (this%iout > 0)
then
1271 call this%log_data(found)
1275 if (.not. found%porosity)
then
1276 write (errmsg,
'(a)')
'POROSITY not specified in GRIDDATA block.'
1283 if (.not. found%bulk_density)
then
1284 write (errmsg,
'(a)')
'Sorption is active but BULK_DENSITY &
1285 ¬ specified. BULK_DENSITY must be specified in GRIDDATA block.'
1288 if (.not. found%distcoef)
then
1289 write (errmsg,
'(a)')
'Sorption is active but distribution &
1290 &coefficient not specified. DISTCOEF must be specified in &
1295 if (.not. found%sp2)
then
1296 write (errmsg,
'(a)')
'Freundlich or langmuir sorption is active &
1297 &but SP2 not specified. SP2 must be specified in &
1303 if (found%bulk_density)
then
1304 write (
warnmsg,
'(a)')
'Sorption is not active but &
1305 &BULK_DENSITY was specified. BULK_DENSITY will have no affect on &
1306 &simulation results.'
1308 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1310 if (found%distcoef)
then
1311 write (
warnmsg,
'(a)')
'Sorption is not active but &
1312 &distribution coefficient was specified. DISTCOEF will have &
1313 &no affect on simulation results.'
1315 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1318 write (
warnmsg,
'(a)')
'Sorption is not active but &
1319 &SP2 was specified. SP2 will have &
1320 &no affect on simulation results.'
1322 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1328 if (.not. found%decay)
then
1329 write (errmsg,
'(a)')
'First or zero order decay is &
1330 &active but the first rate coefficient is not specified. DECAY &
1331 &must be specified in GRIDDATA block.'
1334 if (.not. found%decay_sorbed)
then
1340 write (errmsg,
'(a)')
'DECAY_SORBED not provided in GRIDDATA &
1341 &block but decay and sorption are active. Specify DECAY_SORBED &
1342 &in GRIDDATA block.'
1347 if (found%decay)
then
1348 write (
warnmsg,
'(a)')
'First- or zero-order decay &
1349 &is not active but decay was specified. DECAY will &
1350 &have no affect on simulation results.'
1352 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1354 if (found%decay_sorbed)
then
1355 write (
warnmsg,
'(a)')
'First- or zero-order decay &
1356 &is not active but DECAY_SORBED was specified. &
1357 &DECAY_SORBED will have no affect on simulation results.'
1359 write (this%iout,
'(1x,a)')
'WARNING. '//
warnmsg
1369 do n = 1,
size(this%porosity)
1370 this%thetam(n) = this%porosity(n)
1381 write (this%iout,
'(1x,a)')
'PROCESSING GRIDDATA'
1382 if (found%porosity)
then
1383 write (this%iout,
'(4x,a)')
'MOBILE DOMAIN POROSITY set from input file'
1385 if (found%decay)
then
1386 write (this%iout,
'(4x,a)')
'DECAY RATE set from input file'
1388 if (found%decay_sorbed)
then
1389 write (this%iout,
'(4x,a)')
'DECAY SORBED RATE set from input file'
1391 if (found%bulk_density)
then
1392 write (this%iout,
'(4x,a)')
'BULK DENSITY set from input file'
1394 if (found%distcoef)
then
1395 write (this%iout,
'(4x,a)')
'DISTRIBUTION COEFFICIENT set from input file'
1398 write (this%iout,
'(4x,a)')
'SECOND SORPTION PARAM set from input file'
1400 write (this%iout,
'(1x,a)')
'END PROCESSING GRIDDATA'
1411 real(DP),
dimension(:),
intent(in) :: volfracim
1416 do n = 1, this%dis%nodes
1417 this%volfracim(n) = this%volfracim(n) + volfracim(n)
1422 do n = 1, this%dis%nodes
1423 this%thetam(n) = this%get_volfracm(n) * this%porosity(n)
1434 integer(I4B),
intent(in) :: node
1436 real(dp) :: volfracm
1438 volfracm =
done - this%volfracim(node)
1450 cold, cnew, delt)
result(decay_rate)
1452 real(dp),
intent(in) :: decay_rate_usr
1453 real(dp),
intent(in) :: decay_rate_last
1454 integer(I4B),
intent(in) :: kiter
1455 real(dp),
intent(in) :: cold
1456 real(dp),
intent(in) :: cnew
1457 real(dp),
intent(in) :: delt
1459 real(dp) :: decay_rate
1462 if (decay_rate_usr <
dzero)
then
1465 decay_rate = decay_rate_usr
1471 if (kiter == 1)
then
1472 decay_rate = min(decay_rate_usr, cold / delt)
1474 decay_rate = decay_rate_last
1475 if (cnew <
dzero)
then
1476 decay_rate = decay_rate_last + cnew / delt
1477 else if (cnew > cold)
then
1478 decay_rate = decay_rate_last + cnew / delt
1480 decay_rate = min(decay_rate_usr, decay_rate)
1482 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