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

This module contains the CSUB package methods. More...

Data Types

type  gwfcsubtype

Enumerations

enum  { storage_unset = -1 , storage_elastic = 0 , storage_inelastic = 1 }
 Interbed storage state. More...
enum  { interbed_elastic_inelastic = 0 , interbed_elastic = 1 }
 Interbed type. More...
enum  { storage_input_compression_index = 0 , storage_input_specific_storage = 1 }
 Interbed storage input. More...

Functions/Subroutines

subroutine, public csub_cr (csubobj, name_model, mempath, istounit, stopckname, inunit, iout)
 Create a new package object.
subroutine csub_ar (this, dis, ibound)
 Allocate and read method for package.
subroutine csub_rp (this)
 Read and prepare stress period data for package.
subroutine csub_ad (this, nodes, hnew)
 Advance the package.
subroutine csub_fc (this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
 Fill A and r for the package.
subroutine csub_fn (this, kiter, hold, hnew, matrix_sln, idxglo, rhs)
 Fill Newton-Raphson terms in A and r for the package.
real(dp) function csub_calc_interbed_thickness (this, ib)
 Calculate the interbed thickness.
real(dp) function csub_calc_znode (this, top, bottom, zbar)
 Calculate the cell node.
subroutine csub_calc_sat (this, node, hcell, hcellold, snnew, snold)
 Calculate cell saturation.
real(dp) function csub_calc_sat_derivative (this, node, hcell)
 Calculate the saturation derivative.
subroutine csub_calc_sfacts (this, node, bot, znode, theta, es, es0, geo, fact)
 Calculate specific storage coefficient factor.

Variables

real(dp), parameter dlog10es = 0.4342942_DP
 derivative of the log of effective stress
real(dp), parameter stressfloor = DEM3
 effective-stress regularization floor (fraction of geostatic stress)

Detailed Description

This module contains the methods used to add the effects of elastic skeletal storage, compaction, and subsidence on the groundwater flow equation. The contribution of elastic skelatal, inelastic and elastic interbed storage and water compressibility can be represented.

This file holds the type, the interfaces, the create, allocate and read, read and prepare, advance, and fill routines, and the shared helpers. The other procedures are in submodules/gwf-csub-*.f90:

  • memory: allocation and deallocation
  • input: options, dimensions, griddata, and packagedata
  • stress: initial states and coarse-grained stresses
  • coarse: coarse-grained storage
  • nodelay: no-delay interbed storage
  • delay: delay interbeds
  • budget: convergence check, flows, and budget
  • output: final processing and dependent variable output
  • obs: observations

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
storage_unset 

no state recorded

storage_elastic 

effective stress not above preconsolidation stress

storage_inelastic 

effective stress above preconsolidation stress

Definition at line 71 of file gwf-csub.f90.

◆ anonymous enum

anonymous enum
private
Enumerator
interbed_elastic_inelastic 

elastic and inelastic storage

interbed_elastic 

elastic storage only

Definition at line 79 of file gwf-csub.f90.

◆ anonymous enum

anonymous enum
private
Enumerator
storage_input_compression_index 

compression indices

storage_input_specific_storage 

specific storage coefficients

Definition at line 86 of file gwf-csub.f90.

Function/Subroutine Documentation

◆ csub_ad()

subroutine gwfcsubmodule::csub_ad ( class(gwfcsubtype) this,
integer(i4b), intent(in) nodes,
real(dp), dimension(nodes), intent(in) hnew )
private

Advance data in the CSUB package. The method sets data for the previous time step to the current value for the data (e.g., HOLD = HNEW). The method also calls the method to initialize the initial stress conditions if this is the first transient stress period.

Parameters
[in]nodesnumber of active model nodes
[in]hnewcurrent head

Definition at line 1426 of file gwf-csub.f90.

1427 ! -- modules
1428 use tdismodule, only: nper, kper
1429 ! -- dummy variables
1430 class(GwfCsubType) :: this
1431 integer(I4B), intent(in) :: nodes !< number of active model nodes
1432 real(DP), dimension(nodes), intent(in) :: hnew !< current head
1433 ! -- local variables
1434 integer(I4B) :: ib
1435 integer(I4B) :: n
1436 integer(I4B) :: idelay
1437 integer(I4B) :: node
1438 real(DP) :: h
1439 real(DP) :: es
1440 real(DP) :: pcs
1441 !
1442 ! -- evaluate if steady-state stress periods are specified for more
1443 ! than the first and last stress period if interbeds are simulated
1444 if (this%ninterbeds > 0) then
1445 if (kper > 1 .and. kper < nper) then
1446 if (this%gwfiss /= 0) then
1447 write (errmsg, '(a,i0,a,1x,a,1x,a,1x,i0,1x,a)') &
1448 'Only the first and last (', nper, ')', &
1449 'stress period can be steady if interbeds are simulated.', &
1450 'Stress period', kper, 'has been defined to be steady state.'
1451 call store_error(errmsg, terminate=.true.)
1452 end if
1453 end if
1454 end if
1455 !
1456 ! -- set initial states
1457 if (this%initialized == 0) then
1458 if (this%gwfiss == 0) then
1459 call this%csub_set_initial_state(nodes, hnew)
1460 end if
1461 end if
1462 !
1463 ! -- update state variables
1464 !
1465 ! -- coarse-grained materials
1466 do node = 1, nodes
1467 this%cg_comp(node) = dzero
1468 this%cg_es0(node) = this%cg_es(node)
1469 if (this%iupdatematprop /= 0) then
1470 this%cg_thick0(node) = this%cg_thick(node)
1471 this%cg_theta0(node) = this%cg_theta(node)
1472 end if
1473 end do
1474 !
1475 ! -- interbeds
1476 do ib = 1, this%ninterbeds
1477 idelay = this%idelay(ib)
1478 !
1479 ! -- update common terms for no-delay and delay interbeds
1480 this%comp(ib) = dzero
1481 node = this%nodelist(ib)
1482 if (this%initialized /= 0) then
1483 es = this%cg_es(node)
1484 pcs = this%pcs(ib)
1485 if (es > pcs) then
1486 this%pcs(ib) = es
1487 end if
1488 end if
1489 if (this%iupdatematprop /= 0) then
1490 this%thick0(ib) = this%thick(ib)
1491 this%theta0(ib) = this%theta(ib)
1492 end if
1493 !
1494 ! -- update delay interbed terms
1495 if (idelay /= 0) then
1496 !
1497 ! -- update state if previous period was steady state
1498 if (kper > 1) then
1499 if (this%gwfiss0 /= 0) then
1500 node = this%nodelist(ib)
1501 h = hnew(node)
1502 do n = 1, this%ndelaycells
1503 this%dbh(n, idelay) = h
1504 end do
1505 end if
1506 end if
1507 !
1508 ! -- update preconsolidation stress, stresses, head, dbdz0, and theta0
1509 do n = 1, this%ndelaycells
1510 ! update preconsolidation stress
1511 if (this%initialized /= 0) then
1512 if (this%dbes(n, idelay) > this%dbpcs(n, idelay)) then
1513 this%dbpcs(n, idelay) = this%dbes(n, idelay)
1514 end if
1515 end if
1516 this%dbh0(n, idelay) = this%dbh(n, idelay)
1517 this%dbes0(n, idelay) = this%dbes(n, idelay)
1518 if (this%iupdatematprop /= 0) then
1519 this%dbdz0(n, idelay) = this%dbdz(n, idelay)
1520 this%dbtheta0(n, idelay) = this%dbtheta(n, idelay)
1521 end if
1522 end do
1523 end if
1524 end do
1525 !
1526 ! -- set gwfiss0
1527 this%gwfiss0 = this%gwfiss
1528 !
1529 ! -- For each observation, push simulated value and corresponding
1530 ! simulation time from "current" to "preceding" and reset
1531 ! "current" value.
1532 call this%obs%obs_ad()
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26
integer(i4b), pointer, public nper
number of stress period
Definition tdis.f90:24
Here is the call graph for this function:

◆ csub_ar()

subroutine gwfcsubmodule::csub_ar ( class(gwfcsubtype), intent(inout) this,
class(disbasetype), intent(in), pointer dis,
integer(i4b), dimension(:), pointer, contiguous ibound )
private

Method to allocate and read static data for the CSUB package.

Parameters
[in]dismodel discretization
iboundmodel ibound array

Definition at line 1108 of file gwf-csub.f90.

1109 ! -- modules
1111 use constantsmodule, only: linelength
1112 use kindmodule, only: i4b
1113 ! -- dummy variables
1114 class(GwfCsubType), intent(inout) :: this
1115 class(DisBaseType), pointer, intent(in) :: dis !< model discretization
1116 integer(I4B), dimension(:), pointer, contiguous :: ibound !< model ibound array
1117 ! -- local variables
1118 character(len=20) :: cellid
1119 integer(I4B) :: idelay
1120 integer(I4B) :: ib
1121 integer(I4B) :: node
1122 integer(I4B) :: n
1123 integer(I4B) :: istoerr
1124 real(DP) :: top
1125 real(DP) :: bot
1126 real(DP) :: thick
1127 real(DP) :: cg_ske_cr
1128 real(DP) :: theta
1129 real(DP) :: v
1130 real(DP) :: vtot
1131 real(DP) :: cell_thickness
1132 real(DP) :: overshoot
1133 real(DP) :: f
1134 real(DP) :: rval
1135 ! -- format
1136 character(len=*), parameter :: fmtcsub = &
1137 "(1x,/1x,'CSUB -- COMPACTION PACKAGE, VERSION 1.15, 7/27/2026', &
1138 &' INPUT READ FROM MEMPATH: ', A, /)"
1139 !
1140 ! --print a message identifying the csub package.
1141 write (this%iout, fmtcsub) this%input_mempath
1142 !
1143 ! -- store pointers to arguments that were passed in
1144 this%dis => dis
1145 this%ibound => ibound
1146 !
1147 ! -- create obs package
1148 call obs_cr(this%obs, this%inobspkg)
1149 !
1150 ! -- source csub options
1151 call this%source_options()
1152 !
1153 ! -- source the csub dimensions
1154 call this%source_dimensions()
1155 !
1156 ! - observation data
1157 call this%obs%obs_ar()
1158 !
1159 ! -- terminate if errors dimensions block data
1160 if (count_errors() > 0) then
1161 call store_error_filename(this%input_fname)
1162 end if
1163
1164 ! -- Allocate arrays in
1165 call this%csub_allocate_arrays()
1166 !
1167 ! -- source griddata
1168 call this%csub_source_griddata()
1169 !
1170 ! -- evaluate the coarse-grained material properties and if
1171 ! non-zero specific storage values are specified in the
1172 ! STO package
1173 istoerr = 0
1174 do node = 1, this%dis%nodes
1175 call this%dis%noder_to_string(node, cellid)
1176 cg_ske_cr = this%cg_ske_cr(node)
1177 theta = this%cg_thetaini(node)
1178 !
1179 ! -- coarse-grained storage error condition
1180 if (cg_ske_cr < dzero) then
1181 write (errmsg, '(a,g0,a,1x,a,1x,a,a)') &
1182 'Coarse-grained material CG_SKE_CR (', cg_ske_cr, ') is less', &
1183 'than zero in cell', trim(adjustl(cellid)), '.'
1184 end if
1185 !
1186 ! -- storage (STO) package error condition
1187 if (this%stoss(node) /= dzero) then
1188 istoerr = 1
1189 end if
1190 !
1191 ! -- porosity error condition
1192 if (theta > done .or. theta < dzero) then
1193 write (errmsg, '(a,g0,a,1x,a,1x,a,a)') &
1194 'Coarse-grained material THETA (', theta, ') is less', &
1195 'than zero or greater than 1 in cell', trim(adjustl(cellid)), '.'
1196 end if
1197 end do
1198 !
1199 ! -- write single message if storage (STO) package has non-zero specific
1200 ! storage values
1201 if (istoerr /= 0) then
1202 write (errmsg, '(a,3(1x,a))') &
1203 'Specific storage values in the storage (STO) package must', &
1204 'be zero in all active cells when using the', &
1205 trim(adjustl(this%packName)), &
1206 'package.'
1207 call store_error(errmsg)
1208 end if
1209 !
1210 ! -- source interbed data
1211 if (this%ninterbeds > 0) then
1212 call this%csub_source_packagedata()
1213 end if
1214 !
1215 ! setup package convergence tables
1216 call this%csub_initialize_tables()
1217 !
1218 ! -- calculate the coarse-grained material thickness without the interbeds
1219 do node = 1, this%dis%nodes
1220 top = this%dis%top(node)
1221 bot = this%dis%bot(node)
1222 this%cg_thickini(node) = top - bot
1223 this%cell_thick(node) = top - bot
1224 end do
1225 !
1226 ! -- subtract the interbed thickness from aquifer thickness
1227 do ib = 1, this%ninterbeds
1228 node = this%nodelist(ib)
1229 idelay = this%idelay(ib)
1230 if (idelay == 0) then
1231 v = this%thickini(ib)
1232 else
1233 v = this%rnb(ib) * this%thickini(ib)
1234 end if
1235 this%cg_thickini(node) = this%cg_thickini(node) - v
1236 end do
1237 !
1238 ! -- evaluate if the interbed thicknesses in a cell exceed the cell
1239 ! thickness (cg_thickini < 0). A small excess (numerical roundoff in the
1240 ! summed interbed thicknesses) is resolved by proportionally scaling the
1241 ! cell's interbed thicknesses to fit; a larger excess is a genuine
1242 ! over-specification and is an error
1243 do node = 1, this%dis%nodes
1244 thick = this%cg_thickini(node)
1245 if (thick >= dzero) cycle
1246 cell_thickness = this%cell_thick(node)
1247 overshoot = -thick
1248 if (overshoot <= dem5 * cell_thickness) then
1249 ! -- roundoff: scale the cell's interbed thicknesses so they fill the
1250 ! cell exactly (cell_thickness - thick is the summed interbed
1251 ! thickness, which exceeds cell_thickness by overshoot)
1252 f = cell_thickness / (cell_thickness - thick)
1253 do ib = 1, this%ninterbeds
1254 if (node /= this%nodelist(ib)) cycle
1255 this%thickini(ib) = this%thickini(ib) * f
1256 if (this%iupdatematprop /= 0) then
1257 this%thick(ib) = this%thick(ib) * f
1258 end if
1259 idelay = this%idelay(ib)
1260 if (idelay /= 0) then
1261 rval = this%thickini(ib) / real(this%ndelaycells, dp)
1262 do n = 1, this%ndelaycells
1263 this%dbdzini(n, idelay) = rval
1264 this%dbdz(n, idelay) = rval
1265 this%dbdz0(n, idelay) = rval
1266 end do
1267 ! -- recompute delay-bed cell elevations from the scaled thickness
1268 call this%csub_delay_init_zcell(ib)
1269 end if
1270 end do
1271 this%cg_thickini(node) = dzero
1272 else
1273 call this%dis%noder_to_string(node, cellid)
1274 write (errmsg, '(a,g0,a,1x,a,a)') &
1275 'Coarse grained material thickness is less than zero (', &
1276 thick, ') in cell', trim(adjustl(cellid)), '. Interbed thicknesses:'
1277
1278 vtot = dzero
1279 do ib = 1, this%ninterbeds
1280 if (node /= this%nodelist(ib)) then
1281 cycle
1282 end if
1283 idelay = this%idelay(ib)
1284 v = this%thickini(ib)
1285 if (idelay /= 0) then
1286 v = v * this%rnb(ib)
1287 end if
1288 vtot = vtot + v
1289 write (errmsg, '(a,1x,a,i0,a,g0)') &
1290 trim(adjustl(errmsg)), &
1291 'icbno(', ib, ')=', v
1292 end do
1293 write (errmsg, '(a,a,g0,a)') &
1294 trim(adjustl(errmsg)), &
1295 '. Total interbed thickness=', vtot, '.'
1296 call store_error(errmsg)
1297 end if
1298 end do
1299 !
1300 ! -- terminate if errors griddata, packagedata blocks, TDIS, or STO data
1301 if (count_errors() > 0) then
1302 call store_error_filename(this%input_fname)
1303 end if
1304 !
1305 ! -- set current coarse-grained thickness (cg_thick) and
1306 ! current coarse-grained porosity (cg_theta). Only needed
1307 ! if updating material properties
1308 if (this%iupdatematprop /= 0) then
1309 do node = 1, this%dis%nodes
1310 this%cg_thick(node) = this%cg_thickini(node)
1311 this%cg_theta(node) = this%cg_thetaini(node)
1312 end do
1313 end if
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
@ dis
DIS6 discretization.
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
real(dp), parameter dem5
real constant 1e-5
real(dp), parameter done
real constant 1
Definition Constants.f90:76
This module defines variable data types.
Definition kind.f90:8
Here is the call graph for this function:

◆ csub_calc_interbed_thickness()

real(dp) function gwfcsubmodule::csub_calc_interbed_thickness ( class(gwfcsubtype), intent(inout) this,
integer(i4b), intent(in) ib )
private

Function to calculate the interbed thickness.

Returns
thick interbed thickness
Parameters
[in]ibinterbed number

Definition at line 1751 of file gwf-csub.f90.

1752 ! -- dummy variables
1753 class(GwfCsubType), intent(inout) :: this
1754 integer(I4B), intent(in) :: ib !< interbed number
1755 ! -- local variables
1756 integer(I4B) :: idelay
1757 real(DP) :: thick
1758 !
1759 ! -- calculate interbed thickness
1760 idelay = this%idelay(ib)
1761 thick = this%thick(ib)
1762 if (idelay /= 0) then
1763 thick = thick * this%rnb(ib)
1764 end if

◆ csub_calc_sat()

subroutine gwfcsubmodule::csub_calc_sat ( class(gwfcsubtype), intent(inout) this,
integer(i4b), intent(in) node,
real(dp), intent(in) hcell,
real(dp), intent(in) hcellold,
real(dp), intent(inout) snnew,
real(dp), intent(inout) snold )
private

Method to calculate the cell saturation for the current and previous time step.

Parameters
[in]nodecell node number
[in]hcellcurrent head
[in]hcelloldprevious head
[in,out]snnewcurrent saturation
[in,out]snoldprevious saturation

