MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwf-csub-coarse.f90
Go to the documentation of this file.
1!> @brief CSUB package coarse-grained storage
2!<
3submodule(gwfcsubmodule) gwfcsubmodulecoarse
4contains
5
6 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
7 module subroutine csub_cg_fc(this, node, tled, area, hcell, hcellold, hcof, &
8 rhs)
9 ! -- dummy variables
10 class(GwfCsubType) :: this
11 integer(I4B), intent(in) :: node !< cell node number
12 real(DP), intent(in) :: tled !< recripicol of the time step length
13 real(DP), intent(in) :: area !< horizontal cell area
14 real(DP), intent(in) :: hcell !< current head
15 real(DP), intent(in) :: hcellold !< previous head
16 real(DP), intent(inout) :: hcof !< coarse-grained A matrix entry
17 real(DP), intent(inout) :: rhs !< coarse-grained right-hand side entry
18 ! -- local variables
19 real(DP) :: top
20 real(DP) :: bot
21 real(DP) :: tthk
22 real(DP) :: snold
23 real(DP) :: snnew
24 real(DP) :: hbar
25 real(DP) :: sske
26 real(DP) :: rho1
27 !
28 ! -- initialize variables
29 rhs = dzero
30 hcof = dzero
31 !
32 ! -- aquifer elevations and thickness
33 top = this%dis%top(node)
34 bot = this%dis%bot(node)
35 tthk = this%cg_thickini(node)
36 !
37 ! -- calculate hcof and rhs terms if coarse-grained materials present
38 if (tthk > dzero) then
39 !
40 ! -- calculate aquifer saturation
41 call this%csub_calc_sat(node, hcell, hcellold, snnew, snold)
42 !
43 ! -- calculate corrected head (hbar)
44 hbar = squadratic0sp(hcell, bot, this%satomega)
45 !
46 ! -- storage coefficients
47 call this%csub_cg_calc_sske(node, sske, hcell)
48 rho1 = sske * area * tthk * tled
49 !
50 ! -- update sk and ske
51 this%cg_ske(node) = sske * tthk * snold
52 this%cg_sk(node) = sske * tthk * snnew
53 !
54 ! -- calculate hcof and rhs term
55 hcof = -rho1 * snnew
56 rhs = rho1 * snold * this%cg_es0(node) - &
57 rho1 * snnew * (this%cg_gs(node) + bot)
58 !
59 ! -- calculate and apply the flow correction term
60 rhs = rhs - rho1 * snnew * (hcell - hbar)
61 end if
62 end subroutine csub_cg_fc
63
64 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
65 module subroutine csub_cg_fn(this, node, tled, area, hcell, hcof, rhs)
66 ! -- dummy variables
67 class(GwfCsubType) :: this
68 integer(I4B), intent(in) :: node !< node number
69 real(DP), intent(in) :: tled !< reciprocal of the time step length
70 real(DP), intent(in) :: area !< horizontal cell area
71 real(DP), intent(in) :: hcell !< current head in cell
72 real(DP), intent(inout) :: hcof !< coarse-grained A matrix entry
73 real(DP), intent(inout) :: rhs !< coarse-grained right-hand side entry
74 ! -- local variables
75 real(DP) :: top
76 real(DP) :: bot
77 real(DP) :: tthk
78 real(DP) :: snnew
79 real(DP) :: snold
80 real(DP) :: satderv
81 real(DP) :: hbar
82 real(DP) :: hbarderv
83 real(DP) :: sske
84 real(DP) :: rho1
85 !
86 ! -- initialize variables
87 rhs = dzero
88 hcof = dzero
89 !
90 ! -- aquifer elevations and thickness
91 top = this%dis%top(node)
92 bot = this%dis%bot(node)
93 tthk = this%cg_thickini(node)
94 !
95 ! -- calculate newton terms if coarse-grained materials present
96 if (tthk > dzero) then
97 !
98 ! -- calculate aquifer saturation - only need snnew
99 call this%csub_calc_sat(node, hcell, top, snnew, snold)
100 !
101 ! -- calculate saturation derivative
102 satderv = this%csub_calc_sat_derivative(node, hcell)
103 !
104 ! -- calculate corrected head (hbar)
105 hbar = squadratic0sp(hcell, bot, this%satomega)
106 !
107 ! -- calculate the derivative of the hbar functions
108 hbarderv = squadratic0spderivative(hcell, bot, this%satomega)
109 !
110 ! -- storage coefficients
111 call this%csub_cg_calc_sske(node, sske, hcell)
112 rho1 = sske * area * tthk * tled
113 !
114 ! -- calculate hcof term
115 hcof = rho1 * snnew * (done - hbarderv) + &
116 rho1 * (this%cg_gs(node) - hbar + bot) * satderv
117 !
118 ! -- Add additional term if using lagged effective stress
119 if (this%ieslag /= 0) then
120 hcof = hcof - rho1 * this%cg_es0(node) * satderv
121 end if
122 !
123 ! -- calculate rhs term
124 rhs = hcof * hcell
125 end if
126 end subroutine csub_cg_fn
127
128 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
129 module subroutine csub_cg_calc_sske(this, n, sske, hcell)
130 ! -- dummy variables
131 class(GwfCsubType), intent(inout) :: this
132 integer(I4B), intent(in) :: n !< cell node number
133 real(DP), intent(inout) :: sske !< coarse grained Sske
134 real(DP), intent(in) :: hcell !< current head in cell
135 ! -- local variables
136 real(DP) :: top
137 real(DP) :: bot
138 real(DP) :: hbar
139 real(DP) :: znode
140 real(DP) :: es
141 real(DP) :: es0
142 real(DP) :: theta
143 real(DP) :: f
144 real(DP) :: f0
145 !
146 ! -- initialize variables
147 sske = dzero
148 !
149 ! -- calculate factor for the head-based case
150 if (this%lhead_based .EQV. .true.) then
151 f = done
152 f0 = done
153 !
154 ! -- calculate factor for the effective stress case
155 else
156 top = this%dis%top(n)
157 bot = this%dis%bot(n)
158 !
159 ! -- calculate corrected head (hbar)
160 hbar = squadratic0sp(hcell, bot, this%satomega)
161 !
162 ! -- calculate znode
163 znode = this%csub_calc_znode(top, bot, hbar)
164 !
165 ! -- calculate effective stress and theta
166 es = this%cg_es(n)
167 es0 = this%cg_es0(n)
168 theta = this%cg_thetaini(n)
169 !
170 ! -- calculate the compression index factors for the delay
171 ! node relative to the center of the cell based on the
172 ! current and previous head
173 call this%csub_calc_sfacts(n, bot, znode, theta, es, es0, &
174 this%cg_gs(n), f)
175 end if
176 sske = f * this%cg_ske_cr(n)
177 end subroutine csub_cg_calc_sske
178
179 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
180 module subroutine csub_cg_calc_comp(this, node, hcell, hcellold, comp)
181 ! -- dummy variables
182 class(GwfCsubType) :: this
183 integer(I4B), intent(in) :: node !< cell node number
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) :: comp !< coarse-grained compaction
187 ! -- local variables
188 real(DP) :: area
189 real(DP) :: tled
190 real(DP) :: hcof
191 real(DP) :: rhs
192 !
193 ! -- initialize variables
194 area = done
195 tled = done
196 !
197 ! -- calculate terms
198 call this%csub_cg_fc(node, tled, area, hcell, hcellold, hcof, rhs)
199 !
200 ! - calculate compaction
201 comp = hcof * hcell - rhs
202 end subroutine csub_cg_calc_comp
203
204 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
205 module subroutine csub_cg_update(this, node)
206 ! -- dummy variables
207 class(GwfCsubType), intent(inout) :: this
208 integer(I4B), intent(in) :: node !< cell node number
209 ! -- local variables
210 character(len=20) :: cellid
211 real(DP) :: comp
212 real(DP) :: thick
213 real(DP) :: theta
214 !
215 ! -- update thickness and theta
216 comp = this%cg_tcomp(node) + this%cg_comp(node)
217 call this%dis%noder_to_string(node, cellid)
218 if (abs(comp) > dzero) then
219 thick = this%cg_thickini(node)
220 theta = this%cg_thetaini(node)
221 call compact_layer(comp, thick, theta)
222 if (thick <= dzero) then
223 write (errmsg, '(a,1x,a,1x,a,g0,a)') &
224 'Adjusted thickness for cell', trim(adjustl(cellid)), &
225 'is less than or equal to 0 (', thick, ').'
226 call store_error(errmsg)
227 end if
228 if (theta <= dzero) then
229 write (errmsg, '(a,1x,a,1x,a,g0,a)') &
230 'Adjusted theta for cell', trim(adjustl(cellid)), &
231 'is less than or equal to 0 (', theta, ').'
232 call store_error(errmsg)
233 end if
234 this%cg_thick(node) = thick
235 this%cg_theta(node) = theta
236 end if
237 end subroutine csub_cg_update
238
239 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
240 module subroutine csub_cg_wcomp_fc(this, node, tled, area, hcell, hcellold, &
241 hcof, rhs)
242 ! -- dummy variables
243 class(GwfCsubType), intent(inout) :: this
244 integer(I4B), intent(in) :: node !< cell node number
245 real(DP), intent(in) :: tled !< reciprocal of the time step length
246 real(DP), intent(in) :: area !< horizontal cell area
247 real(DP), intent(in) :: hcell !< current head in cell
248 real(DP), intent(in) :: hcellold !< previous head in cell
249 real(DP), intent(inout) :: hcof !< coarse-grained A matrix entry
250 real(DP), intent(inout) :: rhs !< coarse-grained right-hand side entry
251 ! -- local variables
252 real(DP) :: top
253 real(DP) :: bot
254 real(DP) :: tthk
255 real(DP) :: tthk0
256 real(DP) :: snold
257 real(DP) :: snnew
258 real(DP) :: wc
259 real(DP) :: wc0
260 !
261 ! -- initialize variables
262 rhs = dzero
263 hcof = dzero
264 !
265 ! -- aquifer elevations and thickness
266 top = this%dis%top(node)
267 bot = this%dis%bot(node)
268 tthk = this%cg_thick(node)
269 tthk0 = this%cg_thick0(node)
270 !
271 ! -- aquifer saturation
272 call this%csub_calc_sat(node, hcell, hcellold, snnew, snold)
273 !
274 ! -- storage coefficients
275 wc0 = this%brg * area * tthk0 * this%cg_theta0(node) * tled
276 wc = this%brg * area * tthk * this%cg_theta(node) * tled
277 !
278 ! -- calculate hcof term
279 hcof = -wc * snnew
280 !
281 ! -- calculate rhs term
282 rhs = -wc0 * snold * hcellold
283 end subroutine csub_cg_wcomp_fc
284
285 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
286 module subroutine csub_cg_wcomp_fn(this, node, tled, area, hcell, hcellold, &
287 hcof, rhs)
288 ! -- dummy variables
289 class(GwfCsubType), intent(inout) :: this
290 integer(I4B), intent(in) :: node !< cell node number
291 real(DP), intent(in) :: tled !< reciprocal of the time step length
292 real(DP), intent(in) :: area !< horizontal cell area
293 real(DP), intent(in) :: hcell !< current head in cell
294 real(DP), intent(in) :: hcellold !< previous head in cell
295 real(DP), intent(inout) :: hcof !< coarse-grained A matrix entry
296 real(DP), intent(inout) :: rhs !< coarse-grained right-hand side entry
297 ! -- local variables
298 real(DP) :: top
299 real(DP) :: bot
300 real(DP) :: tthk
301 real(DP) :: tthk0
302 real(DP) :: satderv
303 real(DP) :: f
304 real(DP) :: wc
305 real(DP) :: wc0
306 !
307 ! -- initialize variables
308 rhs = dzero
309 hcof = dzero
310 !
311 ! -- aquifer elevations and thickness
312 top = this%dis%top(node)
313 bot = this%dis%bot(node)
314 tthk = this%cg_thick(node)
315 !
316 ! -- calculate saturation derivative
317 satderv = this%csub_calc_sat_derivative(node, hcell)
318 !
319 ! -- calculate water compressibility factor
320 f = this%brg * area * tled
321 !
322 ! -- water compressibility coefficient
323 wc = f * tthk * this%cg_theta(node)
324 !
325 ! -- calculate hcof term
326 hcof = -wc * hcell * satderv
327 !
328 ! -- Add additional term if using lagged effective stress
329 if (this%ieslag /= 0) then
330 tthk0 = this%cg_thick0(node)
331 wc0 = f * tthk0 * this%cg_theta0(node)
332 hcof = hcof + wc * hcellold * satderv
333 end if
334 !
335 ! -- calculate rhs term
336 rhs = hcof * hcell
337 end subroutine csub_cg_wcomp_fn
338
339end submodule gwfcsubmodulecoarse
This module contains the CSUB package methods.
Definition gwf-csub.f90:23