MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwtmstmodule Module Reference

– More...

Data Types

type  gwtmsttype
 Mobile storage and transfer. More...

Enumerations

enum  { decay_off = 0 , decay_first_order = 1 , decay_zero_order = 2 }
 Enumerator that defines the decay options. More...

Functions/Subroutines

subroutine, public mst_cr (mstobj, name_model, input_mempath, inunit, iout, fmi)
 Create a new package object.
subroutine mst_ar (this, dis, ibound)
 Allocate and read method for package.
subroutine mst_fc (this, nodes, cold, nja, matrix_sln, idxglo, cnew, rhs, kiter)
 Fill coefficient method for package.
subroutine mst_fc_sto (this, nodes, cold, nja, matrix_sln, idxglo, rhs)
 Fill storage coefficient method for package.
subroutine mst_fc_dcy (this, nodes, cold, cnew, nja, matrix_sln, idxglo, rhs, kiter)
 Fill decay coefficient method for package.
subroutine mst_fc_srb (this, nodes, cold, nja, matrix_sln, idxglo, rhs, cnew)
 Fill sorption coefficient method for package.
subroutine mst_fc_dcy_srb (this, nodes, cold, nja, matrix_sln, idxglo, rhs, cnew, kiter)
 Fill sorption-decay coefficient method for package.
subroutine mst_cq (this, nodes, cnew, cold, flowja)
 Calculate flows for package.
subroutine mst_cq_sto (this, nodes, cnew, cold, flowja)
 Calculate storage terms for package.
subroutine mst_cq_dcy (this, nodes, cnew, cold, flowja)
 Calculate decay terms for package.
subroutine mst_cq_srb (this, nodes, cnew, cold, flowja)
 Calculate sorption terms for package.
subroutine mst_cq_dcy_srb (this, nodes, cnew, cold, flowja)
 Calculate decay-sorption terms for package.
subroutine mst_calc_csrb (this, cnew)
 Calculate sorbed concentration.
subroutine mst_bd (this, isuppress_output, model_budget)
 Calculate budget terms for package.
subroutine mst_ot_flow (this, icbcfl, icbcun)
 Output flow terms for package.
subroutine mst_ot_dv (this, idvsave)
 Save sorbate concentration array to binary file.
subroutine mst_da (this)
 Deallocate.
subroutine allocate_scalars (this)
 Allocate scalar variables for package.
subroutine allocate_arrays (this, nodes)
 Allocate arrays for package.
subroutine source_options (this)
 Source options for package.
subroutine log_options (this, found, sorbate_fname)
 Log user options to list file.
subroutine source_data (this)
 Source data for package.
subroutine log_data (this, found)
 Log user data to list file.
subroutine addto_volfracim (this, volfracim)
 Add volfrac values to volfracim.
real(dp) function get_volfracm (this, node)
 Return mobile domain volume fraction.
real(dp) function get_zero_order_decay (decay_rate_usr, decay_rate_last, kiter, cold, cnew, delt)
 Calculate zero-order decay rate and constrain if necessary.

Variables

integer(i4b), parameter nbditems = 4
character(len=lenbudtxt), dimension(nbditems) budtxt

Detailed Description

Mobile Storage and Transfer (MST) Module

The GwtMstModule contains the GwtMstType, which is the derived type responsible for adding the effects of

  1. Changes in dissolved solute mass
  2. Decay of dissolved solute mass
  3. Sorption
  4. Decay of sorbed solute mass

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
decay_off 

Decay (or production) of mass inactive (default).

decay_first_order 

First-order decay.

decay_zero_order 

Zeroth-order decay.

Definition at line 37 of file gwt-mst.f90.

Function/Subroutine Documentation

◆ addto_volfracim()

subroutine gwtmstmodule::addto_volfracim ( class(gwtmsttype) this,
real(dp), dimension(:), intent(in) volfracim )

Method to add immobile domain volume fracions, which are stored as a cumulative value in volfracim.

Parameters
thisGwtMstType object
[in]volfracimimmobile domain volume fraction that contributes to total immobile volume fraction

Definition at line 1405 of file gwt-mst.f90.

1406 ! -- dummy
1407 class(GwtMstType) :: this !< GwtMstType object
1408 real(DP), dimension(:), intent(in) :: volfracim !< immobile domain volume fraction that contributes to total immobile volume fraction
1409 ! -- local
1410 integer(I4B) :: n
1411 !
1412 ! -- Add to volfracim
1413 do n = 1, this%dis%nodes
1414 this%volfracim(n) = this%volfracim(n) + volfracim(n)
1415 end do
1416 !
1417 ! -- An immobile domain is adding a volume fraction, so update thetam
1418 ! accordingly.
1419 do n = 1, this%dis%nodes
1420 this%thetam(n) = this%get_volfracm(n) * this%porosity(n)
1421 end do

◆ allocate_arrays()

subroutine gwtmstmodule::allocate_arrays ( class(gwtmsttype) this,
integer(i4b), intent(in) nodes )

Method to allocate arrays for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes

Definition at line 1012 of file gwt-mst.f90.

1013 ! -- modules
1015 use constantsmodule, only: dzero
1016 ! -- dummy
1017 class(GwtMstType) :: this !< GwtMstType object
1018 integer(I4B), intent(in) :: nodes !< number of nodes
1019 ! -- local
1020 integer(I4B) :: n
1021 !
1022 ! -- Allocate
1023 ! -- sto
1024 call mem_allocate(this%porosity, nodes, 'POROSITY', this%memoryPath)
1025 call mem_allocate(this%thetam, nodes, 'THETAM', this%memoryPath)
1026 call mem_allocate(this%volfracim, nodes, 'VOLFRACIM', this%memoryPath)
1027 call mem_allocate(this%ratesto, nodes, 'RATESTO', this%memoryPath)
1028 !
1029 ! -- dcy
1030 if (this%idcy == decay_off) then
1031 call mem_allocate(this%ratedcy, 1, 'RATEDCY', this%memoryPath)
1032 call mem_allocate(this%decay, 1, 'DECAY', this%memoryPath)
1033 call mem_allocate(this%decaylast, 1, 'DECAYLAST', this%memoryPath)
1034 else
1035 call mem_allocate(this%ratedcy, this%dis%nodes, 'RATEDCY', this%memoryPath)
1036 call mem_allocate(this%decay, nodes, 'DECAY', this%memoryPath)
1037 call mem_allocate(this%decaylast, nodes, 'DECAYLAST', this%memoryPath)
1038 end if
1039 if (this%idcy /= decay_off .and. this%isrb /= sorption_off) then
1040 call mem_allocate(this%ratedcys, this%dis%nodes, 'RATEDCYS', &
1041 this%memoryPath)
1042 call mem_allocate(this%decayslast, this%dis%nodes, 'DECAYSLAST', &
1043 this%memoryPath)
1044 else
1045 call mem_allocate(this%ratedcys, 1, 'RATEDCYS', this%memoryPath)
1046 call mem_allocate(this%decayslast, 1, 'DECAYSLAST', this%memoryPath)
1047 end if
1048 call mem_allocate(this%decay_sorbed, 1, 'DECAY_SORBED', &
1049 this%memoryPath)
1050 !
1051 ! -- srb
1052 if (this%isrb == sorption_off) then
1053 call mem_allocate(this%bulk_density, 1, 'BULK_DENSITY', this%memoryPath)
1054 call mem_allocate(this%sp2, 1, 'SP2', this%memoryPath)
1055 call mem_allocate(this%distcoef, 1, 'DISTCOEF', this%memoryPath)
1056 call mem_allocate(this%ratesrb, 1, 'RATESRB', this%memoryPath)
1057 call mem_allocate(this%csrb, 1, 'CSRB', this%memoryPath)
1058 else
1059 call mem_allocate(this%bulk_density, nodes, 'BULK_DENSITY', this%memoryPath)
1060 call mem_allocate(this%distcoef, nodes, 'DISTCOEF', this%memoryPath)
1061 call mem_allocate(this%ratesrb, nodes, 'RATESRB', this%memoryPath)
1062 call mem_allocate(this%csrb, nodes, 'CSRB', this%memoryPath)
1063 if (this%isrb == sorption_linear) then
1064 call mem_allocate(this%sp2, 1, 'SP2', this%memoryPath)
1065 else
1066 call mem_allocate(this%sp2, nodes, 'SP2', this%memoryPath)
1067 end if
1068 end if
1069 !
1070 ! -- Initialize
1071 do n = 1, nodes
1072 this%porosity(n) = dzero
1073 this%thetam(n) = dzero
1074 this%volfracim(n) = dzero
1075 this%ratesto(n) = dzero
1076 end do
1077 do n = 1, size(this%decay)
1078 this%decay(n) = dzero
1079 this%ratedcy(n) = dzero
1080 this%decaylast(n) = dzero
1081 end do
1082 do n = 1, size(this%bulk_density)
1083 this%bulk_density(n) = dzero
1084 this%distcoef(n) = dzero
1085 this%ratesrb(n) = dzero
1086 this%csrb(n) = dzero
1087 end do
1088 do n = 1, size(this%sp2)
1089 this%sp2(n) = dzero
1090 end do
1091 do n = 1, size(this%ratedcys)
1092 this%ratedcys(n) = dzero
1093 this%decayslast(n) = dzero
1094 end do
This module contains simulation constants.
Definition Constants.f90:9
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65