Definition at line 1801 of file gwf-csub.f90.

1802 ! -- dummy variables
1803 class(GwfCsubType), intent(inout) :: this
1804 integer(I4B), intent(in) :: node !< cell node number
1805 real(DP), intent(in) :: hcell !< current head
1806 real(DP), intent(in) :: hcellold !< previous head
1807 real(DP), intent(inout) :: snnew !< current saturation
1808 real(DP), intent(inout) :: snold !< previous saturation
1809 ! -- local variables
1810 real(DP) :: top
1811 real(DP) :: bot
1812 !
1813 ! -- calculate cell saturation
1814 if (this%stoiconv(node) /= 0) then
1815 top = this%dis%top(node)
1816 bot = this%dis%bot(node)
1817 snnew = squadraticsaturation(top, bot, hcell, this%satomega)
1818 snold = squadraticsaturation(top, bot, hcellold, this%satomega)
1819 else
1820 snnew = done
1821 snold = done
1822 end if
1823 if (this%ieslag /= 0) then
1824 snold = snnew
1825 end if
Here is the call graph for this function:

◆ csub_calc_sat_derivative()

real(dp) function gwfcsubmodule::csub_calc_sat_derivative ( class(gwfcsubtype), intent(inout) this,
integer(i4b), intent(in) node,
real(dp), intent(in) hcell )
private

