MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwf-csub-input.f90
Go to the documentation of this file.
1!> @brief CSUB package input processing
2!<
3submodule(gwfcsubmodule) gwfcsubmoduleinput
4contains
5
6 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
7 module subroutine source_options(this)
8 ! -- modules
12 use openspecmodule, only: access, form
16 ! -- dummy variables
17 class(GwfCsubType), intent(inout) :: this
18 ! -- local variables
19 integer(I4B), pointer :: ibs
20 integer(I4B) :: inobs
21 integer(I4B), pointer :: iei_smoothing
22 integer(I4B), pointer :: istrict
23 character(len=LINELENGTH) :: csv_interbed, csv_coarse
24 character(len=LINELENGTH) :: cmp_fn, ecmp_fn, iecmp_fn, ibcmp_fn, cmpcoarse_fn
25 character(len=LINELENGTH) :: zdisp_fn, pkg_converge_fn
26 type(GwfCsubParamFoundType) :: found
27 logical(LGP) :: warn_estress_lag = .false.
28
29 ! -- allocate and initialize variables
30 allocate (ibs)
31 ibs = 0
32
33 ! -- update defaults from input context
34 call mem_set_value(this%inamedbound, 'BOUNDNAMES', this%input_mempath, &
35 found%boundnames)
36 call mem_set_value(this%iprpak, 'PRINT_INPUT', this%input_mempath, &
37 found%print_input)
38 call mem_set_value(this%ipakcb, 'SAVE_FLOWS', this%input_mempath, &
39 found%save_flows)
40 call mem_set_value(this%gammaw, 'GAMMAW', this%input_mempath, found%gammaw)
41 call mem_set_value(this%beta, 'BETA', this%input_mempath, found%beta)
42 ! -- ELASTIC_INELASTIC_SMOOTHING sets the default smoothing window (DEM3 * pcs)
43 allocate (iei_smoothing)
44 iei_smoothing = 0
45 call mem_set_value(iei_smoothing, 'EI_SMOOTHING', &
46 this%input_mempath, found%ei_smoothing)
47 if (found%ei_smoothing) then
48 this%pcsomega = dem3
49 end if
50 deallocate (iei_smoothing)
51 ! -- STRICT_EFFECTIVE_STRESS terminates on negative effective stress
52 allocate (istrict)
53 istrict = 0
54 call mem_set_value(istrict, 'STRICT_STRESS', this%input_mempath, &
55 found%strict_stress)
56 if (found%strict_stress) then
57 this%istrict_stress = 1
58 end if
59 deallocate (istrict)
60 call mem_set_value(this%ipch, 'HEAD_BASED', this%input_mempath, &
61 found%head_based)
62 call mem_set_value(this%ipch, 'PRECON_HEAD', this%input_mempath, &
63 found%precon_head)
64 call mem_set_value(this%ndelaycells, 'NDELAYCELLS', this%input_mempath, &
65 found%ndelaycells)
66 call mem_set_value(this%istoragec, 'ICOMPRESS', this%input_mempath, &
67 found%icompress)
68 call mem_set_value(this%iupdatematprop, 'MATPROP', this%input_mempath, &
69 found%matprop)
70 call mem_set_value(this%icellf, 'CELL_FRACTION', this%input_mempath, &
71 found%cell_fraction)
72 call mem_set_value(ibs, 'INTERBED_STATE', this%input_mempath, &
73 found%interbed_state)
74 call mem_set_value(this%ispecified_pcs, 'PRECON_STRESS', this%input_mempath, &
75 found%precon_stress)
76 call mem_set_value(this%ispecified_dbh, 'DELAY_HEAD', this%input_mempath, &
77 found%delay_head)
78 call mem_set_value(this%ieslag, 'STRESS_LAG', this%input_mempath, &
79 found%stress_lag)
80 call mem_set_value(csv_interbed, 'INTERBEDSTRAINFN', this%input_mempath, &
81 found%interbedstrainfn)
82 call mem_set_value(csv_coarse, 'COARSESTRAINFN', this%input_mempath, &
83 found%coarsestrainfn)
84 call mem_set_value(cmp_fn, 'CMPFN', this%input_mempath, found%cmpfn)
85 call mem_set_value(ecmp_fn, 'ELASTICCMPFN', this%input_mempath, &
86 found%elasticcmpfn)
87 call mem_set_value(iecmp_fn, 'INELASTICCMPFN', this%input_mempath, &
88 found%inelasticcmpfn)
89 call mem_set_value(ibcmp_fn, 'INTERBEDCMPFN', this%input_mempath, &
90 found%interbedcmpfn)
91 call mem_set_value(cmpcoarse_fn, 'CMPCOARSEFN', this%input_mempath, &
92 found%cmpcoarsefn)
93 call mem_set_value(zdisp_fn, 'ZDISPFN', this%input_mempath, found%zdispfn)
94 call mem_set_value(pkg_converge_fn, 'PKGCONVERGEFN', this%input_mempath, &
95 found%pkgconvergefn)
96
97 ! -- enforce 0 or 1 OBS6_FILENAME entries in option block
98 if (filein_fname(this%obs%inputFilename, 'OBS6_FILENAME', &
99 this%input_mempath, this%input_fname)) then
100 this%obs%active = .true.
101 inobs = getunit()
102 call openfile(inobs, this%iout, this%obs%inputFilename, 'OBS')
103 this%obs%inUnitObs = inobs
104 this%inobspkg = inobs
105 call this%obs%obs_df(this%iout, this%packName, this%filtyp, this%dis)
106 call this%csub_df_obs()
107 end if
108
109 ! -- update input dependent internal state
110 if (found%save_flows) this%ipakcb = -1
111 if (found%head_based) then
112 this%lhead_based = .true.
113 if (this%ieslag /= 0) then
114 this%ieslag = 0
115 warn_estress_lag = .true.
116 end if
117 end if
118 if (found%icompress) this%istoragec = 0
119 if (found%interbed_state) then
120 this%ispecified_pcs = 1
121 this%ispecified_dbh = 1
122 end if
123 if (found%gammaw .or. found%beta) then
124 this%brg = this%gammaw * this%beta
125 end if
126
127 ! fileout options
128 if (found%interbedstrainfn) then
129 this%istrainib = getunit()
130 call openfile(this%istrainib, this%iout, csv_interbed, 'CSV_OUTPUT', &
131 filstat_opt='REPLACE', mode_opt=mnormal)
132 end if
133 if (found%coarsestrainfn) then
134 this%istrainsk = getunit()
135 call openfile(this%istrainsk, this%iout, csv_coarse, 'CSV_OUTPUT', &
136 filstat_opt='REPLACE', mode_opt=mnormal)
137 end if
138 if (found%cmpfn) then
139 this%ioutcomp = getunit()
140 call openfile(this%ioutcomp, this%iout, cmp_fn, 'DATA(BINARY)', &
141 form, access, 'REPLACE', mode_opt=mnormal)
142 end if
143 if (found%elasticcmpfn) then
144 this%ioutcompe = getunit()
145 call openfile(this%ioutcompe, this%iout, ecmp_fn, &
146 'DATA(BINARY)', form, access, 'REPLACE', &
147 mode_opt=mnormal)
148 end if
149 if (found%inelasticcmpfn) then
150 this%ioutcompi = getunit()
151 call openfile(this%ioutcompi, this%iout, iecmp_fn, &
152 'DATA(BINARY)', form, access, 'REPLACE', &
153 mode_opt=mnormal)
154 end if
155 if (found%interbedcmpfn) then
156 this%ioutcompib = getunit()
157 call openfile(this%ioutcompib, this%iout, ibcmp_fn, &
158 'DATA(BINARY)', form, access, 'REPLACE', &
159 mode_opt=mnormal)
160 end if
161 if (found%cmpcoarsefn) then
162 this%ioutcomps = getunit()
163 call openfile(this%ioutcomps, this%iout, cmpcoarse_fn, &
164 'DATA(BINARY)', form, access, 'REPLACE', &
165 mode_opt=mnormal)
166 end if
167 if (found%zdispfn) then
168 this%ioutzdisp = getunit()
169 call openfile(this%ioutzdisp, this%iout, zdisp_fn, &
170 'DATA(BINARY)', form, access, 'REPLACE', &
171 mode_opt=mnormal)
172 end if
173 if (found%pkgconvergefn) then
174 this%ipakcsv = getunit()
175 call openfile(this%ipakcsv, this%iout, pkg_converge_fn, 'CSV', &
176 filstat_opt='REPLACE', mode_opt=mnormal)
177 end if
178
179 ! -- log user options
180 call this%log_options(warn_estress_lag)
181
182 ! -- cleanup
183 deallocate (ibs)
184 end subroutine source_options
185
186 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
187 module subroutine log_options(this, warn_estress_lag)
188 ! -- modules
189 ! -- dummy variables
190 class(GwfCsubType), intent(inout) :: this
191 logical(LGP), intent(in) :: warn_estress_lag
192 ! -- local variables
193 ! -- formats
194 character(len=*), parameter :: fmtts = &
195 &"(4x,'TIME-SERIES DATA WILL BE READ FROM FILE: ',a)"
196 character(len=*), parameter :: fmtflow = &
197 &"(4x,'FLOWS WILL BE SAVED TO FILE: ',a,/4x,'OPENED ON UNIT: ',I7)"
198 character(len=*), parameter :: fmtflow2 = &
199 &"(4x,'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
200 character(len=*), parameter :: fmtssessv = &
201 &"(4x,'USING SSE AND SSV INSTEAD OF CR AND CC.')"
202 character(len=*), parameter :: fmtoffset = &
203 &"(4x,'INITIAL_STRESS TREATED AS AN OFFSET.')"
204 character(len=*), parameter :: fmtopt = &
205 &"(4x,A)"
206 character(len=*), parameter :: fmtopti = &
207 &"(4x,A,1X,I0)"
208 character(len=*), parameter :: fmtoptr = &
209 &"(4x,A,1X,G0)"
210 character(len=*), parameter :: fmtfileout = &
211 "(4x,'CSUB ',1x,a,1x,' WILL BE SAVED TO FILE: ',a,/4x,&
212 &'OPENED ON UNIT: ',I7)"
213 !
214 ! -- write messages for options
215 write (this%iout, '(//2(1X,A))') trim(adjustl(this%packName)), &
216 'PACKAGE SETTINGS'
217 write (this%iout, fmtopti) 'NUMBER OF DELAY CELLS =', &
218 this%ndelaycells
219 if (this%lhead_based .EQV. .true.) then
220 write (this%iout, '(4x,a)') &
221 'HEAD-BASED FORMULATION'
222 else
223 write (this%iout, '(4x,a)') &
224 'EFFECTIVE-STRESS FORMULATION'
225 end if
226 if (this%istoragec == 0) then
227 write (this%iout, '(4x,a,1(/,6x,a))') &
228 'COMPRESSION INDICES WILL BE SPECIFIED INSTEAD OF ELASTIC AND', &
229 'INELASTIC SPECIFIC STORAGE COEFFICIENTS'
230 else
231 write (this%iout, '(4x,a,1(/,6x,a))') &
232 'ELASTIC AND INELASTIC SPECIFIC STORAGE COEFFICIENTS WILL BE ', &
233 'SPECIFIED'
234 end if
235 if (this%iupdatematprop /= 1) then
236 write (this%iout, '(4x,a,1(/,6x,a))') &
237 'THICKNESS AND VOID RATIO WILL NOT BE ADJUSTED DURING THE', &
238 'SIMULATION'
239 else
240 write (this%iout, '(4x,a)') &
241 'THICKNESS AND VOID RATIO WILL BE ADJUSTED DURING THE SIMULATION'
242 end if
243 if (this%icellf /= 1) then
244 write (this%iout, '(4x,a)') &
245 'INTERBED THICKNESS WILL BE SPECIFIED AS A THICKNESS'
246 else
247 write (this%iout, '(4x,a,1(/,6x,a))') &
248 'INTERBED THICKNESS WILL BE SPECIFIED AS A AS A CELL FRACTION'
249 end if
250 if (this%ispecified_pcs /= 1) then
251 if (this%ipch /= 0) then
252 write (this%iout, '(4x,a,1(/,6x,a))') &
253 'PRECONSOLIDATION HEAD WILL BE SPECIFIED RELATIVE TO INITIAL', &
254 'STRESS CONDITIONS'
255 else
256 write (this%iout, '(4x,a,1(/,6x,a))') &
257 'PRECONSOLIDATION STRESS WILL BE SPECIFIED RELATIVE TO INITIAL', &
258 'STRESS CONDITIONS'
259 end if
260 else
261 if (this%ipch /= 0) then
262 write (this%iout, '(4x,a,1(/,6x,a))') &
263 'PRECONSOLIDATION HEAD WILL BE SPECIFIED AS ABSOLUTE VALUES', &
264 'INSTEAD OF RELATIVE TO INITIAL HEAD CONDITIONS'
265 else
266 write (this%iout, '(4x,a,1(/,6x,a))') &
267 'PRECONSOLIDATION STRESS WILL BE SPECIFIED AS ABSOLUTE VALUES', &
268 'INSTEAD OF RELATIVE TO INITIAL STRESS CONDITIONS'
269 end if
270 end if
271 if (this%ispecified_dbh /= 1) then
272 write (this%iout, '(4x,a,1(/,6x,a))') &
273 'DELAY INTERBED HEADS WILL BE SPECIFIED RELATIVE TO INITIAL ', &
274 'GWF HEADS'
275 else
276 write (this%iout, '(4x,a,1(/,6x,a))') &
277 'DELAY INTERBED HEADS WILL BE SPECIFIED AS ABSOLUTE VALUES INSTEAD', &
278 'OF RELATIVE TO INITIAL GWF HEADS'
279 end if
280 !
281 if (this%lhead_based .EQV. .false.) then
282 if (this%ieslag /= 0) then
283 write (this%iout, '(4x,a,1(/,6x,a))') &
284 'SPECIFIC STORAGE VALUES WILL BE CALCULATED USING THE EFFECTIVE', &
285 'STRESS FROM THE PREVIOUS TIME STEP'
286 else
287 write (this%iout, '(4x,a,1(/,6x,a))') &
288 'SPECIFIC STORAGE VALUES WILL BE CALCULATED USING THE CURRENT', &
289 'EFFECTIVE STRESS'
290 end if
291 if (this%istrict_stress == 0) then
292 write (this%iout, '(4x,a,1(/,6x,a))') &
293 'SMALL OR NEGATIVE EFFECTIVE STRESS WILL BE REGULARIZED BY FLOORING', &
294 'THE EFFECTIVE STRESS USED TO CALCULATE THE SPECIFIC STORAGE'
295 else
296 write (this%iout, '(4x,a,1(/,6x,a))') &
297 'SMALL OR NEGATIVE EFFECTIVE STRESS WILL TERMINATE THE SIMULATION', &
298 '(STRICT_EFFECTIVE_STRESS SPECIFIED)'
299 end if
300 else if (warn_estress_lag) then
301 write (this%iout, '(4x,a,2(/,6x,a))') &
302 'EFFECTIVE_STRESS_LAG HAS BEEN SPECIFIED BUT HAS NO EFFECT WHEN', &
303 'USING THE HEAD-BASED FORMULATION (HEAD_BASED HAS BEEN SPECIFIED', &
304 'IN THE OPTIONS BLOCK)'
305 end if
306 !
307 write (this%iout, fmtoptr) 'GAMMAW =', this%gammaw
308 write (this%iout, fmtoptr) 'BETA =', this%beta
309 write (this%iout, fmtoptr) 'GAMMAW * BETA =', this%brg
310 write (this%iout, '((1X,A))') 'END PACKAGE SETTINGS'
311 end subroutine log_options
312
313 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
314 module subroutine csub_source_dimensions(this)
315 ! -- modules
318 ! -- dummy variables
319 class(GwfCsubType), intent(inout) :: this
320 ! -- local variables
321 type(GwfCsubParamFoundType) :: found
322
323 ! -- initialize dimensions to -1
324 this%ninterbeds = -1
325
326 ! -- update defaults from input context
327 call mem_set_value(this%ninterbeds, 'NINTERBEDS', this%input_mempath, &
328 found%ninterbeds)
329 call mem_set_value(this%maxsig0, 'MAXBOUND', this%input_mempath, &
330 found%maxbound)
331
332 ! - log dimensions
333 write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%packName))// &
334 ' DIMENSIONS'
335 write (this%iout, '(4x,a,i0)') 'NINTERBEDS = ', this%ninterbeds
336 write (this%iout, '(4x,a,i0)') 'MAXSIG0 = ', this%maxsig0
337 write (this%iout, '(1x,a)') &
338 'END OF '//trim(adjustl(this%packName))//' DIMENSIONS'
339
340 ! -- verify dimensions were set correctly
341 if (.not. found%ninterbeds) then
342 write (errmsg, '(a)') &
343 'NINTERBEDS is a required dimension.'
344 call store_error(errmsg)
345 call store_error_filename(this%input_mempath)
346 end if
347
348 ! -- Call define_listlabel to construct the list label that is written
349 ! when PRINT_INPUT option is used.
350 call this%define_listlabel()
351 end subroutine csub_source_dimensions
352
353 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
354 module subroutine csub_source_griddata(this)
355 ! -- modules
358 ! -- dummy variables
359 class(GwfCsubType), intent(inout) :: this
360 ! -- locals
361 integer(I4B) :: node
362 type(GwfCsubParamFoundType) :: found
363 integer(I4B), dimension(:), pointer, contiguous :: map
364
365 ! -- set map to convert user input data into reduced data
366 map => null()
367 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
368
369 ! -- update defaults from input context
370 call mem_set_value(this%cg_ske_cr, 'CG_SKE_CR', this%input_mempath, &
371 map, found%cg_ske_cr)
372 call mem_set_value(this%cg_thetaini, 'CG_THETA', this%input_mempath, &
373 map, found%cg_theta)
374 call mem_set_value(this%sgm, 'SGM', this%input_mempath, map, found%sgm)
375 call mem_set_value(this%sgs, 'SGS', this%input_mempath, map, found%sgs)
376
377 ! -- cg_ske and cg_theta are required input params
378 if (.not. found%cg_ske_cr) then
379 call store_error('CG_SKE GRIDDATA must be specified.')
380 call store_error_filename(this%input_fname)
381 end if
382 if (.not. found%cg_theta) then
383 call store_error('CG_THETA GRIDDATA must be specified.')
384 call store_error_filename(this%input_fname)
385 end if
386
387 ! -- if sgm and sgs have not been specified assign default values
388 if (.not. found%sgm) then
389 do node = 1, this%dis%nodes
390 this%sgm(node) = 1.7d0
391 end do
392 end if
393 if (.not. found%sgs) then
394 do node = 1, this%dis%nodes
395 this%sgs(node) = 2.0d0
396 end do
397 end if
398 end subroutine csub_source_griddata
399
400 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
401 module subroutine csub_source_packagedata(this)
402 ! -- modules
406 ! -- dummy variables
407 class(GwfCsubType), intent(inout) :: this
408 integer(I4B), dimension(:), pointer, contiguous :: icsubno
409 integer(I4B), dimension(:, :), pointer, contiguous :: cellid_pkgdata
410 integer(I4B), dimension(:), pointer :: cellid
411 type(CharacterStringType), dimension(:), pointer, &
412 contiguous :: cdelay
413 type(CharacterStringType), dimension(:), pointer, &
414 contiguous :: boundname
415 real(DP), dimension(:), pointer, contiguous :: pcs, thick_frac, rnb
416 real(DP), dimension(:), pointer, contiguous :: ssv_cc, sse_cr, theta, kv, h0
417 character(len=LINELENGTH) :: cdelaystr
418 character(len=LENBOUNDNAME) :: bndname
419 character(len=20) :: cellidstr
420 real(DP) :: top, botm, baq, q, thick, rval
421 integer(I4B) :: idelay, ndelaybeds, csubno
422 integer(I4B) :: ib, n, nodeu, noder
423
424 ! -- set input context pointers
425 call mem_setptr(icsubno, 'ICSUBNO', this%input_mempath)
426 call mem_setptr(cellid_pkgdata, 'CELLID_PKGDATA', this%input_mempath)
427 call mem_setptr(cdelay, 'CDELAY', this%input_mempath)
428 call mem_setptr(pcs, 'PCS0', this%input_mempath)
429 call mem_setptr(thick_frac, 'THICK_FRAC', this%input_mempath)
430 call mem_setptr(rnb, 'RNB', this%input_mempath)
431 call mem_setptr(ssv_cc, 'SSV_CC', this%input_mempath)
432 call mem_setptr(sse_cr, 'SSE_CR', this%input_mempath)
433 call mem_setptr(theta, 'THETA', this%input_mempath)
434 call mem_setptr(kv, 'KV', this%input_mempath)
435 call mem_setptr(h0, 'H0', this%input_mempath)
436 call mem_setptr(boundname, 'BOUNDNAME', this%input_mempath)
437
438 ! initialize ndelaybeds
439 ndelaybeds = 0
440
441 ! -- update state
442 do n = 1, size(icsubno)
443
444 ! -- set cubno
445 csubno = icsubno(n)
446
447 ! -- check csubno
448 if (csubno < 1 .or. csubno > this%ninterbeds) then
449 write (errmsg, '(a,1x,i0,2(1x,a),1x,i0,a)') &
450 'Interbed number (', csubno, ') must be greater than 0 and ', &
451 'less than or equal to', this%ninterbeds, '.'
452 call store_error(errmsg)
453 cycle
454 end if
455
456 ! -- set cellid
457 cellid => cellid_pkgdata(:, n)
458
459 ! -- set node user
460 if (this%dis%ndim == 1) then
461 nodeu = cellid(1)
462 elseif (this%dis%ndim == 2) then
463 nodeu = get_node(cellid(1), 1, cellid(2), &
464 this%dis%mshape(1), 1, &
465 this%dis%mshape(2))
466 else
467 nodeu = get_node(cellid(1), cellid(2), cellid(3), &
468 this%dis%mshape(1), &
469 this%dis%mshape(2), &
470 this%dis%mshape(3))
471 end if
472
473 ! -- set node reduced
474 noder = this%dis%get_nodenumber(nodeu, 1)
475 if (noder <= 0) then
476 call this%dis%nodeu_to_string(nodeu, cellidstr)
477 write (errmsg, '(a)') &
478 'CSUB configured for inactive cell: '// &
479 trim(adjustl(cellidstr))//'.'
480 call store_error(errmsg)
481 cycle
482 end if
483
484 ! -- update nodelists
485 this%nodelist(csubno) = noder
486 this%unodelist(csubno) = nodeu
487
488 ! -- set top, botm, baq
489 top = this%dis%top(noder)
490 botm = this%dis%bot(noder)
491 baq = top - botm
492
493 ! -- set cdelay
494 cdelaystr = cdelay(n)
495 select case (cdelaystr)
496 case ('NODELAY')
497 idelay = 0
498 case ('DELAY')
499 ndelaybeds = ndelaybeds + 1
500 idelay = ndelaybeds
501 case default
502 write (errmsg, '(a,1x,a,1x,i0,1x,a)') &
503 'Invalid CDELAY ', trim(adjustl(cdelaystr)), &
504 'for packagedata entry', csubno, '.'
505 call store_error(errmsg)
506 cycle
507 end select
508 this%idelay(csubno) = idelay
509
510 ! -- set initial preconsolidation stress
511 this%pcs(csubno) = pcs(n)
512
513 ! -- set thickness
514 if (this%icellf == 0) then
515 if (thick_frac(n) < dzero .or. thick_frac(n) > baq) then
516 write (errmsg, '(a,g0,2(a,1x),g0,1x,a,1x,i0,a)') &
517 'THICK (', thick_frac(n), ') MUST BE greater than or equal to 0 ', &
518 'and less than or equal to than', baq, &
519 'for packagedata entry', csubno, '.'
520 call store_error(errmsg)
521 end if
522 thick = thick_frac(n)
523 else
524 if (thick_frac(n) < dzero .or. thick_frac(n) > done) then
525 write (errmsg, '(a,1x,a,1x,i0,a)') &
526 'FRAC MUST BE greater than 0 and less than or equal to 1', &
527 'for packagedata entry', csubno, '.'
528 call store_error(errmsg)
529 end if
530 thick = thick_frac(n) * baq
531 end if
532 this%thickini(csubno) = thick
533 if (this%iupdatematprop /= 0) then
534 this%thick(csubno) = thick
535 end if
536
537 ! -- set rnb
538 if (idelay > 0) then
539 if (rnb(n) < done) then
540 write (errmsg, '(a,g0,a,1x,a,1x,i0,a)') &
541 'RNB (', rnb(n), ') must be greater than or equal to 1', &
542 'for packagedata entry', csubno, '.'
543 call store_error(errmsg)
544 end if
545 this%rnb(csubno) = rnb(n)
546 else
547 this%rnb(csubno) = done
548 end if
549
550 ! -- set skv or ci
551 if (ssv_cc(n) < dzero) then
552 write (errmsg, '(2(a,1x),i0,a)') &
553 '(SKV,CI) must be greater than or equal to 0', &
554 'for packagedata entry', csubno, '.'
555 call store_error(errmsg)
556 end if
557 this%ci(csubno) = ssv_cc(n)
558
559 ! -- set ske or rci
560 if (sse_cr(n) < dzero) then
561 write (errmsg, '(2(a,1x),i0,a)') &
562 '(SKE,RCI) must be greater than or equal to 0', &
563 'for packagedata entry', csubno, '.'
564 call store_error(errmsg)
565 end if
566 this%rci(csubno) = sse_cr(n)
567
568 ! -- set ielastic
569 if (this%ci(csubno) == this%rci(csubno)) then
570 this%ielastic(csubno) = 1
571 else
572 this%ielastic(csubno) = 0
573 end if
574
575 ! -- set porosity
576 if (theta(n) <= dzero .or. theta(n) > done) then
577 write (errmsg, '(a,1x,a,1x,i0,a)') &
578 'THETA must be greater than 0 and less than or equal to 1', &
579 'for packagedata entry', csubno, '.'
580 call store_error(errmsg)
581 end if
582 this%thetaini(csubno) = theta(n)
583 if (this%iupdatematprop /= 0) then
584 this%theta(csubno) = theta(n)
585 end if
586
587 ! -- set kv
588 if (idelay > 0) then
589 if (kv(n) <= 0.0) then
590 write (errmsg, '(a,1x,i0,a)') &
591 'KV must be greater than 0 for packagedata entry', csubno, '.'
592 call store_error(errmsg)
593 end if
594 end if
595 this%kv(csubno) = kv(n)
596
597 ! -- set h0
598 this%h0(csubno) = h0(n)
599
600 ! -- set bound name
601 if (this%inamedbound /= 0) then
602 bndname = boundname(n)
603 if (len_trim(bndname) < 1) then
604 write (errmsg, '(a,1x,i0,a)') &
605 'BOUNDNAME must be specified for packagedata entry', csubno, '.'
606 call store_error(errmsg)
607 end if
608 this%boundname(csubno) = bndname
609 end if
610 end do
611
612 !
613 ! -- set the number of delay interbeds
614 this%ndelaybeds = ndelaybeds
615 !
616 ! -- process delay interbeds
617 if (ndelaybeds > 0) then
618 !
619 ! -- reallocate and initialize delay interbed arrays
620 call mem_allocate(this%idb_nconv_count, 2, &
621 'IDB_NCONV_COUNT', trim(this%memoryPath))
622 call mem_allocate(this%idbconvert, this%ndelaycells, ndelaybeds, &
623 'IDBCONVERT', trim(this%memoryPath))
624 call mem_allocate(this%dbdhmax, ndelaybeds, &
625 'DBDHMAX', trim(this%memoryPath))
626 call mem_allocate(this%dbz, this%ndelaycells, ndelaybeds, &
627 'DBZ', trim(this%memoryPath))
628 call mem_allocate(this%dbrelz, this%ndelaycells, ndelaybeds, &
629 'DBRELZ', trim(this%memoryPath))
630 call mem_allocate(this%dbh, this%ndelaycells, ndelaybeds, &
631 'DBH', trim(this%memoryPath))
632 call mem_allocate(this%dbh0, this%ndelaycells, ndelaybeds, &
633 'DBH0', trim(this%memoryPath))
634 call mem_allocate(this%dbgeo, this%ndelaycells, ndelaybeds, &
635 'DBGEO', trim(this%memoryPath))
636 call mem_allocate(this%dbes, this%ndelaycells, ndelaybeds, &
637 'DBES', trim(this%memoryPath))
638 call mem_allocate(this%dbes0, this%ndelaycells, ndelaybeds, &
639 'DBES0', trim(this%memoryPath))
640 call mem_allocate(this%dbpcs, this%ndelaycells, ndelaybeds, &
641 'DBPCS', trim(this%memoryPath))
642 call mem_allocate(this%dbflowtop, ndelaybeds, &
643 'DBFLOWTOP', trim(this%memoryPath))
644 call mem_allocate(this%dbflowbot, ndelaybeds, &
645 'DBFLOWBOT', trim(this%memoryPath))
646 call mem_allocate(this%dbdzini, this%ndelaycells, ndelaybeds, &
647 'DBDZINI', trim(this%memoryPath))
648 call mem_allocate(this%dbthetaini, this%ndelaycells, ndelaybeds, &
649 'DBTHETAINI', trim(this%memoryPath))
650 call mem_allocate(this%dbcomp, this%ndelaycells, ndelaybeds, &
651 'DBCOMP', trim(this%memoryPath))
652 call mem_allocate(this%dbtcomp, this%ndelaycells, ndelaybeds, &
653 'DBTCOMP', trim(this%memoryPath))
654 !
655 ! -- allocate delay bed arrays
656 if (this%iupdatematprop == 0) then
657 call mem_setptr(this%dbdz, 'DBDZINI', trim(this%memoryPath))
658 call mem_setptr(this%dbdz0, 'DBDZINI', trim(this%memoryPath))
659 call mem_setptr(this%dbtheta, 'DBTHETAINI', trim(this%memoryPath))
660 call mem_setptr(this%dbtheta0, 'DBTHETAINI', trim(this%memoryPath))
661 else
662 call mem_allocate(this%dbdz, this%ndelaycells, ndelaybeds, &
663 'DBDZ', trim(this%memoryPath))
664 call mem_allocate(this%dbdz0, this%ndelaycells, ndelaybeds, &
665 'DBDZ0', trim(this%memoryPath))
666 call mem_allocate(this%dbtheta, this%ndelaycells, ndelaybeds, &
667 'DBTHETA', trim(this%memoryPath))
668 call mem_allocate(this%dbtheta0, this%ndelaycells, ndelaybeds, &
669 'DBTHETA0', trim(this%memoryPath))
670 end if
671 !
672 ! -- allocate delay interbed solution arrays
673 call mem_allocate(this%dbal, this%ndelaycells, &
674 'DBAL', trim(this%memoryPath))
675 call mem_allocate(this%dbad, this%ndelaycells, &
676 'DBAD', trim(this%memoryPath))
677 call mem_allocate(this%dbau, this%ndelaycells, &
678 'DBAU', trim(this%memoryPath))
679 call mem_allocate(this%dbrhs, this%ndelaycells, &
680 'DBRHS', trim(this%memoryPath))
681 call mem_allocate(this%dbdh, this%ndelaycells, &
682 'DBDH', trim(this%memoryPath))
683 call mem_allocate(this%dbaw, this%ndelaycells, &
684 'DBAW', trim(this%memoryPath))
685 !
686 ! -- initialize delay bed counters
687 do n = 1, 2
688 this%idb_nconv_count(n) = 0
689 end do
690 !
691 ! -- initialize delay bed storage
692 do ib = 1, this%ninterbeds
693 idelay = this%idelay(ib)
694 if (idelay == 0) then
695 cycle
696 end if
697 !
698 ! -- initialize delay interbed variables
699 do n = 1, this%ndelaycells
700 rval = this%thickini(ib) / real(this%ndelaycells, dp)
701 this%dbdzini(n, idelay) = rval
702 this%dbh(n, idelay) = this%h0(ib)
703 this%dbh0(n, idelay) = this%h0(ib)
704 this%dbthetaini(n, idelay) = this%thetaini(ib)
705 this%dbgeo(n, idelay) = dzero
706 this%dbes(n, idelay) = dzero
707 this%dbes0(n, idelay) = dzero
708 this%dbpcs(n, idelay) = this%pcs(ib)
709 this%dbcomp(n, idelay) = dzero
710 this%dbtcomp(n, idelay) = dzero
711 if (this%iupdatematprop /= 0) then
712 this%dbdz(n, idelay) = this%dbdzini(n, idelay)
713 this%dbdz0(n, idelay) = this%dbdzini(n, idelay)
714 this%dbtheta(n, idelay) = this%theta(ib)
715 this%dbtheta0(n, idelay) = this%theta(ib)
716 end if
717 end do
718 !
719 ! -- initialize elevation of delay bed cells
720 call this%csub_delay_init_zcell(ib)
721 end do
722 !
723 ! -- initialize delay bed solution arrays
724 do n = 1, this%ndelaycells
725 this%dbal(n) = dzero
726 this%dbad(n) = dzero
727 this%dbau(n) = dzero
728 this%dbrhs(n) = dzero
729 this%dbdh(n) = dzero
730 this%dbaw(n) = dzero
731 end do
732 end if
733 !
734 ! -- check that ndelaycells is odd when using
735 ! the effective stress formulation
736 if (ndelaybeds > 0) then
737 q = mod(real(this%ndelaycells, dp), dtwo)
738 if (q == dzero) then
739 write (errmsg, '(a,i0,a,1x,a)') &
740 'NDELAYCELLS (', this%ndelaycells, ') must be an', &
741 'odd number when using the effective stress formulation.'
742 call store_error(errmsg)
743 end if
744 end if
745
746 if (this%iprpak /= 0) then
747 call this%csub_print_packagedata()
748 end if
749
750 ! -- terminate if errors encountered
751 if (count_errors() > 0) then
752 call store_error_filename(this%input_fname)
753 end if
754
755 call memorystore_release('ICSUBNO', this%input_mempath)
756 call memorystore_release('CELLID_PKGDATA', this%input_mempath)
757 call memorystore_release('CDELAY', this%input_mempath)
758 call memorystore_release('PCS0', this%input_mempath)
759 call memorystore_release('THICK_FRAC', this%input_mempath)
760 call memorystore_release('RNB', this%input_mempath)
761 call memorystore_release('SSV_CC', this%input_mempath)
762 call memorystore_release('SSE_CR', this%input_mempath)
763 call memorystore_release('THETA', this%input_mempath)
764 call memorystore_release('KV', this%input_mempath)
765 call memorystore_release('H0', this%input_mempath)
766 call memorystore_release('BOUNDNAME', this%input_mempath)
767 end subroutine csub_source_packagedata
768
769 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
770 module subroutine csub_print_packagedata(this)
771 ! -- dummy variables
772 class(GwfCsubType) :: this
773 ! local
774 character(len=LINELENGTH) :: title
775 character(len=LINELENGTH) :: tag
776 character(len=10) :: ctype
777 character(len=20) :: cellid
778 integer(I4B) :: ntabrows
779 integer(I4B) :: ntabcols
780 integer(I4B) :: ib
781 integer(I4b) :: idelay
782 integer(I4B) :: node
783
784 ! set title
785 title = 'CSUB'//' PACKAGE ('// &
786 trim(adjustl(this%packName))//') INTERBED DATA'
787 !
788 ! determine the number of columns and rows
789 ntabrows = this%ninterbeds
790 ntabcols = 13
791 if (this%inamedbound /= 0) then
792 ntabcols = ntabcols + 1
793 end if
794
795 ! setup table
796 call table_cr(this%inputtab, this%packName, title)
797 call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
798 !
799 ! add columns
800 !<icsubno> <cellid> <cdelay> <pcs0> <thick_frac> <rnb> <ssv_cc> <sse_cr> <theta> <kv> <h0> [<boundname>]
801
802 tag = 'INTERBED NUMBER'
803 call this%inputtab%initialize_column(tag, 10, alignment=tabcenter)
804 tag = 'CELLID'
805 call this%inputtab%initialize_column(tag, 20, alignment=tableft)
806 tag = 'INTERBED TYPE'
807 call this%inputtab%initialize_column(tag, 10, alignment=tabcenter)
808 tag = 'PCS0'
809 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
810 tag = 'THICK_FRAC'
811 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
812 tag = 'RNB'
813 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
814 tag = 'INTERBED THICKNESS'
815 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
816 tag = 'CELL THICKNESS'
817 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
818 tag = 'SSV_CV'
819 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
820 tag = 'SSE_CR'
821 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
822 tag = 'THETA'
823 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
824 tag = 'KV'
825 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
826 tag = 'H0'
827 call this%inputtab%initialize_column(tag, 12, alignment=tabcenter)
828 if (this%inamedbound /= 0) then
829 tag = 'BOUNDNAME'
830 call this%inputtab%initialize_column(tag, 40, alignment=tableft)
831 end if
832
833 do ib = 1, this%ninterbeds
834 idelay = this%idelay(ib)
835 node = this%nodelist(ib)
836 call this%dis%noder_to_string(node, cellid)
837 if (idelay == 0) then
838 ctype = 'nodelay'
839 else
840 ctype = 'delay'
841 end if
842
843 ! fill table line
844 call this%inputtab%add_term(ib)
845 call this%inputtab%add_term(cellid)
846 call this%inputtab%add_term(ctype)
847 call this%inputtab%add_term(this%pcs(ib))
848 call this%inputtab%add_term(this%thickini(ib))
849 call this%inputtab%add_term(this%rnb(ib))
850 call this%inputtab%add_term(this%thickini(ib) * this%rnb(ib))
851 call this%inputtab%add_term(this%dis%top(node) - this%dis%bot(node))
852 call this%inputtab%add_term(this%ci(ib))
853 call this%inputtab%add_term(this%rci(ib))
854 call this%inputtab%add_term(this%theta(ib))
855 if (idelay == 0) then
856 call this%inputtab%add_term("--")
857 call this%inputtab%add_term("--")
858 else
859 call this%inputtab%add_term(this%kv(ib))
860 call this%inputtab%add_term(this%h0(ib))
861 end if
862 if (this%inamedbound /= 0) then
863 call this%inputtab%add_term(this%boundname(ib))
864 end if
865 end do
866
867 end subroutine csub_print_packagedata
868
869 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
870 module subroutine csub_initialize_tables(this)
871 ! -- dummy variables
872 class(GwfCsubType) :: this
873
874 character(len=LINELENGTH) :: tag
875 integer(I4B) :: ntabrows
876 integer(I4B) :: ntabcols
877
878 if (this%ipakcsv > 0) then
879 if (this%ndelaybeds < 1) then
880 write (warnmsg, '(a,1x,3a)') &
881 'Package convergence data is requested but delay interbeds', &
882 'are not included in package (', &
883 trim(adjustl(this%packName)), ').'
884 call store_warning(warnmsg)
885 end if
886
887 ntabrows = 1
888 ntabcols = 9
889
890 ! setup table
891 call table_cr(this%pakcsvtab, this%packName, '')
892 call this%pakcsvtab%table_df(ntabrows, ntabcols, this%ipakcsv, &
893 lineseparator=.false., separator=',', &
894 finalize=.false.)
895
896 ! add columns to package csv
897 tag = 'total_inner_iterations'
898 call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
899 tag = 'totim'
900 call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
901 tag = 'kper'
902 call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
903 tag = 'kstp'
904 call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
905 tag = 'nouter'
906 call this%pakcsvtab%initialize_column(tag, 10, alignment=tableft)
907 tag = 'dvmax'
908 call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
909 tag = 'dvmax_loc'
910 call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
911 tag = 'dstoragemax'
912 call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
913 tag = 'dstoragemax_loc'
914 call this%pakcsvtab%initialize_column(tag, 15, alignment=tableft)
915 end if
916
917 end subroutine csub_initialize_tables
918
919 ! -- documented on the GwfCsubType type-bound procedure in gwf-csub.f90
920 module subroutine define_listlabel(this)
921 ! -- dummy variables
922 class(GwfCsubType), intent(inout) :: this
923 !
924 ! -- create the header list label
925 this%listlabel = trim(this%filtyp)//' NO.'
926 if (this%dis%ndim == 3) then
927 write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
928 write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
929 write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
930 elseif (this%dis%ndim == 2) then
931 write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
932 write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
933 else
934 write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
935 end if
936 write (this%listlabel, '(a, a16)') trim(this%listlabel), 'SIG0'
937 if (this%inamedbound == 1) then
938 write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
939 end if
940 end subroutine define_listlabel
941
942end submodule gwfcsubmoduleinput
subroutine source_options(this, iout)
Source options.
This module contains simulation constants.
Definition Constants.f90:9
@ mnormal
normal output mode
real(dp), parameter dem3
real constant 1e-3
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
integer(i4b), parameter maxcharlen
maximum length of char string
Definition Constants.f90:47
This module contains the CSUB package methods.
Definition gwf-csub.f90:23
subroutine, public urdaux(naux, inunit, iout, lloc, istart, istop, auxname, line, text)
Read auxiliary variables from an input line.
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.
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
character(len=20) access
Definition OpenSpec.f90:7
character(len=20) form
Definition OpenSpec.f90:7
This module contains the SourceCommonModule.
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
This class is used to store a single deferred-length character string. It was designed to work in an ...
subroutine log_options(this, found)
Write user options to list file.
Definition swf-dfw.f90:385