◆ allocate_scalars()

subroutine gwtmstmodule::allocate_scalars ( class(gwtmsttype) this)

Method to allocate scalar variables for the package.

Parameters
thisGwtMstType object

Definition at line 988 of file gwt-mst.f90.

989 ! -- modules
991 ! -- dummy
992 class(GwtMstType) :: this !< GwtMstType object
993 !
994 ! -- Allocate scalars in NumericalPackageType
995 call this%NumericalPackageType%allocate_scalars()
996 !
997 ! -- Allocate
998 call mem_allocate(this%isrb, 'ISRB', this%memoryPath)
999 call mem_allocate(this%ioutsorbate, 'IOUTSORBATE', this%memoryPath)
1000 call mem_allocate(this%idcy, 'IDCY', this%memoryPath)
1001 !
1002 ! -- Initialize
1003 this%isrb = izero
1004 this%ioutsorbate = 0
1005 this%idcy = izero

◆ get_volfracm()

real(dp) function gwtmstmodule::get_volfracm ( class(gwtmsttype) this,
integer(i4b), intent(in) node )

Calculate and return the volume fraction of the aquifer that is mobile

Parameters
thisGwtMstType object
[in]nodenode number

Definition at line 1428 of file gwt-mst.f90.

1429 ! -- dummy
1430 class(GwtMstType) :: this !< GwtMstType object
1431 integer(I4B), intent(in) :: node !< node number
1432 ! -- return
1433 real(DP) :: volfracm
1434 !
1435 volfracm = done - this%volfracim(node)

◆ get_zero_order_decay()

real(dp) function gwtmstmodule::get_zero_order_decay ( real(dp), intent(in) decay_rate_usr,
real(dp), intent(in) decay_rate_last,
integer(i4b), intent(in) kiter,
real(dp), intent(in) cold,
real(dp), intent(in) cnew,
real(dp), intent(in) delt )

Function to calculate the zero-order decay rate from the user specified decay rate. If the decay rate is positive, then the decay rate must be constrained so that more mass is not removed than is available. Without this constraint, negative concentrations could result from zero-order decay.

Parameters
[in]decay_rate_usruser-entered decay rate
[in]decay_rate_lastdecay rate used for last iteration
[in]kiterPicard iteration counter
[in]coldconcentration at end of last time step
[in]cnewconcentration at end of this time step
[in]deltlength of time step
Returns
returned value for decay rate

Definition at line 1446 of file gwt-mst.f90.

1448 ! -- dummy
1449 real(DP), intent(in) :: decay_rate_usr !< user-entered decay rate
1450 real(DP), intent(in) :: decay_rate_last !< decay rate used for last iteration
1451 integer(I4B), intent(in) :: kiter !< Picard iteration counter
1452 real(DP), intent(in) :: cold !< concentration at end of last time step
1453 real(DP), intent(in) :: cnew !< concentration at end of this time step
1454 real(DP), intent(in) :: delt !< length of time step
1455 ! -- return
1456 real(DP) :: decay_rate !< returned value for decay rate
1457 !
1458 ! -- Return user rate if production, otherwise constrain, if necessary
1459 if (decay_rate_usr < dzero) then
1460 !
1461 ! -- Production, no need to limit rate
1462 decay_rate = decay_rate_usr
1463 else
1464 !
1465 ! -- Need to ensure decay does not result in negative
1466 ! concentration, so reduce the rate if it would result in
1467 ! removing more mass than is in the cell.
1468 if (kiter == 1) then
1469 decay_rate = min(decay_rate_usr, cold / delt)
1470 else
1471 decay_rate = decay_rate_last
1472 if (cnew < dzero) then
1473 decay_rate = decay_rate_last + cnew / delt
1474 else if (cnew > cold) then
1475 decay_rate = decay_rate_last + cnew / delt
1476 end if
1477 decay_rate = min(decay_rate_usr, decay_rate)
1478 end if
1479 decay_rate = max(decay_rate, dzero)
1480 end if
Here is the caller graph for this function:

◆ log_data()

subroutine gwtmstmodule::log_data ( class(gwtmsttype) this,
type(gwtmstparamfoundtype), intent(in) found )

Definition at line 1373 of file gwt-mst.f90.

1375 class(GwTMstType) :: this
1376 type(GwtMstParamFoundType), intent(in) :: found
1377
1378 write (this%iout, '(1x,a)') 'PROCESSING GRIDDATA'
1379 if (found%porosity) then
1380 write (this%iout, '(4x,a)') 'MOBILE DOMAIN POROSITY set from input file'
1381 end if
1382 if (found%decay) then
1383 write (this%iout, '(4x,a)') 'DECAY RATE set from input file'
1384 end if
1385 if (found%decay_sorbed) then
1386 write (this%iout, '(4x,a)') 'DECAY SORBED RATE set from input file'
1387 end if
1388 if (found%bulk_density) then
1389 write (this%iout, '(4x,a)') 'BULK DENSITY set from input file'
1390 end if
1391 if (found%distcoef) then
1392 write (this%iout, '(4x,a)') 'DISTRIBUTION COEFFICIENT set from input file'
1393 end if
1394 if (found%sp2) then
1395 write (this%iout, '(4x,a)') 'SECOND SORPTION PARAM set from input file'
1396 end if
1397 write (this%iout, '(1x,a)') 'END PROCESSING GRIDDATA'

◆ log_options()

subroutine gwtmstmodule::log_options ( class(gwtmsttype) this,
type(gwtmstparamfoundtype), intent(in) found,
character(len=*), intent(in) sorbate_fname )

Definition at line 1154 of file gwt-mst.f90.

1156 class(GwTMstType) :: this
1157 type(GwtMstParamFoundType), intent(in) :: found
1158 character(len=*), intent(in) :: sorbate_fname
1159 ! -- formats
1160 character(len=*), parameter :: fmtisvflow = &
1161 "(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY FILE &
1162 &WHENEVER ICBCFL IS NOT ZERO.')"
1163 character(len=*), parameter :: fmtlinear = &
1164 &"(4x,'LINEAR SORPTION IS ACTIVE. ')"
1165 character(len=*), parameter :: fmtfreundlich = &
1166 &"(4x,'FREUNDLICH SORPTION IS ACTIVE. ')"
1167 character(len=*), parameter :: fmtlangmuir = &
1168 &"(4x,'LANGMUIR SORPTION IS ACTIVE. ')"
1169 character(len=*), parameter :: fmtidcy1 = &
1170 &"(4x,'FIRST-ORDER DECAY IS ACTIVE. ')"
1171 character(len=*), parameter :: fmtidcy2 = &
1172 &"(4x,'ZERO-ORDER DECAY IS ACTIVE. ')"
1173 character(len=*), parameter :: fmtfileout = &
1174 "(4x,'MST ',1x,a,1x,' WILL BE SAVED TO FILE: ',a,/4x,&
1175 &'OPENED ON UNIT: ',I7)"
1176
1177 write (this%iout, '(1x,a)') 'PROCESSING MOBILE STORAGE AND TRANSFER OPTIONS'
1178 if (found%save_flows) then
1179 write (this%iout, fmtisvflow)
1180 end if
1181 if (found%order1_decay) then
1182 write (this%iout, fmtidcy1)
1183 end if
1184 if (found%order0_decay) then
1185 write (this%iout, fmtidcy2)
1186 end if
1187 if (found%sorption) then
1188 select case (this%isrb)
1189 case (sorption_linear)
1190 write (this%iout, fmtlinear)
1191 case (sorption_freund)
1192 write (this%iout, fmtfreundlich)
1193 case (sorption_lang)
1194 write (this%iout, fmtlangmuir)
1195 end select
1196 end if
1197 if (found%sorbatefile) then
1198 write (this%iout, fmtfileout) &
1199 'SORBATE', sorbate_fname, this%ioutsorbate
1200 end if
1201 write (this%iout, '(1x,a)') 'END OF MOBILE STORAGE AND TRANSFER OPTIONS'