Function to calculate the derivative of the saturation with respect to the current head.

Returns
satderv derivative of saturation
Parameters
[in]nodecell node number
[in]hcellcurrent head

Definition at line 1835 of file gwf-csub.f90.

1836 ! -- dummy variables
1837 class(GwfCsubType), intent(inout) :: this
1838 integer(I4B), intent(in) :: node !< cell node number
1839 real(DP), intent(in) :: hcell !< current head
1840 ! -- local variables
1841 real(DP) :: satderv
1842 real(DP) :: top
1843 real(DP) :: bot
1844
1845 if (this%stoiconv(node) /= 0) then
1846 top = this%dis%top(node)
1847 bot = this%dis%bot(node)
1848 satderv = squadraticsaturationderivative(top, bot, hcell, this%satomega)
1849 else
1850 satderv = dzero
1851 end if
Here is the call graph for this function:

◆ csub_calc_sfacts()

subroutine gwfcsubmodule::csub_calc_sfacts ( class(gwfcsubtype), intent(inout) this,
integer(i4b), intent(in) node,
real(dp), intent(in) bot,
real(dp), intent(in) znode,
real(dp), intent(in) theta,
real(dp), intent(in) es,
real(dp), intent(in) es0,
real(dp), intent(in) geo,
real(dp), intent(inout) fact )
private

