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

Data Types

type  concentrationpointer
type  gwfvsctype

Functions/Subroutines

real(dp) function calc_visc (ivisc, viscref, dviscdc, cviscref, conc, a2, a3, a4)
 Generic function to calculate changes in fluid viscosity using a linear formulation.
subroutine, public vsc_cr (vscobj, name_model, input_mempath, inunit, iout)
 Create a new package object.
subroutine vsc_df (this, dis, vsc_input)
 Define viscosity package options and dimensions.
subroutine vsc_ar (this, ibound)
 Allocate and read method for viscosity package.
subroutine vsc_ar_bnd (this, packobj)
 Activate viscosity in advanced packages.
subroutine set_npf_pointers (this)
 Set pointers to NPF variables.
subroutine vsc_rp (this)
 Read new period data in viscosity package.
subroutine vsc_ad (this)
 Advance the viscosity package.
subroutine vsc_ad_bnd (this, packobj, hnew)
 Advance the boundary packages when viscosity is active.
subroutine vsc_ad_standard_bnd (packobj, hnew, visc, viscref, locelev, locvisc, locconc, dviscdc, cviscref, ivisc, a2, a3, a4, ctemp)
 advance ghb, drn and riv while accounting for viscosity
subroutine vsc_ad_sfr (packobj, visc, viscref, elev, locvisc, locconc, dviscdc, cviscref, ivisc, a2, a3, a4, ctemp)
 Update sfr-related viscosity ratios.
subroutine vsc_ad_lak (packobj, visc, viscref, elev, locvisc, locconc, dviscdc, cviscref, ivisc, a2, a3, a4, ctemp)
 Update lak-related viscosity ratios.
subroutine vsc_ad_maw (packobj, visc, viscref, elev, locvisc, locconc, dviscdc, cviscref, ivisc, a2, a3, a4, ctemp)
 Update maw-related viscosity ratios.
real(dp) function calc_vsc_ratio (viscref, bndvisc)
 calculate and return the viscosity ratio
real(dp) function calc_bnd_viscosity (n, locvisc, locconc, viscref, dviscdc, cviscref, ctemp, ivisc, a2, a3, a4, auxvar)
 Calculate the boundary viscosity.
subroutine get_visc_ratio (this, n, m, gwhdn, gwhdm, viscratio)
 Calculate the viscosity ratio.
subroutine calc_q_visc (this, cellid, viscratio)
 Account for viscosity in the aquifer hydraulic flow barriers.
subroutine update_k_with_vsc (this)
 Appled the viscosity ratio (mu_o/mu) to the hydraulic conductivity.
subroutine vsc_set_changed_at (this, kper, kstp)
 Mark K changes as having occurred at (kper, kstp).
subroutine vsc_ot_dv (this, idvfl)
 Output viscosity package dependent-variable terms.
subroutine vsc_da (this)
 Deallocate viscosity package memory.
subroutine source_dimensions (this)
 Source dimensions for package.
subroutine source_packagedata (this)
 source packagedata for package
subroutine set_packagedata (this, input_data)
 Sets package data instead of reading from file.
subroutine vsc_calcvisc (this)
 Calculate fluid viscosity.
subroutine allocate_scalars (this)
 Allocate scalars.
subroutine allocate_arrays (this, nodes)
 Allocate arrays.
subroutine source_options (this)
 Source VSC options.
subroutine log_options (this, found, viscosityfile)
 log VSC options
subroutine set_options (this, input_data)
 Sets options as opposed to reading them from a file.
subroutine set_concentration_pointer (this, modelname, conc, icbund, istmpr)
 Set pointers to concentration(s).

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine gwfvscmodule::allocate_arrays ( class(gwfvsctype) this,
integer(i4b), intent(in) nodes )
private

Allocate and initialize arrays for the VSC package.

Definition at line 1123 of file gwf-vsc.f90.

1124 ! -- dummy
1125 class(GwfVscType) :: this
1126 integer(I4B), intent(in) :: nodes
1127 ! -- local
1128 integer(I4B) :: i
1129 !
1130 ! -- Allocate
1131 call mem_allocate(this%visc, nodes, 'VISC', this%memoryPath)
1132 call mem_allocate(this%ivisc, this%nviscspecies, 'IVISC', this%memoryPath)
1133 call mem_allocate(this%dviscdc, this%nviscspecies, 'DRHODC', &
1134 this%memoryPath)
1135 call mem_allocate(this%cviscref, this%nviscspecies, 'CRHOREF', &
1136 this%memoryPath)
1137 call mem_allocate(this%ctemp, this%nviscspecies, 'CTEMP', this%memoryPath)
1138 allocate (this%cmodelname(this%nviscspecies))
1139 allocate (this%cauxspeciesname(this%nviscspecies))
1140 allocate (this%modelconc(this%nviscspecies))
1141 !
1142 ! -- Initialize
1143 do i = 1, nodes
1144 this%visc(i) = this%viscref
1145 end do
1146 !
1147 ! -- Initialize nviscspecies arrays
1148 do i = 1, this%nviscspecies
1149 this%ivisc(i) = 1
1150 this%dviscdc(i) = dzero
1151 this%cviscref(i) = dzero
1152 this%ctemp(i) = dzero
1153 this%cmodelname(i) = ''
1154 this%cauxspeciesname(i) = ''
1155 end do

◆ allocate_scalars()

subroutine gwfvscmodule::allocate_scalars ( class(gwfvsctype) this)
private

Allocate and initialize scalars for the VSC package. The base model allocate scalars method is also called.

Definition at line 1083 of file gwf-vsc.f90.

1084 ! -- modules
1085 use constantsmodule, only: dzero, dten, dep3
1086 ! -- dummy
1087 class(GwfVscType) :: this
1088 !
1089 ! -- allocate scalars in NumericalPackageType
1090 call this%NumericalPackageType%allocate_scalars()
1091 !
1092 ! -- Allocate
1093 call mem_allocate(this%thermivisc, 'THERMIVISC', this%memoryPath)
1094 call mem_allocate(this%idxtmpr, 'IDXTMPR', this%memoryPath)
1095 call mem_allocate(this%ioutvisc, 'IOUTVISC', this%memoryPath)
1096 call mem_allocate(this%ireadelev, 'IREADELEV', this%memoryPath)
1097 call mem_allocate(this%iconcset, 'ICONCSET', this%memoryPath)
1098 call mem_allocate(this%viscref, 'VISCREF', this%memoryPath)
1099 call mem_allocate(this%a2, 'A2', this%memoryPath)
1100 call mem_allocate(this%a3, 'A3', this%memoryPath)
1101 call mem_allocate(this%a4, 'A4', this%memoryPath)
1102 !
1103 call mem_allocate(this%nviscspecies, 'NVISCSPECIES', this%memoryPath)
1104 !
1105 ! -- Initialize
1106 this%thermivisc = 0
1107 this%idxtmpr = 0
1108 this%ioutvisc = 0
1109 this%ireadelev = 0
1110 this%iconcset = 0
1111 this%viscref = dep3
1112 this%A2 = dten
1113 this%A3 = 248.37_dp
1114 this%A4 = 133.15_dp
1115 !
1116 this%nviscspecies = 0
This module contains simulation constants.
Definition Constants.f90:9
real(dp), parameter dep3
real constant 1000
Definition Constants.f90:88
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
real(dp), parameter dten
real constant 10
Definition Constants.f90:84

◆ calc_bnd_viscosity()