◆ mst_ar()

subroutine gwtmstmodule::mst_ar ( class(gwtmsttype), intent(inout) this,
class(disbasetype), intent(in), pointer dis,
integer(i4b), dimension(:), pointer, contiguous ibound )

Method to allocate and read static data for the package.

Parameters
[in,out]thisGwtMstType object
[in]dispointer to dis package
iboundpointer to GWT ibound array

Definition at line 142 of file gwt-mst.f90.

143 ! -- modules
144 ! -- dummy
145 class(GwtMstType), intent(inout) :: this !< GwtMstType object
146 class(DisBaseType), pointer, intent(in) :: dis !< pointer to dis package
147 integer(I4B), dimension(:), pointer, contiguous :: ibound !< pointer to GWT ibound array
148 ! -- local
149 ! -- formats
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, //)"
153 !
154 ! --print a message identifying the mobile storage and transfer package.
155 write (this%iout, fmtmst) this%input_mempath
156 !
157 ! -- Source options
158 call this%source_options()
159 !
160 ! -- store pointers to arguments that were passed in
161 this%dis => dis
162 this%ibound => ibound
163 !
164 ! -- Allocate arrays
165 call this%allocate_arrays(dis%nodes)
166 !
167 ! -- source the data block
168 call this%source_data()
169 !
170 ! -- Create isotherm object if sorption is active
171 this%isotherm => create_isotherm(this%isrb, this%distcoef, this%sp2)
Here is the call graph for this function:

◆ mst_bd()

subroutine gwtmstmodule::mst_bd ( class(gwtmsttype) this,
integer(i4b), intent(in) isuppress_output,
type(budgettype), intent(inout) model_budget )
Parameters
thisGwtMstType object
[in]isuppress_outputflag to suppress output
[in,out]model_budgetmodel budget object

Definition at line 808 of file gwt-mst.f90.

809 ! -- modules
810 use tdismodule, only: delt
812 ! -- dummy
813 class(GwtMstType) :: this !< GwtMstType object
814 integer(I4B), intent(in) :: isuppress_output !< flag to suppress output
815 type(BudgetType), intent(inout) :: model_budget !< model budget object
816 ! -- local
817 real(DP) :: rin
818 real(DP) :: rout
819 !
820 ! -- sto
821 call rate_accumulator(this%ratesto, rin, rout)
822 call model_budget%addentry(rin, rout, delt, budtxt(1), &
823 isuppress_output, rowlabel=this%packName)
824 !
825 ! -- dcy
826 if (this%idcy /= decay_off) then
827 call rate_accumulator(this%ratedcy, rin, rout)
828 call model_budget%addentry(rin, rout, delt, budtxt(2), &
829 isuppress_output, rowlabel=this%packName)
830 end if
831 !
832 ! -- srb
833 if (this%isrb /= sorption_off) then
834 call rate_accumulator(this%ratesrb, rin, rout)
835 call model_budget%addentry(rin, rout, delt, budtxt(3), &
836 isuppress_output, rowlabel=this%packName)
837 end if
838 !
839 ! -- srb dcy
840 if (this%isrb /= sorption_off .and. this%idcy /= decay_off) then
841 call rate_accumulator(this%ratedcys, rin, rout)
842 call model_budget%addentry(rin, rout, delt, budtxt(4), &
843 isuppress_output, rowlabel=this%packName)
844 end if
This module contains the BudgetModule.
Definition Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
Rate accumulator subroutine.
Definition Budget.f90:634
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32
Derived type for the Budget object.
Definition Budget.f90:40
Here is the call graph for this function:

◆ mst_calc_csrb()

subroutine gwtmstmodule::mst_calc_csrb ( class(gwtmsttype) this,
real(dp), dimension(:), intent(in) cnew )
Parameters
thisGwtMstType object
[in]cnewconcentration at end of this time step

Definition at line 787 of file gwt-mst.f90.

788 ! -- dummy
789 class(GwtMstType) :: this !< GwtMstType object
790 real(DP), intent(in), dimension(:) :: cnew !< concentration at end of this time step
791 ! -- local
792 integer(I4B) :: n
793 real(DP) :: csrb
794
795 ! Calculate sorbed concentration
796 do n = 1, size(cnew)
797 csrb = dzero
798 if (this%ibound(n) > 0 .and. this%isrb /= sorption_off) then
799 csrb = this%isotherm%value(cnew, n)
800 end if
801 this%csrb(n) = csrb
802 end do
803

◆ mst_cq()

subroutine gwtmstmodule::mst_cq ( class(gwtmsttype) this,
integer(i4b), intent(in) nodes,
real(dp), dimension(nodes), intent(in) cnew,
real(dp), dimension(nodes), intent(in) cold,
real(dp), dimension(:), intent(inout), contiguous flowja )

Method to calculate flows for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]cnewconcentration at end of this time step
[in]coldconcentration at end of last time step
[in,out]flowjaflow between two connected control volumes

Definition at line 481 of file gwt-mst.f90.

482 ! -- dummy
483 class(GwtMstType) :: this !< GwtMstType object
484 integer(I4B), intent(in) :: nodes !< number of nodes
485 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
486 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
487 real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
488 !
489 ! - storage
490 call this%mst_cq_sto(nodes, cnew, cold, flowja)
491 !
492 ! -- decay
493 if (this%idcy /= decay_off) then
494 call this%mst_cq_dcy(nodes, cnew, cold, flowja)
495 end if
496 !
497 ! -- sorption
498 if (this%isrb /= sorption_off) then
499 call this%mst_cq_srb(nodes, cnew, cold, flowja)
500 end if
501 !
502 ! -- decay sorbed
503 if (this%isrb /= sorption_off .and. this%idcy /= decay_off) then
504 call this%mst_cq_dcy_srb(nodes, cnew, cold, flowja)
505 end if
506 !
507 ! -- calculate csrb
508 if (this%isrb /= sorption_off) then
509 call this%mst_calc_csrb(cnew)
510 end if

◆ mst_cq_dcy()

subroutine gwtmstmodule::mst_cq_dcy ( class(gwtmsttype) this,
integer(i4b), intent(in) nodes,
real(dp), dimension(nodes), intent(in) cnew,
real(dp), dimension(nodes), intent(in) cold,
real(dp), dimension(:), intent(inout), contiguous flowja )

Method to calculate decay terms for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]cnewconcentration at end of this time step
[in]coldconcentration at end of last time step
[in,out]flowjaflow between two connected control volumes

Definition at line 564 of file gwt-mst.f90.

565 ! -- modules
566 use tdismodule, only: delt
567 ! -- dummy
568 class(GwtMstType) :: this !< GwtMstType object
569 integer(I4B), intent(in) :: nodes !< number of nodes
570 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
571 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
572 real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
573 ! -- local
574 integer(I4B) :: n
575 integer(I4B) :: idiag
576 real(DP) :: rate
577 real(DP) :: swtpdt
578 real(DP) :: hhcof, rrhs
579 real(DP) :: vcell
580 real(DP) :: decay_rate
581 !
582 ! -- initialize
583 !
584 ! -- Calculate decay change
585 do n = 1, nodes
586 !
587 ! -- skip if transport inactive
588 this%ratedcy(n) = dzero
589 if (this%ibound(n) <= 0) cycle
590 !
591 ! -- calculate new and old water volumes
592 vcell = this%dis%get_cell_volume(n)
593 swtpdt = this%fmi%gwfsat(n)
594 !
595 ! -- calculate decay gains and losses
596 rate = dzero
597 hhcof = dzero
598 rrhs = dzero
599 if (this%idcy == decay_first_order) then
600 if (cnew(n) > dzero) then
601 hhcof = -this%decay(n) * vcell * swtpdt * this%thetam(n)
602 end if
603 elseif (this%idcy == decay_zero_order) then
604 decay_rate = get_zero_order_decay(this%decay(n), this%decaylast(n), &
605 0, cold(n), cnew(n), delt)
606 rrhs = decay_rate * vcell * swtpdt * this%thetam(n)
607 end if
608 rate = hhcof * cnew(n) - rrhs
609 this%ratedcy(n) = rate
610 idiag = this%dis%con%ia(n)
611 flowja(idiag) = flowja(idiag) + rate
612 !
613 end do
Here is the call graph for this function:

◆ mst_cq_dcy_srb()

subroutine gwtmstmodule::mst_cq_dcy_srb ( class(gwtmsttype) this,
integer(i4b), intent(in) nodes,
real(dp), dimension(nodes), intent(in) cnew,
real(dp), dimension(nodes), intent(in) cold,
real(dp), dimension(:), intent(inout), contiguous flowja )

Method to calculate decay-sorption terms for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]cnewconcentration at end of this time step
[in]coldconcentration at end of last time step
[in,out]flowjaflow between two connected control volumes

Definition at line 692 of file gwt-mst.f90.

693 ! -- modules
694 use tdismodule, only: delt
695 ! -- dummy
696 class(GwtMstType) :: this !< GwtMstType object
697 integer(I4B), intent(in) :: nodes !< number of nodes
698 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
699 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
700 real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
701 ! -- local
702 integer(I4B) :: n
703 integer(I4B) :: idiag
704 real(DP) :: rate
705 real(DP) :: hhcof, rrhs
706 real(DP) :: vcell
707 real(DP) :: swnew
708 real(DP) :: distcoef
709 real(DP) :: volfracm
710 real(DP) :: rhobm
711 real(DP) :: term
712 real(DP) :: csrb
713 real(DP) :: csrbnew
714 real(DP) :: csrbold
715 real(DP) :: decay_rate
716 !
717 ! -- Calculate sorbed decay change
718 ! This routine will only be called if sorption and decay are active
719 do n = 1, nodes
720 !
721 ! -- initialize rates
722 this%ratedcys(n) = dzero
723 !
724 ! -- skip if transport inactive
725 if (this%ibound(n) <= 0) cycle
726 !
727 ! -- set variables
728 hhcof = dzero
729 rrhs = dzero
730 vcell = this%dis%get_cell_volume(n)
731 swnew = this%fmi%gwfsat(n)
732 distcoef = this%distcoef(n)
733 volfracm = this%get_volfracm(n)
734 rhobm = this%bulk_density(n)
735 term = this%decay_sorbed(n) * volfracm * rhobm * swnew * vcell
736 !
737 ! -- add sorbed mass decay rate terms to accumulators
738 select case (this%idcy)
739 case (decay_first_order)
740
741 !
742 select case (this%isrb)
743 case (sorption_linear)
744 !
745 ! -- first order decay rate is a function of concentration, so add
746 ! to left hand side
747 if (cnew(n) > dzero) then
748 hhcof = -term * distcoef
749 end if
750 case (sorption_freund)
751 !
752 ! -- nonlinear Freundlich sorption, so add to RHS
753 csrb = this%isotherm%value(cnew, n)
754 rrhs = term * csrb
755 case (sorption_lang)
756 !
757 ! -- nonlinear Lanmuir sorption, so add to RHS
758 csrb = this%isotherm%value(cnew, n)
759 rrhs = term * csrb
760 end select
761 case (decay_zero_order)
762 !
763 ! -- Call function to get zero-order decay rate, which may be changed
764 ! from the user-specified rate to prevent negative concentrations
765 if (distcoef > dzero) then
766 csrbold = this%isotherm%value(cold, n)
767 csrbnew = this%isotherm%value(cnew, n)
768
769 decay_rate = get_zero_order_decay(this%decay_sorbed(n), &
770 this%decayslast(n), &
771 0, csrbold, csrbnew, delt)
772 rrhs = decay_rate * volfracm * rhobm * swnew * vcell
773 end if
774 end select
775 !
776 ! -- calculate rate
777 rate = hhcof * cnew(n) - rrhs
778 this%ratedcys(n) = rate
779 idiag = this%dis%con%ia(n)
780 flowja(idiag) = flowja(idiag) + rate
781 !
782 end do
Here is the call graph for this function:

◆ mst_cq_srb()

subroutine gwtmstmodule::mst_cq_srb ( class(gwtmsttype) this,
integer(i4b), intent(in) nodes,
real(dp), dimension(nodes), intent(in) cnew,
real(dp), dimension(nodes), intent(in) cold,
real(dp), dimension(:), intent(inout), contiguous flowja )

Method to calculate sorption terms for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]cnewconcentration at end of this time step
[in]coldconcentration at end of last time step
[in,out]flowjaflow between two connected control volumes

Definition at line 620 of file gwt-mst.f90.

621 ! -- modules
622 use tdismodule, only: delt
623 ! -- dummy
624 class(GwtMstType) :: this !< GwtMstType object
625 integer(I4B), intent(in) :: nodes !< number of nodes
626 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
627 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
628 real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
629 ! -- local
630 integer(I4B) :: n
631 integer(I4B) :: idiag
632 real(DP) :: rate
633 real(DP) :: tled
634 real(DP) :: vcell
635 real(DP) :: volfracm
636 real(DP) :: rhobm
637 real(DP) :: sat_new, sat_old
638 real(DP) :: contribution
639 !
640 ! -- initialize
641 tled = done / delt
642 !
643 ! -- Calculate sorption change
644 do n = 1, nodes
645 !
646 ! -- initialize rates
647 this%ratesrb(n) = dzero
648 rate = 0.0_dp
649 !
650 ! -- skip if transport inactive
651 if (this%ibound(n) <= 0) cycle
652 !
653 ! -- assign variables
654 vcell = this%dis%get_cell_volume(n)
655
656 rhobm = this%bulk_density(n)
657 volfracm = this%get_volfracm(n)
658 sat_new = this%fmi%gwfsat(n)
659 sat_old = this%fmi%gwfsatold(n, delt, this%thetam(n))
660
661 ! -- Matrix contribution for sorption term
662 contribution = -volfracm * rhobm * sat_new &
663 * this%isotherm%derivative(cnew, n) * cnew(n) * vcell * tled
664 rate = rate + contribution
665
666 ! -- Right-hand side contribution due to linearization
667 ! -- Note: this contribution should cancel with the matrix contribution when the outer loop is converged
668 contribution = -volfracm * rhobm * sat_new * &
669 this%isotherm%derivative(cnew, n) * cnew(n) * vcell * tled
670 rate = rate - contribution
671
672 contribution = volfracm * rhobm * sat_new * this%isotherm%value(cnew, n) &
673 * vcell * tled
674 rate = rate - contribution
675
676 ! -- Right-hand side contribution from previous time step
677 contribution = -volfracm * rhobm * sat_old * this%isotherm%value(cold, n) &
678 * vcell * tled
679 rate = rate - contribution
680
681 this%ratesrb(n) = rate
682 idiag = this%dis%con%ia(n)
683 flowja(idiag) = flowja(idiag) + rate
684 !
685 end do

◆ mst_cq_sto()

subroutine gwtmstmodule::mst_cq_sto ( class(gwtmsttype) this,
integer(i4b), intent(in) nodes,
real(dp), dimension(nodes), intent(in) cnew,
real(dp), dimension(nodes), intent(in) cold,
real(dp), dimension(:), intent(inout), contiguous flowja )

Method to calculate storage terms for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]cnewconcentration at end of this time step
[in]coldconcentration at end of last time step
[in,out]flowjaflow between two connected control volumes

Definition at line 517 of file gwt-mst.f90.

