MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwf-csub-nodelay.f90
Go to the documentation of this file.
1!> @brief CSUB package no-delay interbed storage
2!<
3submodule(gwfcsubmodule) gwfcsubmodulenodelay
4contains
5
6 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
7 module subroutine csub_nodelay_update(this, i)
8 ! -- dummy variables
9 class(GwfCsubType), intent(inout) :: this
10 integer(I4B), intent(in) :: i
11 ! -- local variables
12 real(DP) :: comp
13 real(DP) :: thick
14 real(DP) :: theta
15 !
16 ! -- update thickness and theta
17 comp = this%tcomp(i) + this%comp(i)
18 if (abs(comp) > dzero) then
19 thick = this%thickini(i)
20 theta = this%thetaini(i)
21 call compact_layer(comp, thick, theta)
22 if (thick <= dzero) then
23 write (errmsg, '(a,1x,i0,1x,a,g0,a)') &
24 'Adjusted thickness for no-delay interbed', i, &
25 'is less than or equal to 0 (', thick, ').'
26 call store_error(errmsg)
27 end if
28 if (theta <= dzero) then
29 write (errmsg, '(a,1x,i0,1x,a,g0,a)') &
30 'Adjusted theta for no-delay interbed', i, &
31 'is less than or equal to 0 (', theta, ').'
32 call store_error(errmsg)
33 end if
34 this%thick(i) = thick
35 this%theta(i) = theta
36 end if
37 end subroutine csub_nodelay_update
38
39 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
40 module subroutine csub_nodelay_fc(this, ib, hcell, hcellold, rho1, rho2, &
41 rhs, argtled)
42 ! -- modules
43 use tdismodule, only: delt
44 ! -- dummy variables
45 class(GwfCsubType) :: this
46 integer(I4B), intent(in) :: ib !< interbed number
47 real(DP), intent(in) :: hcell !< current head in the cell
48 real(DP), intent(in) :: hcellold !< previous head in the cell
49 real(DP), intent(inout) :: rho1 !< current storage coefficient value using Sske
50 real(DP), intent(inout) :: rho2 !< current storage coefficient value based on Ssk
51 real(DP), intent(inout) :: rhs !< no-delay interbed contribution to the right-hand side
52 real(DP), intent(in), optional :: argtled !< optional reciprocal of the time step length
53 ! -- local variables
54 integer(I4B) :: node
55 real(DP) :: tled
56 real(DP) :: top
57 real(DP) :: bot
58 real(DP) :: thick
59 real(DP) :: hbar
60 real(DP) :: znode
61 real(DP) :: snold
62 real(DP) :: snnew
63 real(DP) :: sto_fac
64 real(DP) :: sto_fac0
65 real(DP) :: area
66 real(DP) :: theta
67 real(DP) :: es
68 real(DP) :: es0
69 real(DP) :: f
70 real(DP) :: f0
71 real(DP) :: rcorr
72 !
73 ! -- process optional variables
74 if (present(argtled)) then
75 tled = argtled
76 else
77 tled = done / delt
78 end if
79 node = this%nodelist(ib)
80 area = this%dis%get_area(node)
81 bot = this%dis%bot(node)
82 top = this%dis%top(node)
83 thick = this%thickini(ib)
84 !
85 ! -- calculate corrected head (hbar)
86 hbar = squadratic0sp(hcell, bot, this%satomega)
87 !
88 ! -- set iconvert
89 this%iconvert(ib) = 0
90 !
91 ! -- aquifer saturation
92 call this%csub_calc_sat(node, hcell, hcellold, snnew, snold)
93 if (this%lhead_based .EQV. .true.) then
94 f = done
95 f0 = done
96 else
97 znode = this%csub_calc_znode(top, bot, hbar)
98 es = this%cg_es(node)
99 es0 = this%cg_es0(node)
100 theta = this%thetaini(ib)
101 !
102 ! -- calculate the compression index factors for the delay
103 ! node relative to the center of the cell based on the
104 ! current and previous head
105 call this%csub_calc_sfacts(node, bot, znode, theta, es, es0, &
106 this%cg_gs(node), f)
107 end if
108 sto_fac = tled * snnew * thick * f
109 sto_fac0 = tled * snold * thick * f
110 !
111 ! -- calculate rho1 and rho2
112 rho1 = this%rci(ib) * sto_fac0
113 rho2 = this%rci(ib) * sto_fac
114 if (this%cg_es(node) > this%pcs(ib)) then
115 this%iconvert(ib) = 1
116 rho2 = this%ci(ib) * sto_fac
117 end if
118 !
119 ! -- calculate correction term
120 rcorr = rho2 * (hcell - hbar)
121 !
122 ! -- fill right-hand side
123 if (this%ielastic(ib) /= 0) then
124 rhs = rho1 * this%cg_es0(node) - &
125 rho2 * (this%cg_gs(node) + bot) - &
126 rcorr
127 else
128 rhs = -rho2 * (this%cg_gs(node) + bot) + &
129 (this%pcs(ib) * (rho2 - rho1)) + &
130 (rho1 * this%cg_es0(node)) - &
131 rcorr
132 end if
133 !
134 ! -- save ske and sk
135 this%ske(ib) = rho1
136 this%sk(ib) = rho2
137 end subroutine csub_nodelay_fc
138
139 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
140 module subroutine csub_nodelay_calc_comp(this, ib, hcell, hcellold, comp, &
141 rho1, rho2)
142 ! -- dummy variables
143 class(GwfCsubType) :: this
144 integer(I4B), intent(in) :: ib !< interbed number
145 real(DP), intent(in) :: hcell !< current head for the cell
146 real(DP), intent(in) :: hcellold !< previous head for the cell
147 real(DP), intent(inout) :: comp !< no-delay interbed compaction
148 real(DP), intent(inout) :: rho1 !< current storage coefficient based on Sske
149 real(DP), intent(inout) :: rho2 !< current storage coefficient based on Ssk
150 ! -- local variables
151 integer(I4B) :: node
152 real(DP) :: es
153 real(DP) :: es0
154 real(DP) :: pcs
155 real(DP) :: tled
156 real(DP) :: rhs
157 !
158 ! -- initialize variables
159 node = this%nodelist(ib)
160 tled = done
161 es = this%cg_es(node)
162 es0 = this%cg_es0(node)
163 pcs = this%pcs(ib)
164 !
165 ! -- calculate no-delay interbed rho1 and rho2
166 call this%csub_nodelay_fc(ib, hcell, hcellold, rho1, rho2, rhs, argtled=tled)
167 !
168 ! -- calculate no-delay interbed compaction
169 if (this%ielastic(ib) /= 0) then
170 comp = rho2 * es - rho1 * es0
171 else
172 comp = -pcs * (rho2 - rho1) - (rho1 * es0) + (rho2 * es)
173 end if
174 end subroutine csub_nodelay_calc_comp
175
176 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
177 module subroutine csub_interbed_fc(this, ib, node, area, hcell, hcellold, &
178 hcof, rhs)
179 ! -- dummy variables
180 class(GwfCsubType) :: this
181 integer(I4B), intent(in) :: ib !< interbed number
182 integer(I4B), intent(in) :: node !< cell node number
183 real(DP), intent(in) :: area !< horizontal cell area
184 real(DP), intent(in) :: hcell !< current head in cell
185 real(DP), intent(in) :: hcellold !< previous head in cell
186 real(DP), intent(inout) :: hcof !< interbed A matrix entry
187 real(DP), intent(inout) :: rhs !< interbed right-hand side
188 ! -- local variables
189 real(DP) :: snnew
190 real(DP) :: snold
191 real(DP) :: comp
192 real(DP) :: compi
193 real(DP) :: compe
194 real(DP) :: rho1
195 real(DP) :: rho2
196 real(DP) :: f
197 !
198 ! -- initialize variables
199 rhs = dzero
200 hcof = dzero
201 comp = dzero
202 compi = dzero
203 compe = dzero
204 !
205 ! -- skip inactive and constant head cells
206 if (this%ibound(node) > 0) then
207 if (this%idelay(ib) == 0) then
208 !
209 ! -- update material properties
210 if (this%iupdatematprop /= 0) then
211 if (this%ieslag == 0) then
212 !
213 ! -- calculate compaction
214 call this%csub_nodelay_calc_comp(ib, hcell, hcellold, comp, &
215 rho1, rho2)
216 this%comp(ib) = comp
217 !
218 ! -- update thickness and void ratio
219 call this%csub_nodelay_update(ib)
220 end if
221 end if
222 !
223 ! -- calculate no-delay interbed rho1 and rho2
224 call this%csub_nodelay_fc(ib, hcell, hcellold, rho1, hcof, rhs)
225 f = area
226 else
227 !
228 ! -- calculate cell saturation
229 call this%csub_calc_sat(node, hcell, hcellold, snnew, snold)
230 !
231 ! -- update material properties
232 if (this%iupdatematprop /= 0) then
233 if (this%ieslag == 0) then
234 !
235 ! -- calculate compaction
236 call this%csub_delay_calc_comp(ib, hcell, hcellold, &
237 comp, compi, compe)
238 this%comp(ib) = comp
239 !
240 ! -- update thickness and void ratio
241 call this%csub_delay_update(ib)
242 end if
243 end if
244 !
245 ! -- calculate delay interbed hcof and rhs
246 call this%csub_delay_sln(ib, hcell)
247 call this%csub_delay_fc(ib, hcof, rhs)
248 f = area * this%rnb(ib)
249 end if
250 rhs = rhs * f
251 hcof = -hcof * f
252 end if
253 end subroutine csub_interbed_fc
254
255 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
256 module subroutine csub_interbed_fn(this, ib, node, hcell, hcellold, hcof, rhs)
257 ! -- modules
258 use tdismodule, only: delt
259 ! -- dummy variables
260 class(GwfCsubType) :: this
261 integer(I4B), intent(in) :: ib !< interbed number
262 integer(I4B), intent(in) :: node !< cell node number
263 real(DP), intent(in) :: hcell !< current head in a cell
264 real(DP), intent(in) :: hcellold !< previous head in a cell
265 real(DP), intent(inout) :: hcof !< interbed A matrix entry
266 real(DP), intent(inout) :: rhs !< interbed right-hand side entry
267 ! -- local variables
268 integer(I4B) :: idelay
269 real(DP) :: hcofn
270 real(DP) :: rhsn
271 real(DP) :: top
272 real(DP) :: bot
273 real(DP) :: tled
274 real(DP) :: tthk
275 real(DP) :: snnew
276 real(DP) :: snold
277 real(DP) :: f
278 real(DP) :: satderv
279 real(DP) :: hbar
280 real(DP) :: hbarderv
281 real(DP) :: rho1
282 real(DP) :: rho2
283 !
284 ! -- initialize variables
285 rhs = dzero
286 hcof = dzero
287 rhsn = dzero
288 hcofn = dzero
289 satderv = dzero
290 idelay = this%idelay(ib)
291 top = this%dis%top(node)
292 bot = this%dis%bot(node)
293 !
294 ! -- skip inactive and constant head cells
295 if (this%ibound(node) > 0) then
296 tled = done / delt
297 tthk = this%thickini(ib)
298 !
299 ! -- calculate cell saturation
300 call this%csub_calc_sat(node, hcell, hcellold, snnew, snold)
301 !
302 ! -- no-delay interbeds
303 if (idelay == 0) then
304 !
305 ! -- initialize factor
306 f = done
307 !
308 ! -- calculate the saturation derivative
309 satderv = this%csub_calc_sat_derivative(node, hcell)
310 !
311 ! -- calculate corrected head (hbar)
312 hbar = squadratic0sp(hcell, bot, this%satomega)
313 !
314 ! -- calculate the derivative of the hbar functions
315 hbarderv = squadratic0spderivative(hcell, bot, this%satomega)
316 !
317 ! -- calculate storage coefficient
318 call this%csub_nodelay_fc(ib, hcell, hcellold, rho1, rho2, rhsn)
319 !
320 ! -- calculate hcofn term
321 hcofn = rho2 * (done - hbarderv) * snnew + &
322 rho2 * (this%cg_gs(node) - hbar + bot) * satderv
323 if (this%ielastic(ib) == 0) then
324 hcofn = hcofn - rho2 * this%pcs(ib) * satderv
325 end if
326 !
327 ! -- Add additional term if using lagged effective stress
328 if (this%ieslag /= 0) then
329 if (this%ielastic(ib) /= 0) then
330 hcofn = hcofn - rho1 * this%cg_es0(node) * satderv
331 else
332 hcofn = hcofn - rho1 * (this%pcs(ib) - this%cg_es0(node)) * satderv
333 end if
334 end if
335 end if
336 end if
337 end subroutine csub_interbed_fn
338
339 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
340 module subroutine csub_nodelay_wcomp_fc(this, ib, node, tled, area, hcell, &
341 hcellold, hcof, rhs)
342 ! -- dummy variables
343 class(GwfCsubType), intent(inout) :: this
344 integer(I4B), intent(in) :: ib !< interbed number
345 integer(I4B), intent(in) :: node !< cell node number
346 real(DP), intent(in) :: tled !< reciprocal of time step length
347 real(DP), intent(in) :: area !< horizontal cell area
348 real(DP), intent(in) :: hcell !< current head in cell
349 real(DP), intent(in) :: hcellold !< previous head in cell
350 real(DP), intent(inout) :: hcof !< no-delay A matrix entry
351 real(DP), intent(inout) :: rhs !< no-delay right-hand side entry
352 ! -- local variables
353 real(DP) :: top
354 real(DP) :: bot
355 real(DP) :: snold
356 real(DP) :: snnew
357 real(DP) :: f
358 real(DP) :: wc
359 real(DP) :: wc0
360 !
361 ! -- initialize variables
362 rhs = dzero
363 hcof = dzero
364 !
365 ! -- aquifer elevations and thickness
366 top = this%dis%top(node)
367 bot = this%dis%bot(node)
368 !
369 ! -- calculate cell saturation
370 call this%csub_calc_sat(node, hcell, hcellold, snnew, snold)
371 !
372 !
373 f = this%brg * area * tled
374 wc0 = f * this%theta0(ib) * this%thick0(ib)
375 wc = f * this%theta(ib) * this%thick(ib)
376 hcof = -wc * snnew
377 rhs = -wc0 * snold * hcellold
378 end subroutine csub_nodelay_wcomp_fc
379
380 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
381 module subroutine csub_nodelay_wcomp_fn(this, ib, node, tled, area, hcell, &
382 hcellold, hcof, rhs)
383 ! -- dummy variables
384 class(GwfCsubType), intent(inout) :: this
385 integer(I4B), intent(in) :: ib !< interbed number
386 integer(I4B), intent(in) :: node !< cell node number
387 real(DP), intent(in) :: tled !< reciprocal of time step length
388 real(DP), intent(in) :: area !< horizontal cell area
389 real(DP), intent(in) :: hcell !< current head in cell
390 real(DP), intent(in) :: hcellold !< previous head in cell
391 real(DP), intent(inout) :: hcof !< no-delay A matrix entry
392 real(DP), intent(inout) :: rhs !< no-delay right-hand side entry
393 ! -- local variables
394 real(DP) :: top
395 real(DP) :: bot
396 real(DP) :: f
397 real(DP) :: wc
398 real(DP) :: wc0
399 real(DP) :: satderv
400 !
401 ! -- initialize variables
402 rhs = dzero
403 hcof = dzero
404 !
405 ! -- aquifer elevations and thickness
406 top = this%dis%top(node)
407 bot = this%dis%bot(node)
408 !
409 !
410 f = this%brg * area * tled
411 !
412 ! -- calculate saturation derivative
413 satderv = this%csub_calc_sat_derivative(node, hcell)
414 !
415 ! -- calculate the current water compressibility factor
416 wc = f * this%theta(ib) * this%thick(ib)
417 !
418 ! -- calculate derivative term
419 hcof = -wc * hcell * satderv
420 !
421 ! -- Add additional term if using lagged effective stress
422 if (this%ieslag /= 0) then
423 wc0 = f * this%theta0(ib) * this%thick0(ib)
424 hcof = hcof + wc0 * hcellold * satderv
425 end if
426 !
427 ! -- set rhs
428 rhs = hcof * hcell
429 end subroutine csub_nodelay_wcomp_fn
430
431end submodule gwfcsubmodulenodelay
This module contains the CSUB package methods.
Definition gwf-csub.f90:23
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32