real(dp) function gwfvscmodule::calc_bnd_viscosity ( integer(i4b), intent(in) n,
integer(i4b), intent(in) locvisc,
integer(i4b), dimension(:), intent(in) locconc,
real(dp), intent(in) viscref,
real(dp), dimension(:), intent(in) dviscdc,
real(dp), dimension(:), intent(in) cviscref,
real(dp), dimension(:), intent(inout) ctemp,
integer(i4b), dimension(:), intent(in) ivisc,
real(dp), intent(in) a2,
real(dp), intent(in) a3,
real(dp), intent(in) a4,
real(dp), dimension(:, :), intent(in) auxvar )
private

Return the viscosity of the boundary package using one of the options in the following order of priority:

  1. Assign as aux variable in column with name 'VISCOSITY'
  2. Calculate using viscosity equation and nviscspecies aux columns
  3. If neither of those, then assign as viscref !!

Definition at line 679 of file gwf-vsc.f90.

681 ! -- modules
682 ! -- dummy
683 integer(I4B), intent(in) :: n
684 integer(I4B), intent(in) :: locvisc
685 real(DP), intent(in) :: a2, a3, a4
686 integer(I4B), dimension(:), intent(in) :: ivisc
687 integer(I4B), dimension(:), intent(in) :: locconc
688 real(DP), intent(in) :: viscref
689 real(DP), dimension(:), intent(in) :: dviscdc
690 real(DP), dimension(:), intent(in) :: cviscref
691 real(DP), dimension(:), intent(inout) :: ctemp
692 real(DP), dimension(:, :), intent(in) :: auxvar
693 ! -- Return
694 real(DP) :: viscbnd
695 ! -- local
696 integer(I4B) :: i
697 !
698 ! -- assign boundary viscosity based on one of three options
699 if (locvisc > 0) then
700 ! -- assign viscosity to an aux column named 'VISCOSITY'
701 viscbnd = auxvar(locvisc, n)
702 else if (locconc(1) > 0) then
703 ! -- calculate viscosity using one or more concentration auxcolumns
704 do i = 1, size(locconc)
705 ctemp(i) = dzero
706 if (locconc(i) > 0) then
707 ctemp(i) = auxvar(locconc(i), n)
708 end if
709 end do
710 viscbnd = calc_visc(ivisc, viscref, dviscdc, cviscref, ctemp, a2, a3, a4)
711 else
712 ! -- neither of the above, so assign as viscref
713 viscbnd = viscref
714 end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_q_visc()

subroutine gwfvscmodule::calc_q_visc ( class(gwfvsctype) this,
integer(i4b), intent(in) cellid,
real(dp), intent(inout) viscratio )
private

Will return the viscosity associated with the upgradient node (cell) to the HFB package for adjusting the hydraulic characteristic (hydchr) of the barrier

Definition at line 750 of file gwf-vsc.f90.

751 ! -- dummy variables
752 class(GwfVscType) :: this
753 integer(I4B), intent(in) :: cellid
754 ! -- Return
755 real(DP), intent(inout) :: viscratio
756 ! -- local
757 real(DP) :: visc
758 !
759 ! -- Retrieve viscosity for the passed node number
760 visc = this%visc(cellid)
761 !
762 ! -- Calculate the viscosity ratio for the
763 viscratio = calc_vsc_ratio(this%viscref, visc)
Here is the call graph for this function:

◆ calc_visc()

real(dp) function gwfvscmodule::calc_visc ( integer(i4b), dimension(:), intent(in) ivisc,
real(dp), intent(in) viscref,
real(dp), dimension(:), intent(in) dviscdc,
real(dp), dimension(:), intent(in) cviscref,
real(dp), dimension(:), intent(in) conc,
real(dp), intent(in) a2,
real(dp), intent(in) a3,
real(dp), intent(in) a4 )

Definition at line 100 of file gwf-vsc.f90.

102 ! -- dummy
103 integer(I4B), dimension(:), intent(in) :: ivisc
104 real(DP), intent(in) :: viscref
105 real(DP), dimension(:), intent(in) :: dviscdc
106 real(DP), dimension(:), intent(in) :: cviscref
107 real(DP), dimension(:), intent(in) :: conc
108 real(DP), intent(in) :: a2, a3, a4
109 ! -- return
110 real(DP) :: visc
111 ! -- local
112 integer(I4B) :: nviscspec
113 integer(I4B) :: i
114 real(DP) :: mu_t
115 real(DP) :: expon
116 !
117 nviscspec = size(dviscdc)
118 visc = viscref
119 !
120 do i = 1, nviscspec
121 if (ivisc(i) == 1) then
122 visc = visc + dviscdc(i) * (conc(i) - cviscref(i))
123 else
124 expon = -1 * a3 * ((conc(i) - cviscref(i)) / &
125 ((conc(i) + a4) * (cviscref(i) + a4)))
126 mu_t = viscref * a2**expon
127 ! Order matters!! (This assumes we apply the temperature correction after
128 ! accounting for solute concentrations)
129 ! If a nonlinear correction is applied, then b/c it takes into account
130 ! viscref, need to subtract it in this case
131 ! At most, there will only ever be 1 nonlinear correction
132 visc = (visc - viscref) + mu_t
133 end if
134 ! end if
135 end do
Here is the caller graph for this function:

◆ calc_vsc_ratio()

real(dp) function gwfvscmodule::calc_vsc_ratio ( real(dp), intent(in) viscref,
real(dp), intent(in) bndvisc )
private

Definition at line 661 of file gwf-vsc.f90.

662 ! -- dummy
663 real(DP), intent(in) :: viscref
664 real(DP), intent(in) :: bndvisc
665 ! -- local
666 real(DP) :: viscratio
667 !
668 viscratio = viscref / bndvisc
Here is the caller graph for this function:

◆ get_visc_ratio()

subroutine gwfvscmodule::get_visc_ratio ( class(gwfvsctype) this,
integer(i4b), intent(in) n,
integer(i4b), intent(in) m,
real(dp), intent(in) gwhdn,
real(dp), intent(in) gwhdm,
real(dp), intent(inout) viscratio )
private

Calculate the viscosity ratio applied to the hydraulic characteristic provided by the user. The viscosity ratio is applicable only when the hydraulic characteristic is specified as positive and will not be applied when the hydchr is negative

Definition at line 724 of file gwf-vsc.f90.

725 ! -- modules
726 use constantsmodule, only: done
727 ! -- dummy
728 class(GwfVscType) :: this
729 integer(I4B), intent(in) :: n, m
730 real(DP), intent(in) :: gwhdn, gwhdm
731 real(DP), intent(inout) :: viscratio
732 ! -- loca
733 integer(I4B) :: cellid
734 !
735 viscratio = done
736 if (gwhdm > gwhdn) then
737 cellid = m
738 else if (gwhdn >= gwhdm) then
739 cellid = n
740 end if
741 call this%calc_q_visc(cellid, viscratio)
real(dp), parameter done
real constant 1
Definition Constants.f90:76

◆ log_options()

subroutine gwfvscmodule::log_options ( class(gwfvsctype), intent(inout) this,
type(gwfvscparamfoundtype), intent(in) found,
character(len=*), intent(in) viscosityfile )
private

Definition at line 1246 of file gwf-vsc.f90.