518 ! -- modules
519 use tdismodule, only: delt
520 ! -- dummy
521 class(GwtMstType) :: this !< GwtMstType object
522 integer(I4B), intent(in) :: nodes !< number of nodes
523 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
524 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
525 real(DP), dimension(:), contiguous, intent(inout) :: flowja !< flow between two connected control volumes
526 ! -- local
527 integer(I4B) :: n
528 integer(I4B) :: idiag
529 real(DP) :: rate
530 real(DP) :: tled
531 real(DP) :: vnew, vold
532 real(DP) :: hhcof, rrhs
533 !
534 ! -- initialize
535 tled = done / delt
536 !
537 ! -- Calculate storage change
538 do n = 1, nodes
539 this%ratesto(n) = dzero
540 !
541 ! -- skip if transport inactive
542 if (this%ibound(n) <= 0) cycle
543 !
544 ! -- calculate new and old water volumes
545 vnew = this%dis%get_cell_volume(n) * this%fmi%gwfsat(n) * this%thetam(n)
546 vold = vnew
547 if (this%fmi%igwfstrgss /= 0) vold = vold + this%fmi%gwfstrgss(n) * delt
548 if (this%fmi%igwfstrgsy /= 0) vold = vold + this%fmi%gwfstrgsy(n) * delt
549 !
550 ! -- calculate rate
551 hhcof = -vnew * tled
552 rrhs = -vold * tled * cold(n)
553 rate = hhcof * cnew(n) - rrhs
554 this%ratesto(n) = rate
555 idiag = this%dis%con%ia(n)
556 flowja(idiag) = flowja(idiag) + rate
557 end do

◆ mst_cr()

subroutine, public gwtmstmodule::mst_cr ( type(gwtmsttype), pointer mstobj,
character(len=*), intent(in) name_model,
character(len=*), intent(in) input_mempath,
integer(i4b), intent(in) inunit,
integer(i4b), intent(in) iout,
type(tspfmitype), intent(in), target fmi )

Create a new MST object

Parameters
mstobjunallocated new mst object to create
[in]name_modelname of the model
[in]input_mempathmemory path of input
[in]inunitunit number of WEL package input file
[in]ioutunit number of model listing file
[in]fmifmi package for this GWT model

Definition at line 114 of file gwt-mst.f90.

115 ! -- dummy
116 type(GwtMstType), pointer :: mstobj !< unallocated new mst object to create
117 character(len=*), intent(in) :: name_model !< name of the model
118 character(len=*), intent(in) :: input_mempath !< memory path of input
119 integer(I4B), intent(in) :: inunit !< unit number of WEL package input file
120 integer(I4B), intent(in) :: iout !< unit number of model listing file
121 type(TspFmiType), intent(in), target :: fmi !< fmi package for this GWT model
122 !
123 ! -- Create the object
124 allocate (mstobj)
125 !
126 ! -- create name and memory path
127 call mstobj%set_names(1, name_model, 'MST', 'MST', input_mempath)
128 !
129 ! -- Allocate scalars
130 call mstobj%allocate_scalars()
131 !
132 ! -- Set variables
133 mstobj%inunit = inunit
134 mstobj%iout = iout
135 mstobj%fmi => fmi
Here is the caller graph for this function:

◆ mst_da()

subroutine gwtmstmodule::mst_da ( class(gwtmsttype) this)

Method to deallocate memory for the package.

Parameters
thisGwtMstType object

Definition at line 942 of file gwt-mst.f90.

943 ! -- modules
945 ! -- dummy
946 class(GwtMstType) :: this !< GwtMstType object
947 !
948 ! -- Deallocate arrays if package was active
949 if (this%inunit > 0) then
950 call mem_deallocate(this%porosity)
951 call mem_deallocate(this%thetam)
952 call mem_deallocate(this%volfracim)
953 call mem_deallocate(this%ratesto)
954 call mem_deallocate(this%idcy)
955 call mem_deallocate(this%decay)
956 call mem_deallocate(this%decay_sorbed)
957 call mem_deallocate(this%ratedcy)
958 call mem_deallocate(this%decaylast)
959 call mem_deallocate(this%decayslast)
960 call mem_deallocate(this%isrb)
961 call mem_deallocate(this%ioutsorbate)
962 call mem_deallocate(this%bulk_density)
963 call mem_deallocate(this%distcoef)
964 call mem_deallocate(this%sp2)
965 call mem_deallocate(this%ratesrb)
966 call mem_deallocate(this%csrb)
967 call mem_deallocate(this%ratedcys)
968 this%ibound => null()
969 this%fmi => null()
970 end if
971 !
972 ! -- Scalars
973 !
974 ! -- Objects
975 if (associated(this%isotherm)) then
976 deallocate (this%isotherm)
977 nullify (this%isotherm)
978 end if
979 !
980 ! -- deallocate parent
981 call this%NumericalPackageType%da()

◆ mst_fc()

subroutine gwtmstmodule::mst_fc ( class(gwtmsttype) this,
integer, intent(in) nodes,
real(dp), dimension(nodes), intent(in) cold,
integer(i4b), intent(in) nja,
class(matrixbasetype), pointer matrix_sln,
integer(i4b), dimension(nja), intent(in) idxglo,
real(dp), dimension(nodes), intent(in) cnew,
real(dp), dimension(nodes), intent(inout) rhs,
integer(i4b), intent(in) kiter )

Method to calculate and fill coefficients for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]coldconcentration at end of last time step
[in]njanumber of GWT connections
matrix_slnsolution matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model
[in]cnewconcentration at end of this time step
[in]kitersolution outer iteration number

Definition at line 178 of file gwt-mst.f90.

180 ! -- modules
181 ! -- dummy
182 class(GwtMstType) :: this !< GwtMstType object
183 integer, intent(in) :: nodes !< number of nodes
184 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
185 integer(I4B), intent(in) :: nja !< number of GWT connections
186 class(MatrixBaseType), pointer :: matrix_sln !< solution matrix
187 integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
188 real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
189 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
190 integer(I4B), intent(in) :: kiter !< solution outer iteration number
191 !
192 ! -- storage contribution
193 call this%mst_fc_sto(nodes, cold, nja, matrix_sln, idxglo, rhs)
194 !
195 ! -- decay contribution
196 if (this%idcy /= decay_off) then
197 call this%mst_fc_dcy(nodes, cold, cnew, nja, matrix_sln, idxglo, &
198 rhs, kiter)
199 end if
200 !
201 ! -- sorption contribution
202 if (this%isrb /= sorption_off) then
203 call this%mst_fc_srb(nodes, cold, nja, matrix_sln, idxglo, rhs, cnew)
204 end if
205 !
206 ! -- decay sorbed contribution
207 if (this%isrb /= sorption_off .and. this%idcy /= decay_off) then
208 call this%mst_fc_dcy_srb(nodes, cold, nja, matrix_sln, idxglo, rhs, &
209 cnew, kiter)
210 end if

◆ mst_fc_dcy()

subroutine gwtmstmodule::mst_fc_dcy ( class(gwtmsttype) this,
integer, intent(in) nodes,
real(dp), dimension(nodes), intent(in) cold,
real(dp), dimension(nodes), intent(in) cnew,
integer(i4b), intent(in) nja,
class(matrixbasetype), pointer matrix_sln,
integer(i4b), dimension(nja), intent(in) idxglo,
real(dp), dimension(nodes), intent(inout) rhs,
integer(i4b), intent(in) kiter )

Method to calculate and fill decay coefficients for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]coldconcentration at end of last time step
[in]cnewconcentration at end of this time step
[in]njanumber of GWT connections
matrix_slnsolution coefficient matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model
[in]kitersolution outer iteration number

Definition at line 262 of file gwt-mst.f90.