Method to calculate the factor that is used to calculate skeletal specific storage coefficients. Can be used for coarse-grained materials and interbeds.

Parameters
[in]nodecell node number
[in]thetaporosity
[in]escurrent effective stress
[in]es0previous effective stress
[in]geogeostatic stress (regularization reference)
[in,out]factskeletal storage coefficient factor (1/((1+void_ratio)*bar(es)))

Definition at line 1860 of file gwf-csub.f90.

1861 ! -- dummy variables
1862 class(GwfCsubType), intent(inout) :: this
1863 integer(I4B), intent(in) :: node !< cell node number
1864 real(DP), intent(in) :: bot !
1865 real(DP), intent(in) :: znode
1866 real(DP), intent(in) :: theta !< porosity
1867 real(DP), intent(in) :: es !< current effective stress
1868 real(DP), intent(in) :: es0 !< previous effective stress
1869 real(DP), intent(in) :: geo !< geostatic stress (regularization reference)
1870 real(DP), intent(inout) :: fact !< skeletal storage coefficient factor (1/((1+void_ratio)*bar(es)))
1871 ! -- local variables
1872 real(DP) :: esv
1873 real(DP) :: adjes
1874 real(DP) :: esfloor
1875 !
1876 ! -- initialize variables
1877 fact = dzero
1878 if (this%ieslag /= 0) then
1879 esv = es0
1880 else
1881 esv = es
1882 end if
1883 !
1884 ! -- effective stress adjusted to the vertical node position
1885 adjes = adjust_eff_stress(esv, bot, znode, this%sgs(node))
1886 !
1887 ! -- smoothly floor the adjusted effective stress at stressfloor * geo so the
1888 ! storage factor (1/es) stays bounded and positive as es approaches zero;
1889 ! unchanged above the floor, disabled by STRICT_EFFECTIVE_STRESS
1890 if (this%istrict_stress == 0 .and. geo > dzero) then
1891 esfloor = stressfloor * geo
1892 adjes = squadratic0sp(adjes, esfloor, esfloor)
1893 end if
1894 !
1895 ! -- calculate storage factors for the effective stress case
1896 fact = storage_factor(adjes, theta)
Here is the call graph for this function:

◆ csub_calc_znode()

real(dp) function gwfcsubmodule::csub_calc_znode ( class(gwfcsubtype), intent(inout) this,
real(dp), intent(in) top,
real(dp), intent(in) bottom,
real(dp), intent(in) zbar )
private

Function to calculate elevation of the node between the specified corrected elevation zbar and the bottom elevation. If zbar is greater than the top elevation, the node elevation is halfway between the top and bottom elevations. The corrected elevation (zbar) is always greater than or equal to bottom.

Returns
znode node elevation
Parameters
[in]toptop of cell
[in]bottombottom of cell
[in]zbarcorrected elevation

Definition at line 1777 of file gwf-csub.f90.

1778 ! -- dummy variables
1779 class(GwfCsubType), intent(inout) :: this
1780 real(DP), intent(in) :: top !< top of cell
1781 real(DP), intent(in) :: bottom !< bottom of cell
1782 real(DP), intent(in) :: zbar !< corrected elevation
1783 ! -- local variables
1784 real(DP) :: znode
1785 real(DP) :: v
1786 !
1787 ! -- calculate the node elevation
1788 if (zbar > top) then
1789 v = top
1790 else
1791 v = zbar
1792 end if
1793 znode = dhalf * (v + bottom)

◆ csub_cr()

subroutine, public gwfcsubmodule::csub_cr ( type(gwfcsubtype), pointer csubobj,
character(len=*), intent(in) name_model,
character(len=*), intent(in) mempath,
integer(i4b), intent(in) istounit,
character(len=*), intent(in) stopckname,
integer(i4b), intent(in) inunit,
integer(i4b), intent(in) iout )

Create a new CSUB object