1247 ! -- modules
1249 ! -- dummy variables
1250 class(GwfVscType), intent(inout) :: this
1251 type(GwfVscParamFoundType), intent(in) :: found
1252 character(len=*), intent(in) :: viscosityfile
1253 ! -- local variables
1254 ! -- formats
1255 character(len=*), parameter :: fmtfileout = &
1256 "(4x, 'VSC', 1x, a, 1x, 'Will be saved to file: ', &
1257 &a, ' opened on unit: ', I7)"
1258 character(len=*), parameter :: fmtlinear = &
1259 "(4x,'Viscosity will vary linearly with temperature &
1260 &change ')"
1261 character(len=*), parameter :: fmtnonlinear = &
1262 "(4x,'Viscosity will vary non-linearly with temperature &
1263 &change ')"
1264
1265 write (this%iout, '(1x,a)') 'Processing VSC OPTIONS block'
1266
1267 if (found%viscref) then
1268 write (this%iout, '(4x,a,1pg15.6)') &
1269 'Reference viscosity has been set to: ', this%viscref
1270 end if
1271 if (found%viscosityfile) then
1272 write (this%iout, fmtfileout) &
1273 'VISCOSITY', trim(viscosityfile), this%ioutvisc
1274 end if
1275 if (found%temp_specname) then
1276 write (this%iout, '(4x, a)') 'Temperature species name set to: '// &
1277 trim(this%name_temp_spec)
1278 end if
1279 if (found%thermal_form) then
1280 select case (this%thermivisc)
1281 case (1)
1282 write (this%iout, fmtlinear)
1283 case (2)
1284 write (this%iout, fmtnonlinear)
1285 end select
1286 end if
1287 if (found%thermal_a2) then
1288 if (this%thermivisc == 2) then
1289 write (this%iout, '(4x,a,1pg15.6)') &
1290 'A2 in nonlinear viscosity formulation has been set to: ', &
1291 this%a2
1292 else
1293 write (this%iout, '(4x,a,/,4x,a,/,4x,a)') 'THERMAL_A2 specified by user &
1294 &in VSC Package input file. LINEAR viscosity ', 'formulation also &
1295 &specified. THERMAL_A2 will not affect ', 'viscosity calculations.'
1296 end if
1297 end if
1298 if (found%thermal_a3) then
1299 if (this%thermivisc == 2) then
1300 write (this%iout, '(4x,a,1pg15.6)') &
1301 'A3 in nonlinear viscosity formulation has been set to: ', &
1302 this%a3
1303 else
1304 write (this%iout, '(4x,a,/,4x,a,/,4x,a)') 'THERMAL_A3 specified by user &
1305 &in VSC Package input file. LINEAR viscosity ', 'formulation also &
1306 &specified. THERMAL_A3 will not affect ', 'viscosity calculations.'
1307 end if
1308 end if
1309 if (found%thermal_a4) then
1310 if (this%thermivisc == 2) then
1311 write (this%iout, '(4x,a,1pg15.6)') &
1312 'A4 in nonlinear viscosity formulation has been set to: ', &
1313 this%a4
1314 else
1315 write (this%iout, '(4x,a,/,4x,a,/,4x,a)') 'THERMAL_A4 specified by user &
1316 &in VSC Package input file. LINEAR viscosity ', 'formulation also &
1317 &specified. THERMAL_A4 will not affect ', 'viscosity calculations.'
1318 end if
1319 end if
1320
1321 write (this%iout, '(1x,a)') 'end of VSC options block'

◆ set_concentration_pointer()

subroutine gwfvscmodule::set_concentration_pointer ( class(gwfvsctype) this,
character(len=lenmodelname), intent(in) modelname,
real(dp), dimension(:), pointer conc,
integer(i4b), dimension(:), pointer icbund,
integer(i4b), intent(in), optional istmpr )
private

Pass in a gwt model name, concentration array, and ibound, and store a pointer to these in the VSC package so that viscosity can be calculated from them. This routine is called from the gwfgwt exchange in the exg_ar() method.

Definition at line 1341 of file gwf-vsc.f90.

1342 ! -- dummy
1343 class(GwfVscType) :: this
1344 character(len=LENMODELNAME), intent(in) :: modelname
1345 real(DP), dimension(:), pointer :: conc
1346 integer(I4B), dimension(:), pointer :: icbund
1347 integer(I4B), optional, intent(in) :: istmpr
1348 ! -- local
1349 integer(I4B) :: i
1350 logical :: found
1351 !
1352 this%iconcset = 1
1353 found = .false.
1354 do i = 1, this%nviscspecies
1355 if (this%cmodelname(i) == modelname) then
1356 this%modelconc(i)%conc => conc
1357 this%modelconc(i)%icbund => icbund
1358 found = .true.
1359 exit
1360 end if
1361 end do

◆ set_npf_pointers()

subroutine gwfvscmodule::set_npf_pointers ( class(gwfvsctype) this)
private

Set array and variable pointers from the NPF package for access by VSC.

Definition at line 301 of file gwf-vsc.f90.

302 ! -- dummy
303 class(GwfVscType) :: this
304 ! -- local
305 character(len=LENMEMPATH) :: npfMemoryPath
306 !
307 ! -- Set pointers to other package variables
308 ! -- NPF
309 npfmemorypath = create_mem_path(this%name_model, 'NPF')
310 call mem_setptr(this%k11, 'K11', npfmemorypath)
311 call mem_setptr(this%k22, 'K22', npfmemorypath)
312 call mem_setptr(this%k33, 'K33', npfmemorypath)
313 call mem_setptr(this%k11input, 'K11INPUT', npfmemorypath)
314 call mem_setptr(this%k22input, 'K22INPUT', npfmemorypath)
315 call mem_setptr(this%k33input, 'K33INPUT', npfmemorypath)
316 call mem_setptr(this%kchangeper, 'KCHANGEPER', npfmemorypath)
317 call mem_setptr(this%kchangestp, 'KCHANGESTP', npfmemorypath)
318 call mem_setptr(this%nodekchange, 'NODEKCHANGE', npfmemorypath)
Here is the call graph for this function:

◆ set_options()

subroutine gwfvscmodule::set_options ( class(gwfvsctype) this,
type(gwfvscinputdatatype), intent(in) input_data )
private
Parameters
[in]input_datathe input data to be set

Definition at line 1326 of file gwf-vsc.f90.

1327 ! -- dummy
1328 class(GwfVscType) :: this
1329 type(GwfVscInputDataType), intent(in) :: input_data !< the input data to be set
1330 !
1331 this%viscref = input_data%viscref

◆ set_packagedata()

subroutine gwfvscmodule::set_packagedata ( class(gwfvsctype) this,
type(gwfvscinputdatatype), intent(in) input_data )
private
Parameters
thisthis vscoancy pkg
[in]input_datathe input data to be set

Definition at line 1034 of file gwf-vsc.f90.

1035 ! -- dummy
1036 class(GwfVscType) :: this !< this vscoancy pkg
1037 type(GwfVscInputDataType), intent(in) :: input_data !< the input data to be set
1038 ! -- local
1039 integer(I4B) :: ispec
1040 !
1041 do ispec = 1, this%nviscspecies
1042 this%dviscdc(ispec) = input_data%dviscdc(ispec)
1043 this%cviscref(ispec) = input_data%cviscref(ispec)
1044 this%cmodelname(ispec) = input_data%cmodelname(ispec)
1045 this%cauxspeciesname(ispec) = input_data%cauxspeciesname(ispec)
1046 end do

◆ source_dimensions()

subroutine gwfvscmodule::source_dimensions ( class(gwfvsctype), intent(inout) this)
private