264 ! -- modules
265 use tdismodule, only: delt
266 ! -- dummy
267 class(GwtMstType) :: this !< GwtMstType object
268 integer, intent(in) :: nodes !< number of nodes
269 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
270 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
271 integer(I4B), intent(in) :: nja !< number of GWT connections
272 class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
273 integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
274 real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
275 integer(I4B), intent(in) :: kiter !< solution outer iteration number
276 ! -- local
277 integer(I4B) :: n, idiag
278 real(DP) :: hhcof, rrhs
279 real(DP) :: swtpdt
280 real(DP) :: vcell
281 real(DP) :: decay_rate
282 !
283 ! -- loop through and calculate decay contribution to hcof and rhs
284 do n = 1, this%dis%nodes
285 !
286 ! -- skip if transport inactive
287 if (this%ibound(n) <= 0) cycle
288 !
289 ! -- calculate new and old water volumes
290 vcell = this%dis%get_cell_volume(n)
291 swtpdt = this%fmi%gwfsat(n)
292 !
293 ! -- add decay rate terms to accumulators
294 idiag = this%dis%con%ia(n)
295 select case (this%idcy)
296 case (decay_first_order)
297 !
298 ! -- first order decay rate is a function of concentration, so add
299 ! to left hand side
300 if (cnew(n) > dzero) then
301 hhcof = -this%decay(n) * vcell * swtpdt * this%thetam(n)
302 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
303 end if
304 case (decay_zero_order)
305 !
306 ! -- Call function to get zero-order decay rate, which may be changed
307 ! from the user-specified rate to prevent negative concentrations
308 decay_rate = get_zero_order_decay(this%decay(n), this%decaylast(n), &
309 kiter, cold(n), cnew(n), delt)
310 this%decaylast(n) = decay_rate
311 rrhs = decay_rate * vcell * swtpdt * this%thetam(n)
312 rhs(n) = rhs(n) + rrhs
313 end select
314 !
315 end do
Here is the call graph for this function:

◆ mst_fc_dcy_srb()

subroutine gwtmstmodule::mst_fc_dcy_srb ( class(gwtmsttype) this,
integer, intent(in) nodes,
real(dp), dimension(nodes), intent(in) cold,
integer(i4b), intent(in) nja,
class(matrixbasetype), pointer matrix_sln,
integer(i4b), dimension(nja), intent(in) idxglo,
real(dp), dimension(nodes), intent(inout) rhs,
real(dp), dimension(nodes), intent(in) cnew,
integer(i4b), intent(in) kiter )

Method to calculate and fill sorption-decay coefficients for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]coldconcentration at end of last time step
[in]njanumber of GWT connections
matrix_slnsolution coefficient matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model
[in]cnewconcentration at end of this time step
[in]kitersolution outer iteration number

Definition at line 387 of file gwt-mst.f90.

389 ! -- modules
390 use tdismodule, only: delt
391 ! -- dummy
392 class(GwtMstType) :: this !< GwtMstType object
393 integer, intent(in) :: nodes !< number of nodes
394 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
395 integer(I4B), intent(in) :: nja !< number of GWT connections
396 class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
397 integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
398 real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
399 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
400 integer(I4B), intent(in) :: kiter !< solution outer iteration number
401 ! -- local
402 integer(I4B) :: n, idiag
403 real(DP) :: hhcof, rrhs
404 real(DP) :: vcell
405 real(DP) :: swnew
406 real(DP) :: distcoef
407 real(DP) :: volfracm
408 real(DP) :: rhobm
409 real(DP) :: term
410 real(DP) :: csrb
411 real(DP) :: decay_rate
412 real(DP) :: csrbold
413 real(DP) :: csrbnew
414 !
415 ! -- loop through and calculate sorption contribution to hcof and rhs
416 do n = 1, this%dis%nodes
417 !
418 ! -- skip if transport inactive
419 if (this%ibound(n) <= 0) cycle
420 !
421 ! -- set variables
422 hhcof = dzero
423 rrhs = dzero
424 vcell = this%dis%get_cell_volume(n)
425 swnew = this%fmi%gwfsat(n)
426 distcoef = this%distcoef(n)
427 idiag = this%dis%con%ia(n)
428 volfracm = this%get_volfracm(n)
429 rhobm = this%bulk_density(n)
430 term = this%decay_sorbed(n) * volfracm * rhobm * swnew * vcell
431 !
432 ! -- add sorbed mass decay rate terms to accumulators
433 select case (this%idcy)
434 case (decay_first_order)
435 select case (this%isrb)
436 case (sorption_linear)
437 !
438 ! -- first order decay rate is a function of concentration, so add
439 ! to left hand side
440 if (cnew(n) > dzero) then
441 hhcof = -term * distcoef
442 end if
443 case (sorption_freund)
444 !
445 ! -- nonlinear Freundlich sorption, so add to RHS
446 csrb = this%isotherm%value(cnew, n)
447 rrhs = term * csrb
448 case (sorption_lang)
449 !
450 ! -- nonlinear Lanmuir sorption, so add to RHS
451 csrb = this%isotherm%value(cnew, n)
452 rrhs = term * csrb
453 end select
454 case (decay_zero_order)
455 !
456 ! -- call function to get zero-order decay rate, which may be changed
457 ! from the user-specified rate to prevent negative concentrations
458 if (distcoef > dzero) then
459 csrbold = this%isotherm%value(cold, n)
460 csrbnew = this%isotherm%value(cnew, n)
461 !
462 decay_rate = get_zero_order_decay(this%decay_sorbed(n), &
463 this%decayslast(n), &
464 kiter, csrbold, csrbnew, delt)
465 this%decayslast(n) = decay_rate
466 rrhs = decay_rate * volfracm * rhobm * swnew * vcell
467 end if
468 end select
469 !
470 ! -- Add hhcof to diagonal and rrhs to right-hand side
471 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
472 rhs(n) = rhs(n) + rrhs
473 !
474 end do
Here is the call graph for this function:

◆ mst_fc_srb()

subroutine gwtmstmodule::mst_fc_srb ( class(gwtmsttype) this,
integer, intent(in) nodes,
real(dp), dimension(nodes), intent(in) cold,
integer(i4b), intent(in) nja,
class(matrixbasetype), pointer matrix_sln,
integer(i4b), dimension(nja), intent(in) idxglo,
real(dp), dimension(nodes), intent(inout) rhs,
real(dp), dimension(nodes), intent(in) cnew )

Method to calculate and fill sorption coefficients for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]coldconcentration at end of last time step
[in]njanumber of GWT connections
matrix_slnsolution coefficient matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model
[in]cnewconcentration at end of this time step

Definition at line 322 of file gwt-mst.f90.

324 ! -- modules
325 use tdismodule, only: delt
326 ! -- dummy
327 class(GwtMstType) :: this !< GwtMstType object
328 integer, intent(in) :: nodes !< number of nodes
329 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
330 integer(I4B), intent(in) :: nja !< number of GWT connections
331 class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
332 integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
333 real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
334 real(DP), intent(in), dimension(nodes) :: cnew !< concentration at end of this time step
335 ! -- local
336 integer(I4B) :: n, idiag
337 real(DP) :: tled
338 real(DP) :: hhcof, rrhs
339 real(DP) :: vcell
340 real(DP) :: volfracm
341 real(DP) :: rhobm
342 real(DP) :: sat_new, sat_old
343 !
344 ! -- set variables
345 tled = done / delt
346 !
347 ! -- loop through and calculate sorption contribution to hcof and rhs
348 do n = 1, this%dis%nodes
349 !
350 ! -- skip if transport inactive
351 if (this%ibound(n) <= 0) cycle
352 !
353 ! -- assign variables
354 vcell = this%dis%get_cell_volume(n)
355 volfracm = this%get_volfracm(n)
356 rhobm = this%bulk_density(n)
357 sat_new = this%fmi%gwfsat(n)
358 sat_old = this%fmi%gwfsatold(n, delt, this%thetam(n))
359
360 ! -- Matrix contribution for sorption term
361 hhcof = -volfracm * rhobm * sat_new * this%isotherm%derivative(cnew, n) &
362 * vcell * tled
363 idiag = this%dis%con%ia(n)
364 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
365
366 ! -- Right-hand side contribution due to linearization
367 rrhs = -volfracm * rhobm * sat_new * this%isotherm%derivative(cnew, n) &
368 * cnew(n) * vcell * tled
369 rhs(n) = rhs(n) + rrhs
370
371 rrhs = volfracm * rhobm * sat_new * this%isotherm%value(cnew, n) * &
372 vcell * tled
373 rhs(n) = rhs(n) + rrhs
374
375 ! -- Right-hand side contribution from previous time step
376 rrhs = -volfracm * rhobm * sat_old * this%isotherm%value(cold, n) * &
377 vcell * tled
378 rhs(n) = rhs(n) + rrhs
379
380 end do

◆ mst_fc_sto()

subroutine gwtmstmodule::mst_fc_sto ( class(gwtmsttype) this,
integer, intent(in) nodes,
real(dp), dimension(nodes), intent(in) cold,
integer(i4b), intent(in) nja,
class(matrixbasetype), pointer matrix_sln,
integer(i4b), dimension(nja), intent(in) idxglo,
real(dp), dimension(nodes), intent(inout) rhs )