Parameters
csubobjpointer to default package type
[in]name_modelmodel name
[in]mempathinput context mem path
[in]inunitunit number of csub input file
[in]istounitunit number of storage package
[in]stopcknamename of the storage package
[in]ioutunit number of lst output file

Definition at line 1073 of file gwf-csub.f90.

1075 ! -- dummy variables
1076 type(GwfCsubType), pointer :: csubobj !< pointer to default package type
1077 character(len=*), intent(in) :: name_model !< model name
1078 character(len=*), intent(in) :: mempath !< input context mem path
1079 integer(I4B), intent(in) :: inunit !< unit number of csub input file
1080 integer(I4B), intent(in) :: istounit !< unit number of storage package
1081 character(len=*), intent(in) :: stoPckName !< name of the storage package
1082 integer(I4B), intent(in) :: iout !< unit number of lst output file
1083 ! -- local variables
1084 !
1085 ! -- allocate the object and assign values to object variables
1086 allocate (csubobj)
1087
1088 ! -- create name and memory path
1089 call csubobj%set_names(1, name_model, 'CSUB', 'CSUB', mempath)
1090 !
1091 ! -- Allocate scalars
1092 call csubobj%csub_allocate_scalars()
1093 !
1094 ! -- Create memory path to variables from STO package
1095 csubobj%stoMemPath = create_mem_path(name_model, stopckname)
1096 !
1097 ! -- Set variables
1098 csubobj%istounit = istounit
1099 csubobj%inunit = inunit
1100 csubobj%iout = iout
Here is the call graph for this function:
Here is the caller graph for this function:

◆ csub_fc()

subroutine gwfcsubmodule::csub_fc ( class(gwfcsubtype) this,
integer(i4b), intent(in) kiter,
real(dp), dimension(:), intent(in) hold,
real(dp), dimension(:), intent(in) hnew,
class(matrixbasetype), pointer matrix_sln,
integer(i4b), dimension(:), intent(in) idxglo,
real(dp), dimension(:), intent(inout) rhs )
private

Fill the coefficient matrix and right-hand side with the CSUB package terms.

Parameters
[in]kiterouter iteration numbed
[in]holdprevious heads
[in]hnewcurrent heads
matrix_slnA matrix
[in]idxgloglobal index model to solution
[in,out]rhsright-hand side

Definition at line 1540 of file gwf-csub.f90.

1541 ! -- modules
1542 use tdismodule, only: delt
1543 ! -- dummy variables
1544 class(GwfCsubType) :: this
1545 integer(I4B), intent(in) :: kiter !< outer iteration numbed
1546 real(DP), intent(in), dimension(:) :: hold !< previous heads
1547 real(DP), intent(in), dimension(:) :: hnew !< current heads
1548 class(MatrixBaseType), pointer :: matrix_sln !< A matrix
1549 integer(I4B), intent(in), dimension(:) :: idxglo !< global index model to solution
1550 real(DP), intent(inout), dimension(:) :: rhs !< right-hand side
1551 ! -- local variables
1552 integer(I4B) :: ib
1553 integer(I4B) :: node
1554 integer(I4B) :: idiag
1555 integer(I4B) :: idelay
1556 real(DP) :: tled
1557 real(DP) :: area
1558 real(DP) :: hcof
1559 real(DP) :: rhsterm
1560 real(DP) :: comp
1561 !
1562 ! -- update geostatic load calculation
1563 call this%csub_cg_calc_stress(this%dis%nodes, hnew)
1564 !
1565 ! -- formulate csub terms
1566 if (this%gwfiss == 0) then
1567 !
1568 ! -- initialize tled
1569 tled = done / delt
1570 !
1571 ! -- coarse-grained storage
1572 do node = 1, this%dis%nodes
1573 idiag = this%dis%con%ia(node)
1574 area = this%dis%get_area(node)
1575 !
1576 ! -- skip inactive cells
1577 if (this%ibound(node) < 1) cycle
1578 !
1579 ! -- update coarse-grained material properties
1580 if (this%iupdatematprop /= 0) then
1581 if (this%ieslag == 0) then
1582 !
1583 ! -- calculate compaction
1584 call this%csub_cg_calc_comp(node, hnew(node), hold(node), comp)
1585 this%cg_comp(node) = comp
1586 !
1587 ! -- update coarse-grained thickness and void ratio
1588 call this%csub_cg_update(node)
1589 end if
1590 end if
1591 !
1592 ! -- calculate coarse-grained storage terms
1593 call this%csub_cg_fc(node, tled, area, hnew(node), hold(node), &
1594 hcof, rhsterm)
1595 !
1596 ! -- add coarse-grained storage terms to amat and rhs for coarse-grained storage
1597 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1598 rhs(node) = rhs(node) + rhsterm
1599 !
1600 ! -- calculate coarse-grained water compressibility
1601 ! storage terms
1602 if (this%brg /= dzero) then
1603 call this%csub_cg_wcomp_fc(node, tled, area, hnew(node), hold(node), &
1604 hcof, rhsterm)
1605 !
1606 ! -- add water compression storage terms to amat and rhs for
1607 ! coarse-grained storage
1608 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1609 rhs(node) = rhs(node) + rhsterm
1610 end if
1611 end do
1612 !
1613 ! -- interbed storage
1614 if (this%ninterbeds /= 0) then
1615 !
1616 ! -- calculate the contribution of interbeds to the
1617 ! groundwater flow equation
1618 do ib = 1, this%ninterbeds
1619 node = this%nodelist(ib)
1620 idelay = this%idelay(ib)
1621 idiag = this%dis%con%ia(node)
1622 area = this%dis%get_area(node)
1623 call this%csub_interbed_fc(ib, node, area, hnew(node), hold(node), &
1624 hcof, rhsterm)
1625 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1626 rhs(node) = rhs(node) + rhsterm
1627 !
1628 ! -- calculate interbed water compressibility terms
1629 if (.not. is_close(this%brg, dzero) .and. idelay == 0) then
1630 call this%csub_nodelay_wcomp_fc(ib, node, tled, area, &
1631 hnew(node), hold(node), &
1632 hcof, rhsterm)
1633 !
1634 ! -- add water compression storage terms to amat and rhs for interbed
1635 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1636 rhs(node) = rhs(node) + rhsterm
1637 end if
1638 end do
1639 end if
1640 end if
1641 !
1642 ! -- terminate if errors encountered when updating material properties
1643 if (count_errors() > 0) then
1644 call store_error_filename(this%input_fname)
1645 end if
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32
Here is the call graph for this function:

◆ csub_fn()

subroutine gwfcsubmodule::csub_fn ( class(gwfcsubtype) this,
integer(i4b), intent(in) kiter,
real(dp), dimension(:), intent(in) hold,
real(dp), dimension(:), intent(in) hnew,
class(matrixbasetype), pointer matrix_sln,
integer(i4b), dimension(:), intent(in) idxglo,
real(dp), dimension(:), intent(inout) rhs )
private

Fill the coefficient matrix and right-hand side with CSUB package with Newton-Raphson terms.

Parameters
[in]kiterouter iteration number
[in]holdprevious heads
[in]hnewcurrent heads
matrix_slnA matrix
[in]idxgloglobal index model to solution
[in,out]rhsright-hand side

Definition at line 1653 of file gwf-csub.f90.

1654 ! -- modules
1655 use tdismodule, only: delt
1656 ! -- dummy variables
1657 class(GwfCsubType) :: this
1658 integer(I4B), intent(in) :: kiter !< outer iteration number
1659 real(DP), intent(in), dimension(:) :: hold !< previous heads
1660 real(DP), intent(in), dimension(:) :: hnew !< current heads
1661 class(MatrixBaseType), pointer :: matrix_sln !< A matrix
1662 integer(I4B), intent(in), dimension(:) :: idxglo !< global index model to solution
1663 real(DP), intent(inout), dimension(:) :: rhs !< right-hand side
1664 ! -- local variables
1665 integer(I4B) :: idelay
1666 integer(I4B) :: node
1667 integer(I4B) :: idiag
1668 integer(I4B) :: ib
1669 real(DP) :: tled
1670 real(DP) :: area
1671 real(DP) :: hcof
1672 real(DP) :: rhsterm
1673 !
1674 ! -- formulate csub terms
1675 if (this%gwfiss == 0) then
1676 tled = done / delt
1677 !
1678 ! -- coarse-grained storage
1679 do node = 1, this%dis%nodes
1680 idiag = this%dis%con%ia(node)
1681 area = this%dis%get_area(node)
1682 !
1683 ! -- skip inactive cells
1684 if (this%ibound(node) < 1) cycle
1685 !
1686 ! -- calculate coarse-grained storage newton terms
1687 call this%csub_cg_fn(node, tled, area, &
1688 hnew(node), hcof, rhsterm)
1689 !
1690 ! -- add coarse-grained storage newton terms to amat and rhs for
1691 ! coarse-grained storage
1692 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1693 rhs(node) = rhs(node) + rhsterm
1694 !
1695 ! -- calculate coarse-grained water compressibility storage
1696 ! newton terms
1697 if (this%brg /= dzero) then
1698 call this%csub_cg_wcomp_fn(node, tled, area, hnew(node), hold(node), &
1699 hcof, rhsterm)
1700 !
1701 ! -- add water compression storage newton terms to amat and rhs for
1702 ! coarse-grained storage
1703 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1704 rhs(node) = rhs(node) + rhsterm
1705 end if
1706 end do
1707 !
1708 ! -- interbed storage
1709 if (this%ninterbeds /= 0) then
1710 !
1711 ! -- calculate the interbed newton terms for the
1712 ! groundwater flow equation
1713 do ib = 1, this%ninterbeds
1714 idelay = this%idelay(ib)
1715 node = this%nodelist(ib)
1716 !
1717 ! -- skip inactive cells
1718 if (this%ibound(node) < 1) cycle
1719 !
1720 ! -- calculate interbed newton terms
1721 idiag = this%dis%con%ia(node)
1722 area = this%dis%get_area(node)
1723 call this%csub_interbed_fn(ib, node, area, hnew(node), hold(node), &
1724 hcof, rhsterm)
1725 !
1726 ! -- add interbed newton terms to amat and rhs
1727 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1728 rhs(node) = rhs(node) + rhsterm
1729 !
1730 ! -- calculate interbed water compressibility terms
1731 if (this%brg /= dzero .and. idelay == 0) then
1732 call this%csub_nodelay_wcomp_fn(ib, node, tled, area, &
1733 hnew(node), hold(node), &
1734 hcof, rhsterm)
1735 !
1736 ! -- add interbed water compression newton terms to amat and rhs
1737 call matrix_sln%add_value_pos(idxglo(idiag), hcof)
1738 rhs(node) = rhs(node) + rhsterm
1739 end if
1740 end do
1741 end if
1742 end if