Definition at line 898 of file gwf-vsc.f90.

899 ! -- modules
902 ! -- dummy
903 class(GwfVscType), intent(inout) :: this
904 ! -- local
905 type(GwfVscParamFoundType) :: found
906
907 ! update defaults from input context
908 call mem_set_value(this%nviscspecies, 'NVISCSPECIES', this%input_mempath, &
909 found%nviscspecies)
910
911 ! log dimensions
912 write (this%iout, '(/1x,a)') 'Processing VSC DIMENSIONS block'
913 write (this%iout, '(4x,a,i0)') 'NVISCSPECIES = ', this%nviscspecies
914 write (this%iout, '(1x,a)') 'End of VSC DIMENSIONS block'
915
916 ! check dimension
917 if (this%nviscspecies < 1) then
918 call store_error('NVISCSPECIES must be greater than zero.')
919 call store_error_filename(this%input_fname)
920 end if
Here is the call graph for this function:

◆ source_options()

subroutine gwfvscmodule::source_options ( class(gwfvsctype), intent(inout) this)
private

Definition at line 1160 of file gwf-vsc.f90.

1161 ! -- modules
1162 use constantsmodule, only: lenvarname
1164 use openspecmodule, only: access, form
1167 ! -- dummy
1168 class(GwfVscType), intent(inout) :: this
1169 ! -- local
1170 character(len=LENVARNAME), dimension(2) :: thermal_form = &
1171 &[character(len=LENVARNAME) :: 'LINEAR', 'NONLINEAR']
1172 character(len=linelength) :: viscosityfile
1173 type(GwfVscParamFoundType) :: found
1174
1175 ! initialize variables
1176 viscosityfile = ''
1177
1178 ! update defaults from input context
1179 call mem_set_value(this%viscref, 'VISCREF', this%input_mempath, &
1180 found%viscref)
1181 call mem_set_value(viscosityfile, 'VISCOSITYFILE', this%input_mempath, &
1182 found%viscosityfile)
1183 call mem_set_value(this%name_temp_spec, 'TEMP_SPECNAME', this%input_mempath, &
1184 found%temp_specname)
1185 call mem_set_value(this%thermivisc, 'THERMAL_FORM', this%input_mempath, &
1186 thermal_form, found%thermal_form)
1187 call mem_set_value(this%a2, 'THERMAL_A2', this%input_mempath, &
1188 found%thermal_a2)
1189 call mem_set_value(this%a3, 'THERMAL_A3', this%input_mempath, &
1190 found%thermal_a3)
1191 call mem_set_value(this%a4, 'THERMAL_A4', this%input_mempath, &
1192 found%thermal_a4)
1193
1194 ! fileout options
1195 if (found%viscosityfile) then
1196 this%ioutvisc = getunit()
1197 call openfile(this%ioutvisc, this%iout, viscosityfile, 'DATA(BINARY)', &
1198 form, access, 'REPLACE')
1199 end if
1200
1201 ! -- verify THERMAL_FORM input value is supported
1202 if (found%thermal_form) then
1203 if (this%thermivisc == 0) then
1204 call store_error('Unrecognized input value for THERMAL_FORM option.')
1205 call store_error_filename(this%input_fname)
1206 end if
1207 end if
1208
1209 ! set warnings and errors
1210 if (this%thermivisc == 1) then
1211 if (this%a2 == 0.0) then
1212 write (errmsg, '(a)') 'LINEAR option selected for varying &
1213 &viscosity with temperature, but A1, a surrogate for &
1214 &dVISC/dT, set equal to 0.0'
1215 call store_error(errmsg)
1216 call store_error_filename(this%input_fname)
1217 end if
1218 end if
1219 if (this%thermivisc > 1) then
1220 if (this%a2 == 0) then
1221 write (warnmsg, '(a)') 'NONLINEAR option selected for &
1222 &varying viscosity with temperature, but A2 set equal to &
1223 &zero which may lead to unintended values for viscosity'
1224 call store_warning(warnmsg)
1225 end if
1226 if (this%a3 == 0) then
1227 write (warnmsg, '(a)') 'NONLINEAR option selected for &
1228 &varying viscosity with temperature,, but A3 set equal to &
1229 &zero which may lead to unintended values for viscosity'
1230 call store_warning(warnmsg)
1231 end if
1232 if (this%a4 == 0) then
1233 write (warnmsg, '(a)') 'NONLINEAR option selected for &
1234 &varying viscosity with temperature, BUT A4 SET EQUAL TO &
1235 &zero which may lead to unintended values for viscosity'
1236 call store_warning(warnmsg)
1237 end if
1238 end if
1239
1240 ! log options
1241 call this%log_options(found, viscosityfile)
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition Constants.f90:17
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:

◆ source_packagedata()

subroutine gwfvscmodule::source_packagedata ( class(gwfvsctype), intent(inout) this)
private

Definition at line 925 of file gwf-vsc.f90.

926 ! -- modules
930 ! -- dummy
931 class(GwfVscType), intent(inout) :: this
932 integer(I4B), dimension(:), pointer, contiguous :: iviscspec
933 type(CharacterStringType), dimension(:), pointer, &
934 contiguous :: modelnames, auxspeciesnames
935 real(DP), dimension(:), pointer, contiguous :: dviscdc, cviscref
936 integer(I4B), dimension(:), allocatable :: itemp
937 character(len=LINELENGTH) :: modelname, auxspeciesname, line
938 character(len=10) :: c10
939 character(len=16) :: c16
940 integer(I4B) :: n
941 ! -- format
942 character(len=*), parameter :: fmterr = &
943 "('Invalid value for IRHOSPEC (',i0,') detected in VSC Package. &
944 &IRHOSPEC must be > 0 and <= NVISCSPECIES, and duplicate values &
945 &are not allowed.')"
946
947 ! initialize
948 allocate (itemp(this%nviscspecies))
949 itemp(:) = 0
950
951 ! set input context pointers
952 call mem_setptr(iviscspec, 'IVISCSPEC', this%input_mempath)
953 call mem_setptr(dviscdc, 'DVISCDC', this%input_mempath)
954 call mem_setptr(cviscref, 'CVISCREF', this%input_mempath)
955 call mem_setptr(modelnames, 'MODELNAME', this%input_mempath)
956 call mem_setptr(auxspeciesnames, 'AUXSPECIESNAME', this%input_mempath)
957
958 ! process package data
959 do n = 1, size(iviscspec)
960 modelname = modelnames(n)
961 auxspeciesname = auxspeciesnames(n)
962
963 if (iviscspec(n) < 1 .or. iviscspec(n) > this%nviscspecies) then
964 write (errmsg, fmterr) iviscspec(n)
965 call store_error(errmsg)
966 end if
967 if (itemp(iviscspec(n)) /= 0) then
968 write (errmsg, fmterr) iviscspec(n)
969 call store_error(errmsg)
970 end if
971 itemp(iviscspec(n)) = 1
972 !
973 this%dviscdc(iviscspec(n)) = dviscdc(n)
974 this%cviscref(iviscspec(n)) = cviscref(n)
975 this%cmodelname(iviscspec(n)) = trim(modelname)
976 this%cauxspeciesname(iviscspec(n)) = trim(auxspeciesname)
977 !
978 if (auxspeciesname == this%name_temp_spec) then
979 if (this%idxtmpr > 0) then
980 write (errmsg, '(a)') 'More than one species in VSC input identified &
981 &as '//trim(this%name_temp_spec)//'. Only one species may be &
982 &designated to represent temperature.'
983 call store_error(errmsg)
984 else
985 this%idxtmpr = iviscspec(n)
986 if (this%thermivisc == 2) then
987 this%ivisc(iviscspec(n)) = 2
988 end if
989 end if
990 end if
991 end do
992
993 ! Check for errors.
994 if (count_errors() > 0) then
995 call store_error_filename(this%input_fname)
996 end if
997
998 ! log package data
999 write (this%iout, '(/,1x,a)') 'Processing VSC PACKAGEDATA block'
1000
1001 ! write packagedata information
1002 write (this%iout, '(1x,a)') 'Summary of species information in VSC Package'
1003 write (this%iout, '(1a11,5a17)') &
1004 'Species', 'DVISCDC', 'CVISCREF', 'Model', 'AUXSPECIESNAME'
1005 do n = 1, this%nviscspecies
1006 write (c10, '(i0)') n
1007 line = ' '//adjustr(c10)
1008
1009 write (c16, '(g15.6)') this%dviscdc(n)
1010 line = trim(line)//' '//adjustr(c16)
1011 write (c16, '(g15.6)') this%cviscref(n)
1012 line = trim(line)//' '//adjustr(c16)
1013 write (c16, '(a)') this%cmodelname(n)
1014 line = trim(line)//' '//adjustr(c16)
1015 write (c16, '(a)') this%cauxspeciesname(n)
1016 line = trim(line)//' '//adjustr(c16)
1017 write (this%iout, '(a)') trim(line)
1018 end do
1019
1020 write (this%iout, '(1x,a)') 'End of VSC PACKAGEDATA block'
1021
1022 ! deallocate
1023 deallocate (itemp)
1024
1025 call memorystore_release('IVISCSPEC', this%input_mempath)
1026 call memorystore_release('DVISCDC', this%input_mempath)
1027 call memorystore_release('CVISCREF', this%input_mempath)
1028 call memorystore_release('MODELNAME', this%input_mempath)
1029 call memorystore_release('AUXSPECIESNAME', this%input_mempath)
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
This class is used to store a single deferred-length character string. It was designed to work in an ...
Here is the call graph for this function:

◆ update_k_with_vsc()

subroutine gwfvscmodule::update_k_with_vsc ( class(gwfvsctype) this)
private

This routine called after updating the viscosity values using the latest concentration and/or temperature values. The ratio mu_o/mu, reference viscosity divided by the updated viscosity value, is multiplied by K for each cell.

Definition at line 773 of file gwf-vsc.f90.

774 ! -- dummy
775 class(GwfVscType) :: this
776 ! -- local
777 integer(I4B) :: n
778 real(DP) :: viscratio
779 !
780 ! -- For viscosity-based K's, apply change of K to K11 by starting with
781 ! K before VSC adjustment (including TVK changes) and not the K's
782 ! leftover from the last viscosity update.
783 do n = 1, this%dis%nodes
784 call this%calc_q_visc(n, viscratio)
785 this%k11(n) = this%k11input(n) * viscratio
786 this%k22(n) = this%k22input(n) * viscratio
787 this%k33(n) = this%k33input(n) * viscratio
788 this%nodekchange(n) = 1
789 end do
790 !
791 ! -- Flag kchange
792 call this%vsc_set_changed_at(kper, kstp)

◆ vsc_ad()

subroutine gwfvscmodule::vsc_ad ( class(gwfvsctype) this)
private

Advance data in the VSC package. The method sets or advances time series, time array series, and observation data.

Definition at line 358 of file gwf-vsc.f90.

359 ! -- dummy
360 class(GwfVscType) :: this
361 !
362 ! -- update viscosity using the latest concentration/temperature
363 call this%vsc_calcvisc()

◆ vsc_ad_bnd()

subroutine gwfvscmodule::vsc_ad_bnd ( class(gwfvsctype) this,
class(bndtype), pointer packobj,
real(dp), dimension(:), intent(in) hnew )
private

Update the conductance values associate with inflow from a boundary when VSC package is active.

Definition at line 371 of file gwf-vsc.f90.

372 ! -- modules
373 use bndmodule, only: bndtype
374 ! -- dummy
375 class(GwfVscType) :: this
376 class(BndType), pointer :: packobj
377 real(DP), intent(in), dimension(:) :: hnew
378 ! -- local
379 integer(I4B) :: i, j
380 integer(I4B) :: n, locvisc, locelev
381 integer(I4B), dimension(:), allocatable :: locconc
382 !
383 ! -- initialize
384 locvisc = 0
385 locelev = 0
386 allocate (locconc(this%nviscspecies))
387 locconc(:) = 0
388 !
389 ! -- Add viscosity terms for conductance-dependent boundaries
390 do n = 1, packobj%naux
391 if (packobj%auxname(n) == 'VISCOSITY') then
392 locvisc = n
393 else if (packobj%auxname(n) == 'ELEVATION') then
394 locelev = n
395 end if
396 end do
397 !
398 ! -- find aux columns for conc (or temp.) that affect viscosity
399 do i = 1, this%nviscspecies
400 locconc(i) = 0
401 do j = 1, packobj%naux
402 if (this%cauxspeciesname(i) == packobj%auxname(j)) then
403 locconc(i) = j
404 exit
405 end if
406 end do
407 if (locconc(i) == 0) then
408 ! -- one not found, so don't use and mark all as 0
409 locconc(:) = 0
410 exit
411 end if
412 end do
413 !
414 ! -- apply viscosity terms to inflow from boundary based on package type
415 select case (packobj%filtyp)
416 case ('GHB', 'DRN', 'RIV')
417 !
418 ! -- general head, drain, and river boundary
419 call vsc_ad_standard_bnd(packobj, hnew, this%visc, this%viscref, &
420 locelev, locvisc, locconc, this%dviscdc, &
421 this%cviscref, this%ivisc, this%a2, this%a3, &
422 this%a4, this%ctemp)
423 case ('LAK')
424 !
425 ! -- lake
426 ! Update 'viscratios' internal to lak such that they are
427 ! automatically applied in the LAK calc_cond() routine
428 call vsc_ad_lak(packobj, this%visc, this%viscref, this%elev, locvisc, &
429 locconc, this%dviscdc, this%cviscref, this%ivisc, &
430 this%a2, this%a3, this%a4, this%ctemp)
431 case ('SFR')
432 !
433 ! -- streamflow routing
434 ! Update 'viscratios' internal to sfr such that they are
435 ! automatically applied in the SFR calc_cond() routine
436 call vsc_ad_sfr(packobj, this%visc, this%viscref, this%elev, locvisc, &
437 locconc, this%dviscdc, this%cviscref, this%ivisc, &
438 this%a2, this%a3, this%a4, this%ctemp)
439 case ('MAW')
440 !
441 ! -- multi-aquifer well
442 call vsc_ad_maw(packobj, this%visc, this%viscref, this%elev, locvisc, &
443 locconc, this%dviscdc, this%cviscref, this%ivisc, &
444 this%a2, this%a3, this%a4, this%ctemp)
445 case ('UZF')
446 !
447 ! -- unsaturated-zone flow
448 case default
449 !
450 ! -- nothing
451 end select
452 !
453 ! -- deallocate
454 deallocate (locconc)
This module contains the base boundary package.
Here is the call graph for this function:

◆ vsc_ad_lak()