Method to calculate and fill storage coefficients for the package.

Parameters
thisGwtMstType object
[in]nodesnumber of nodes
[in]coldconcentration at end of last time step
[in]njanumber of GWT connections
matrix_slnsolution coefficient matrix
[in]idxglomapping vector for model (local) to solution (global)
[in,out]rhsright-hand side vector for model

Definition at line 217 of file gwt-mst.f90.

218 ! -- modules
219 use tdismodule, only: delt
220 ! -- dummy
221 class(GwtMstType) :: this !< GwtMstType object
222 integer, intent(in) :: nodes !< number of nodes
223 real(DP), intent(in), dimension(nodes) :: cold !< concentration at end of last time step
224 integer(I4B), intent(in) :: nja !< number of GWT connections
225 class(MatrixBaseType), pointer :: matrix_sln !< solution coefficient matrix
226 integer(I4B), intent(in), dimension(nja) :: idxglo !< mapping vector for model (local) to solution (global)
227 real(DP), intent(inout), dimension(nodes) :: rhs !< right-hand side vector for model
228 ! -- local
229 integer(I4B) :: n, idiag
230 real(DP) :: tled
231 real(DP) :: hhcof, rrhs
232 real(DP) :: vnew, vold
233 !
234 ! -- set variables
235 tled = done / delt
236 !
237 ! -- loop through and calculate storage contribution to hcof and rhs
238 do n = 1, this%dis%nodes
239 !
240 ! -- skip if transport inactive
241 if (this%ibound(n) <= 0) cycle
242 !
243 ! -- calculate new and old water volumes
244 vnew = this%dis%get_cell_volume(n) * this%fmi%gwfsat(n) * this%thetam(n)
245 vold = vnew
246 if (this%fmi%igwfstrgss /= 0) vold = vold + this%fmi%gwfstrgss(n) * delt
247 if (this%fmi%igwfstrgsy /= 0) vold = vold + this%fmi%gwfstrgsy(n) * delt
248 !
249 ! -- add terms to diagonal and rhs accumulators
250 hhcof = -vnew * tled
251 rrhs = -vold * tled * cold(n)
252 idiag = this%dis%con%ia(n)
253 call matrix_sln%add_value_pos(idxglo(idiag), hhcof)
254 rhs(n) = rhs(n) + rrhs
255 end do

◆ mst_ot_dv()

subroutine gwtmstmodule::mst_ot_dv ( class(gwtmsttype) this,
integer(i4b), intent(in) idvsave )

Definition at line 904 of file gwt-mst.f90.

905 ! -- dummy
906 class(GwtMstType) :: this
907 integer(I4B), intent(in) :: idvsave
908 ! -- local
909 character(len=1) :: cdatafmp = ' ', editdesc = ' '
910 integer(I4B) :: ibinun
911 integer(I4B) :: iprint
912 integer(I4B) :: nvaluesp
913 integer(I4B) :: nwidthp
914 real(DP) :: dinact
915
916 ! Set unit number for sorbate output
917 if (this%ioutsorbate /= 0) then
918 ibinun = 1
919 else
920 ibinun = 0
921 end if
922 if (idvsave == 0) ibinun = 0
923
924 ! save sorbate concentration array
925 if (ibinun /= 0) then
926 iprint = 0
927 dinact = dhnoflo
928 if (this%ioutsorbate /= 0) then
929 ibinun = this%ioutsorbate
930 call this%dis%record_array(this%csrb, this%iout, iprint, ibinun, &
931 ' SORBATE', cdatafmp, nvaluesp, &
932 nwidthp, editdesc, dinact)
933 end if
934 end if
935

◆ mst_ot_flow()

subroutine gwtmstmodule::mst_ot_flow ( class(gwtmsttype) this,
integer(i4b), intent(in) icbcfl,
integer(i4b), intent(in) icbcun )

Method to output terms for the package.

Parameters
thisGwtMstType object
[in]icbcflflag and unit number for cell-by-cell output
[in]icbcunflag indication if cell-by-cell data should be saved

Definition at line 851 of file gwt-mst.f90.

852 ! -- dummy
853 class(GwtMstType) :: this !< GwtMstType object
854 integer(I4B), intent(in) :: icbcfl !< flag and unit number for cell-by-cell output
855 integer(I4B), intent(in) :: icbcun !< flag indication if cell-by-cell data should be saved
856 ! -- local
857 integer(I4B) :: ibinun
858 integer(I4B) :: iprint, nvaluesp, nwidthp
859 character(len=1) :: cdatafmp = ' ', editdesc = ' '
860 real(DP) :: dinact
861 !
862 ! -- Set unit number for binary output
863 if (this%ipakcb < 0) then
864 ibinun = icbcun
865 elseif (this%ipakcb == 0) then
866 ibinun = 0
867 else
868 ibinun = this%ipakcb
869 end if
870 if (icbcfl == 0) ibinun = 0
871 !
872 ! -- Record the storage rate if requested
873 if (ibinun /= 0) then
874 iprint = 0
875 dinact = dzero
876 !
877 ! -- sto
878 call this%dis%record_array(this%ratesto, this%iout, iprint, -ibinun, &
879 budtxt(1), cdatafmp, nvaluesp, &
880 nwidthp, editdesc, dinact)
881 !
882 ! -- dcy
883 if (this%idcy /= decay_off) &
884 call this%dis%record_array(this%ratedcy, this%iout, iprint, -ibinun, &
885 budtxt(2), cdatafmp, nvaluesp, &
886 nwidthp, editdesc, dinact)
887 !
888 ! -- srb
889 if (this%isrb /= sorption_off) &
890 call this%dis%record_array(this%ratesrb, this%iout, iprint, -ibinun, &
891 budtxt(3), cdatafmp, nvaluesp, &
892 nwidthp, editdesc, dinact)
893 !
894 ! -- dcy srb
895 if (this%isrb /= sorption_off .and. this%idcy /= decay_off) &
896 call this%dis%record_array(this%ratedcys, this%iout, iprint, -ibinun, &
897 budtxt(4), cdatafmp, nvaluesp, &
898 nwidthp, editdesc, dinact)
899 end if

◆ source_data()

subroutine gwtmstmodule::source_data ( class(gwtmsttype) this)

Method to source data for the package.

Definition at line 1208 of file gwt-mst.f90.

