MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
gwf.f90
Go to the documentation of this file.
1 module gwfmodule
2 
3  use kindmodule, only: dp, i4b
8  use simvariablesmodule, only: errmsg
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
33  public :: gwf_nbasepkg, gwf_nmultipkg
34  public :: gwf_basepkg, gwf_multipkg
35 
36  type, extends(numericalmodeltype) :: gwfmodeltype
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 
130 contains
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
168  call addbasemodeltolist(basemodellist, model)
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  end if
520  end if
521  !
522  ! -- Fill newton terms for ghost nodes
523  if (this%ingnc > 0) then
524  if (inwt /= 0) then
525  call this%gnc%gnc_fn(kiter, matrix_sln, this%npf%condsat, &
526  ivarcv_opt=this%npf%ivarcv, &
527  ictm1_opt=this%npf%icelltype, &
528  ictm2_opt=this%npf%icelltype)
529  end if
530  end if
531  !
532  ! -- Fill newton terms for storage
533  if (this%insto > 0) then
534  if (inwtsto /= 0) then
535  call this%sto%sto_fn(kiter, this%xold, this%x, matrix_sln, &
536  this%idxglo, this%rhs)
537  end if
538  end if
539  !
540  ! -- Fill newton terms for skeletal storage, compaction, and land subsidence
541  if (this%incsub > 0) then
542  if (inwtcsub /= 0) then
543  call this%csub%csub_fn(kiter, this%xold, this%x, matrix_sln, &
544  this%idxglo, this%rhs)
545  end if
546  end if
547  !
548  ! -- Fill Newton terms for packages
549  do ip = 1, this%bndlist%Count()
550  packobj => getbndfromlist(this%bndlist, ip)
551  inwtpak = inwtflag
552  if (inwtflag == 1) inwtpak = packobj%inewton
553  if (inwtpak /= 0) then
554  call packobj%bnd_fn(this%rhs, this%ia, this%idxglo, matrix_sln)
555  end if
556  end do
557  end subroutine gwf_fc
558 
559  !> @brief GroundWater Flow Model Final Convergence Check for Boundary Packages
560  !!
561  !! (1) calls package cc routines
562  !!
563  !<
564  subroutine gwf_cc(this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
565  ! -- dummy
566  class(gwfmodeltype) :: this
567  integer(I4B), intent(in) :: innertot
568  integer(I4B), intent(in) :: kiter
569  integer(I4B), intent(in) :: iend
570  integer(I4B), intent(in) :: icnvgmod
571  character(len=LENPAKLOC), intent(inout) :: cpak
572  integer(I4B), intent(inout) :: ipak
573  real(DP), intent(inout) :: dpak
574  ! -- local
575  class(bndtype), pointer :: packobj
576  integer(I4B) :: ip
577  ! -- formats
578  !
579  ! -- If mover is on, then at least 2 outers required
580  if (this%inmvr > 0) then
581  call this%mvr%mvr_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
582  end if
583  !
584  ! -- csub convergence check
585  if (this%incsub > 0) then
586  call this%csub%csub_cc(innertot, kiter, iend, icnvgmod, &
587  this%dis%nodes, this%x, this%xold, &
588  cpak, ipak, dpak)
589  end if
590  !
591  ! -- Call package cc routines
592  do ip = 1, this%bndlist%Count()
593  packobj => getbndfromlist(this%bndlist, ip)
594  call packobj%bnd_cc(innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
595  end do
596  end subroutine gwf_cc
597 
598  !> @brief check if pseudo-transient continuation factor should be used
599  !!
600  !! (1) Check if pseudo-transient continuation factor should be used
601  !!
602  !<
603  subroutine gwf_ptcchk(this, iptc)
604  ! -- dummy
605  class(gwfmodeltype) :: this
606  integer(I4B), intent(inout) :: iptc
607  !
608  ! -- determine if pseudo-transient continuation should be applied to this
609  ! model - pseudo-transient continuation only applied to problems that
610  ! use the Newton-Raphson formulation during steady-state stress periods
611  iptc = 0
612  if (this%iss > 0) then
613  if (this%inewton > 0) then
614  iptc = this%inewton
615  else
616  iptc = this%npf%inewton
617  end if
618  end if
619  end subroutine gwf_ptcchk
620 
621  !> @brief calculate maximum pseudo-transient continuation factor
622  !!
623  !! (1) Calculate maximum pseudo-transient continuation factor
624  !! for the current outer iteration
625  !!
626  !<
627  subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
628  ! -- modules
629  use constantsmodule, only: done
630  use tdismodule, only: delt
631  ! -- dummy
632  class(gwfmodeltype) :: this
633  class(vectorbasetype), pointer :: vec_residual
634  integer(I4B), intent(inout) :: iptc
635  real(DP), intent(inout) :: ptcf
636  ! -- local
637  integer(I4B) :: n
638  integer(I4B) :: iptct
639  real(DP) :: v
640  real(DP) :: resid
641  real(DP) :: ptcdelem1
642  !
643  ! -- set temporary flag indicating if pseudo-transient continuation should
644  ! be used for this model and time step
645  iptct = 0
646  ! -- only apply pseudo-transient continuation to problems using the
647  ! Newton-Raphson formulations for steady-state stress periods
648  if (this%iss > 0) then
649  if (this%inewton > 0) then
650  iptct = this%inewton
651  else
652  iptct = this%npf%inewton
653  end if
654  end if
655  !
656  ! -- calculate pseudo-transient continuation factor for model
657  if (iptct > 0) then
658  !
659  ! -- calculate the pseudo-time step using the residual
660  do n = 1, this%dis%nodes
661  if (this%npf%ibound(n) < 1) cycle
662  !
663  ! -- get the maximum volume of the cell (head at top of cell)
664  v = this%dis%get_cell_volume(n, this%dis%top(n))
665  !
666  ! -- set the residual
667  resid = vec_residual%get_value_local(n)
668  !
669  ! -- calculate the reciprocal of the pseudo-time step
670  ! resid [L3/T] / volume [L3] = [1/T]
671  ptcdelem1 = abs(resid) / v
672  !
673  ! -- set ptcf if the reciprocal of the pseudo-time step
674  ! exceeds the current value (equivalent to using the
675  ! smallest pseudo-time step)
676  if (ptcdelem1 > ptcf) ptcf = ptcdelem1
677  end do
678  !
679  ! -- protection for the case where the residuals are zero
680  if (ptcf == dzero) then
681  ptcf = done / (delt * dten)
682  end if
683  end if
684  !
685  ! -- reset ipc if needed
686  if (iptc == 0) then
687  if (iptct > 0) iptc = 1
688  end if
689  end subroutine gwf_ptc
690 
691  !> @brief under-relaxation
692  !!
693  !! (1) Under-relaxation of Groundwater Flow Model Heads for current
694  !! outer iteration using the cell bottoms at the bottom of the
695  !! model
696  !!
697  !<
698  subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
699  ! modules
700  use constantsmodule, only: done, dp9
701  ! -- dummy
702  class(gwfmodeltype) :: this
703  integer(I4B), intent(in) :: neqmod
704  real(DP), dimension(neqmod), intent(inout) :: x
705  real(DP), dimension(neqmod), intent(in) :: xtemp
706  real(DP), dimension(neqmod), intent(inout) :: dx
707  integer(I4B), intent(inout) :: inewtonur
708  real(DP), intent(inout) :: dxmax
709  integer(I4B), intent(inout) :: locmax
710  ! -- local
711  integer(I4B) :: i0
712  integer(I4B) :: i1
713  class(bndtype), pointer :: packobj
714  integer(I4B) :: ip
715  !
716  ! -- apply Newton-Raphson under-relaxation if model is using
717  ! the Newton-Raphson formulation and this Newton-Raphson
718  ! under-relaxation is turned on.
719  if (this%inewton /= 0 .and. this%inewtonur /= 0) then
720  if (this%innpf > 0) then
721  call this%npf%npf_nur(neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
722  end if
723  !
724  ! -- Call package nur routines
725  i0 = this%dis%nodes + 1
726  do ip = 1, this%bndlist%Count()
727  packobj => getbndfromlist(this%bndlist, ip)
728  if (packobj%npakeq > 0) then
729  i1 = i0 + packobj%npakeq - 1
730  call packobj%bnd_nur(packobj%npakeq, x(i0:i1), xtemp(i0:i1), &
731  dx(i0:i1), inewtonur, dxmax, locmax)
732  i0 = i1 + 1
733  end if
734  end do
735  end if
736  end subroutine gwf_nur
737 
738  !> @brief Groundwater flow model calculate flow
739  !!
740  !! (1) Calculate intercell flows (flowja)
741  !!
742  !<
743  subroutine gwf_cq(this, icnvg, isuppress_output)
744  ! -- modules
745  ! -- dummy
746  class(gwfmodeltype) :: this
747  integer(I4B), intent(in) :: icnvg
748  integer(I4B), intent(in) :: isuppress_output
749  ! -- local
750  integer(I4B) :: i
751  integer(I4B) :: ip
752  class(bndtype), pointer :: packobj
753  !
754  ! -- Construct the flowja array. Flowja is calculated each time, even if
755  ! output is suppressed. (flowja is positive into a cell.) The diagonal
756  ! position of the flowja array will contain the flow residual after
757  ! these routines are called, so each package is responsible for adding
758  ! its flow to this diagonal position.
759  do i = 1, this%nja
760  this%flowja(i) = dzero
761  end do
762  if (this%innpf > 0) call this%npf%npf_cq(this%x, this%flowja)
763  if (this%inbuy > 0) call this%buy%buy_cq(this%x, this%flowja)
764  if (this%inhfb > 0) call this%hfb%hfb_cq(this%x, this%flowja)
765  if (this%ingnc > 0) call this%gnc%gnc_cq(this%flowja)
766  if (this%insto > 0) call this%sto%sto_cq(this%flowja, this%x, this%xold)
767  if (this%incsub > 0) call this%csub%csub_cq(this%dis%nodes, this%x, &
768  this%xold, isuppress_output, &
769  this%flowja)
770  !
771  ! -- Go through packages and call cq routines. cf() routines are called
772  ! first to regenerate non-linear terms to be consistent with the final
773  ! head solution.
774  do ip = 1, this%bndlist%Count()
775  packobj => getbndfromlist(this%bndlist, ip)
776  call packobj%bnd_cf()
777  if (this%inbuy > 0) call this%buy%buy_cf_bnd(packobj, this%x)
778  call packobj%bnd_cq(this%x, this%flowja)
779  end do
780  end subroutine gwf_cq
781 
782  !> @brief GroundWater Flow Model Budget
783  !!
784  !! (1) Calculate stress package contributions to model budget
785  !!
786  !<
787  subroutine gwf_bd(this, icnvg, isuppress_output)
788  ! -- modules
789  use sparsemodule, only: csr_diagsum
790  ! -- dummy
791  class(gwfmodeltype) :: this
792  integer(I4B), intent(in) :: icnvg
793  integer(I4B), intent(in) :: isuppress_output
794  ! -- local
795  integer(I4B) :: ip
796  class(bndtype), pointer :: packobj
797  !
798  ! -- Finalize calculation of flowja by adding face flows to the diagonal.
799  ! This results in the flow residual being stored in the diagonal
800  ! position for each cell.
801  call csr_diagsum(this%dis%con%ia, this%flowja)
802  !
803  ! -- Save the solution convergence flag
804  this%icnvg = icnvg
805  !
806  ! -- Budget routines (start by resetting). Sole purpose of this section
807  ! is to add in and outs to model budget. All ins and out for a model
808  ! should be added here to this%budget. In a subsequent exchange call,
809  ! exchange flows might also be added.
810  call this%budget%reset()
811  if (this%insto > 0) call this%sto%sto_bd(isuppress_output, this%budget)
812  if (this%incsub > 0) call this%csub%csub_bd(isuppress_output, this%budget)
813  if (this%inmvr > 0) call this%mvr%mvr_bd()
814  do ip = 1, this%bndlist%Count()
815  packobj => getbndfromlist(this%bndlist, ip)
816  call packobj%bnd_bd(this%budget)
817  end do
818  !
819  ! -- npf velocities have to be calculated here, after gwf-gwf exchanges
820  ! have passed in their contributions from exg_cq()
821  if (this%innpf > 0) then
822  if (this%npf%icalcspdis /= 0) then
823  call this%npf%calc_spdis(this%flowja)
824  end if
825  end if
826  end subroutine gwf_bd
827 
828  !> @brief GroundWater Flow Model Output
829  !<
830  subroutine gwf_ot(this)
831  ! -- modules
832  use tdismodule, only: kstp, kper, tdis_ot, endofperiod
833  ! -- dummy
834  class(gwfmodeltype) :: this
835  ! -- local
836  integer(I4B) :: idvsave
837  integer(I4B) :: idvprint
838  integer(I4B) :: icbcfl
839  integer(I4B) :: icbcun
840  integer(I4B) :: ibudfl
841  integer(I4B) :: ipflag
842  ! -- formats
843  character(len=*), parameter :: fmtnocnvg = &
844  "(1X,/9X,'****FAILED TO MEET SOLVER CONVERGENCE CRITERIA IN TIME STEP ', &
845  &I0,' OF STRESS PERIOD ',I0,'****')"
846  !
847  ! -- Set write and print flags
848  idvsave = 0
849  idvprint = 0
850  icbcfl = 0
851  ibudfl = 0
852  if (this%oc%oc_save('HEAD')) idvsave = 1
853  if (this%oc%oc_print('HEAD')) idvprint = 1
854  if (this%oc%oc_save('BUDGET')) icbcfl = 1
855  if (this%oc%oc_print('BUDGET')) ibudfl = 1
856  icbcun = this%oc%oc_save_unit('BUDGET')
857  !
858  ! -- Override ibudfl and idvprint flags for nonconvergence
859  ! and end of period
860  ibudfl = this%oc%set_print_flag('BUDGET', this%icnvg, endofperiod)
861  idvprint = this%oc%set_print_flag('HEAD', this%icnvg, endofperiod)
862  !
863  ! Calculate and save observations
864  call this%gwf_ot_obs()
865  !
866  ! Save and print flows
867  call this%gwf_ot_flow(icbcfl, ibudfl, icbcun)
868  !
869  ! Save and print dependent variables
870  call this%gwf_ot_dv(idvsave, idvprint, ipflag)
871  !
872  ! Print budget summaries
873  call this%gwf_ot_bdsummary(ibudfl, ipflag)
874  !
875  ! -- Timing Output; if any dependent variables or budgets
876  ! are printed, then ipflag is set to 1.
877  if (ipflag == 1) call tdis_ot(this%iout)
878  !
879  ! -- Write non-convergence message
880  if (this%icnvg == 0) then
881  write (this%iout, fmtnocnvg) kstp, kper
882  end if
883  end subroutine gwf_ot
884 
885  !> @brief GroundWater Flow Model output observations
886  !<
887  subroutine gwf_ot_obs(this)
888  class(gwfmodeltype) :: this
889  class(bndtype), pointer :: packobj
890  integer(I4B) :: ip
891 
892  ! -- Calculate and save GWF observations
893  call this%obs%obs_bd()
894  call this%obs%obs_ot()
895 
896  ! -- Calculate and save csub observations
897  if (this%incsub > 0) then
898  call this%csub%csub_bd_obs()
899  call this%csub%obs%obs_ot()
900  end if
901 
902  ! -- Calculate and save package observations
903  do ip = 1, this%bndlist%Count()
904  packobj => getbndfromlist(this%bndlist, ip)
905  call packobj%bnd_bd_obs()
906  call packobj%bnd_ot_obs()
907  end do
908 
909  end subroutine gwf_ot_obs
910 
911  !> @brief Groundwater Flow Model output flows
912  !<
913  subroutine gwf_ot_flow(this, icbcfl, ibudfl, icbcun)
914  class(gwfmodeltype) :: this
915  integer(I4B), intent(in) :: icbcfl
916  integer(I4B), intent(in) :: ibudfl
917  integer(I4B), intent(in) :: icbcun
918  class(bndtype), pointer :: packobj
919  integer(I4B) :: ip
920 
921  ! -- Save GWF flows
922  if (this%insto > 0) then
923  call this%sto%sto_save_model_flows(icbcfl, icbcun)
924  end if
925  if (this%innpf > 0) then
926  call this%npf%npf_save_model_flows(this%flowja, icbcfl, icbcun)
927  end if
928  if (this%incsub > 0) call this%csub%csub_save_model_flows(icbcfl, icbcun)
929  do ip = 1, this%bndlist%Count()
930  packobj => getbndfromlist(this%bndlist, ip)
931  call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=0, icbcun=icbcun)
932  end do
933 
934  ! -- Save advanced package flows
935  do ip = 1, this%bndlist%Count()
936  packobj => getbndfromlist(this%bndlist, ip)
937  call packobj%bnd_ot_package_flows(icbcfl=icbcfl, ibudfl=0)
938  end do
939  if (this%inmvr > 0) then
940  call this%mvr%mvr_ot_saveflow(icbcfl, ibudfl)
941  end if
942 
943  ! -- Print GWF flows
944  if (this%innpf > 0) call this%npf%npf_print_model_flows(ibudfl, this%flowja)
945  if (this%ingnc > 0) call this%gnc%gnc_ot(ibudfl)
946  do ip = 1, this%bndlist%Count()
947  packobj => getbndfromlist(this%bndlist, ip)
948  call packobj%bnd_ot_model_flows(icbcfl=icbcfl, ibudfl=ibudfl, icbcun=0)
949  end do
950 
951  ! -- Print advanced package flows
952  do ip = 1, this%bndlist%Count()
953  packobj => getbndfromlist(this%bndlist, ip)
954  call packobj%bnd_ot_package_flows(icbcfl=0, ibudfl=ibudfl)
955  end do
956  if (this%inmvr > 0) then
957  call this%mvr%mvr_ot_printflow(icbcfl, ibudfl)
958  end if
959 
960  end subroutine gwf_ot_flow
961 
962  !> @brief Groundwater Flow Model output dependent variable
963  !<
964  subroutine gwf_ot_dv(this, idvsave, idvprint, ipflag)
965  class(gwfmodeltype) :: this
966  integer(I4B), intent(in) :: idvsave
967  integer(I4B), intent(in) :: idvprint
968  integer(I4B), intent(inout) :: ipflag
969  class(bndtype), pointer :: packobj
970  integer(I4B) :: ip
971  !
972  ! -- Save compaction to binary file
973  if (this%incsub > 0) call this%csub%csub_ot_dv(idvsave, idvprint)
974  !
975  ! -- save density to binary file
976  if (this%inbuy > 0) then
977  call this%buy%buy_ot_dv(idvsave)
978  end if
979  !
980  ! -- save viscosity to binary file
981  if (this%invsc > 0) then
982  call this%vsc%vsc_ot_dv(idvsave)
983  end if
984  !
985  ! -- Print advanced package dependent variables
986  do ip = 1, this%bndlist%Count()
987  packobj => getbndfromlist(this%bndlist, ip)
988  call packobj%bnd_ot_dv(idvsave, idvprint)
989  end do
990  !
991  ! -- save head and print head
992  call this%oc%oc_ot(ipflag)
993  end subroutine gwf_ot_dv
994 
995  !> @brief Groundwater Flow Model output budget summary
996  !<
997  subroutine gwf_ot_bdsummary(this, ibudfl, ipflag)
998  use tdismodule, only: kstp, kper, totim, delt
999  class(gwfmodeltype) :: this
1000  integer(I4B), intent(in) :: ibudfl
1001  integer(I4B), intent(inout) :: ipflag
1002  class(bndtype), pointer :: packobj
1003  integer(I4B) :: ip
1004 
1005  ! -- Package budget summary
1006  do ip = 1, this%bndlist%Count()
1007  packobj => getbndfromlist(this%bndlist, ip)
1008  call packobj%bnd_ot_bdsummary(kstp, kper, this%iout, ibudfl)
1009  end do
1010 
1011  ! -- mover budget summary
1012  if (this%inmvr > 0) then
1013  call this%mvr%mvr_ot_bdsummary(ibudfl)
1014  end if
1015 
1016  ! -- model budget summary
1017  call this%budget%finalize_step(delt)
1018  if (ibudfl /= 0) then
1019  ipflag = 1
1020  call this%budget%budget_ot(kstp, kper, this%iout)
1021  end if
1022 
1023  ! -- Write to budget csv every time step
1024  call this%budget%writecsv(totim)
1025 
1026  end subroutine gwf_ot_bdsummary
1027 
1028  !> @brief Submit boundary-package ATS time step requests
1029  !<
1030  subroutine gwf_dt(this)
1031  ! -- dummy
1032  class(gwfmodeltype) :: this
1033  ! -- local
1034  integer(I4B) :: ip
1035  class(bndtype), pointer :: packobj => null()
1036  !
1037  ! -- boundary package time step submission
1038  do ip = 1, this%bndlist%Count()
1039  packobj => getbndfromlist(this%bndlist, ip)
1040  call packobj%bnd_dt()
1041  end do
1042  end subroutine gwf_dt
1043 
1044  subroutine gwf_fp(this)
1045  ! -- modules
1046  ! -- dummy
1047  class(gwfmodeltype) :: this
1048  ! -- local
1049  integer(I4B) :: ip
1050  class(bndtype), pointer :: packobj => null()
1051  !
1052  ! -- csub final processing
1053  if (this%incsub > 0) then
1054  call this%csub%csub_fp()
1055  end if
1056  !
1057  ! -- boundary package final processing
1058  do ip = 1, this%bndlist%Count()
1059  packobj => getbndfromlist(this%bndlist, ip)
1060  call packobj%bnd_fp()
1061  end do
1062  end subroutine gwf_fp
1063 
1064  !> @brief Deallocate
1065  !<
1066  subroutine gwf_da(this)
1067  ! -- modules
1070  use simvariablesmodule, only: idm_context
1071  ! -- dummy
1072  class(gwfmodeltype) :: this
1073  ! -- local
1074  integer(I4B) :: ip
1075  class(bndtype), pointer :: packobj
1076  !
1077  ! -- Deallocate idm memory
1078  call memorystore_remove(this%name, 'NAM', idm_context)
1079  call memorystore_remove(component=this%name, context=idm_context)
1080  !
1081  ! -- Internal flow packages deallocate
1082  call this%dis%dis_da()
1083  call this%ic%ic_da()
1084  call this%npf%npf_da()
1085  call this%xt3d%xt3d_da()
1086  call this%buy%buy_da()
1087  call this%vsc%vsc_da()
1088  call this%gnc%gnc_da()
1089  call this%sto%sto_da()
1090  call this%csub%csub_da()
1091  call this%budget%budget_da()
1092  call this%hfb%hfb_da()
1093  call this%mvr%mvr_da()
1094  call this%oc%oc_da()
1095  call this%obs%obs_da()
1096  !
1097  ! -- Internal package objects
1098  deallocate (this%dis)
1099  deallocate (this%ic)
1100  deallocate (this%npf)
1101  deallocate (this%xt3d)
1102  deallocate (this%buy)
1103  deallocate (this%vsc)
1104  deallocate (this%gnc)
1105  deallocate (this%sto)
1106  deallocate (this%csub)
1107  deallocate (this%budget)
1108  deallocate (this%hfb)
1109  deallocate (this%mvr)
1110  deallocate (this%obs)
1111  deallocate (this%oc)
1112  !
1113  ! -- Boundary packages
1114  do ip = 1, this%bndlist%Count()
1115  packobj => getbndfromlist(this%bndlist, ip)
1116  call packobj%bnd_da()
1117  deallocate (packobj)
1118  end do
1119  !
1120  ! -- Scalars
1121  call mem_deallocate(this%inic)
1122  call mem_deallocate(this%inoc)
1123  call mem_deallocate(this%inobs)
1124  call mem_deallocate(this%innpf)
1125  call mem_deallocate(this%inbuy)
1126  call mem_deallocate(this%invsc)
1127  call mem_deallocate(this%insto)
1128  call mem_deallocate(this%incsub)
1129  call mem_deallocate(this%inmvr)
1130  call mem_deallocate(this%inhfb)
1131  call mem_deallocate(this%ingnc)
1132  call mem_deallocate(this%iss)
1133  call mem_deallocate(this%inewtonur)
1134  !
1135  ! -- NumericalModelType
1136  call this%NumericalModelType%model_da()
1137  end subroutine gwf_da
1138 
1139  !> @brief GroundWater Flow Model Budget Entry
1140  !!
1141  !! This subroutine adds a budget entry to the flow budget. It was added as
1142  !! a method for the gwf model object so that the exchange object could add its
1143  !< contributions.
1144  subroutine gwf_bdentry(this, budterm, budtxt, rowlabel)
1145  ! -- modules
1146  use constantsmodule, only: lenbudtxt
1147  use tdismodule, only: delt
1148  ! -- dummy
1149  class(gwfmodeltype) :: this
1150  real(DP), dimension(:, :), intent(in) :: budterm
1151  character(len=LENBUDTXT), dimension(:), intent(in) :: budtxt
1152  character(len=*), intent(in) :: rowlabel
1153  !
1154  call this%budget%addentry(budterm, delt, budtxt, rowlabel=rowlabel)
1155  end subroutine gwf_bdentry
1156 
1157  !> @brief return 1 if any package causes the matrix to be asymmetric.
1158  !! Otherwise return 0.
1159  !<
1160  function gwf_get_iasym(this) result(iasym)
1161  class(gwfmodeltype) :: this
1162  ! -- local
1163  integer(I4B) :: iasym
1164  integer(I4B) :: ip
1165  class(bndtype), pointer :: packobj
1166  !
1167  ! -- Start by setting iasym to zero
1168  iasym = 0
1169  !
1170  ! -- NPF
1171  if (this%innpf > 0) then
1172  if (this%npf%iasym /= 0) iasym = 1
1173  if (this%npf%ixt3d /= 0) iasym = 1
1174  end if
1175  !
1176  ! -- GNC
1177  if (this%ingnc > 0) then
1178  if (this%gnc%iasym /= 0) iasym = 1
1179  end if
1180  !
1181  ! -- Check for any packages that introduce matrix asymmetry
1182  do ip = 1, this%bndlist%Count()
1183  packobj => getbndfromlist(this%bndlist, ip)
1184  if (packobj%iasym /= 0) iasym = 1
1185  end do
1186  end function gwf_get_iasym
1187 
1188  !> @brief Allocate memory for non-allocatable members
1189  !<
1190  subroutine allocate_scalars(this, modelname)
1191  ! -- modules
1193  ! -- dummy
1194  class(gwfmodeltype) :: this
1195  character(len=*), intent(in) :: modelname
1196  !
1197  ! -- allocate members from parent class
1198  call this%NumericalModelType%allocate_scalars(modelname)
1199  !
1200  ! -- allocate members that are part of model class
1201  call mem_allocate(this%inic, 'INIC', this%memoryPath)
1202  call mem_allocate(this%inoc, 'INOC', this%memoryPath)
1203  call mem_allocate(this%innpf, 'INNPF', this%memoryPath)
1204  call mem_allocate(this%inbuy, 'INBUY', this%memoryPath)
1205  call mem_allocate(this%invsc, 'INVSC', this%memoryPath)
1206  call mem_allocate(this%insto, 'INSTO', this%memoryPath)
1207  call mem_allocate(this%incsub, 'INCSUB', this%memoryPath)
1208  call mem_allocate(this%inmvr, 'INMVR', this%memoryPath)
1209  call mem_allocate(this%inhfb, 'INHFB', this%memoryPath)
1210  call mem_allocate(this%ingnc, 'INGNC', this%memoryPath)
1211  call mem_allocate(this%inobs, 'INOBS', this%memoryPath)
1212  call mem_allocate(this%iss, 'ISS', this%memoryPath)
1213  call mem_allocate(this%inewtonur, 'INEWTONUR', this%memoryPath)
1214  !
1215  this%inic = 0
1216  this%inoc = 0
1217  this%innpf = 0
1218  this%inbuy = 0
1219  this%invsc = 0
1220  this%insto = 0
1221  this%incsub = 0
1222  this%inmvr = 0
1223  this%inhfb = 0
1224  this%ingnc = 0
1225  this%inobs = 0
1226  this%iss = 1 !default is steady-state (i.e., no STO package)
1227  this%inewtonur = 0 !default is to not use newton bottom head dampening
1228  end subroutine allocate_scalars
1229 
1230  !> @brief Create boundary condition packages for this model
1231  !!
1232  !! (1) create new-style package
1233  !! (2) add a pointer to the package
1234  !!
1235  !<
1236  subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, &
1237  inunit, iout)
1238  ! -- modules
1239  use constantsmodule, only: linelength
1240  use simmodule, only: store_error
1241  use chdmodule, only: chd_create
1242  use welmodule, only: wel_create
1243  use drnmodule, only: drn_create
1244  use rivmodule, only: riv_create
1245  use ghbmodule, only: ghb_create
1246  use rchmodule, only: rch_create
1247  use evtmodule, only: evt_create
1248  use mawmodule, only: maw_create
1249  use sfrmodule, only: sfr_create
1250  use lakmodule, only: lak_create
1251  use uzfmodule, only: uzf_create
1252  use apimodule, only: api_create
1253  ! -- dummy
1254  class(gwfmodeltype) :: this
1255  character(len=*), intent(in) :: filtyp
1256  integer(I4B), intent(in) :: ipakid
1257  integer(I4B), intent(in) :: ipaknum
1258  character(len=*), intent(in) :: pakname
1259  character(len=*), intent(in) :: mempath
1260  integer(I4B), intent(in) :: inunit
1261  integer(I4B), intent(in) :: iout
1262  ! -- local
1263  class(bndtype), pointer :: packobj
1264  class(bndtype), pointer :: packobj2
1265  integer(I4B) :: ip
1266  !
1267  ! -- This part creates the package object
1268  select case (filtyp)
1269  case ('CHD6')
1270  call chd_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1271  pakname, mempath)
1272  case ('WEL6')
1273  call wel_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1274  pakname, mempath)
1275  case ('DRN6')
1276  call drn_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1277  pakname, mempath)
1278  case ('RIV6')
1279  call riv_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1280  pakname, mempath)
1281  case ('GHB6')
1282  call ghb_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1283  pakname, mempath)
1284  case ('RCH6')
1285  call rch_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1286  pakname, mempath)
1287  case ('EVT6')
1288  call evt_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1289  pakname, mempath)
1290  case ('MAW6')
1291  call maw_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1292  case ('SFR6')
1293  call sfr_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1294  case ('LAK6')
1295  call lak_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1296  case ('UZF6')
1297  call uzf_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
1298  case ('API6')
1299  call api_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
1300  pakname, mempath)
1301  case default
1302  write (errmsg, *) 'Invalid package type: ', filtyp
1303  call store_error(errmsg, terminate=.true.)
1304  end select
1305  !
1306  ! -- Check to make sure that the package name is unique, then store a
1307  ! pointer to the package in the model bndlist
1308  do ip = 1, this%bndlist%Count()
1309  packobj2 => getbndfromlist(this%bndlist, ip)
1310  if (packobj2%packName == pakname) then
1311  write (errmsg, '(a,a)') 'Cannot create package. Package name '// &
1312  'already exists: ', trim(pakname)
1313  call store_error(errmsg, terminate=.true.)
1314  end if
1315  end do
1316  call addbndtolist(this%bndlist, packobj)
1317  end subroutine package_create
1318 
1319  !> @brief Check to make sure required input files have been specified
1320  !<
1321  subroutine ftype_check(this, indis)
1322  ! -- modules
1323  use constantsmodule, only: linelength
1324  use simmodule, only: store_error, count_errors
1325  ! -- dummy
1326  class(gwfmodeltype) :: this
1327  integer(I4B), intent(in) :: indis
1328  ! -- local
1329  !
1330  ! -- Check for IC8, DIS(u), and NPF. Stop if not present.
1331  if (this%inic == 0) then
1332  write (errmsg, '(a)') &
1333  'Initial Conditions (IC6) package not specified.'
1334  call store_error(errmsg)
1335  end if
1336  if (indis == 0) then
1337  write (errmsg, '(a)') &
1338  'Discretization (DIS6, DISV6, or DISU6) Package not specified.'
1339  call store_error(errmsg)
1340  end if
1341  if (this%innpf == 0) then
1342  write (errmsg, '(a)') &
1343  'Node Property Flow (NPF6) Package not specified.'
1344  call store_error(errmsg)
1345  end if
1346  !
1347  if (count_errors() > 0) then
1348  write (errmsg, '(a)') 'One or more required package(s) not specified.'
1349  call store_error(errmsg)
1350  call store_error_filename(this%filename)
1351  end if
1352  end subroutine ftype_check
1353 
1354  !> @brief Cast to GWF model
1355  !<
1356  function castasgwfmodel(model) result(gwfModel)
1357  implicit none
1358  class(*), pointer, intent(inout) :: model
1359  class(gwfmodeltype), pointer :: gwfmodel
1360 
1361  gwfmodel => null()
1362  if (.not. associated(model)) return
1363  select type (model)
1364  class is (gwfmodeltype)
1365  gwfmodel => model
1366  end select
1367  end function castasgwfmodel
1368 
1369  !> @brief Source package info and begin to process
1370  !<
1371  subroutine create_bndpkgs(this, bndpkgs, pkgtypes, pkgnames, &
1372  mempaths, inunits)
1373  ! -- modules
1376  ! -- dummy
1377  class(gwfmodeltype) :: this
1378  integer(I4B), dimension(:), allocatable, intent(inout) :: bndpkgs
1379  type(characterstringtype), dimension(:), contiguous, &
1380  pointer, intent(inout) :: pkgtypes
1381  type(characterstringtype), dimension(:), contiguous, &
1382  pointer, intent(inout) :: pkgnames
1383  type(characterstringtype), dimension(:), contiguous, &
1384  pointer, intent(inout) :: mempaths
1385  integer(I4B), dimension(:), contiguous, &
1386  pointer, intent(inout) :: inunits
1387  ! -- local
1388  integer(I4B) :: ipakid, ipaknum
1389  character(len=LENFTYPE) :: pkgtype, bndptype
1390  character(len=LENPACKAGENAME) :: pkgname
1391  character(len=LENMEMPATH) :: mempath
1392  integer(I4B), pointer :: inunit
1393  integer(I4B) :: n
1394 
1395  if (allocated(bndpkgs)) then
1396  !
1397  ! -- create stress packages
1398  ipakid = 1
1399  bndptype = ''
1400  do n = 1, size(bndpkgs)
1401  !
1402  pkgtype = pkgtypes(bndpkgs(n))
1403  pkgname = pkgnames(bndpkgs(n))
1404  mempath = mempaths(bndpkgs(n))
1405  inunit => inunits(bndpkgs(n))
1406  !
1407  if (bndptype /= pkgtype) then
1408  ipaknum = 1
1409  bndptype = pkgtype
1410  end if
1411  !
1412  call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
1413  inunit, this%iout)
1414  ipakid = ipakid + 1
1415  ipaknum = ipaknum + 1
1416  end do
1417  !
1418  ! -- cleanup
1419  deallocate (bndpkgs)
1420  end if
1421  end subroutine create_bndpkgs
1422 
1423  !> @brief Source package info and begin to process
1424  !<
1425  subroutine create_packages(this)
1426  ! -- modules
1429  use arrayhandlersmodule, only: expandarray
1430  use memorymanagermodule, only: mem_setptr
1432  use simvariablesmodule, only: idm_context
1433  use dismodule, only: dis_cr
1434  use disvmodule, only: disv_cr
1435  use disumodule, only: disu_cr
1436  use gwfnpfmodule, only: npf_cr
1437  use xt3dmodule, only: xt3d_cr
1438  use gwfbuymodule, only: buy_cr
1439  use gwfvscmodule, only: vsc_cr
1440  use gwfstomodule, only: sto_cr
1441  use gwfcsubmodule, only: csub_cr
1442  use gwfmvrmodule, only: mvr_cr
1443  use gwfhfbmodule, only: hfb_cr
1444  use gwficmodule, only: ic_cr
1445  use gwfocmodule, only: oc_cr
1446  ! -- dummy
1447  class(gwfmodeltype) :: this
1448  ! -- local
1449  type(characterstringtype), dimension(:), contiguous, &
1450  pointer :: pkgtypes => null()
1451  type(characterstringtype), dimension(:), contiguous, &
1452  pointer :: pkgnames => null()
1453  type(characterstringtype), dimension(:), contiguous, &
1454  pointer :: mempaths => null()
1455  integer(I4B), dimension(:), contiguous, &
1456  pointer :: inunits => null()
1457  character(len=LENMEMPATH) :: model_mempath
1458  character(len=LENFTYPE) :: pkgtype
1459  character(len=LENPACKAGENAME) :: pkgname
1460  character(len=LENMEMPATH) :: mempath
1461  integer(I4B), pointer :: inunit
1462  integer(I4B), dimension(:), allocatable :: bndpkgs
1463  integer(I4B) :: n
1464  integer(I4B) :: indis = 0 ! DIS enabled flag
1465  character(len=LENMEMPATH) :: mempathbuy = ''
1466  character(len=LENMEMPATH) :: mempathcsub = ''
1467  character(len=LENMEMPATH) :: mempathhfb = ''
1468  character(len=LENMEMPATH) :: mempathic = ''
1469  character(len=LENMEMPATH) :: mempathnpf = ''
1470  character(len=LENMEMPATH) :: mempathoc = ''
1471  character(len=LENMEMPATH) :: mempathsto = ''
1472  character(len=LENMEMPATH) :: mempathvsc = ''
1473  !
1474  ! -- set input model memory path
1475  model_mempath = create_mem_path(component=this%name, context=idm_context)
1476  !
1477  ! -- set pointers to model path package info
1478  call mem_setptr(pkgtypes, 'PKGTYPES', model_mempath)
1479  call mem_setptr(pkgnames, 'PKGNAMES', model_mempath)
1480  call mem_setptr(mempaths, 'MEMPATHS', model_mempath)
1481  call mem_setptr(inunits, 'INUNITS', model_mempath)
1482  !
1483  do n = 1, size(pkgtypes)
1484  !
1485  ! attributes for this input package
1486  pkgtype = pkgtypes(n)
1487  pkgname = pkgnames(n)
1488  mempath = mempaths(n)
1489  inunit => inunits(n)
1490  !
1491  ! -- create dis package as it is a prerequisite for other packages
1492  select case (pkgtype)
1493  case ('DIS6')
1494  indis = 1
1495  call dis_cr(this%dis, this%name, mempath, indis, this%iout)
1496  case ('DISV6')
1497  indis = 1
1498  call disv_cr(this%dis, this%name, mempath, indis, this%iout)
1499  case ('DISU6')
1500  indis = 1
1501  call disu_cr(this%dis, this%name, mempath, indis, this%iout)
1502  case ('NPF6')
1503  this%innpf = 1
1504  mempathnpf = mempath
1505  case ('BUY6')
1506  this%inbuy = 1
1507  mempathbuy = mempath
1508  case ('VSC6')
1509  this%invsc = 1
1510  mempathvsc = mempath
1511  case ('GNC6')
1512  this%ingnc = inunit
1513  case ('HFB6')
1514  this%inhfb = 1
1515  mempathhfb = mempath
1516  case ('STO6')
1517  this%insto = 1
1518  mempathsto = mempath
1519  case ('CSUB6')
1520  this%incsub = 1
1521  mempathcsub = mempath
1522  case ('IC6')
1523  this%inic = 1
1524  mempathic = mempath
1525  case ('MVR6')
1526  this%inmvr = inunit
1527  case ('OC6')
1528  this%inoc = 1
1529  mempathoc = mempath
1530  case ('OBS6')
1531  this%inobs = inunit
1532  case ('WEL6', 'DRN6', 'RIV6', 'GHB6', 'RCH6', &
1533  'EVT6', 'API6', 'CHD6', 'MAW6', 'SFR6', &
1534  'LAK6', 'UZF6')
1535  call expandarray(bndpkgs)
1536  bndpkgs(size(bndpkgs)) = n
1537  case default
1538  ! TODO
1539  end select
1540  end do
1541  !
1542  ! -- Create packages that are tied directly to model
1543  call npf_cr(this%npf, this%name, mempathnpf, this%innpf, this%iout)
1544  call xt3d_cr(this%xt3d, this%name, this%innpf, this%iout)
1545  call buy_cr(this%buy, this%name, mempathbuy, this%inbuy, this%iout)
1546  call vsc_cr(this%vsc, this%name, mempathvsc, this%invsc, this%iout)
1547  call gnc_cr(this%gnc, this%name, this%ingnc, this%iout)
1548  call hfb_cr(this%hfb, this%name, mempathhfb, this%inhfb, this%iout)
1549  call sto_cr(this%sto, this%name, mempathsto, this%insto, this%iout)
1550  call csub_cr(this%csub, this%name, mempathcsub, this%insto, &
1551  this%sto%packName, this%incsub, this%iout)
1552  call ic_cr(this%ic, this%name, mempathic, this%inic, this%iout, this%dis)
1553  call mvr_cr(this%mvr, this%name, this%inmvr, this%iout, this%dis)
1554  call oc_cr(this%oc, this%name, mempathoc, this%inoc, this%iout)
1555  call gwf_obs_cr(this%obs, this%inobs)
1556  !
1557  ! -- Check to make sure that required ftype's have been specified
1558  call this%ftype_check(indis)
1559  !
1560  call this%create_bndpkgs(bndpkgs, pkgtypes, pkgnames, mempaths, inunits)
1561  end subroutine create_packages
1562 
1563  !> @brief Write model namfile options to list file
1564  !<
1565  subroutine log_namfile_options(this, found)
1567  class(gwfmodeltype) :: this
1568  type(gwfnamparamfoundtype), intent(in) :: found
1569 
1570  write (this%iout, '(1x,a)') 'NAMEFILE OPTIONS:'
1571 
1572  if (found%newton) then
1573  write (this%iout, '(4x,a)') &
1574  'NEWTON-RAPHSON method enabled for the model.'
1575  if (found%under_relaxation) then
1576  write (this%iout, '(4x,a,a)') &
1577  'NEWTON-RAPHSON UNDER-RELAXATION based on the bottom ', &
1578  'elevation of the model will be applied to the model.'
1579  end if
1580  end if
1581 
1582  if (found%print_input) then
1583  write (this%iout, '(4x,a)') 'STRESS PACKAGE INPUT WILL BE PRINTED '// &
1584  'FOR ALL MODEL STRESS PACKAGES'
1585  end if
1586 
1587  if (found%print_flows) then
1588  write (this%iout, '(4x,a)') 'PACKAGE FLOWS WILL BE PRINTED '// &
1589  'FOR ALL MODEL PACKAGES'
1590  end if
1591 
1592  if (found%save_flows) then
1593  write (this%iout, '(4x,a)') &
1594  'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL'
1595  end if
1596 
1597  write (this%iout, '(1x,a)') 'END NAMEFILE OPTIONS:'
1598  end subroutine log_namfile_options
1599 
1600  !> @brief Check for steady state period
1601  !!
1602  !! Write warning message if steady state
1603  !! period and adaptive time stepping is
1604  !! active for the period
1605  !!
1606  !<
1607  subroutine steady_period_check(this)
1608  ! -- modules
1609  use tdismodule, only: kper, ats
1610  use simvariablesmodule, only: warnmsg
1611  use simmodule, only: store_warning
1612  ! -- dummy
1613  class(gwfmodeltype) :: this
1614  if (this%iss == 1) then
1615  if (ats%isAdaptivePeriod(kper)) then
1616  write (warnmsg, '(a,a,a,i0,a)') &
1617  'GWF Model (', trim(this%name), ') is steady state for period ', &
1618  kper, ' and adaptive time stepping is active. Adaptive time &
1619  &stepping may not work properly for steady-state conditions.'
1620  call store_warning(warnmsg)
1621  end if
1622  end if
1623  end subroutine steady_period_check
1624 
1625 end module gwfmodule
This module contains the API package methods.
Definition: gwf-api.f90:12
subroutine, public api_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
@ brief Create a new package object
Definition: gwf-api.f90:51
subroutine, public addbasemodeltolist(list, model)
Definition: BaseModel.f90:160
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)
@ brief Create a new budget object
Definition: Budget.f90:84
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
Definition: Dis.f90:1
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:128
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, public buy_cr(buyobj, name_model, input_mempath, inunit, iout)
Create a new BUY object.
Definition: gwf-buy.f90:104
This module contains the CSUB package methods.
Definition: gwf-csub.f90:9
subroutine, public csub_cr(csubobj, name_model, mempath, istounit, stoPckName, inunit, iout)
@ brief 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
Definition: gwf.f90:1
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:604
subroutine log_namfile_options(this, found)
Write model namfile options to list file.
Definition: gwf.f90:1566
subroutine gwf_ptc(this, vec_residual, iptc, ptcf)
calculate maximum pseudo-transient continuation factor
Definition: gwf.f90:628
subroutine allocate_scalars(this, modelname)
Allocate memory for non-allocatable members.
Definition: gwf.f90:1191
subroutine gwf_ot_flow(this, icbcfl, ibudfl, icbcun)
Groundwater Flow Model output flows.
Definition: gwf.f90:914
integer(i4b) function gwf_get_iasym(this)
return 1 if any package causes the matrix to be asymmetric. Otherwise return 0.
Definition: gwf.f90:1161
subroutine gwf_da(this)
Deallocate.
Definition: gwf.f90:1067
subroutine create_packages(this)
Source package info and begin to process.
Definition: gwf.f90:1426
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:565
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:1608
class(gwfmodeltype) function, pointer, public castasgwfmodel(model)
Cast to GWF model.
Definition: gwf.f90:1357
subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, inunit, iout)
Create boundary condition packages for this model.
Definition: gwf.f90:1238
subroutine gwf_ot_dv(this, idvsave, idvprint, ipflag)
Groundwater Flow Model output dependent variable.
Definition: gwf.f90:965
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:1373
subroutine gwf_ot(this)
GroundWater Flow Model Output.
Definition: gwf.f90:831
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:888
subroutine gwf_fp(this)
Definition: gwf.f90:1045
subroutine gwf_dt(this)
Submit boundary-package ATS time step requests.
Definition: gwf.f90:1031
subroutine gwf_ot_bdsummary(this, ibudfl, ipflag)
Groundwater Flow Model output budget summary.
Definition: gwf.f90:998
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:1145
subroutine gwf_nur(this, neqmod, x, xtemp, dx, inewtonur, dxmax, locmax)
under-relaxation
Definition: gwf.f90:699
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:744
subroutine gwf_bd(this, icnvg, isuppress_output)
GroundWater Flow Model Budget.
Definition: gwf.f90:788
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:1322
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:159
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)
@ brief 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)
@ brief Create a new package object
Definition: gwf-sto.f90:77
subroutine, public vsc_cr(vscobj, name_model, input_mempath, inunit, iout)
@ brief 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)
Create a new LAK Package and point bndobj to the new package.
Definition: gwf-lak.f90:351
type(listtype), public basemodellist
Definition: mf6lists.f90:16
subroutine, public maw_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname)
Create a New Multi-Aquifer Well (MAW) Package.
Definition: gwf-maw.f90:247
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, 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)
@ brief Create a new package object
Definition: gwf-sfr.f90:326
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_warning(msg, substring)
Store warning message.
Definition: Sim.f90:236
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:203
This module contains simulation variables.
Definition: SimVariables.f90:9
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)
Create a New UZF Package and point packobj to the new package.
Definition: gwf-uzf.f90:176
This module contains the WEL package methods.
Definition: gwf-wel.f90:15
subroutine, public wel_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
@ brief Create a new package object
Definition: gwf-wel.f90:79
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
@ brief BndType
Derived type for the Budget object.
Definition: Budget.f90:39
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
@ brief Output control for GWF
Definition: gwf-oc.f90:18