subroutine gwfvscmodule::vsc_ad_lak ( class(bndtype), pointer packobj,
real(dp), dimension(:), intent(in) visc,
real(dp), intent(in) viscref,
real(dp), dimension(:), intent(in) elev,
integer(i4b), intent(in) locvisc,
integer(i4b), dimension(:), intent(in) locconc,
real(dp), dimension(:), intent(in) dviscdc,
real(dp), dimension(:), intent(in) cviscref,
integer(i4b), dimension(:), intent(in) ivisc,
real(dp), intent(in) a2,
real(dp), intent(in) a3,
real(dp), intent(in) a4,
real(dp), dimension(:), intent(inout) ctemp )
private

When the viscosity package is active, update the viscosity ratio that is applied to the lakebed conductance calculated in the LAK package

Definition at line 556 of file gwf-vsc.f90.

558 ! -- modules
559 use bndmodule, only: bndtype
560 use lakmodule, only: laktype
561 class(BndType), pointer :: packobj
562 ! -- dummy
563 real(DP), intent(in) :: viscref
564 real(DP), intent(in) :: a2, a3, a4
565 integer(I4B), intent(in) :: locvisc
566 integer(I4B), dimension(:), intent(in) :: locconc
567 integer(I4B), dimension(:), intent(in) :: ivisc
568 real(DP), dimension(:), intent(in) :: visc
569 real(DP), dimension(:), intent(in) :: elev
570 real(DP), dimension(:), intent(in) :: dviscdc
571 real(DP), dimension(:), intent(in) :: cviscref
572 real(DP), dimension(:), intent(inout) :: ctemp
573 ! -- local
574 integer(I4B) :: n
575 integer(I4B) :: node
576 real(DP) :: visclak
577 !
578 ! -- update viscosity ratios for updating hyd. cond (and conductance)
579 select type (packobj)
580 type is (laktype)
581 do n = 1, packobj%nbound
582 !
583 ! -- get gwf node number
584 node = packobj%nodelist(n)
585 !
586 ! -- Check if boundary cell is active, cycle if not
587 if (packobj%ibound(node) <= 0) cycle
588 !
589 ! --
590 !
591 ! -- calculate the viscosity associated with the boundary
592 visclak = calc_bnd_viscosity(n, locvisc, locconc, viscref, dviscdc, &
593 cviscref, ctemp, ivisc, a2, a3, a4, &
594 packobj%auxvar)
595 !
596 ! -- fill lak relative viscosity into column 1 of viscratios
597 packobj%viscratios(1, n) = calc_vsc_ratio(viscref, visclak)
598 !
599 ! -- fill gwf relative viscosity into column 2 of viscratios
600 packobj%viscratios(2, n) = calc_vsc_ratio(viscref, visc(node))
601 end do
602 end select
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vsc_ad_maw()

subroutine gwfvscmodule::vsc_ad_maw ( class(bndtype), pointer packobj,
real(dp), dimension(:), intent(in) visc,
real(dp), intent(in) viscref,
real(dp), dimension(:), intent(in) elev,
integer(i4b), intent(in) locvisc,
integer(i4b), dimension(:), intent(in) locconc,
real(dp), dimension(:), intent(in) dviscdc,
real(dp), dimension(:), intent(in) cviscref,
integer(i4b), dimension(:), intent(in) ivisc,
real(dp), intent(in) a2,
real(dp), intent(in) a3,
real(dp), intent(in) a4,
real(dp), dimension(:), intent(inout) ctemp )
private

When the viscosity package is active, update the viscosity ratio that is applied to the conductance calculated in the MAW package

Definition at line 610 of file gwf-vsc.f90.

612 ! -- modules
613 use bndmodule, only: bndtype
614 use mawmodule, only: mawtype
615 class(BndType), pointer :: packobj
616 ! -- dummy
617 real(DP), intent(in) :: viscref
618 real(DP), intent(in) :: a2, a3, a4
619 integer(I4B), intent(in) :: locvisc
620 integer(I4B), dimension(:), intent(in) :: locconc
621 integer(I4B), dimension(:), intent(in) :: ivisc
622 real(DP), dimension(:), intent(in) :: visc
623 real(DP), dimension(:), intent(in) :: elev
624 real(DP), dimension(:), intent(in) :: dviscdc
625 real(DP), dimension(:), intent(in) :: cviscref
626 real(DP), dimension(:), intent(inout) :: ctemp
627 ! -- local
628 integer(I4B) :: n
629 integer(I4B) :: node
630 real(DP) :: viscmaw
631 !
632 ! -- update viscosity ratios for updating hyd. cond (and conductance)
633 select type (packobj)
634 type is (mawtype)
635 do n = 1, packobj%nbound
636 !
637 ! -- get gwf node number
638 node = packobj%nodelist(n)
639 !
640 ! -- Check if boundary cell is active, cycle if not
641 if (packobj%ibound(node) <= 0) cycle
642 !
643 ! --
644 !
645 ! -- calculate the viscosity associated with the boundary
646 viscmaw = calc_bnd_viscosity(n, locvisc, locconc, viscref, dviscdc, &
647 cviscref, ctemp, ivisc, a2, a3, a4, &
648 packobj%auxvar)
649 !
650 ! -- fill lak relative viscosity into column 1 of viscratios
651 packobj%viscratios(1, n) = calc_vsc_ratio(viscref, viscmaw)
652 !
653 ! -- fill gwf relative viscosity into column 2 of viscratios
654 packobj%viscratios(2, n) = calc_vsc_ratio(viscref, visc(node))
655 end do
656 end select
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vsc_ad_sfr()

subroutine gwfvscmodule::vsc_ad_sfr ( class(bndtype), pointer packobj,
real(dp), dimension(:), intent(in) visc,
real(dp), intent(in) viscref,
real(dp), dimension(:), intent(in) elev,
integer(i4b), intent(in) locvisc,
integer(i4b), dimension(:), intent(in) locconc,
real(dp), dimension(:), intent(in) dviscdc,
real(dp), dimension(:), intent(in) cviscref,
integer(i4b), dimension(:), intent(in) ivisc,
real(dp), intent(in) a2,
real(dp), intent(in) a3,
real(dp), intent(in) a4,
real(dp), dimension(:), intent(inout) ctemp )
private

When the viscosity package is active, update the viscosity ratio that is applied to the hydraulic conductivity specified in the SFR package

Definition at line 502 of file gwf-vsc.f90.

504 ! -- modules
505 use bndmodule, only: bndtype
506 use sfrmodule, only: sfrtype
507 class(BndType), pointer :: packobj
508 ! -- dummy
509 real(DP), intent(in) :: viscref
510 real(DP), intent(in) :: a2, a3, a4
511 integer(I4B), intent(in) :: locvisc
512 integer(I4B), dimension(:), intent(in) :: locconc
513 integer(I4B), dimension(:), intent(in) :: ivisc
514 real(DP), dimension(:), intent(in) :: visc
515 real(DP), dimension(:), intent(in) :: elev
516 real(DP), dimension(:), intent(in) :: dviscdc
517 real(DP), dimension(:), intent(in) :: cviscref
518 real(DP), dimension(:), intent(inout) :: ctemp
519 ! -- local
520 integer(I4B) :: n
521 integer(I4B) :: node
522 real(DP) :: viscsfr
523 !
524 ! -- update viscosity ratios for updating hyd. cond (and conductance)
525 select type (packobj)
526 type is (sfrtype)
527 do n = 1, packobj%nbound
528 !
529 ! -- get gwf node number
530 node = packobj%nodelist(n)
531 !
532 ! -- Check if boundary cell is active, cycle if not
533 if (packobj%ibound(node) <= 0) cycle
534 !
535 ! --
536 !
537 ! -- calculate the viscosity associated with the boundary
538 viscsfr = calc_bnd_viscosity(n, locvisc, locconc, viscref, dviscdc, &
539 cviscref, ctemp, ivisc, a2, a3, a4, &
540 packobj%auxvar)
541 !
542 ! -- fill sfr relative viscosity into column 1 of viscratios
543 packobj%viscratios(1, n) = calc_vsc_ratio(viscref, viscsfr)
544 !
545 ! -- fill gwf relative viscosity into column 2 of viscratios
546 packobj%viscratios(2, n) = calc_vsc_ratio(viscref, visc(node))
547 end do
548 end select
This module contains the SFR package methods.
Definition gwf-sfr.f90:7
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vsc_ad_standard_bnd()