1209 ! -- modules
1213 ! -- dummy
1214 class(GwtMsttype) :: this
1215 ! -- locals
1216 character(len=LINELENGTH) :: errmsg
1217 type(GwtMstParamFoundType) :: found
1218 integer(I4B) :: n, asize
1219 integer(I4B), dimension(:), pointer, contiguous :: map
1220 !
1221 ! -- set map to convert user input data into reduced data
1222 map => null()
1223 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
1224 !
1225 ! -- reallocate
1226 if (this%isrb == sorption_off) then
1227 call get_isize('BULK_DENSITY', this%input_mempath, asize)
1228 if (asize > 0) &
1229 call mem_reallocate(this%bulk_density, this%dis%nodes, &
1230 'BULK_DENSITY', this%memoryPath)
1231 call get_isize('DISTCOEF', this%input_mempath, asize)
1232 if (asize > 0) &
1233 call mem_reallocate(this%distcoef, this%dis%nodes, 'DISTCOEF', &
1234 this%memoryPath)
1235 end if
1236 if (this%idcy == decay_off) then
1237 call get_isize('DECAY', this%input_mempath, asize)
1238 if (asize > 0) &
1239 call mem_reallocate(this%decay, this%dis%nodes, 'DECAY', this%memoryPath)
1240 end if
1241 call get_isize('DECAY_SORBED', this%input_mempath, asize)
1242 if (asize > 0) then
1243 call mem_reallocate(this%decay_sorbed, this%dis%nodes, &
1244 'DECAY_SORBED', this%memoryPath)
1245 end if
1246 if (this%isrb == sorption_off .or. this%isrb == sorption_linear) then
1247 call get_isize('SP2', this%input_mempath, asize)
1248 if (asize > 0) &
1249 call mem_reallocate(this%sp2, this%dis%nodes, 'SP2', this%memoryPath)
1250 end if
1251 !
1252 ! -- update defaults with memory sourced values
1253 call mem_set_value(this%porosity, 'POROSITY', this%input_mempath, map, &
1254 found%porosity)
1255 call mem_set_value(this%decay, 'DECAY', this%input_mempath, map, &
1256 found%decay)
1257 call mem_set_value(this%decay_sorbed, 'DECAY_SORBED', this%input_mempath, &
1258 map, found%decay_sorbed)
1259 call mem_set_value(this%bulk_density, 'BULK_DENSITY', this%input_mempath, &
1260 map, found%bulk_density)
1261 call mem_set_value(this%distcoef, 'DISTCOEF', this%input_mempath, map, &
1262 found%distcoef)
1263 call mem_set_value(this%sp2, 'SP2', this%input_mempath, map, &
1264 found%sp2)
1265
1266 ! -- log options
1267 if (this%iout > 0) then
1268 call this%log_data(found)
1269 end if
1270
1271 ! -- Check for required porosity
1272 if (.not. found%porosity) then
1273 write (errmsg, '(a)') 'POROSITY not specified in GRIDDATA block.'
1274 call store_error(errmsg)
1275 end if
1276
1277 ! -- Check for required sorption variables
1278 if (this%isrb == sorption_linear .or. this%isrb == sorption_freund .or. &
1279 this%isrb == sorption_lang) then
1280 if (.not. found%bulk_density) then
1281 write (errmsg, '(a)') 'Sorption is active but BULK_DENSITY &
1282 &not specified. BULK_DENSITY must be specified in GRIDDATA block.'
1283 call store_error(errmsg)
1284 end if
1285 if (.not. found%distcoef) then
1286 write (errmsg, '(a)') 'Sorption is active but distribution &
1287 &coefficient not specified. DISTCOEF must be specified in &
1288 &GRIDDATA block.'
1289 call store_error(errmsg)
1290 end if
1291 if (this%isrb == sorption_freund .or. this%isrb == sorption_lang) then
1292 if (.not. found%sp2) then
1293 write (errmsg, '(a)') 'Freundlich or langmuir sorption is active &
1294 &but SP2 not specified. SP2 must be specified in &
1295 &GRIDDATA block.'
1296 call store_error(errmsg)
1297 end if
1298 end if
1299 else
1300 if (found%bulk_density) then
1301 write (warnmsg, '(a)') 'Sorption is not active but &
1302 &BULK_DENSITY was specified. BULK_DENSITY will have no affect on &
1303 &simulation results.'
1304 call store_warning(warnmsg)
1305 write (this%iout, '(1x,a)') 'WARNING. '//warnmsg
1306 end if
1307 if (found%distcoef) then
1308 write (warnmsg, '(a)') 'Sorption is not active but &
1309 &distribution coefficient was specified. DISTCOEF will have &
1310 &no affect on simulation results.'
1311 call store_warning(warnmsg)
1312 write (this%iout, '(1x,a)') 'WARNING. '//warnmsg
1313 end if
1314 if (found%sp2) then
1315 write (warnmsg, '(a)') 'Sorption is not active but &
1316 &SP2 was specified. SP2 will have &
1317 &no affect on simulation results.'
1318 call store_warning(warnmsg)
1319 write (this%iout, '(1x,a)') 'WARNING. '//warnmsg
1320 end if
1321 end if
1322
1323 ! -- Check for required decay/production rate coefficients
1324 if (this%idcy /= decay_off) then
1325 if (.not. found%decay) then
1326 write (errmsg, '(a)') 'First or zero order decay is &
1327 &active but the first rate coefficient is not specified. DECAY &
1328 &must be specified in GRIDDATA block.'
1329 call store_error(errmsg)
1330 end if
1331 if (.not. found%decay_sorbed) then
1332 !
1333 ! -- If DECAY_SORBED not specified and sorption is active, then
1334 ! terminate with an error
1335 if (this%isrb == sorption_linear .or. this%isrb == sorption_freund .or. &
1336 this%isrb == sorption_lang) then
1337 write (errmsg, '(a)') 'DECAY_SORBED not provided in GRIDDATA &
1338 &block but decay and sorption are active. Specify DECAY_SORBED &
1339 &in GRIDDATA block.'
1340 call store_error(errmsg)
1341 end if
1342 end if
1343 else
1344 if (found%decay) then
1345 write (warnmsg, '(a)') 'First- or zero-order decay &
1346 &is not active but decay was specified. DECAY will &
1347 &have no affect on simulation results.'
1348 call store_warning(warnmsg)
1349 write (this%iout, '(1x,a)') 'WARNING. '//warnmsg
1350 end if
1351 if (found%decay_sorbed) then
1352 write (warnmsg, '(a)') 'First- or zero-order decay &
1353 &is not active but DECAY_SORBED was specified. &
1354 &DECAY_SORBED will have no affect on simulation results.'
1355 call store_warning(warnmsg)
1356 write (this%iout, '(1x,a)') 'WARNING. '//warnmsg
1357 end if
1358 end if
1359
1360 ! -- terminate if errors
1361 if (count_errors() > 0) then
1362 call store_error_filename(this%input_fname)
1363 end if
1364
1365 ! -- initialize thetam from porosity
1366 do n = 1, size(this%porosity)
1367 this%thetam(n) = this%porosity(n)
1368 end do
subroutine, public get_isize(name, mem_path, isize)
Get the number of elements for this variable.
Here is the call graph for this function:

◆ source_options()

subroutine gwtmstmodule::source_options ( class(gwtmsttype) this)

Method to source options for the package.

Definition at line 1101 of file gwt-mst.f90.

1102 ! -- modules
1103 use constantsmodule, only: lenvarname
1104 use openspecmodule, only: access, form
1108 ! -- dummy
1109 class(GwtMstType) :: this
1110 ! -- locals
1111 type(GwtMstParamFoundType) :: found
1112 character(len=LENVARNAME), dimension(3) :: sorption_method = &
1113 &[character(len=LENVARNAME) :: 'LINEAR', 'FREUNDLICH', 'LANGMUIR']
1114 character(len=linelength) :: fname
1115 !
1116 ! -- update defaults with memory sourced values
1117 call mem_set_value(this%ipakcb, 'SAVE_FLOWS', this%input_mempath, &
1118 found%save_flows)
1119 call mem_set_value(this%idcy, 'ORDER1_DECAY', this%input_mempath, &
1120 found%order1_decay)
1121 call mem_set_value(this%idcy, 'ORDER0_DECAY', this%input_mempath, &
1122 found%order0_decay)
1123 call mem_set_value(this%isrb, 'SORPTION', this%input_mempath, &
1124 sorption_method, found%sorption)
1125 call mem_set_value(fname, 'SORBATEFILE', this%input_mempath, &
1126 found%sorbatefile)
1127
1128 ! -- found side effects
1129 if (found%save_flows) this%ipakcb = -1
1130 if (found%order1_decay) this%idcy = decay_first_order
1131 if (found%order0_decay) this%idcy = decay_zero_order
1132 if (found%sorption) then
1133 if (this%isrb == izero) then
1134 call store_error('Unknown sorption type was specified. &
1135 &Sorption must be specified as LINEAR, &
1136 &FREUNDLICH, or LANGMUIR.')
1137 call store_error_filename(this%input_fname)
1138 end if
1139 end if
1140 if (found%sorbatefile) then
1141 this%ioutsorbate = getunit()
1142 call openfile(this%ioutsorbate, this%iout, fname, 'DATA(BINARY)', &
1143 form, access, 'REPLACE', mode_opt=mnormal)
1144 end if
1145 !
1146 ! -- log options
1147 if (this%iout > 0) then
1148 call this%log_options(found, fname)
1149 end if
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
@ mnormal
normal output mode
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition Constants.f90:17
integer(i4b), parameter izero
integer constant zero
Definition Constants.f90:51
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
character(len=20) access
Definition OpenSpec.f90:7
character(len=20) form
Definition OpenSpec.f90:7
Here is the call graph for this function:

Variable Documentation

◆ budtxt

character(len=lenbudtxt), dimension(nbditems) gwtmstmodule::budtxt

Definition at line 31 of file gwt-mst.f90.

31 character(len=LENBUDTXT), dimension(NBDITEMS) :: budtxt

◆ nbditems

integer(i4b), parameter gwtmstmodule::nbditems = 4

Definition at line 30 of file gwt-mst.f90.