MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwf-csub-stress.f90
Go to the documentation of this file.
1!> @brief CSUB package initial states and stresses
2!<
3submodule(gwfcsubmodule) gwfcsubmodulestress
4contains
5
6 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
7 module subroutine csub_cg_calc_stress(this, nodes, hnew)
8 ! -- dummy variables
9 class(GwfCsubType) :: this
10 integer(I4B), intent(in) :: nodes !< number of active model nodes
11 real(DP), dimension(nodes), intent(in) :: hnew !< current head
12 ! -- local variables
13 integer(I4B) :: node
14 integer(I4B) :: ii
15 integer(I4B) :: nn
16 integer(I4B) :: m
17 integer(I4B) :: idx_conn
18 real(DP) :: gs
19 real(DP) :: top
20 real(DP) :: bot
21 real(DP) :: thick
22 real(DP) :: va_scale
23 real(DP) :: hcell
24 real(DP) :: hbar
25 real(DP) :: gs_conn
26 real(DP) :: es
27 real(DP) :: phead
28 real(DP) :: sadd
29 !
30 ! -- calculate geostatic stress if necessary
31 if (this%iupdatestress /= 0) then
32 do node = 1, this%dis%nodes
33 !
34 ! -- calculate geostatic stress for this node
35 ! this represents the geostatic stress component
36 ! for the cell
37 top = this%dis%top(node)
38 bot = this%dis%bot(node)
39 thick = top - bot
40 !
41 ! -- calculate cell contribution to geostatic stress
42 if (this%ibound(node) /= 0) then
43 hcell = hnew(node)
44 else
45 hcell = bot
46 end if
47 !
48 ! -- calculate corrected head (hbar)
49 hbar = squadratic0sp(hcell, bot, this%satomega)
50 !
51 ! -- geostatic stress calculation
52 if (hcell < top) then
53 gs = (top - hbar) * this%sgm(node) + (hbar - bot) * this%sgs(node)
54 else
55 gs = thick * this%sgs(node)
56 end if
57 !
58 ! -- cell contribution to geostatic stress
59 this%cg_gs(node) = gs
60 end do
61 !
62 ! -- add user specified overlying geostatic stress
63 do nn = 1, this%nbound
64 node = this%nodelistsig0(nn)
65 sadd = this%sig0(nn)
66 this%cg_gs(node) = this%cg_gs(node) + sadd
67 end do
68 !
69 ! -- calculate geostatic stress above cell
70 do node = 1, this%dis%nodes
71 !
72 ! -- geostatic stress of cell
73 gs = this%cg_gs(node)
74 !
75 ! -- Add geostatic stress of overlying cells (ihc=0)
76 ! m < node = m is vertically above node
77 do ii = this%dis%con%ia(node) + 1, this%dis%con%ia(node + 1) - 1
78 !
79 ! -- Set the m cell number
80 m = this%dis%con%ja(ii)
81 idx_conn = this%dis%con%jas(ii)
82 !
83 ! -- vertical connection
84 if (this%dis%con%ihc(idx_conn) == 0) then
85 !
86 ! -- node has an overlying cell
87 if (m < node) then
88 !
89 ! -- dis and disv discretization
90 if (this%dis%ndim /= 1) then
91 gs = gs + this%cg_gs(m)
92 !
93 ! -- disu discretization
94 else
95 va_scale = this%dis%get_area_factor(node, idx_conn)
96 gs_conn = this%cg_gs(m)
97 gs = gs + (gs_conn * va_scale)
98 end if
99 end if
100 end if
101 end do
102 !
103 ! -- geostatic stress for cell with geostatic stress
104 ! of overlying cells
105 this%cg_gs(node) = gs
106 end do
107 end if
108 !
109 ! -- save effective stress from the last iteration and
110 ! calculate the new effective stress for a cell
111 do node = 1, this%dis%nodes
112 top = this%dis%top(node)
113 bot = this%dis%bot(node)
114 if (this%ibound(node) /= 0) then
115 hcell = hnew(node)
116 else
117 hcell = bot
118 end if
119 !
120 ! -- calculate corrected head (hbar)
121 hbar = squadratic0sp(hcell, bot, this%satomega)
122 !
123 ! -- calculate pressure head
124 phead = hbar - bot
125 !
126 ! -- calculate effective stress
127 es = this%cg_gs(node) - phead
128 this%cg_es(node) = es
129 end do
130 end subroutine csub_cg_calc_stress
131
132 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
133 module subroutine csub_set_initial_state(this, nodes, hnew)
134 ! -- dummy variables
135 class(GwfCsubType) :: this
136 integer(I4B), intent(in) :: nodes !< number of active model nodes
137 real(DP), dimension(nodes), intent(in) :: hnew !< current heads
138 ! -- local variables
139 character(len=LINELENGTH) :: title
140 character(len=LINELENGTH) :: tag
141 character(len=20) :: cellid
142 integer(I4B) :: ib
143 integer(I4B) :: node
144 integer(I4B) :: n
145 integer(I4B) :: idelay
146 integer(I4B) :: ntabrows
147 integer(I4B) :: ntabcols
148 real(DP) :: pcs0
149 real(DP) :: pcs
150 real(DP) :: fact
151 real(DP) :: top
152 real(DP) :: bot
153 real(DP) :: void_ratio
154 real(DP) :: es
155 real(DP) :: znode
156 real(DP) :: hcell
157 real(DP) :: hbar
158 real(DP) :: dzhalf
159 real(DP) :: zbot
160 real(DP) :: dbpcs
161 !
162 ! -- update geostatic load calculation
163 call this%csub_cg_calc_stress(nodes, hnew)
164 !
165 ! -- initialize coarse-grained material effective stress
166 ! for the previous time step and the previous iteration
167 do node = 1, nodes
168 this%cg_es0(node) = this%cg_es(node)
169 end do
170 !
171 ! -- initialize interbed initial states
172 do ib = 1, this%ninterbeds
173 idelay = this%idelay(ib)
174 node = this%nodelist(ib)
175 top = this%dis%top(node)
176 bot = this%dis%bot(node)
177 hcell = hnew(node)
178 pcs = this%pcs(ib)
179 pcs0 = pcs
180 if (this%ispecified_pcs == 0) then
181 ! relative pcs...subtract head (u) from sigma'
182 if (this%ipch /= 0) then
183 pcs = this%cg_es(node) - pcs0
184 else
185 pcs = this%cg_es(node) + pcs0
186 end if
187 else
188 ! specified pcs...subtract head (u) from sigma
189 if (this%ipch /= 0) then
190 pcs = this%cg_gs(node) - (pcs0 - bot)
191 end if
192 if (pcs < this%cg_es(node)) then
193 pcs = this%cg_es(node)
194 end if
195 end if
196 this%pcs(ib) = pcs
197 !
198 ! -- delay bed initial states
199 if (idelay /= 0) then
200 dzhalf = dhalf * this%dbdzini(1, idelay)
201 !
202 ! -- fill delay bed head with aquifer head or offset from aquifer head
203 ! heads need to be filled first since used to calculate
204 ! the effective stress for each delay bed
205 do n = 1, this%ndelaycells
206 if (this%ispecified_dbh == 0) then
207 this%dbh(n, idelay) = hcell + this%dbh(n, idelay)
208 else
209 this%dbh(n, idelay) = hcell
210 end if
211 this%dbh0(n, idelay) = this%dbh(n, idelay)
212 end do
213 !
214 ! -- fill delay bed effective stress
215 call this%csub_delay_calc_stress(ib, hcell)
216 !
217 ! -- fill delay bed pcs
218 pcs = this%pcs(ib)
219 do n = 1, this%ndelaycells
220 zbot = this%dbz(n, idelay) - dzhalf
221 ! -- adjust pcs to bottom of each delay bed cell
222 ! not using adjust_eff_stress() since smoothing not required
223 dbpcs = pcs - (zbot - bot) * (this%sgs(node) - done)
224 this%dbpcs(n, idelay) = dbpcs
225 !
226 ! -- initialize effective stress for previous time step
227 this%dbes0(n, idelay) = this%dbes(n, idelay)
228 end do
229 end if
230 end do
231 !
232 ! -- scale coarse-grained materials cr
233 do node = 1, nodes
234 top = this%dis%top(node)
235 bot = this%dis%bot(node)
236 !
237 ! -- user-specified specific storage
238 if (this%istoragec == 1) then
239 !
240 ! -- retain specific storage values since they are constant
241 if (this%lhead_based .EQV. .true.) then
242 fact = done
243 !
244 ! -- convert specific storage values since they are simulated to
245 ! be a function of the average effective stress
246 else
247 void_ratio = porosity_to_void_ratio(this%cg_theta(node))
248 es = this%cg_es(node)
249 hcell = hnew(node)
250 !
251 ! -- calculate corrected head (hbar)
252 hbar = squadratic0sp(hcell, bot, this%satomega)
253 !
254 ! -- calculate znode and factor
255 znode = this%csub_calc_znode(top, bot, hbar)
256 fact = adjust_eff_stress(es, bot, znode, this%sgs(node))
257 fact = fact * (done + void_ratio)
258 end if
259 !
260 ! -- user-specified compression indices - multiply by dlog10es
261 else
262 fact = dlog10es
263 end if
264 this%cg_ske_cr(node) = this%cg_ske_cr(node) * fact
265 !
266 ! -- write error message if negative compression indices
267 if (fact <= dzero) then
268 call this%dis%noder_to_string(node, cellid)
269 write (errmsg, '(a,1x,a,a)') &
270 'Negative recompression index calculated for cell', &
271 trim(adjustl(cellid)), '.'
272 call store_error(errmsg)
273 end if
274 end do
275 !
276 ! -- scale interbed cc and cr
277 do ib = 1, this%ninterbeds
278 idelay = this%idelay(ib)
279 node = this%nodelist(ib)
280 top = this%dis%top(node)
281 bot = this%dis%bot(node)
282 !
283 ! -- user-specified specific storage
284 if (this%istoragec == 1) then
285 !
286 ! -- retain specific storage values since they are constant
287 if (this%lhead_based .EQV. .true.) then
288 fact = done
289 !
290 ! -- convert specific storage values since they are simulated to
291 ! be a function of the average effective stress
292 else
293 void_ratio = porosity_to_void_ratio(this%theta(ib))
294 es = this%cg_es(node)
295 hcell = hnew(node)
296 !
297 ! -- calculate corrected head (hbar)
298 hbar = squadratic0sp(hcell, bot, this%satomega)
299 !
300 ! -- calculate zone and factor
301 znode = this%csub_calc_znode(top, bot, hbar)
302 fact = adjust_eff_stress(es, bot, znode, this%sgs(node))
303 fact = fact * (done + void_ratio)
304 end if
305 !
306 ! -- user-specified compression indices - multiply by dlog10es
307 else
308 fact = dlog10es
309 end if
310 this%ci(ib) = this%ci(ib) * fact
311 this%rci(ib) = this%rci(ib) * fact
312 !
313 ! -- write error message if negative compression indices
314 if (fact <= dzero) then
315 call this%dis%noder_to_string(node, cellid)
316 write (errmsg, '(a,1x,i0,2(1x,a),a)') &
317 'Negative compression indices calculated for interbed', ib, &
318 'in cell', trim(adjustl(cellid)), '.'
319 call store_error(errmsg)
320 end if
321 end do
322 !
323 ! -- write current stress and initial preconsolidation stress
324 if (this%iprpak == 1) then
325 ! -- set title
326 title = trim(adjustl(this%packName))// &
327 ' PACKAGE CALCULATED INITIAL INTERBED STRESSES AT THE CELL BOTTOM'
328 !
329 ! -- determine the number of columns and rows
330 ntabrows = this%ninterbeds
331 ntabcols = 5
332 if (this%inamedbound /= 0) then
333 ntabcols = ntabcols + 1
334 end if
335 !
336 ! -- setup table
337 call table_cr(this%inputtab, this%packName, title)
338 call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
339 !
340 ! add columns
341 tag = 'INTERBED NUMBER'
342 call this%inputtab%initialize_column(tag, 10, alignment=tableft)
343 tag = 'CELLID'
344 call this%inputtab%initialize_column(tag, 20)
345 tag = 'GEOSTATIC STRESS'
346 call this%inputtab%initialize_column(tag, 16)
347 tag = 'EFFECTIVE STRESS'
348 call this%inputtab%initialize_column(tag, 16)
349 tag = 'PRECONSOLIDATION STRESS'
350 call this%inputtab%initialize_column(tag, 16)
351 if (this%inamedbound /= 0) then
352 tag = 'BOUNDNAME'
353 call this%inputtab%initialize_column(tag, lenboundname, &
354 alignment=tableft)
355 end if
356 !
357 ! -- write the data
358 do ib = 1, this%ninterbeds
359 node = this%nodelist(ib)
360 call this%dis%noder_to_string(node, cellid)
361 !
362 ! -- write the columns
363 call this%inputtab%add_term(ib)
364 call this%inputtab%add_term(cellid)
365 call this%inputtab%add_term(this%cg_gs(node))
366 call this%inputtab%add_term(this%cg_es(node))
367 call this%inputtab%add_term(this%pcs(ib))
368 if (this%inamedbound /= 0) then
369 call this%inputtab%add_term(this%boundname(ib))
370 end if
371 end do
372 !
373 ! -- write effective stress and preconsolidation stress
374 ! for delay beds
375 ! -- set title
376 title = trim(adjustl(this%packName))// &
377 ' PACKAGE CALCULATED INITIAL DELAY INTERBED STRESSES'
378 !
379 ! -- determine the number of columns and rows
380 ntabrows = 0
381 do ib = 1, this%ninterbeds
382 idelay = this%idelay(ib)
383 if (idelay /= 0) then
384 ntabrows = ntabrows + this%ndelaycells
385 end if
386 end do
387 ntabcols = 6
388 if (this%inamedbound /= 0) then
389 ntabcols = ntabcols + 1
390 end if
391 !
392 ! -- setup table
393 call table_cr(this%inputtab, this%packName, title)
394 call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
395 !
396 ! add columns
397 tag = 'INTERBED NUMBER'
398 call this%inputtab%initialize_column(tag, 10, alignment=tableft)
399 tag = 'CELLID'
400 call this%inputtab%initialize_column(tag, 20)
401 tag = 'DELAY CELL'
402 call this%inputtab%initialize_column(tag, 10, alignment=tableft)
403 tag = 'GEOSTATIC STRESS'
404 call this%inputtab%initialize_column(tag, 16)
405 tag = 'EFFECTIVE STRESS'
406 call this%inputtab%initialize_column(tag, 16)
407 tag = 'PRECONSOLIDATION STRESS'
408 call this%inputtab%initialize_column(tag, 16)
409 if (this%inamedbound /= 0) then
410 tag = 'BOUNDNAME'
411 call this%inputtab%initialize_column(tag, lenboundname, &
412 alignment=tableft)
413 end if
414 !
415 ! -- write the data
416 do ib = 1, this%ninterbeds
417 idelay = this%idelay(ib)
418 if (idelay /= 0) then
419 node = this%nodelist(ib)
420 call this%dis%noder_to_string(node, cellid)
421 !
422 ! -- write the columns
423 do n = 1, this%ndelaycells
424 if (n == 1) then
425 call this%inputtab%add_term(ib)
426 call this%inputtab%add_term(cellid)
427 else
428 call this%inputtab%add_term(' ')
429 call this%inputtab%add_term(' ')
430 end if
431 call this%inputtab%add_term(n)
432 call this%inputtab%add_term(this%dbgeo(n, idelay))
433 call this%inputtab%add_term(this%dbes(n, idelay))
434 call this%inputtab%add_term(this%dbpcs(n, idelay))
435 if (this%inamedbound /= 0) then
436 if (n == 1) then
437 call this%inputtab%add_term(this%boundname(ib))
438 else
439 call this%inputtab%add_term(' ')
440 end if
441 end if
442 end do
443 end if
444 end do
445 !
446 ! -- write calculated compression indices
447 if (this%istoragec == 1) then
448 if (this%lhead_based .EQV. .false.) then
449 ! -- set title
450 title = trim(adjustl(this%packName))// &
451 ' PACKAGE COMPRESSION INDICES'
452 !
453 ! -- determine the number of columns and rows
454 ntabrows = this%ninterbeds
455 ntabcols = 4
456 if (this%inamedbound /= 0) then
457 ntabcols = ntabcols + 1
458 end if
459 !
460 ! -- setup table
461 call table_cr(this%inputtab, this%packName, title)
462 call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
463 !
464 ! add columns
465 tag = 'INTERBED NUMBER'
466 call this%inputtab%initialize_column(tag, 10, alignment=tableft)
467 tag = 'CELLID'
468 call this%inputtab%initialize_column(tag, 20)
469 tag = 'CC'
470 call this%inputtab%initialize_column(tag, 16)
471 tag = 'CR'
472 call this%inputtab%initialize_column(tag, 16)
473 if (this%inamedbound /= 0) then
474 tag = 'BOUNDNAME'
475 call this%inputtab%initialize_column(tag, lenboundname, &
476 alignment=tableft)
477 end if
478 !
479 ! -- write the data
480 do ib = 1, this%ninterbeds
481 fact = done / dlog10es
482 node = this%nodelist(ib)
483 call this%dis%noder_to_string(node, cellid)
484 !
485 ! -- write the columns
486 call this%inputtab%add_term(ib)
487 call this%inputtab%add_term(cellid)
488 call this%inputtab%add_term(this%ci(ib) * fact)
489 call this%inputtab%add_term(this%rci(ib) * fact)
490 if (this%inamedbound /= 0) then
491 call this%inputtab%add_term(this%boundname(ib))
492 end if
493 end do
494 end if
495 end if
496 end if
497 !
498 ! -- terminate if any initialization errors have been detected
499 if (count_errors() > 0) then
500 call store_error_filename(this%input_fname)
501 end if
502 !
503 ! -- set initialized
504 this%initialized = 1
505 !
506 ! -- set flag to retain initial stresses for entire simulation
507 if (this%lhead_based .EQV. .true.) then
508 this%iupdatestress = 0
509 end if
510 end subroutine csub_set_initial_state
511
512end submodule gwfcsubmodulestress
This module contains the CSUB package methods.
Definition gwf-csub.f90:23