subroutine gwfvscmodule::vsc_ad_standard_bnd ( class(bndtype), pointer packobj,
real(dp), dimension(:), intent(in) hnew,
real(dp), dimension(:), intent(in) visc,
real(dp), intent(in) viscref,
integer(i4b), intent(in) locelev,
integer(i4b), intent(in) locvisc,
integer(i4b), dimension(:), intent(in) locconc,
real(dp), dimension(:), intent(in) dviscdc,
real(dp), dimension(:), intent(in) cviscref,
integer(i4b), dimension(:), intent(in) ivisc,
real(dp), intent(in) a2,
real(dp), intent(in) a3,
real(dp), intent(in) a4,
real(dp), dimension(:), intent(inout) ctemp )
private

Set the viscosity ratio that the package applies to each boundary conductance

Definition at line 462 of file gwf-vsc.f90.

465 ! -- modules
466 use bndmodule, only: bndtype
467 class(BndType), pointer :: packobj
468 ! -- dummy
469 real(DP), intent(in), dimension(:) :: hnew
470 real(DP), intent(in), dimension(:) :: visc
471 real(DP), intent(in) :: a2, a3, a4
472 real(DP), intent(in) :: viscref
473 integer(I4B), intent(in) :: locelev
474 integer(I4B), intent(in) :: locvisc
475 integer(I4B), dimension(:), intent(in) :: locconc
476 integer(I4B), dimension(:), intent(in) :: ivisc
477 real(DP), dimension(:), intent(in) :: dviscdc
478 real(DP), dimension(:), intent(in) :: cviscref
479 real(DP), dimension(:), intent(inout) :: ctemp
480 ! -- local
481 integer(I4B) :: n
482 real(DP) :: viscbnd
483 !
484 ! -- Set the viscosity ratio for each boundary
485 do n = 1, packobj%nbound
486 !
487 ! -- calculate the viscosity associated with the boundary
488 viscbnd = calc_bnd_viscosity(n, locvisc, locconc, viscref, dviscdc, &
489 cviscref, ctemp, ivisc, a2, a3, a4, &
490 packobj%auxvar)
491 !
492 ! -- viscosity ratio applied to the boundary conductance
493 packobj%viscratio(n) = calc_vsc_ratio(viscref, viscbnd)
494 end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vsc_ar()

subroutine gwfvscmodule::vsc_ar ( class(gwfvsctype) this,
integer(i4b), dimension(:), pointer ibound )
private

Generic method to allocate and read static data for the viscosity package available within the GWF model type.

Definition at line 215 of file gwf-vsc.f90.

216 ! -- dummy
217 class(GwfVscType) :: this
218 integer(I4B), dimension(:), pointer :: ibound
219 !
220 ! -- store pointers to arguments that were passed in
221 this%ibound => ibound
222 !
223 ! -- Set pointers to npf variables
224 call this%set_npf_pointers()

◆ vsc_ar_bnd()

subroutine gwfvscmodule::vsc_ar_bnd ( class(gwfvsctype) this,
class(bndtype), pointer packobj )
private

Viscosity ar_bnd routine to activate viscosity in the advanced packages. This routine is called from gwf_ar() as it moves through each package

Definition at line 233 of file gwf-vsc.f90.

234 ! -- modules
235 use bndmodule, only: bndtype
236 use drnmodule, only: drntype
237 use ghbmodule, only: ghbtype
238 use rivmodule, only: rivtype
239 use lakmodule, only: laktype
240 use sfrmodule, only: sfrtype
241 use mawmodule, only: mawtype
242 ! -- dummy
243 class(GwfVscType) :: this
244 class(BndType), pointer :: packobj
245 !
246 ! -- Add density terms based on boundary package type
247 select case (packobj%filtyp)
248 case ('DRN')
249 !
250 ! -- activate viscosity for the drain package
251 select type (packobj)
252 type is (drntype)
253 call packobj%bnd_activate_viscosity()
254 end select
255 case ('GHB')
256 !
257 ! -- activate viscosity for the drain package
258 select type (packobj)
259 type is (ghbtype)
260 call packobj%bnd_activate_viscosity()
261 end select
262 case ('RIV')
263 !
264 ! -- activate viscosity for the drain package
265 select type (packobj)
266 type is (rivtype)
267 call packobj%bnd_activate_viscosity()
268 end select
269 case ('LAK')
270 !
271 ! -- activate viscosity for lake package
272 select type (packobj)
273 type is (laktype)
274 call packobj%lak_activate_viscosity()
275 end select
276 case ('SFR')
277 !
278 ! -- activate viscosity for sfr package
279 select type (packobj)
280 type is (sfrtype)
281 call packobj%sfr_activate_viscosity()
282 end select
283 case ('MAW')
284 !
285 ! -- activate viscosity for maw package
286 select type (packobj)
287 type is (mawtype)
288 call packobj%maw_activate_viscosity()
289 end select
290 case default
291 !
292 ! -- nothing
293 end select

◆ vsc_calcvisc()

subroutine gwfvscmodule::vsc_calcvisc ( class(gwfvsctype) this)
private

Calculates fluid viscosity based on concentration or temperature

Definition at line 1054 of file gwf-vsc.f90.

1055 ! -- dummy
1056 class(GwfVscType) :: this
1057 ! -- local
1058 integer(I4B) :: n
1059 integer(I4B) :: i
1060 !
1061 ! -- Calculate the viscosity using the specified concentration and/or
1062 ! temperature arrays
1063 do n = 1, this%dis%nodes
1064 do i = 1, this%nviscspecies
1065 if (this%modelconc(i)%icbund(n) == 0) then
1066 this%ctemp(i) = dzero
1067 else
1068 this%ctemp(i) = this%modelconc(i)%conc(n)
1069 end if
1070 end do
1071 !
1072 this%visc(n) = calc_visc(this%ivisc, this%viscref, this%dviscdc, &
1073 this%cviscref, this%ctemp, this%a2, &
1074 this%a3, this%a4)
1075 end do
Here is the call graph for this function:

◆ vsc_cr()

subroutine, public gwfvscmodule::vsc_cr ( type(gwfvsctype), pointer vscobj,
character(len=*), intent(in) name_model,
character(len=*), intent(in) input_mempath,
integer(i4b), intent(in) inunit,
integer(i4b), intent(in) iout )

Create a new VSC Package object.

Definition at line 142 of file gwf-vsc.f90.