◆ csub_rp()

subroutine gwfcsubmodule::csub_rp ( class(gwfcsubtype), intent(inout) this)
private

Method reads and prepares stress period data for the CSUB package. The overlying geostatic stress (sig0) is the only stress period data read by the CSUB package.

Definition at line 1323 of file gwf-csub.f90.

1324 ! -- modules
1325 use tdismodule, only: kper
1326 use constantsmodule, only: linelength
1329 ! -- dummy variables
1330 class(GwfCsubType), intent(inout) :: this
1331 ! -- local variables
1332 integer(I4B), dimension(:, :), pointer, contiguous :: cellids
1333 integer(I4B), dimension(:), pointer, contiguous :: cellid
1334 integer(I4B), pointer :: iper
1335 integer(I4B) :: n, nodeu, noder
1336 character(len=LINELENGTH) :: title, text
1337 character(len=20) :: cellstr
1338 logical(LGP) :: found
1339 ! -- formats
1340 character(len=*), parameter :: fmtlsp = &
1341 &"(1X,/1X,'REUSING ',a,'S FROM LAST STRESS PERIOD')"
1342
1343 call mem_setptr(iper, 'IPER', this%input_mempath)
1344 if (iper /= kper) then
1345 write (this%iout, fmtlsp) trim(this%filtyp)
1346 call this%csub_rp_obs()
1347 return
1348 end if
1349
1350 call mem_setptr(cellids, 'CELLID', this%input_mempath)
1351 call mem_set_value(this%nbound, 'NBOUND', this%input_mempath, &
1352 found, release=.false.)
1353
1354 ! -- setup table for period data
1355 if (this%iprpak /= 0) then
1356 ! -- reset the input table object
1357 title = 'CSUB'//' PACKAGE ('// &
1358 trim(adjustl(this%packName))//') DATA FOR PERIOD'
1359 write (title, '(a,1x,i6)') trim(adjustl(title)), kper
1360 call table_cr(this%inputtab, this%packName, title)
1361 call this%inputtab%table_df(1, 2, this%iout, finalize=.false.)
1362 text = 'CELLID'
1363 call this%inputtab%initialize_column(text, 20)
1364 text = 'SIG0'
1365 call this%inputtab%initialize_column(text, 15, alignment=tableft)
1366 end if
1367
1368 ! -- update nodelist
1369 do n = 1, this%nbound
1370
1371 ! -- set cellid
1372 cellid => cellids(:, n)
1373
1374 ! -- set user node number
1375 if (this%dis%ndim == 1) then
1376 nodeu = cellid(1)
1377 elseif (this%dis%ndim == 2) then
1378 nodeu = get_node(cellid(1), 1, cellid(2), &
1379 this%dis%mshape(1), 1, &
1380 this%dis%mshape(2))
1381 else
1382 nodeu = get_node(cellid(1), cellid(2), cellid(3), &
1383 this%dis%mshape(1), &
1384 this%dis%mshape(2), &
1385 this%dis%mshape(3))
1386 end if
1387
1388 ! -- set noder
1389 noder = this%dis%get_nodenumber(nodeu, 1)
1390 if (noder <= 0) then
1391 cycle
1392 end if
1393
1394 this%nodelistsig0(n) = noder
1395
1396 ! -- write line to table
1397 if (this%iprpak /= 0) then
1398 call this%dis%noder_to_string(noder, cellstr)
1399 call this%inputtab%add_term(cellstr)
1400 call this%inputtab%add_term(this%sig0(n))
1401 end if
1402 end do
1403 !
1404 ! -- terminate if errors encountered
1405 if (count_errors() > 0) then
1406 call store_error_filename(this%input_fname)
1407 end if
1408 !
1409 ! -- finalize the table
1410 if (this%iprpak /= 0) then
1411 call this%inputtab%finalize_table()
1412 end if
1413 !
1414 ! -- read observations
1415 call this%csub_rp_obs()
@ tableft
left justified table column
Here is the call graph for this function:

Variable Documentation

◆ dlog10es

real(dp), parameter gwfcsubmodule::dlog10es = 0.4342942_DP
private

Definition at line 66 of file gwf-csub.f90.

◆ stressfloor

real(dp), parameter gwfcsubmodule::stressfloor = DEM3
private

Definition at line 67 of file gwf-csub.f90.