MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwf.f90
Go to the documentation of this file.
2
3 use kindmodule, only: dp, i4b
11 use gwficmodule, only: gwfictype
12 use gwfnpfmodule, only: gwfnpftype
13 use xt3dmodule, only: xt3dtype
14 use gwfbuymodule, only: gwfbuytype
15 use gwfvscmodule, only: gwfvsctype
16 use gwfhfbmodule, only: gwfhfbtype
17 use gwfstomodule, only: gwfstotype
18 use gwfcsubmodule, only: gwfcsubtype
19 use gwfmvrmodule, only: gwfmvrtype
20 use budgetmodule, only: budgettype
21 use gwfocmodule, only: gwfoctype
26
27 implicit none
28
29 private
30 public :: gwf_cr
31 public :: gwfmodeltype
32 public :: castasgwfmodel
34 public :: gwf_basepkg, gwf_multipkg
35
37
38 type(gwfictype), pointer :: ic => null() ! initial conditions package
39 type(gwfnpftype), pointer :: npf => null() ! node property flow package
40 type(xt3dtype), pointer :: xt3d => null() ! xt3d option for npf
41 type(gwfbuytype), pointer :: buy => null() ! buoyancy package
42 type(gwfvsctype), pointer :: vsc => null() ! viscosity package
43 type(gwfstotype), pointer :: sto => null() ! storage package
44 type(gwfcsubtype), pointer :: csub => null() ! subsidence package
45 type(gwfoctype), pointer :: oc => null() ! output control package
46 type(ghostnodetype), pointer :: gnc => null() ! ghost node correction package
47 type(gwfhfbtype), pointer :: hfb => null() ! hydraulic flow barrier package
48 type(gwfmvrtype), pointer :: mvr => null() ! water mover package
49 type(gwfobstype), pointer :: obs => null() ! observation package
50 type(budgettype), pointer :: budget => null() ! budget object
51 integer(I4B), pointer :: inic => null() ! IC enabled flag
52 integer(I4B), pointer :: inoc => null() ! unit number OC
53 integer(I4B), pointer :: innpf => null() ! NPF enabled flag
54 integer(I4B), pointer :: inbuy => null() ! unit number BUY
55 integer(I4B), pointer :: invsc => null() ! unit number VSC
56 integer(I4B), pointer :: insto => null() ! STO enabled flag
57 integer(I4B), pointer :: incsub => null() ! unit number CSUB
58 integer(I4B), pointer :: inmvr => null() ! unit number MVR
59 integer(I4B), pointer :: inhfb => null() ! unit number HFB
60 integer(I4B), pointer :: ingnc => null() ! unit number GNC
61 integer(I4B), pointer :: inobs => null() ! unit number OBS
62 integer(I4B), pointer :: iss => null() ! steady state flag
63 integer(I4B), pointer :: inewtonur => null() ! newton under relaxation flag
64
65 contains
66
67 procedure :: model_df => gwf_df
68 procedure :: model_ac => gwf_ac
69 procedure :: model_mc => gwf_mc
70 procedure :: model_ar => gwf_ar
71 procedure :: model_rp => gwf_rp
72 procedure :: model_ad => gwf_ad
73 procedure :: model_cf => gwf_cf
74 procedure :: model_fc => gwf_fc
75 procedure :: model_cc => gwf_cc
76 procedure :: model_ptcchk => gwf_ptcchk
77 procedure :: model_ptc => gwf_ptc
78 procedure :: model_nur => gwf_nur
79 procedure :: model_cq => gwf_cq
80 procedure :: model_bd => gwf_bd
81 procedure :: model_ot => gwf_ot
82 procedure :: model_dt => gwf_dt
83 procedure :: model_fp => gwf_fp
84 procedure :: model_da => gwf_da
85 procedure :: model_bdentry => gwf_bdentry
86 procedure :: get_iasym => gwf_get_iasym
87 ! -- private
88 procedure :: allocate_scalars
89 procedure :: package_create
90 procedure :: ftype_check
91 procedure :: gwf_ot_obs
92 procedure :: gwf_ot_flow
93 procedure :: gwf_ot_dv
94 procedure :: gwf_ot_bdsummary
95 procedure, private :: create_packages
96 procedure, private :: create_bndpkgs
97 procedure, private :: log_namfile_options
98 procedure, private :: steady_period_check
99 !
100 end type gwfmodeltype
101
102 !> @brief GWF base package array descriptors
103 !!
104 !! GWF6 model base package types. Only listed packages are candidates
105 !! for input and these will be loaded in the order specified.
106 !<
107 integer(I4B), parameter :: gwf_nbasepkg = 50
108 character(len=LENPACKAGETYPE), dimension(GWF_NBASEPKG) :: gwf_basepkg
109 data gwf_basepkg/'DIS6 ', 'DISV6', 'DISU6', ' ', ' ', & ! 5
110 &'NPF6 ', 'BUY6 ', 'VSC6 ', 'GNC6 ', ' ', & ! 10
111 &'HFB6 ', 'STO6 ', 'IC6 ', 'CSUB6', ' ', & ! 15
112 &'MVR6 ', 'OC6 ', 'OBS6 ', ' ', ' ', & ! 20
113 &30*' '/ ! 50
114
115 !> @brief GWF multi package array descriptors
116 !!
117 !! GWF6 model multi-instance package types. Only listed packages are
118 !! candidates for input and these will be loaded in the order specified.
119 !<
120 integer(I4B), parameter :: gwf_nmultipkg = 50
121 character(len=LENPACKAGETYPE), dimension(GWF_NMULTIPKG) :: gwf_multipkg
122 data gwf_multipkg/'WEL6 ', 'DRN6 ', 'RIV6 ', 'GHB6 ', ' ', & ! 5
123 &'RCH6 ', 'EVT6 ', 'CHD6 ', ' ', ' ', & ! 10
124 &'MAW6 ', 'SFR6 ', 'LAK6 ', 'UZF6 ', 'API6 ', & ! 15
125 &35*' '/ ! 50
126
127 ! -- size of supported model package arrays
128 integer(I4B), parameter :: niunit_gwf = gwf_nbasepkg + gwf_nmultipkg
129
130contains
131
132 !> @brief Create a new groundwater flow model object
133 !!
134 !! (1) creates model object and add to modellist
135 !! (2) assign values
136 !!
137 !<
138 subroutine gwf_cr(filename, id, modelname)
139 ! -- modules
140 use listsmodule, only: basemodellist
142 use constantsmodule, only: linelength
147 use budgetmodule, only: budget_cr
148 ! -- dummy
149 character(len=*), intent(in) :: filename !< input file
150 integer(I4B), intent(in) :: id !< consecutive model number listed in mfsim.nam
151 character(len=*), intent(in) :: modelname !< name of the model
152 ! -- local
153 type(gwfmodeltype), pointer :: this
154 class(basemodeltype), pointer :: model
155 character(len=LENMEMPATH) :: input_mempath
156 character(len=LINELENGTH) :: lst_fname
157 type(gwfnamparamfoundtype) :: found
158 ! -- format
159 !
160 ! -- Allocate a new GWF Model (this) and add it to basemodellist
161 allocate (this)
162 !
163 ! -- Set memory path before allocation in memory manager can be done
164 this%memoryPath = create_mem_path(modelname)
165 !
166 call this%allocate_scalars(modelname)
167 model => this
169 !
170 ! -- Assign values
171 this%filename = filename
172 this%name = modelname
173 this%macronym = 'GWF'
174 this%id = id
175 !
176 ! -- set input model namfile memory path
177 input_mempath = create_mem_path(modelname, 'NAM', idm_context)
178 !
179 ! -- copy option params from input context
180 call mem_set_value(lst_fname, 'LIST', input_mempath, found%list)
181 call mem_set_value(this%inewton, 'NEWTON', input_mempath, found%newton)
182 call mem_set_value(this%inewtonur, 'UNDER_RELAXATION', input_mempath, &
183 found%under_relaxation)
184 call mem_set_value(this%iprpak, 'PRINT_INPUT', input_mempath, &
185 found%print_input)
186 call mem_set_value(this%iprflow, 'PRINT_FLOWS', input_mempath, &
187 found%print_flows)
188 call mem_set_value(this%ipakcb, 'SAVE_FLOWS', input_mempath, found%save_flows)
189 !
190 ! -- create the list file
191 call this%create_lstfile(lst_fname, filename, found%list, &
192 'GROUNDWATER FLOW MODEL (GWF)')
193 !
194 ! -- activate save_flows if found
195 if (found%save_flows) then
196 this%ipakcb = -1
197 end if
198 !
199 ! -- log set options
200 if (this%iout > 0) then
201 call this%log_namfile_options(found)
202 end if
203 !
204 ! -- Create utility objects
205 call budget_cr(this%budget, this%name)
206 !
207 ! -- create model packages
208 call this%create_packages()
209 end subroutine gwf_cr
210
211 !> @brief Define packages of the model
212 !!
213 !! (1) call df routines for each package
214 !! (2) set gwf variables and pointers
215 !!
216 !<
217 subroutine gwf_df(this)
218 ! -- modules
219 ! -- dummy
220 class(gwfmodeltype) :: this
221 ! -- local
222 integer(I4B) :: ip
223 class(bndtype), pointer :: packobj
224 !
225 ! -- Define packages and utility objects
226 call this%dis%dis_df()
227 call this%npf%npf_df(this%dis, this%xt3d, this%ingnc, this%invsc)
228 call this%oc%oc_df()
229 call this%budget%budget_df(niunit_gwf, 'VOLUME', 'L**3')
230 if (this%inbuy > 0) call this%buy%buy_df(this%dis)
231 if (this%invsc > 0) call this%vsc%vsc_df(this%dis)
232 if (this%ingnc > 0) call this%gnc%gnc_df(this)
233 !
234 ! -- Assign or point model members to dis members
235 ! this%neq will be incremented if packages add additional unknowns
236 this%neq = this%dis%nodes
237 this%nja = this%dis%nja
238 this%ia => this%dis%con%ia
239 this%ja => this%dis%con%ja
240 !
241 ! -- Allocate model arrays, now that neq and nja are known
242 call this%allocate_arrays()
243 !
244 ! -- Define packages and assign iout for time series managers
245 do ip = 1, this%bndlist%Count()
246 packobj => getbndfromlist(this%bndlist, ip)
247 call packobj%bnd_df(this%neq, this%dis)
248 end do
249 !
250 ! -- Store information needed for observations
251 call this%obs%obs_df(this%iout, this%name, 'GWF', this%dis)
252 end subroutine gwf_df
253
254 !> @brief Add the internal connections of this model to the sparse matrix
255 !<
256 subroutine gwf_ac(this, sparse)
257 ! -- modules
258 use sparsemodule, only: sparsematrix
259 ! -- dummy
260 class(gwfmodeltype) :: this
261 type(sparsematrix), intent(inout) :: sparse
262 ! -- local
263 class(bndtype), pointer :: packobj
264 integer(I4B) :: ip
265 !
266 ! -- Add the primary grid connections of this model to sparse
267 call this%dis%dis_ac(this%moffset, sparse)
268 !
269 ! -- Add any additional connections that NPF may need
270 if (this%innpf > 0) call this%npf%npf_ac(this%moffset, sparse)
271 !
272 ! -- Add any package connections
273 do ip = 1, this%bndlist%Count()
274 packobj => getbndfromlist(this%bndlist, ip)
275 call packobj%bnd_ac(this%moffset, sparse)
276 end do
277 !
278 ! -- If GNC is active, then add the gnc connections to sparse
279 if (this%ingnc > 0) call this%gnc%gnc_ac(sparse)
280 end subroutine gwf_ac
281
282 !> @brief Map the positions of this models connections in the
283 !! numerical solution coefficient matrix.
284 !<
285 subroutine gwf_mc(this, matrix_sln)
286 ! -- dummy
287 class(gwfmodeltype) :: this
288 class(matrixbasetype), pointer :: matrix_sln
289 ! -- local
290 class(bndtype), pointer :: packobj
291 integer(I4B) :: ip
292 !
293 ! -- Find the position of each connection in the global ia, ja structure
294 ! and store them in idxglo.
295 call this%dis%dis_mc(this%moffset, this%idxglo, matrix_sln)
296 !
297 ! -- Map any additional connections that NPF may need
298 if (this%innpf > 0) call this%npf%npf_mc(this%moffset, matrix_sln)
299 !
300 ! -- Map any package connections
301 do ip = 1, this%bndlist%Count()
302 packobj => getbndfromlist(this%bndlist, ip)
303 call packobj%bnd_mc(this%moffset, matrix_sln)
304 end do
305 !
306 ! -- For implicit gnc, need to store positions of gnc connections
307 ! in solution matrix connection
308 if (this%ingnc > 0) call this%gnc%gnc_mc(matrix_sln)
309 end subroutine gwf_mc
310
311 !> @brief GroundWater Flow Model Allocate and Read
312 !!
313 !! (1) allocates and reads packages part of this model,
314 !! (2) allocates memory for arrays part of this model object
315 !!
316 !<
317 subroutine gwf_ar(this)
318 ! -- dummy
319 class(gwfmodeltype) :: this
320 ! -- locals
321 integer(I4B) :: ip
322 class(bndtype), pointer :: packobj
323 !
324 ! -- Allocate and read modules attached to model
325 if (this%inic > 0) call this%ic%ic_ar(this%x)
326 if (this%innpf > 0) call this%npf%npf_ar(this%ic, this%vsc, this%ibound, &
327 this%x)
328 if (this%invsc > 0) call this%vsc%vsc_ar(this%ibound)
329 if (this%inbuy > 0) call this%buy%buy_ar(this%npf, this%ibound)
330 if (this%inhfb > 0) call this%hfb%hfb_ar(this%ibound, this%xt3d, this%dis, &
331 this%invsc, this%vsc)
332 if (this%insto > 0) call this%sto%sto_ar(this%dis, this%ibound)
333 if (this%incsub > 0) call this%csub%csub_ar(this%dis, this%ibound)
334 if (this%inmvr > 0) call this%mvr%mvr_ar()
335 if (this%inobs > 0) call this%obs%gwf_obs_ar(this%ic, this%x, this%flowja)
336 !
337 ! -- Call dis_ar to write binary grid file
338 call this%dis%dis_ar(this%npf%icelltype)
339 !
340 ! -- set up output control
341 call this%oc%oc_ar(this%x, this%dis, this%npf%hnoflo)
342 call this%budget%set_ibudcsv(this%oc%ibudcsv)
343 !
344 ! -- Package input files now open, so allocate and read
345 do ip = 1, this%bndlist%Count()
346 packobj => getbndfromlist(this%bndlist, ip)
347 call packobj%set_pointers(this%dis%nodes, this%ibound, this%x, &
348 this%xold, this%flowja)
349 ! -- Read and allocate package
350 call packobj%bnd_ar()
351 if (this%inbuy > 0) call this%buy%buy_ar_bnd(packobj, this%x)
352 if (this%invsc > 0) call this%vsc%vsc_ar_bnd(packobj)
353 end do
354 end subroutine gwf_ar
355
356 !> @brief GroundWater Flow Model Read and Prepare
357 !!
358 !! (1) calls package read and prepare routines
359 !!
360 !<
361 subroutine gwf_rp(this)
362 ! -- modules
363 use tdismodule, only: readnewdata
364 ! -- dummy
365 class(gwfmodeltype) :: this
366 ! -- local
367 class(bndtype), pointer :: packobj
368 integer(I4B) :: ip
369 !
370 ! -- Check with TDIS on whether or not it is time to RP
371 if (.not. readnewdata) return
372 !
373 ! -- Read and prepare
374 if (this%innpf > 0) call this%npf%npf_rp()
375 if (this%inbuy > 0) call this%buy%buy_rp()
376 if (this%invsc > 0) call this%vsc%vsc_rp()
377 if (this%inhfb > 0) call this%hfb%hfb_rp()
378 if (this%inoc > 0) call this%oc%oc_rp()
379 if (this%insto > 0) call this%sto%sto_rp()
380 if (this%incsub > 0) call this%csub%csub_rp()
381 if (this%inmvr > 0) call this%mvr%mvr_rp()
382 do ip = 1, this%bndlist%Count()
383 packobj => getbndfromlist(this%bndlist, ip)
384 call packobj%bnd_rp()
385 call packobj%bnd_rp_log()
386 call packobj%bnd_rp_obs()
387 end do
388 !
389 ! -- Check for steady state period
390 call this%steady_period_check()
391 end subroutine gwf_rp
392
393 !> @brief GroundWater Flow Model Time Step Advance
394 !!
395 !! (1) calls package advance subroutines
396 !!
397 !<
398 subroutine gwf_ad(this)
399 ! -- modules
401 ! -- dummy
402 class(gwfmodeltype) :: this
403 class(bndtype), pointer :: packobj
404 ! -- local
405 integer(I4B) :: irestore
406 integer(I4B) :: ip, n
407 !
408 ! -- Reset state variable
409 irestore = 0
410 if (ifailedstepretry > 0) irestore = 1
411 if (irestore == 0) then
412 !
413 ! -- copy x into xold
414 do n = 1, this%dis%nodes
415 this%xold(n) = this%x(n)
416 end do
417 else
418 !
419 ! -- copy xold into x if this time step is a redo
420 do n = 1, this%dis%nodes
421 this%x(n) = this%xold(n)
422 end do
423 end if
424 !
425 ! -- Advance
426 if (this%invsc > 0) call this%vsc%vsc_ad()
427 if (this%innpf > 0) call this%npf%npf_ad(this%dis%nodes, this%xold, &
428 this%x, irestore)
429 if (this%insto > 0) call this%sto%sto_ad()
430 if (this%incsub > 0) call this%csub%csub_ad(this%dis%nodes, this%x)
431 if (this%inbuy > 0) call this%buy%buy_ad()
432 if (this%inmvr > 0) call this%mvr%mvr_ad()
433 do ip = 1, this%bndlist%Count()
434 packobj => getbndfromlist(this%bndlist, ip)
435 call packobj%bnd_ad()
436 if (this%invsc > 0) call this%vsc%vsc_ad_bnd(packobj, this%x)
437 if (isimcheck > 0) then
438 call packobj%bnd_ck()
439 end if
440 end do
441 !
442 ! -- Push simulated values to preceding time/subtime step
443 call this%obs%obs_ad()
444 end subroutine gwf_ad
445
446 !> @brief GroundWater Flow Model calculate coefficients
447 !<
448 subroutine gwf_cf(this, kiter)
449 ! -- dummy
450 class(gwfmodeltype) :: this
451 integer(I4B), intent(in) :: kiter
452 ! -- local
453 class(bndtype), pointer :: packobj
454 integer(I4B) :: ip
455 !
456 ! -- Call package cf routines
457 if (this%innpf > 0) call this%npf%npf_cf(kiter, this%dis%nodes, this%x)
458 if (this%inbuy > 0) call this%buy%buy_cf(kiter)
459 do ip = 1, this%bndlist%Count()
460 packobj => getbndfromlist(this%bndlist, ip)
461 call packobj%bnd_cf()
462 if (this%inbuy > 0) call this%buy%buy_cf_bnd(packobj, this%x)
463 end do
464 end subroutine gwf_cf
465
466 !> @brief GroundWater Flow Model fill coefficients
467 !<
468 subroutine gwf_fc(this, kiter, matrix_sln, inwtflag)
469 ! -- dummy
470 class(gwfmodeltype) :: this
471 integer(I4B), intent(in) :: kiter
472 class(matrixbasetype), pointer :: matrix_sln
473 integer(I4B), intent(in) :: inwtflag
474 ! -- local
475 class(bndtype), pointer :: packobj
476 integer(I4B) :: ip
477 integer(I4B) :: inwt, inwtsto, inwtcsub, inwtpak
478 !
479 ! -- newton flags
480 inwt = inwtflag
481 if (inwtflag == 1) inwt = this%npf%inewton
482 inwtsto = inwtflag
483 if (this%insto > 0) then
484 if (inwtflag == 1) inwtsto = this%sto%inewton
485 end if
486 inwtcsub = inwtflag
487 if (this%incsub > 0) then
488 if (inwtflag == 1) inwtcsub = this%csub%inewton
489 end if
490 !
491 ! -- Fill standard conductance terms
492 if (this%innpf > 0) call this%npf%npf_fc(kiter, matrix_sln, this%idxglo, &
493 this%rhs, this%x)
494 if (this%inbuy > 0) call this%buy%buy_fc(kiter, matrix_sln, this%idxglo, &
495 this%rhs, this%x)
496 if (this%inhfb > 0) call this%hfb%hfb_fc(kiter, matrix_sln, this%idxglo, &
497 this%rhs, this%x)
498 if (this%ingnc > 0) call this%gnc%gnc_fc(kiter, matrix_sln)
499 ! -- storage
500 if (this%insto > 0) then
501 call this%sto%sto_fc(kiter, this%xold, this%x, matrix_sln, &
502 this%idxglo, this%rhs)
503 end if
504 ! -- skeletal storage, compaction, and land subsidence
505 if (this%incsub > 0) then
506 call this%csub%csub_fc(kiter, this%xold, this%x, matrix_sln, &
507 this%idxglo, this%rhs)
508 end if
509 if (this%inmvr > 0) call this%mvr%mvr_fc()
510 do ip = 1, this%bndlist%Count()
511 packobj => getbndfromlist(this%bndlist, ip)
512 call packobj%bnd_fc(this%rhs, this%ia, this%idxglo, matrix_sln)
513 end do
514 !
515 !--Fill newton terms
516 if (this%innpf > 0) then
517 if (inwt /= 0) then
518 call this%npf%npf_fn(kiter, matrix_sln, this%idxglo, this%rhs, this%x)
519 if (this%inbuy > 0) then
520 call this%buy%buy_fn(kiter, matrix_sln, this%idxglo, this%rhs, &
521 this%x)
522 end if
523 end if
524 end if
525 !
526 ! -- Fill newton terms for ghost nodes
527 if (this%ingnc > 0) then
528 if (inwt /= 0) then
529 call this%gnc%gnc_fn(kiter, matrix_sln, this%npf%condsat, &
530 ivarcv_opt=this%npf%ivarcv, &
531 ictm1_opt=this%npf%icelltype, &
532 ictm2_opt=this%npf%icelltype)
533 end if
534 end if
535 !
536 ! -- Fill newton terms for storage
537 if (this%insto > 0) then
538 if (inwtsto /= 0) then
539 call this%sto%sto_fn(kiter, this%xold, this%x, matrix_sln, &
540 this%idxglo, this%rhs)
541 end if
542 end if
543 !
544 ! -- Fill newton terms for skeletal storage, compaction, and land subsidence
545 if (this%incsub > 0) then
546 if (inwtcsub /= 0) then
547 call this%csub%csub_fn(kiter, this%xold, this%x, matrix_sln, &
548 this%idxglo, this%rhs)
549 end if
550 end if
551 !
552 ! -- Fill Newton terms for packages
553 do ip = 1, this%bndlist%Count()
554 packobj => getbndfromlist(this%bndlist, ip)
555 inwtpak = inwtflag
556 if (inwtflag == 1) inwtpak = packobj%inewton
557 if (inwtpak /= 0) then
558 call packobj%bnd_fn(this%rhs, this%ia, this%idxglo, matrix_sln)
559 end if
560 end do
561 end subroutine gwf_fc
562
563 !> @brief GroundWater Flow Model Final Convergence Check for Boundary Packages
564 !!
565 !! (1) calls package cc routines
566 !!
567 !<
568 subroutine gwf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
569 ! -- dummy
570 class(gwfmodeltype) :: this
571 integer(I4B), intent(in) :: innertot
572 integer(I4B), intent(in) :: kiter
573 integer(I4B), intent(in) :: iend
574 integer(I4B), intent(in) :: icnvgmod
575 character(len=LENPAKLOC), intent(inout) :: cpak
576 integer(I4B), intent(inout) :: ipak
577 real(DP), intent(inout) :: dpak
578 ! -- local
579 class(bndtype), pointer :: packobj
580 integer(I4B) :: ip
581 ! -- formats
582 !
583 ! -- If mover is on, then at least 2 outers required
584 if (this%inmvr > 0) then
585 call this%mvr%mvr_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
586 end if
587 !
588 ! -- csub convergence check
589 if (this%incsub > 0) then
590 call this%csub%csub_cc(innertot, kiter, iend, icnvgmod, &
591 this%dis%nodes, this%x, this%xold, &
592 cpak, ipak, dpak)
593 end if
594 !
595 ! -- Call package cc routines
596 do ip = 1, this%bndlist%Count()
597 packobj => getbndfromlist(this%bndlist, ip)
598 call packobj%bnd_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
599 end do
600 end subroutine gwf_cc
601
602 !> @brief check if pseudo-transient continuation factor should be used
603 !!
604 !! (1) Check if pseudo-transient continuation factor should be used
605 !!
606 !<
607 subroutine gwf_ptcchk(this, iptc)
608 ! -- dummy
609 class(gwfmodeltype) :: this
610 integer(I4B), intent(inout) :: iptc
611 !
612 ! -- determine if pseudo-transient continuation should be applied to this
613 ! model - pseudo-transient continuation only applied to problems that
614 ! use the Newton-Raphson formulation during steady-state stress periods
615 iptc = 0
616 if (this%iss > 0) then
617 if (this%inewton > 0) then
618 iptc = this%inewton
619 else
620 iptc = this%npf%inewton
621 end if
622 end if
623 end subroutine gwf_ptcchk
624
625 !> @brief calculate maximum pseudo-transient continuation factor
626 !!
627 !! (1) Calculate maximum pseudo-transient continuation factor
628 !! for the current outer iteration
629 !!
630 !<
631 subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
632 ! -- modules
633 use constantsmodule, only: done
634 use tdismodule, only: delt
635 ! -- dummy
636 class(gwfmodeltype) :: this
637 class(vectorbasetype), pointer :: vec_residual
638 integer(I4B), intent(inout) :: iptc
639 real(DP), intent(inout) :: ptcf
640 ! -- local
641 integer(I4B) :: n
642 integer(I4B) :: iptct
643 integer(I4B) :: irow_start
644 integer(I4B) :: irow_end
645 integer(I4B) :: ioffset
646 real(DP) :: v
647 real(DP) :: resid
648 real(DP) :: ptcdelem1
649 !
650 ! -- set temporary flag indicating if pseudo-transient continuation should
651 ! be used for this model and time step
652 iptct = 0
653 ! -- only apply pseudo-transient continuation to problems using the
654 ! Newton-Raphson formulations for steady-state stress periods
655 if (this%iss > 0) then
656 if (this%inewton > 0) then
657 iptct = this%inewton
658 else
659 iptct = this%npf%inewton
660 end if
661 end if
662 !
663 ! -- calculate pseudo-transient continuation factor for model
664 if (iptct > 0) then
665 !
666 ! -- offset of this model in the local residual vector
667 call vec_residual%get_ownership_range(irow_start, irow_end)
668 ioffset = this%moffset - (irow_start - 1)
669 !
670 ! -- calculate the pseudo-time step using the residual
671 do n = 1, this%dis%nodes
672 if (this%npf%ibound(n) < 1) cycle
673 !
674 ! -- get the maximum volume of the cell (head at top of cell)
675 v = this%dis%get_cell_volume(n, this%dis%top(n))
676 !
677 ! -- set the residual
678 resid = vec_residual%get_value_local(n + ioffset)
679 !
680 ! -- calculate the reciprocal of the pseudo-time step
681 ! resid [L3/T] / volume [L3] = [1/T]
682 ptcdelem1 = abs(resid) / v
683 !
684 ! -- set ptcf if the reciprocal of the pseudo-time step
685 ! exceeds the current value (equivalent to using the
686 ! smallest pseudo-time step)
687 if (ptcdelem1 > ptcf) ptcf = ptcdelem1
688 end do
689 !
690 ! -- protection for the case where the residuals are zero
691 if (ptcf == dzero) then
692 ptcf = done / (delt * dten)
693 end if
694 end if
695 !
696 ! -- reset ipc if needed
697 if (iptc == 0) then
698 if (iptct > 0) iptc = 1
699 end if
700 end subroutine gwf_ptc
701
702 !> @brief under-relaxation
703 !!
704 !! (1) Under-relaxation of Groundwater Flow Model Heads for current
705 !! outer iteration using the cell bottoms at the bottom of the
706 !! model
707 !!
708 !<
709 subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
710 ! modules
711 use constantsmodule, only: done, dp9
712 ! -- dummy
713 class(gwfmodeltype) :: this
714 integer(I4B), intent(in) :: neqmod
715 real(DP), dimension(neqmod), intent(inout) :: x
716 real(DP), dimension(neqmod), intent(in) :: xtemp
717 real(DP), dimension(neqmod), intent(inout) :: dx
718 integer(I4B), intent(inout) :: inewtonur
719 real(DP), intent(inout) :: dxmax
720 integer(I4B), intent(inout) :: locmax
721 ! -- local
722 integer(I4B) :: i0
723 integer(I4B) :: i1
724 class(bndtype), pointer :: packobj
725 integer(I4B) :: ip
726 !
727 ! -- apply Newton-Raphson under-relaxation if model is using
728 ! the Newton-Raphson formulation and this Newton-Raphson
729 ! under-relaxation is turned on.
730 if (this%inewton /= 0 .and. this%inewtonur /= 0) then
731 if (this%innpf > 0) then
732 call this%npf%npf_nur(neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
733 end if
734 !
735 ! -- Call package nur routines
736 i0 = this%dis%nodes + 1
737 do ip = 1, this%bndlist%Count()
738 packobj => getbndfromlist(this%bndlist, ip)
739 if (packobj%npakeq > 0) then
740 i1 = i0 + packobj%npakeq - 1
741 call packobj%bnd_nur(packobj%npakeq, x(i0:i1), xtemp(i0:i1), &
742 dx(i0:i1), inewtonur, dxmax, locmax)
743 i0 = i1 + 1
744 end if
745 end do
746 end if
747 end subroutine gwf_nur
748
749 !> @brief Groundwater flow model calculate flow
750 !!
751 !! (1) Calculate intercell flows (flowja)
752 !!
753 !<
754 subroutine gwf_cq(this, icnvg, isuppress_output)
755 ! -- modules
756 ! -- dummy
757 class(gwfmodeltype) :: this
758 integer(I4B), intent(in) :: icnvg
759 integer(I4B), intent(in) :: isuppress_output
760 ! -- local
761 integer(I4B) :: i
762 integer(I4B) :: ip
763 class(bndtype), pointer :: packobj
764 !
765 ! -- Construct the flowja array. Flowja is calculated each time, even if
766 ! output is suppressed. (flowja is positive into a cell.) The diagonal
767 ! position of the flowja array will contain the flow residual after
768 ! these routines are called, so each package is responsible for adding
769 ! its flow to this diagonal position.
770 do i = 1, this%nja
771 this%flowja(i) = dzero
772 end do
773 if (this%innpf > 0) call this%npf%npf_cq(this%x, this%flowja)
774 if (this%inbuy > 0) call this%buy%buy_cq(this%x, this%flowja)
775 if (this%inhfb > 0) call this%hfb%hfb_cq(this%x, this%flowja)
776 if (this%ingnc > 0) call this%gnc%gnc_cq(this%flowja)
777 if (this%insto > 0) call this%sto%sto_cq(this%flowja, this%x, this%xold)
778 if (this%incsub > 0) call this%csub%csub_cq(this%dis%nodes, this%x, &
779 this%xold, isuppress_output, &
780 this%flowja)
781 !
782 ! -- Go through packages and call cq routines. cf() routines are called
783 ! first to regenerate non-linear terms to be consistent with the final
784 ! head solution.
785 do ip = 1, this%bndlist%Count()
786 packobj => getbndfromlist(this%bndlist, ip)
787 call packobj%bnd_cf()
788 if (this%inbuy > 0) call this%buy%buy_cf_bnd(packobj, this%x)
789 call packobj%bnd_cq(this%x, this%flowja)
790 end do
791 end subroutine gwf_cq
792
793 !> @brief GroundWater Flow Model Budget
794 !!
795 !! (1) Calculate stress package contributions to model budget
796 !!
797 !<
798 subroutine gwf_bd(this, icnvg, isuppress_output)
799 ! -- modules
800 use sparsemodule, only: csr_diagsum
801 ! -- dummy
802 class(gwfmodeltype) :: this
803 integer(I4B), intent(in) :: icnvg
804 integer(I4B), intent(in) :: isuppress_output
805 ! -- local
806 integer(I4B) :: ip
807 class(bndtype), pointer :: packobj
808 !
809 ! -- Finalize calculation of flowja by adding face flows to the diagonal.
810 ! This results in the flow residual being stored in the diagonal
811 ! position for each cell.
812 call csr_diagsum(this%dis%con%ia, this%flowja)
813 !
814 ! -- Save the solution convergence flag
815 this%icnvg = icnvg
816 !
817 ! -- Budget routines (start by resetting). Sole purpose of this section
818 ! is to add in and outs to model budget. All ins and out for a model
819 ! should be added here to this%budget. In a subsequent exchange call,
820 ! exchange flows might also be added.
821 call this%budget%reset()
822 if (this%insto > 0) call this%sto%sto_bd(isuppress_output, this%budget)
823 if (this%incsub > 0) call this%csub%csub_bd(isuppress_output, this%budget)
824 if (this%inmvr > 0) call this%mvr%mvr_bd()
825 do ip = 1, this%bndlist%Count()
826 packobj => getbndfromlist(this%bndlist, ip)
827 call packobj%bnd_bd(this%budget)
828 end do
829 !
830 ! -- npf velocities have to be calculated here, after gwf-gwf exchanges
831 ! have passed in their contributions from exg_cq()
832 if (this%innpf > 0) then
833 if (this%npf%icalcspdis /= 0) then
834 call this%npf%calc_spdis(this%flowja)
835 end if
836 end if
837 end subroutine gwf_bd
838
839 !> @brief GroundWater Flow Model Output
840 !<
841 subroutine gwf_ot(this)
842 ! -- modules
844 ! -- dummy
845 class(gwfmodeltype) :: this
846 ! -- local
847 integer(I4B) :: idvsave
848 integer(I4B) :: idvprint
849 integer(I4B) :: icbcfl
850 integer(I4B) :: icbcun
851 integer(I4B) :: ibudfl
852 integer(I4B) :: ipflag
853 ! -- formats
854 character(len=*), parameter :: fmtnocnvg = &
855 "(1X,/9X,'****FAILED TO MEET SOLVER CONVERGENCE CRITERIA IN TIME STEP ', &
856 &I0,' OF STRESS PERIOD ',I0,'****')"
857 !
858 ! -- Set write and print flags
859 idvsave = 0
860 idvprint = 0
861 icbcfl = 0
862 ibudfl = 0
863 if (this%oc%oc_save('HEAD')) idvsave = 1
864 if (this%oc%oc_print('HEAD')) idvprint = 1
865 if (this%oc%oc_save('BUDGET')) icbcfl = 1
866 if (this%oc%oc_print('BUDGET')) ibudfl = 1
867 icbcun = this%oc%oc_save_unit('BUDGET')
868 !
869 ! -- Override ibudfl and idvprint flags for nonconvergence
870 ! and end of period
871 ibudfl = this%oc%set_print_flag('BUDGET', this%icnvg, endofperiod)
872 idvprint = this%oc%set_print_flag('HEAD', this%icnvg, endofperiod)
873 !
874 ! Calculate and save observations
875 call this%gwf_ot_obs()
876 !
877 ! Save and print flows
878 call this%gwf_ot_flow(icbcfl, ibudfl, icbcun)
879 !
880 ! Save and print dependent variables
881 call this%gwf_ot_dv(idvsave, idvprint, ipflag)
882 !
883 ! Print budget summaries
884 call this%gwf_ot_bdsummary(ibudfl, ipflag)
885 !
886 ! -- Timing Output; if any dependent variables or budgets
887 ! are printed, then ipflag is set to 1.
888 if (ipflag == 1) call tdis_ot(this%iout)
889 !
890 ! -- Write non-convergence message
891 if (this%icnvg == 0) then
892 write (this%iout, fmtnocnvg) kstp, kper
893 end if
894 end subroutine gwf_ot
895
896 !> @brief GroundWater Flow Model output observations
897 !<
898 subroutine gwf_ot_obs(this)
899 class(gwfmodeltype) :: this
900 class(bndtype), pointer :: packobj
901 integer(I4B) :: ip
902
903 ! -- Calculate and save GWF observations
904 call this%obs%obs_bd()
905 call this%obs%obs_ot()
906
907 ! -- Calculate and save csub observations
908 if (this%incsub > 0) then
909 call this%csub%csub_bd_obs()
910 call this%csub%obs%obs_ot()
911 end if
912
913 ! -- Calculate and save package observations
914 do ip = 1, this%bndlist%Count()
915 packobj => getbndfromlist(this%bndlist, ip)
916 call packobj%bnd_bd_obs()
917 call packobj%bnd_ot_obs()
918 end do
919
920 end subroutine gwf_ot_obs
921
922 !> @brief Groundwater Flow Model output flows
923 !<
924 subroutine gwf_ot_flow(this, icbcfl, ibudfl, icbcun)
925 class(gwfmodeltype) :: this
926 integer(I4B), intent(in) :: icbcfl
927 integer(I4B), intent(in) :: ibudfl
928 integer(I4B), intent(in) :: icbcun
929 class(bndtype), pointer :: packobj
930 integer(I4B) :: ip
931
932 ! -- Save GWF flows
933 if (this%insto > 0) then
934 call this%sto%sto_save_model_flows(icbcfl, icbcun)
935 end if
936 if (this%innpf > 0) then
937 call this%npf%npf_save_model_flows(this%flowja, icbcfl, icbcun)
938 end if
939 if (this%incsub > 0) call this%csub%csub_save_model_flows(icbcfl, icbcun)
940 do ip = 1, this%bndlist%Count()
941 packobj => getbndfromlist(this%bndlist, ip)
942 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=0, icbcun=icbcun)
943 end do
944
945 ! -- Save advanced package flows
946 do ip = 1, this%bndlist%Count()
947 packobj => getbndfromlist(this%bndlist, ip)
948 call packobj%bnd_ot_package_flows(icbcfl=icbcfl, ibudfl=0)
949 end do
950 if (this%inmvr > 0) then
951 call this%mvr%mvr_ot_saveflow(icbcfl, ibudfl)
952 end if
953
954 ! -- Print GWF flows
955 if (this%innpf > 0) call this%npf%npf_print_model_flows(ibudfl, this%flowja)
956 if (this%ingnc > 0) call this%gnc%gnc_ot(ibudfl)
957 do ip = 1, this%bndlist%Count()
958 packobj => getbndfromlist(this%bndlist, ip)
959 call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=ibudfl, icbcun=0)
960 end do
961
962 ! -- Print advanced package flows
963 do ip = 1, this%bndlist%Count()
964 packobj => getbndfromlist(this%bndlist, ip)
965 call packobj%bnd_ot_package_flows(icbcfl=0, ibudfl=ibudfl)
966 end do
967 if (this%inmvr > 0) then
968 call this%mvr%mvr_ot_printflow(icbcfl, ibudfl)
969 end if
970
971 end subroutine gwf_ot_flow
972
973 !> @brief Groundwater Flow Model output dependent variable
974 !<
975 subroutine gwf_ot_dv(this, idvsave, idvprint, ipflag)
976 class(gwfmodeltype) :: this
977 integer(I4B), intent(in) :: idvsave
978 integer(I4B), intent(in) :: idvprint
979 integer(I4B), intent(inout) :: ipflag
980 class(bndtype), pointer :: packobj
981 integer(I4B) :: ip
982 !
983 ! -- Save compaction to binary file
984 if (this%incsub > 0) call this%csub%csub_ot_dv(idvsave, idvprint)
985 !
986 ! -- save density to binary file
987 if (this%inbuy > 0) then
988 call this%buy%buy_ot_dv(idvsave)
989 end if
990 !
991 ! -- save viscosity to binary file
992 if (this%invsc > 0) then
993 call this%vsc%vsc_ot_dv(idvsave)
994 end if
995 !
996 ! -- Print advanced package dependent variables
997 do ip = 1, this%bndlist%Count()
998 packobj => getbndfromlist(this%bndlist, ip)
999 call packobj%bnd_ot_dv(idvsave, idvprint)
1000 end do
1001 !
1002 ! -- save head and print head
1003 call this%oc%oc_ot(ipflag)
1004 end subroutine gwf_ot_dv
1005
1006 !> @brief Groundwater Flow Model output budget summary
1007 !<
1008 subroutine gwf_ot_bdsummary(this, ibudfl, ipflag)
1009 use tdismodule, only: kstp, kper, totim, delt
1010 class(gwfmodeltype) :: this
1011 integer(I4B), intent(in) :: ibudfl
1012 integer(I4B), intent(inout) :: ipflag
1013 class(bndtype), pointer :: packobj
1014 integer(I4B) :: ip
1015
1016 ! -- Package budget summary
1017 do ip = 1, this%bndlist%Count()
1018 packobj => getbndfromlist(this%bndlist, ip)
1019 call packobj%bnd_ot_bdsummary(kstp, kper, this%iout, ibudfl)
1020 end do
1021
1022 ! -- mover budget summary
1023 if (this%inmvr > 0) then
1024 call this%mvr%mvr_ot_bdsummary(ibudfl)
1025 end if
1026
1027 ! -- model budget summary
1028 call this%budget%finalize_step(delt)
1029 if (ibudfl /= 0) then
1030 ipflag = 1
1031 call this%budget%budget_ot(kstp, kper, this%iout)
1032 end if
1033
1034 ! -- Write to budget csv every time step
1035 call this%budget%writecsv(totim)
1036
1037 end subroutine gwf_ot_bdsummary
1038
1039 !> @brief Submit boundary-package ATS time step requests
1040 !<
1041 subroutine gwf_dt(this)
1042 ! -- dummy
1043 class(gwfmodeltype) :: this
1044 ! -- local
1045 integer(I4B) :: ip
1046 class(bndtype), pointer :: packobj => null()
1047 !
1048 ! -- boundary package time step submission
1049 do ip = 1, this%bndlist%Count()
1050 packobj => getbndfromlist(this%bndlist, ip)
1051 call packobj%bnd_dt()
1052 end do
1053 end subroutine gwf_dt
1054
1055 subroutine gwf_fp(this)
1056 ! -- modules
1057 ! -- dummy
1058 class(gwfmodeltype) :: this
1059 ! -- local
1060 integer(I4B) :: ip
1061 class(bndtype), pointer :: packobj => null()
1062 !
1063 ! -- csub final processing
1064 if (this%incsub > 0) then
1065 call this%csub%csub_fp()
1066 end if
1067 !
1068 ! -- boundary package final processing
1069 do ip = 1, this%bndlist%Count()
1070 packobj => getbndfromlist(this%bndlist, ip)
1071 call packobj%bnd_fp()
1072 end do
1073 end subroutine gwf_fp
1074
1075 !> @brief Deallocate
1076 !<
1077 subroutine gwf_da(this)
1078 ! -- modules
1082 ! -- dummy
1083 class(gwfmodeltype) :: this
1084 ! -- local
1085 integer(I4B) :: ip
1086 class(bndtype), pointer :: packobj
1087 !
1088 ! -- Deallocate idm memory
1089 call memorystore_remove(this%name, 'NAM', idm_context)
1090 call memorystore_remove(component=this%name, context=idm_context)
1091 !
1092 ! -- Internal flow packages deallocate
1093 call this%dis%dis_da()
1094 call this%ic%ic_da()
1095 call this%npf%npf_da()
1096 call this%xt3d%xt3d_da()
1097 call this%buy%buy_da()
1098 call this%vsc%vsc_da()
1099 call this%gnc%gnc_da()
1100 call this%sto%sto_da()
1101 call this%csub%csub_da()
1102 call this%budget%budget_da()
1103 call this%hfb%hfb_da()
1104 call this%mvr%mvr_da()
1105 call this%oc%oc_da()
1106 call this%obs%obs_da()
1107 !
1108 ! -- Internal package objects
1109 deallocate (this%dis)
1110 deallocate (this%ic)
1111 deallocate (this%npf)
1112 deallocate (this%xt3d)
1113 deallocate (this%buy)
1114 deallocate (this%vsc)
1115 deallocate (this%gnc)
1116 deallocate (this%sto)
1117 deallocate (this%csub)
1118 deallocate (this%budget)
1119 deallocate (this%hfb)
1120 deallocate (this%mvr)
1121 deallocate (this%obs)
1122 deallocate (this%oc)
1123 !
1124 ! -- Boundary packages
1125 do ip = 1, this%bndlist%Count()
1126 packobj => getbndfromlist(this%bndlist, ip)
1127 call packobj%bnd_da()
1128 deallocate (packobj)
1129 end do
1130 !
1131 ! -- Scalars
1132 call mem_deallocate(this%inic)
1133 call mem_deallocate(this%inoc)
1134 call mem_deallocate(this%inobs)
1135 call mem_deallocate(this%innpf)
1136 call mem_deallocate(this%inbuy)
1137 call mem_deallocate(this%invsc)
1138 call mem_deallocate(this%insto)
1139 call mem_deallocate(this%incsub)
1140 call mem_deallocate(this%inmvr)
1141 call mem_deallocate(this%inhfb)
1142 call mem_deallocate(this%ingnc)
1143 call mem_deallocate(this%iss)
1144 call mem_deallocate(this%inewtonur)
1145 !
1146 ! -- NumericalModelType
1147 call this%NumericalModelType%model_da()
1148 end subroutine gwf_da
1149
1150 !> @brief GroundWater Flow Model Budget Entry
1151 !!
1152 !! This subroutine adds a budget entry to the flow budget. It was added as
1153 !! a method for the gwf model object so that the exchange object could add its
1154 !< contributions.
1155 subroutine gwf_bdentry(this, budterm, budtxt, rowlabel)
1156 ! -- modules
1157 use constantsmodule, only: lenbudtxt
1158 use tdismodule, only: delt
1159 ! -- dummy
1160 class(gwfmodeltype) :: this
1161 real(DP), dimension(:, :), intent(in) :: budterm
1162 character(len=LENBUDTXT), dimension(:), intent(in) :: budtxt
1163 character(len=*), intent(in) :: rowlabel
1164 !
1165 call this%budget%addentry(budterm, delt, budtxt, rowlabel=rowlabel)
1166 end subroutine gwf_bdentry
1167
1168 !> @brief return 1 if any package causes the matrix to be asymmetric.
1169 !! Otherwise return 0.
1170 !<
1171 function gwf_get_iasym(this) result(iasym)
1172 class(gwfmodeltype) :: this
1173 ! -- local
1174 integer(I4B) :: iasym
1175 integer(I4B) :: ip
1176 class(bndtype), pointer :: packobj
1177 !
1178 ! -- Start by setting iasym to zero
1179 iasym = 0
1180 !
1181 ! -- NPF
1182 if (this%innpf > 0) then
1183 if (this%npf%iasym /= 0) iasym = 1
1184 if (this%npf%ixt3d /= 0) iasym = 1
1185 end if
1186 !
1187 ! -- GNC
1188 if (this%ingnc > 0) then
1189 if (this%gnc%iasym /= 0) iasym = 1
1190 end if
1191 !
1192 ! -- Check for any packages that introduce matrix asymmetry
1193 do ip = 1, this%bndlist%Count()
1194 packobj => getbndfromlist(this%bndlist, ip)
1195 if (packobj%iasym /= 0) iasym = 1
1196 end do
1197 end function gwf_get_iasym
1198
1199 !> @brief Allocate memory for non-allocatable members
1200 !<
1201 subroutine allocate_scalars(this, modelname)
1202 ! -- modules
1204 ! -- dummy
1205 class(gwfmodeltype) :: this
1206 character(len=*), intent(in) :: modelname
1207 !
1208 ! -- allocate members from parent class
1209 call this%NumericalModelType%allocate_scalars(modelname)
1210 !
1211 ! -- allocate members that are part of model class
1212 call mem_allocate(this%inic, 'INIC', this%memoryPath)
1213 call mem_allocate(this%inoc, 'INOC', this%memoryPath)
1214 call mem_allocate(this%innpf, 'INNPF', this%memoryPath)
1215 call mem_allocate(this%inbuy, 'INBUY', this%memoryPath)
1216 call mem_allocate(this%invsc, 'INVSC', this%memoryPath)
1217 call mem_allocate(this%insto, 'INSTO', this%memoryPath)
1218 call mem_allocate(this%incsub, 'INCSUB', this%memoryPath)
1219 call mem_allocate(this%inmvr, 'INMVR', this%memoryPath)
1220 call mem_allocate(this%inhfb, 'INHFB', this%memoryPath)
1221 call mem_allocate(this%ingnc, 'INGNC', this%memoryPath)
1222 call mem_allocate(this%inobs, 'INOBS', this%memoryPath)
1223 call mem_allocate(this%iss, 'ISS', this%memoryPath)
1224 call mem_allocate(this%inewtonur, 'INEWTONUR', this%memoryPath)
1225 !
1226 this%inic = 0
1227 this%inoc = 0
1228 this%innpf = 0
1229 this%inbuy = 0
1230 this%invsc = 0
1231 this%insto = 0
1232 this%incsub = 0
1233 this%inmvr = 0
1234 this%inhfb = 0
1235 this%ingnc = 0
1236 this%inobs = 0
1237 this%iss = 1 !default is steady-state (i.e., no STO package)
1238 this%inewtonur = 0 !default is to not use newton bottom head dampening
1239 end subroutine allocate_scalars
1240
1241 !> @brief Create boundary condition packages for this model
1242 !!
1243 !! (1) create new-style package
1244 !! (2) add a pointer to the package
1245 !!
1246 !<
1247 subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, &
1248 inunit, iout)
1249 ! -- modules
1250 use constantsmodule, only: linelength
1251 use simmodule, only: store_error
1252 use chdmodule, only: chd_create
1253 use welmodule, only: wel_create
1254 use drnmodule, only: drn_create
1255 use rivmodule, only: riv_create
1256 use ghbmodule, only: ghb_create
1257 use rchmodule, only: rch_create
1258 use evtmodule, only: evt_create
1259 use mawmodule, only: maw_create
1260 use sfrmodule, only: sfr_create
1261 use lakmodule, only: lak_create
1262 use uzfmodule, only: uzf_create
1263 use apimodule, only: api_create
1264 ! -- dummy
1265 class(gwfmodeltype) :: this
1266 character(len=*), intent(in) :: filtyp
1267 integer(I4B), intent(in) :: ipakid
1268 integer(I4B), intent(in) :: ipaknum
1269 character(len=*), intent(in) :: pakname
1270 character(len=*), intent(in) :: mempath
1271 integer(I4B), intent(in) :: inunit
1272 integer(I4B), intent(in) :: iout
1273 ! -- local
1274 class(bndtype), pointer :: packobj
1275 class(bndtype), pointer :: packobj2
1276 integer(I4B) :: ip
1277 !
1278 ! -- This part creates the package object
1279 select case (filtyp)
1280 case ('CHD6')
1281 call chd_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1282 pakname, mempath)
1283 case ('WEL6')
1284 call wel_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1285 pakname, mempath)
1286 case ('DRN6')
1287 call drn_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1288 pakname, mempath)
1289 case ('RIV6')
1290 call riv_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1291 pakname, mempath)
1292 case ('GHB6')
1293 call ghb_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1294 pakname, mempath)
1295 case ('RCH6')
1296 call rch_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1297 pakname, mempath)
1298 case ('EVT6')
1299 call evt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1300 pakname, mempath)
1301 case ('MAW6')
1302 call maw_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1303 pakname, mempath)
1304 case ('SFR6')
1305 call sfr_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1306 pakname, mempath)
1307 case ('LAK6')
1308 call lak_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1309 pakname, mempath)
1310 case ('UZF6')
1311 call uzf_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1312 pakname, mempath)
1313 case ('API6')
1314 call api_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1315 pakname, mempath)
1316 case default
1317 write (errmsg, *) 'Invalid package type: ', filtyp
1318 call store_error(errmsg, terminate=.true.)
1319 end select
1320 !
1321 ! -- Check to make sure that the package name is unique, then store a
1322 ! pointer to the package in the model bndlist
1323 do ip = 1, this%bndlist%Count()
1324 packobj2 => getbndfromlist(this%bndlist, ip)
1325 if (packobj2%packName == pakname) then
1326 write (errmsg, '(a,a)') 'Cannot create package. Package name '// &
1327 'already exists: ', trim(pakname)
1328 call store_error(errmsg, terminate=.true.)
1329 end if
1330 end do
1331 call addbndtolist(this%bndlist, packobj)
1332 end subroutine package_create
1333
1334 !> @brief Check to make sure required input files have been specified
1335 !<
1336 subroutine ftype_check(this, indis)
1337 ! -- modules
1338 use constantsmodule, only: linelength
1340 ! -- dummy
1341 class(gwfmodeltype) :: this
1342 integer(I4B), intent(in) :: indis
1343 ! -- local
1344 !
1345 ! -- Check for IC8, DIS(u), and NPF. Stop if not present.
1346 if (this%inic == 0) then
1347 write (errmsg, '(a)') &
1348 'Initial Conditions (IC6) package not specified.'
1349 call store_error(errmsg)
1350 end if
1351 if (indis == 0) then
1352 write (errmsg, '(a)') &
1353 'Discretization (DIS6, DISV6, or DISU6) Package not specified.'
1354 call store_error(errmsg)
1355 end if
1356 if (this%innpf == 0) then
1357 write (errmsg, '(a)') &
1358 'Node Property Flow (NPF6) Package not specified.'
1359 call store_error(errmsg)
1360 end if
1361 !
1362 if (count_errors() > 0) then
1363 write (errmsg, '(a)') 'One or more required package(s) not specified.'
1364 call store_error(errmsg)
1365 call store_error_filename(this%filename)
1366 end if
1367 end subroutine ftype_check
1368
1369 !> @brief Cast to GWF model
1370 !<
1371 function castasgwfmodel(model) result(gwfModel)
1372 implicit none
1373 class(*), pointer, intent(inout) :: model
1374 class(gwfmodeltype), pointer :: gwfmodel
1375
1376 gwfmodel => null()
1377 if (.not. associated(model)) return
1378 select type (model)
1379 class is (gwfmodeltype)
1380 gwfmodel => model
1381 end select
1382 end function castasgwfmodel
1383
1384 !> @brief Source package info and begin to process
1385 !<
1386 subroutine create_bndpkgs(this, bndpkgs, pkgtypes, pkgnames, &
1387 mempaths, inunits)
1388 ! -- modules
1391 ! -- dummy
1392 class(gwfmodeltype) :: this
1393 integer(I4B), dimension(:), allocatable, intent(inout) :: bndpkgs
1394 type(characterstringtype), dimension(:), contiguous, &
1395 pointer, intent(inout) :: pkgtypes
1396 type(characterstringtype), dimension(:), contiguous, &
1397 pointer, intent(inout) :: pkgnames
1398 type(characterstringtype), dimension(:), contiguous, &
1399 pointer, intent(inout) :: mempaths
1400 integer(I4B), dimension(:), contiguous, &
1401 pointer, intent(inout) :: inunits
1402 ! -- local
1403 integer(I4B) :: ipakid, ipaknum
1404 character(len=LENFTYPE) :: pkgtype, bndptype
1405 character(len=LENPACKAGENAME) :: pkgname
1406 character(len=LENMEMPATH) :: mempath
1407 integer(I4B), pointer :: inunit
1408 integer(I4B) :: n
1409
1410 if (allocated(bndpkgs)) then
1411 !
1412 ! -- create stress packages
1413 ipakid = 1
1414 bndptype = ''
1415 do n = 1, size(bndpkgs)
1416 !
1417 pkgtype = pkgtypes(bndpkgs(n))
1418 pkgname = pkgnames(bndpkgs(n))
1419 mempath = mempaths(bndpkgs(n))
1420 inunit => inunits(bndpkgs(n))
1421 !
1422 if (bndptype /= pkgtype) then
1423 ipaknum = 1
1424 bndptype = pkgtype
1425 end if
1426 !
1427 call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
1428 inunit, this%iout)
1429 ipakid = ipakid + 1
1430 ipaknum = ipaknum + 1
1431 end do
1432 !
1433 ! -- cleanup
1434 deallocate (bndpkgs)
1435 end if
1436 end subroutine create_bndpkgs
1437
1438 !> @brief Source package info and begin to process
1439 !<
1440 subroutine create_packages(this)
1441 ! -- modules
1448 use dismodule, only: dis_cr
1449 use disvmodule, only: disv_cr
1450 use disumodule, only: disu_cr
1451 use gwfnpfmodule, only: npf_cr
1452 use xt3dmodule, only: xt3d_cr
1453 use gwfbuymodule, only: buy_cr
1454 use gwfvscmodule, only: vsc_cr
1455 use gwfstomodule, only: sto_cr
1456 use gwfcsubmodule, only: csub_cr
1457 use gwfmvrmodule, only: mvr_cr
1458 use gwfhfbmodule, only: hfb_cr
1459 use gwficmodule, only: ic_cr
1460 use gwfocmodule, only: oc_cr
1461 ! -- dummy
1462 class(gwfmodeltype) :: this
1463 ! -- local
1464 type(characterstringtype), dimension(:), contiguous, &
1465 pointer :: pkgtypes => null()
1466 type(characterstringtype), dimension(:), contiguous, &
1467 pointer :: pkgnames => null()
1468 type(characterstringtype), dimension(:), contiguous, &
1469 pointer :: mempaths => null()
1470 integer(I4B), dimension(:), contiguous, &
1471 pointer :: inunits => null()
1472 character(len=LENMEMPATH) :: model_mempath
1473 character(len=LENFTYPE) :: pkgtype
1474 character(len=LENPACKAGENAME) :: pkgname
1475 character(len=LENMEMPATH) :: mempath
1476 integer(I4B), pointer :: inunit
1477 integer(I4B), dimension(:), allocatable :: bndpkgs
1478 integer(I4B) :: n
1479 integer(I4B) :: indis = 0 ! DIS enabled flag
1480 character(len=LENMEMPATH) :: mempathbuy = ''
1481 character(len=LENMEMPATH) :: mempathcsub = ''
1482 character(len=LENMEMPATH) :: mempathhfb = ''
1483 character(len=LENMEMPATH) :: mempathic = ''
1484 character(len=LENMEMPATH) :: mempathnpf = ''
1485 character(len=LENMEMPATH) :: mempathoc = ''
1486 character(len=LENMEMPATH) :: mempathsto = ''
1487 character(len=LENMEMPATH) :: mempathvsc = ''
1488 !
1489 ! -- set input model memory path
1490 model_mempath = create_mem_path(component=this%name, context=idm_context)
1491 !
1492 ! -- set pointers to model path package info
1493 call mem_setptr(pkgtypes, 'PKGTYPES', model_mempath)
1494 call mem_setptr(pkgnames, 'PKGNAMES', model_mempath)
1495 call mem_setptr(mempaths, 'MEMPATHS', model_mempath)
1496 call mem_setptr(inunits, 'INUNITS', model_mempath)
1497 !
1498 do n = 1, size(pkgtypes)
1499 !
1500 ! attributes for this input package
1501 pkgtype = pkgtypes(n)
1502 pkgname = pkgnames(n)
1503 mempath = mempaths(n)
1504 inunit => inunits(n)
1505 !
1506 ! -- create dis package as it is a prerequisite for other packages
1507 select case (pkgtype)
1508 case ('DIS6')
1509 indis = 1
1510 call dis_cr(this%dis, this%name, mempath, indis, this%iout)
1511 case ('DISV6')
1512 indis = 1
1513 call disv_cr(this%dis, this%name, mempath, indis, this%iout)
1514 case ('DISU6')
1515 indis = 1
1516 call disu_cr(this%dis, this%name, mempath, indis, this%iout)
1517 case ('NPF6')
1518 this%innpf = 1
1519 mempathnpf = mempath
1520 case ('BUY6')
1521 this%inbuy = 1
1522 mempathbuy = mempath
1523 case ('VSC6')
1524 this%invsc = 1
1525 mempathvsc = mempath
1526 case ('GNC6')
1527 this%ingnc = inunit
1528 case ('HFB6')
1529 this%inhfb = 1
1530 mempathhfb = mempath
1531 case ('STO6')
1532 this%insto = 1
1533 mempathsto = mempath
1534 case ('CSUB6')
1535 this%incsub = 1
1536 mempathcsub = mempath
1537 case ('IC6')
1538 this%inic = 1
1539 mempathic = mempath
1540 case ('MVR6')
1541 this%inmvr = inunit
1542 case ('OC6')
1543 this%inoc = 1
1544 mempathoc = mempath
1545 case ('OBS6')
1546 this%inobs = inunit
1547 case ('WEL6', 'DRN6', 'RIV6', 'GHB6', 'RCH6', &
1548 'EVT6', 'API6', 'CHD6', 'MAW6', 'SFR6', &
1549 'LAK6', 'UZF6')
1550 call expandarray(bndpkgs)
1551 bndpkgs(size(bndpkgs)) = n
1552 case default
1553 ! TODO
1554 end select
1555 end do
1556 !
1557 ! -- Create packages that are tied directly to model
1558 call npf_cr(this%npf, this%name, mempathnpf, this%innpf, this%iout)
1559 call xt3d_cr(this%xt3d, this%name, this%innpf, this%iout)
1560 call buy_cr(this%buy, this%name, mempathbuy, this%inbuy, this%iout)
1561 call vsc_cr(this%vsc, this%name, mempathvsc, this%invsc, this%iout)
1562 call gnc_cr(this%gnc, this%name, this%ingnc, this%iout)
1563 call hfb_cr(this%hfb, this%name, mempathhfb, this%inhfb, this%iout)
1564 call sto_cr(this%sto, this%name, mempathsto, this%insto, this%iout)
1565 call csub_cr(this%csub, this%name, mempathcsub, this%insto, &
1566 this%sto%packName, this%incsub, this%iout)
1567 call ic_cr(this%ic, this%name, mempathic, this%inic, this%iout, this%dis)
1568 call mvr_cr(this%mvr, this%name, this%inmvr, this%iout, this%dis)
1569 call oc_cr(this%oc, this%name, mempathoc, this%inoc, this%iout)
1570 call gwf_obs_cr(this%obs, this%inobs)
1571 !
1572 ! -- Check to make sure that required ftype's have been specified
1573 call this%ftype_check(indis)
1574 !
1575 call this%create_bndpkgs(bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
1576 end subroutine create_packages
1577
1578 !> @brief Write model namfile options to list file
1579 !<
1580 subroutine log_namfile_options(this, found)
1582 class(gwfmodeltype) :: this
1583 type(gwfnamparamfoundtype), intent(in) :: found
1584
1585 write (this%iout, '(1x,a)') 'NAMEFILE OPTIONS:'
1586
1587 if (found%newton) then
1588 write (this%iout, '(4x,a)') &
1589 'NEWTON-RAPHSON method enabled for the model.'
1590 if (found%under_relaxation) then
1591 write (this%iout, '(4x,a,a)') &
1592 'NEWTON-RAPHSON UNDER-RELAXATION based on the bottom ', &
1593 'elevation of the model will be applied to the model.'
1594 end if
1595 end if
1596
1597 if (found%print_input) then
1598 write (this%iout, '(4x,a)') 'STRESS PACKAGE INPUT WILL BE PRINTED '// &
1599 'FOR ALL MODEL STRESS PACKAGES'
1600 end if
1601
1602 if (found%print_flows) then
1603 write (this%iout, '(4x,a)') 'PACKAGE FLOWS WILL BE PRINTED '// &
1604 'FOR ALL MODEL PACKAGES'
1605 end if
1606
1607 if (found%save_flows) then
1608 write (this%iout, '(4x,a)') &
1609 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL'
1610 end if
1611
1612 write (this%iout, '(1x,a)') 'END NAMEFILE OPTIONS:'
1613 end subroutine log_namfile_options
1614
1615 !> @brief Check for steady state period
1616 !!
1617 !! Write warning message if steady state
1618 !! period and adaptive time stepping is
1619 !! active for the period
1620 !!
1621 !<
1622 subroutine steady_period_check(this)
1623 ! -- modules
1624 use tdismodule, only: kper, ats
1625 use simvariablesmodule, only: warnmsg
1626 use simmodule, only: store_warning
1627 ! -- dummy
1628 class(gwfmodeltype) :: this
1629 if (this%iss == 1) then
1630 if (ats%isAdaptivePeriod(kper)) then
1631 write (warnmsg, '(a,a,a,i0,a)') &
1632 'GWF Model (', trim(this%name), ') is steady state for period ', &
1633 kper, ' and adaptive time stepping is active. Adaptive time &
1634 &stepping may not work properly for steady-state conditions.'
1636 end if
1637 end if
1638 end subroutine steady_period_check
1639
1640end module gwfmodule
This module contains the API package methods.
subroutine, public api_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new package object.
subroutine, public addbasemodeltolist(list, model)
subroutine model_ar(this)
Allocate and read.
Definition BaseModel.f90:55
subroutine model_ot(this)
Output results.
Definition BaseModel.f90:70
subroutine model_dt(this)
Calculate time step length.
Definition BaseModel.f90:65
subroutine model_rp(this)
Read and prepare.
Definition BaseModel.f90:60
subroutine model_df(this)
Define the model.
Definition BaseModel.f90:50
subroutine model_fp(this)
Final processing.
Definition BaseModel.f90:93
subroutine model_da(this)
Deallocate.
This module contains the base boundary package.
subroutine, public addbndtolist(list, bnd)
Add boundary to package list.
class(bndtype) function, pointer, public getbndfromlist(list, idx)
Get boundary from package list.
This module contains the BudgetModule.
Definition Budget.f90:20
subroutine, public budget_cr(this, name_model)
Create a new budget object.
Definition Budget.f90:85
subroutine, public chd_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new constant head package.
Definition gwf-chd.f90:56
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
integer(i4b), parameter lenpackagename
maximum length of the package name
Definition Constants.f90:23
real(dp), parameter dp9
real constant 9/10
Definition Constants.f90:72
integer(i4b), parameter lenpackagetype
maximum length of a package type (DIS6, SFR6, CSUB6, etc.)
Definition Constants.f90:38
integer(i4b), parameter lenpakloc
maximum length of a package location
Definition Constants.f90:50
integer(i4b), parameter lenftype
maximum length of a package type (DIS, WEL, OC, etc.)
Definition Constants.f90:39
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
real(dp), parameter dten
real constant 10
Definition Constants.f90:84
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition Constants.f90:37
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition Constants.f90:27
real(dp), parameter done
real constant 1
Definition Constants.f90:76
subroutine, public dis_cr(dis, name_model, input_mempath, inunit, iout)
Create a new structured discretization object.
Definition Dis.f90:99
subroutine, public disu_cr(dis, name_model, input_mempath, inunit, iout)
Create a new unstructured discretization object.
Definition Disu.f90:135
subroutine, public disv_cr(dis, name_model, input_mempath, inunit, iout)
Create a new discretization by vertices object.
Definition Disv.f90:112
subroutine, public drn_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Drn Package and point packobj to the new package.
Definition gwf-drn.f90:60
subroutine, public evt_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new Evapotranspiration Segments Package and point pakobj to the new package.
Definition gwf-evt.f90:65
subroutine, public ghb_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Ghb Package and point bndobj to the new package.
Definition gwf-ghb.f90:48
subroutine, public gnc_cr(gncobj, name_parent, inunit, iout)
Create new GNC exchange object.
Definition GhostNode.f90:61
subroutine allocate_scalars(this)
Allocate gnc scalar variables.
subroutine, public buy_cr(buyobj, name_model, input_mempath, inunit, iout)
Create a new BUY object.
Definition gwf-buy.f90:112
This module contains the CSUB package methods.
Definition gwf-csub.f90:9
subroutine, public csub_cr(csubobj, name_model, mempath, istounit, stopckname, inunit, iout)
Create a new package object.
Definition gwf-csub.f90:323
subroutine, public hfb_cr(hfbobj, name_model, input_mempath, inunit, iout)
Create a new hfb object.
Definition gwf-hfb.f90:71
subroutine, public ic_cr(ic, name_model, input_mempath, inunit, iout, dis)
Create a new initial conditions object.
Definition gwf-ic.f90:33
subroutine gwf_df(this)
Define packages of the model.
Definition gwf.f90:218
subroutine, public gwf_cr(filename, id, modelname)
Create a new groundwater flow model object.
Definition gwf.f90:139
subroutine gwf_ptcchk(this, iptc)
check if pseudo-transient continuation factor should be used
Definition gwf.f90:608
subroutine log_namfile_options(this, found)
Write model namfile options to list file.
Definition gwf.f90:1581
subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
calculate maximum pseudo-transient continuation factor
Definition gwf.f90:632
subroutine gwf_ot_flow(this, icbcfl, ibudfl, icbcun)
Groundwater Flow Model output flows.
Definition gwf.f90:925
integer(i4b) function gwf_get_iasym(this)
return 1 if any package causes the matrix to be asymmetric. Otherwise return 0.
Definition gwf.f90:1172
subroutine gwf_da(this)
Deallocate.
Definition gwf.f90:1078
subroutine create_packages(this)
Source package info and begin to process.
Definition gwf.f90:1441
subroutine gwf_mc(this, matrix_sln)
Map the positions of this models connections in the numerical solution coefficient matrix.
Definition gwf.f90:286
subroutine gwf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
GroundWater Flow Model Final Convergence Check for Boundary Packages.
Definition gwf.f90:569
subroutine gwf_rp(this)
GroundWater Flow Model Read and Prepare.
Definition gwf.f90:362
subroutine steady_period_check(this)
Check for steady state period.
Definition gwf.f90:1623
class(gwfmodeltype) function, pointer, public castasgwfmodel(model)
Cast to GWF model.
Definition gwf.f90:1372
subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, inunit, iout)
Create boundary condition packages for this model.
Definition gwf.f90:1249
subroutine gwf_ot_dv(this, idvsave, idvprint, ipflag)
Groundwater Flow Model output dependent variable.
Definition gwf.f90:976
integer(i4b), parameter, public gwf_nmultipkg
GWF multi package array descriptors.
Definition gwf.f90:120
subroutine create_bndpkgs(this, bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
Source package info and begin to process.
Definition gwf.f90:1388
subroutine gwf_ot(this)
GroundWater Flow Model Output.
Definition gwf.f90:842
character(len=lenpackagetype), dimension(gwf_nmultipkg), public gwf_multipkg
Definition gwf.f90:121
subroutine gwf_cf(this, kiter)
GroundWater Flow Model calculate coefficients.
Definition gwf.f90:449
integer(i4b), parameter niunit_gwf
Definition gwf.f90:128
subroutine gwf_ot_obs(this)
GroundWater Flow Model output observations.
Definition gwf.f90:899
subroutine gwf_fp(this)
Definition gwf.f90:1056
subroutine gwf_dt(this)
Submit boundary-package ATS time step requests.
Definition gwf.f90:1042
subroutine gwf_ot_bdsummary(this, ibudfl, ipflag)
Groundwater Flow Model output budget summary.
Definition gwf.f90:1009
subroutine gwf_ac(this, sparse)
Add the internal connections of this model to the sparse matrix.
Definition gwf.f90:257
subroutine gwf_fc(this, kiter, matrix_sln, inwtflag)
GroundWater Flow Model fill coefficients.
Definition gwf.f90:469
subroutine gwf_ar(this)
GroundWater Flow Model Allocate and Read.
Definition gwf.f90:318
subroutine gwf_bdentry(this, budterm, budtxt, rowlabel)
GroundWater Flow Model Budget Entry.
Definition gwf.f90:1156
subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
under-relaxation
Definition gwf.f90:710
subroutine gwf_ad(this)
GroundWater Flow Model Time Step Advance.
Definition gwf.f90:399
subroutine gwf_cq(this, icnvg, isuppress_output)
Groundwater flow model calculate flow.
Definition gwf.f90:755
subroutine gwf_bd(this, icnvg, isuppress_output)
GroundWater Flow Model Budget.
Definition gwf.f90:799
integer(i4b), parameter, public gwf_nbasepkg
GWF base package array descriptors.
Definition gwf.f90:107
character(len=lenpackagetype), dimension(gwf_nbasepkg), public gwf_basepkg
Definition gwf.f90:108
subroutine ftype_check(this, indis)
Check to make sure required input files have been specified.
Definition gwf.f90:1337
subroutine, public mvr_cr(mvrobj, name_parent, inunit, iout, dis, iexgmvr)
Create a new mvr object.
Definition gwf-mvr.f90:186
subroutine, public npf_cr(npfobj, name_model, input_mempath, inunit, iout)
Create a new NPF object. Pass a inunit value of 0 if npf data will initialized from memory.
Definition gwf-npf.f90:189
subroutine, public gwf_obs_cr(obs, inobs)
Create a new GwfObsType object.
Definition gwf-obs.f90:41
subroutine, public oc_cr(ocobj, name_model, input_mempath, inunit, iout)
Create GwfOcType.
Definition gwf-oc.f90:32
This module contains the storage package methods.
Definition gwf-sto.f90:8
subroutine, public sto_cr(stoobj, name_model, mempath, inunit, iout)
Create a new package object.
Definition gwf-sto.f90:109
subroutine, public vsc_cr(vscobj, name_model, input_mempath, inunit, iout)
Create a new package object.
Definition gwf-vsc.f90:143
This module defines variable data types.
Definition kind.f90:8
subroutine, public lak_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new LAK Package and point bndobj to the new package.
Definition gwf-lak.f90:469
type(listtype), public basemodellist
Definition mf6lists.f90:16
subroutine, public maw_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Multi-Aquifer Well (MAW) Package.
Definition gwf-maw.f90:302
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public memorystore_remove(component, subcomponent, context)
subroutine model_ac(this, sparse)
subroutine model_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
subroutine model_ad(this)
subroutine model_mc(this, matrix_sln)
subroutine model_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
subroutine model_cq(this, icnvg, isuppress_output)
subroutine model_bd(this, icnvg, isuppress_output)
subroutine model_ptc(this, vec_residual, iptc, ptcf)
subroutine model_ptcchk(this, iptc)
integer(i4b) function get_iasym(this)
subroutine model_fc(this, kiter, matrix_sln, inwtflag)
subroutine model_cf(this, kiter)
subroutine model_bdentry(this, budterm, budtxt, rowlabel)
subroutine, public rch_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Recharge Package.
Definition gwf-rch.f90:56
subroutine, public riv_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New Riv Package and point packobj to the new package.
Definition gwf-riv.f90:51
This module contains the SFR package methods.
Definition gwf-sfr.f90:7
subroutine, public sfr_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new package object.
Definition gwf-sfr.f90:390
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public store_warning(msg, substring)
Store warning message.
Definition Sim.f90:241
subroutine, public store_error(msg, terminate)
Store an error message.
Definition Sim.f90:94
integer(i4b) function, public count_errors()
Return number of errors.
Definition Sim.f90:60
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition Sim.f90:208
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
integer(i4b) isimcheck
simulation input check flag (1) to check input, (0) to ignore checks
integer(i4b) ifailedstepretry
current retry for this time step
character(len=maxcharlen) warnmsg
warning message string
subroutine csr_diagsum(ia, flowja)
Definition Sparse.f90:263
logical(lgp), pointer, public endofperiod
flag indicating end of stress period
Definition tdis.f90:30
subroutine, public tdis_ot(iout)
Print simulation time.
Definition tdis.f90:271
real(dp), pointer, public totim
time relative to start of simulation
Definition tdis.f90:35
class(atstype), pointer, public ats
Definition tdis.f90:48
logical(lgp), pointer, public readnewdata
flag indicating time to read new data
Definition tdis.f90:29
integer(i4b), pointer, public kstp
current time step number
Definition tdis.f90:27
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32
subroutine, public uzf_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a New UZF Package and point packobj to the new package.
Definition gwf-uzf.f90:223
This module contains the WEL package methods.
Definition gwf-wel.f90:15
subroutine, public wel_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
Create a new package object.
Definition gwf-wel.f90:83
subroutine, public xt3d_cr(xt3dobj, name_model, inunit, iout, ldispopt)
Create a new xt3d object.
Highest level model type. All models extend this parent type.
Definition BaseModel.f90:16
Derived type for the Budget object.
Definition Budget.f90:40
This class is used to store a single deferred-length character string. It was designed to work in an ...
Output control for GWF.
Definition gwf-oc.f90:18