143 ! -- dummy
144 type(GwfVscType), pointer :: vscobj
145 character(len=*), intent(in) :: name_model
146 character(len=*), intent(in) :: input_mempath
147 integer(I4B), intent(in) :: inunit
148 integer(I4B), intent(in) :: iout
149 !
150 ! -- Create the object
151 allocate (vscobj)
152 !
153 ! -- create name and memory path
154 call vscobj%set_names(1, name_model, 'VSC', 'VSC', input_mempath)
155 !
156 ! -- Allocate scalars
157 call vscobj%allocate_scalars()
158 !
159 ! -- Set variables
160 vscobj%inunit = inunit
161 vscobj%iout = iout
Here is the caller graph for this function:

◆ vsc_da()

subroutine gwfvscmodule::vsc_da ( class(gwfvsctype) this)
private

Deallocate viscosity package scalars and arrays.

Definition at line 853 of file gwf-vsc.f90.

854 ! -- dummy
855 class(GwfVscType) :: this
856 !
857 ! -- Deallocate arrays if package was active
858 if (this%inunit > 0) then
859 call mem_deallocate(this%visc)
860 call mem_deallocate(this%ivisc)
861 call mem_deallocate(this%dviscdc)
862 call mem_deallocate(this%cviscref)
863 call mem_deallocate(this%ctemp)
864 deallocate (this%cmodelname)
865 deallocate (this%cauxspeciesname)
866 deallocate (this%modelconc)
867 end if
868 !
869 ! -- Scalars
870 call mem_deallocate(this%thermivisc)
871 call mem_deallocate(this%idxtmpr)
872 call mem_deallocate(this%ioutvisc)
873 call mem_deallocate(this%ireadelev)
874 call mem_deallocate(this%iconcset)
875 call mem_deallocate(this%viscref)
876 call mem_deallocate(this%nviscspecies)
877 call mem_deallocate(this%a2)
878 call mem_deallocate(this%a3)
879 call mem_deallocate(this%a4)
880 !
881 ! -- Nullify pointers to other package variables
882 nullify (this%k11)
883 nullify (this%k22)
884 nullify (this%k33)
885 nullify (this%k11input)
886 nullify (this%k22input)
887 nullify (this%k33input)
888 nullify (this%kchangeper)
889 nullify (this%kchangestp)
890 nullify (this%nodekchange)
891 !
892 ! -- deallocate parent
893 call this%NumericalPackageType%da()

◆ vsc_df()

subroutine gwfvscmodule::vsc_df ( class(gwfvsctype) this,
class(disbasetype), intent(in), pointer dis,
type(gwfvscinputdatatype), intent(in), optional vsc_input )
private

Define viscosity package options and dimensions

Parameters
thisthis viscosity package
[in]dispointer to discretization
[in]vsc_inputoptional vsc input data, otherwise read from file

Definition at line 168 of file gwf-vsc.f90.

169 ! -- dummy
170 class(GwfVscType) :: this !< this viscosity package
171 class(DisBaseType), pointer, intent(in) :: dis !< pointer to discretization
172 type(GwfVscInputDataType), optional, intent(in) :: vsc_input !< optional vsc input data, otherwise read from file
173 ! -- formats
174 character(len=*), parameter :: fmtvsc = &
175 "(1x,/1x,'VSC -- Viscosity Package, version 1, 11/15/2022', &
176 &' input read from mempath: ', a, /)"
177 !
178 ! --print a message identifying the viscosity package
179 write (this%iout, fmtvsc) this%input_mempath
180 !
181 ! -- store pointers to arguments that were passed in
182 this%dis => dis
183 !
184 if (.not. present(vsc_input)) then
185 !
186 ! -- Read viscosity options
187 call this%source_options()
188 !
189 ! -- Read viscosity dimensions
190 call this%source_dimensions()
191 else
192 ! set from input data instead
193 call this%set_options(vsc_input)
194 this%nviscspecies = vsc_input%nviscspecies
195 end if
196 !
197 ! -- Allocate arrays
198 call this%allocate_arrays(dis%nodes)
199 !
200 if (.not. present(vsc_input)) then
201 !
202 ! -- Read viscosity packagedata
203 call this%source_packagedata()
204 else
205 ! set from input data instead
206 call this%set_packagedata(vsc_input)
207 end if

◆ vsc_ot_dv()

subroutine gwfvscmodule::vsc_ot_dv ( class(gwfvsctype) this,
integer(i4b), intent(in) idvfl )
private

Save calculated viscosity array to binary file

Definition at line 814 of file gwf-vsc.f90.

815 ! -- dummy
816 class(GwfVscType) :: this
817 integer(I4B), intent(in) :: idvfl
818 ! -- local
819 character(len=1) :: cdatafmp = ' ', editdesc = ' '
820 integer(I4B) :: ibinun
821 integer(I4B) :: iprint
822 integer(I4B) :: nvaluesp
823 integer(I4B) :: nwidthp
824 real(DP) :: dinact
825 !
826 ! -- Set unit number for viscosity output
827 if (this%ioutvisc /= 0) then
828 ibinun = 1
829 else
830 ibinun = 0
831 end if
832 if (idvfl == 0) ibinun = 0
833 !
834 ! -- save viscosity array
835 if (ibinun /= 0) then
836 iprint = 0
837 dinact = dhnoflo
838 !
839 ! -- write viscosity to binary file
840 if (this%ioutvisc /= 0) then
841 ibinun = this%ioutvisc
842 call this%dis%record_array(this%visc, this%iout, iprint, ibinun, &
843 ' VISCOSITY', cdatafmp, nvaluesp, &
844 nwidthp, editdesc, dinact)
845 end if
846 end if

◆ vsc_rp()

subroutine gwfvscmodule::vsc_rp ( class(gwfvsctype) this)
private

Method to read and prepare period data for the VSC package.

Definition at line 325 of file gwf-vsc.f90.

326 ! -- modules
327 use tdismodule, only: kstp, kper
328 ! -- dummy
329 class(GwfVscType) :: this
330 ! -- local
331 integer(I4B) :: i
332 ! -- formats
333 character(len=*), parameter :: fmtc = &
334 "('Viscosity Package does not have a concentration set &
335 &for species ',i0,'. One or more model names may be specified &
336 &incorrectly in the PACKAGEDATA block or a GWF-GWT exchange may need &
337 &to be activated.')"
338 !
339 ! -- Check to make sure all concentration pointers have been set
340 if (kstp * kper == 1) then
341 do i = 1, this%nviscspecies
342 if (.not. associated(this%modelconc(i)%conc)) then
343 write (errmsg, fmtc) i
344 call store_error(errmsg)
345 end if
346 end do
347 if (count_errors() > 0) then
348 call store_error_filename(this%input_fname)
349 end if
350 end if
integer(i4b), pointer, public kstp
current time step number
Definition tdis.f90:27
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26
Here is the call graph for this function:

◆ vsc_set_changed_at()

subroutine gwfvscmodule::vsc_set_changed_at ( class(gwfvsctype) this,
integer(i4b), intent(in) kper,
integer(i4b), intent(in) kstp )
private

Procedure called by VSC code when K updated due to viscosity changes. K values changed at (kper, kstp).

Definition at line 800 of file gwf-vsc.f90.

801 ! -- dummy variables
802 class(GwfVscType) :: this
803 integer(I4B), intent(in) :: kper
804 integer(I4B), intent(in) :: kstp
805 !
806 this%kchangeper = kper
807 this%kchangestp = kstp