MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
NCModel.f90
Go to the documentation of this file.
1 !> @brief This module contains the NCModelExportModule
2 !!
3 !! This module defines a model export and base type for
4 !! supported netcdf files and is not dependent on
5 !! netcdf libraries.
6 !!
7 !<
9 
10  use kindmodule, only: dp, i4b, lgp
13  dis, disu, disv
19  use listmodule, only: listtype
20 
21  implicit none
22  private
24  public :: ncexportannotation
25  public :: exportpackagetype
28  public :: wkt_to_cf_gridmapping
29 
30  !> @brief netcdf export types enumerator
31  !<
32  ENUM, BIND(C)
33  ENUMERATOR :: netcdf_undef = 0 !< undefined netcdf export type
34  ENUMERATOR :: netcdf_structured = 1 !< netcdf structrured export
35  ENUMERATOR :: netcdf_mesh2d = 2 !< netcdf ugrid layered mesh export
36  END ENUM
37 
39  type(modflowinputtype) :: mf6_input !< description of modflow6 input
40  character(len=LINELENGTH), dimension(:), allocatable :: param_names !< dynamic param tagnames
41  type(readstatevartype), dimension(:), allocatable :: param_reads !< param read states
42  integer(I4B), dimension(:, :), allocatable :: varids_param
43  integer(I4B), dimension(:, :), allocatable :: varids_aux
44  integer(I4B), dimension(:), pointer, contiguous :: mshape => null() !< model shape
45  integer(I4B), pointer :: iper !< most recent package rp load
46  integer(I4B) :: eper !< most recent period of netcdf package export
47  integer(I4B) :: nparam !< number of in scope params
48  integer(I4B) :: naux !< number of auxiliary variables
49  contains
50  procedure :: init => epkg_init
51  procedure :: destroy => epkg_destroy
52  end type exportpackagetype
53 
54  !> @brief netcdf export attribute annotations
55  !<
57  character(len=LINELENGTH) :: title !< file scoped title attribute
58  character(len=LINELENGTH) :: model !< file scoped model attribute
59  character(len=LINELENGTH) :: mesh !< mesh type
60  character(len=LINELENGTH) :: grid !< grid type
61  character(len=LINELENGTH) :: history !< file scoped history attribute
62  character(len=LINELENGTH) :: source !< file scoped source attribute
63  character(len=LINELENGTH) :: conventions !< file scoped conventions attribute
64  character(len=LINELENGTH) :: stdname !< dependent variable standard name
65  character(len=LINELENGTH) :: longname !< dependent variable long name
66  contains
67  procedure :: set
68  end type ncexportannotation
69 
70  !> @brief base class for an export model
71  !<
73  type(listtype) :: pkglist
74  character(len=LENMODELNAME) :: modelname !< name of model
75  character(len=LENCOMPONENTNAME) :: modeltype !< type of model
76  character(len=LINELENGTH) :: modelfname !< name of model input file
77  character(len=LINELENGTH) :: nc_fname !< name of netcdf export file
78  character(len=LINELENGTH) :: gridmap_name !< name of grid mapping variable
79  character(len=LINELENGTH) :: mesh_name = 'mesh' !< name of mesh container variable
80  character(len=LENMEMPATH) :: dis_mempath !< discretization input mempath
81  character(len=LENMEMPATH) :: ncf_mempath !< netcdf utility package input mempath
82  character(len=LENBIGLINE) :: wkt !< WKT1 (OGC 01-009) user string
83  character(len=LENBIGLINE) :: crs_wkt !< WKT2 (ISO 19162:2019) user string; falls back to wkt if empty
84  character(len=LINELENGTH) :: datetime !< export file creation time
85  character(len=LINELENGTH) :: xname !< dependent variable name
86  character(len=LINELENGTH) :: lenunits !< unidata udunits length units
87  type(ncexportannotation) :: annotation !< export file annotation
88  real(dp), dimension(:), pointer, contiguous :: x !< dependent variable pointer
89  integer(I4B) :: disenum !< type of discretization
90  integer(I4B) :: ncid !< netcdf file descriptor
91  integer(I4B) :: totnstp !< simulation total number of steps
92  integer(I4B), pointer :: deflate !< variable deflate level
93  integer(I4B), pointer :: shuffle !< variable shuffle filter
94  integer(I4B), pointer :: input_attr !< assign variable input attr
95  integer(I4B), pointer :: chunk_time !< chunking parameter for time dimension
96  integer(I4B) :: iout !< lst file descriptor
97  logical(LGP) :: chunking_active !< have chunking parameters been provided
98  contains
99  procedure :: init => export_init
100  procedure :: get => export_get
101  procedure :: input_attribute
102  procedure :: istp
103  procedure :: destroy => export_destroy
104  end type ncmodelexporttype
105 
106  !> @brief abstract type for model netcdf export type
107  !<
108  type, abstract, extends(ncmodelexporttype) :: ncbasemodelexporttype
109  contains
110  procedure :: export_input
111  procedure(model_define), deferred :: df
112  procedure(package_export), deferred :: export_df
113  procedure(model_step), deferred :: step
114  procedure(package_export), deferred :: package_step
115  end type ncbasemodelexporttype
116 
117  !> @brief abstract interfaces for model netcdf export type
118  !<
119  abstract interface
120  subroutine model_define(this)
121  import ncbasemodelexporttype
122  class(ncbasemodelexporttype), intent(inout) :: this
123  end subroutine
124  subroutine model_step(this)
125  import ncbasemodelexporttype
126  class(ncbasemodelexporttype), intent(inout) :: this
127  end subroutine
128  subroutine package_export(this, export_pkg)
130  class(ncbasemodelexporttype), intent(inout) :: this
131  class(exportpackagetype), pointer, intent(in) :: export_pkg
132  end subroutine
133  subroutine package_export_ilayer(this, export_pkg, ilayer_varname, &
134  ilayer)
136  class(ncbasemodelexporttype), intent(inout) :: this
137  class(exportpackagetype), pointer, intent(in) :: export_pkg
138  character(len=*), intent(in) :: ilayer_varname
139  integer(I4B), intent(in) :: ilayer
140  end subroutine
141  end interface
142 
143 contains
144 
145  !> @brief initialize dynamic package export object
146  !<
147  subroutine epkg_init(this, mf6_input, mshape, naux, param_names, &
148  nparam)
153  class(exportpackagetype), intent(inout) :: this
154  type(modflowinputtype), intent(in) :: mf6_input
155  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: mshape !< model shape
156  integer(I4B), intent(in) :: naux
157  character(len=LINELENGTH), dimension(:), allocatable, &
158  intent(in) :: param_names
159  integer(I4B), intent(in) :: nparam
160  integer(I4B) :: n
161  character(len=LENVARNAME) :: rs_varname
162  character(len=LENMEMPATH) :: input_mempath
163  integer(I4B), pointer :: rsvar
164 
165  this%mf6_input = mf6_input
166  this%mshape => mshape
167  this%nparam = nparam
168  this%naux = naux
169  this%eper = 0
170 
171  input_mempath = create_mem_path(component=mf6_input%component_name, &
172  subcomponent=mf6_input%subcomponent_name, &
173  context=idm_context)
174 
175  ! allocate param arrays
176  allocate (this%param_names(nparam))
177  allocate (this%param_reads(nparam))
178  allocate (this%varids_param(nparam, mshape(1)))
179  allocate (this%varids_aux(naux, mshape(1)))
180 
181  ! set param arrays
182  do n = 1, nparam
183  this%param_names(n) = param_names(n)
184  rs_varname = rsv_name(param_names(n))
185  call mem_setptr(rsvar, rs_varname, mf6_input%mempath)
186  this%param_reads(n)%invar => rsvar
187  end do
188 
189  ! set pointer to loaded input period
190  call mem_setptr(this%iper, 'IPER', mf6_input%mempath)
191  end subroutine epkg_init
192 
193  !> @brief destroy dynamic package export object
194  !<
195  subroutine epkg_destroy(this)
197  class(exportpackagetype), intent(inout) :: this
198  if (allocated(this%param_names)) deallocate (this%param_names)
199  end subroutine epkg_destroy
200 
201  !> @brief set netcdf file scoped attributes
202  !<
203  subroutine set(this, modelname, modeltype, modelfname, nctype, disenum)
204  use versionmodule, only: fullversion
205  use inputoutputmodule, only: lowcase
206  class(ncexportannotation), intent(inout) :: this
207  character(len=*), intent(in) :: modelname
208  character(len=*), intent(in) :: modeltype
209  character(len=*), intent(in) :: modelfname
210  integer(I4B), intent(in) :: nctype
211  integer(I4B), intent(in) :: disenum
212  integer :: values(8)
213 
214  this%title = ''
215  this%model = ''
216  this%mesh = ''
217  this%grid = ''
218  this%history = ''
219  this%source = ''
220  this%conventions = ''
221  this%stdname = ''
222  this%longname = ''
223 
224  ! set file conventions
225  this%conventions = 'CF-1.11'
226  if (nctype == netcdf_mesh2d) this%conventions = &
227  trim(this%conventions)//' UGRID-1.0'
228 
229  ! set model specific attributes
230  select case (modeltype)
231  case ('GWF')
232  this%title = trim(modelname)//' hydraulic head'
233  this%longname = 'head'
234  case ('GWT')
235  this%title = trim(modelname)//' concentration'
236  this%longname = 'concentration'
237  case ('GWE')
238  this%title = trim(modelname)//' temperature'
239  this%longname = 'temperature'
240  case default
241  errmsg = trim(modeltype)//' models not supported for NetCDF export.'
242  call store_error(errmsg)
243  call store_error_filename(modelfname)
244  end select
245 
246  if (isim_mode == mvalidate) then
247  this%title = trim(this%title)//' array input'
248  end if
249 
250  ! set mesh type
251  if (nctype == netcdf_mesh2d) then
252  this%mesh = 'layered'
253  end if
254 
255  ! set grid type
256  if (disenum == dis) then
257  this%grid = 'structured'
258  else if (disenum == disv) then
259  this%grid = 'vertex'
260  end if
261 
262  ! model description string (lowercase, no version suffix, matching CF convention)
263  this%model = trim(modeltype)//': '//trim(modelname)
264  call lowcase(this%model)
265 
266  ! modflow6 version string
267  this%source = 'MODFLOW 6 '//trim(adjustl(fullversion))
268 
269  ! create timestamp
270  call date_and_time(values=values)
271  write (this%history, '(a,i0,a,i0,a,i0,a,i0,a,i0,a,i0,a,i0)') &
272  'first created ', values(1), '/', values(2), '/', values(3), ' ', &
273  values(5), ':', values(6), ':', values(7), '.', values(8)
274  end subroutine set
275 
276  !> @brief initialization of model netcdf export
277  !<
278  subroutine export_init(this, modelname, modeltype, modelfname, nc_fname, &
279  disenum, nctype, iout)
280  use tdismodule, only: datetime0, nper, nstp
284  use inputoutputmodule, only: lowcase
287  class(ncmodelexporttype), intent(inout) :: this
288  character(len=*), intent(in) :: modelname
289  character(len=*), intent(in) :: modeltype
290  character(len=*), intent(in) :: modelfname
291  character(len=*), intent(in) :: nc_fname
292  integer(I4B), intent(in) :: disenum
293  integer(I4B), intent(in) :: nctype
294  integer(I4B), intent(in) :: iout
295  character(len=LENMEMPATH) :: model_mempath
296  type(utlncfparamfoundtype) :: ncf_found
297 
298  ! allocate
299  allocate (this%deflate)
300  allocate (this%shuffle)
301  allocate (this%input_attr)
302  allocate (this%chunk_time)
303 
304  ! initialize
305  this%modelname = modelname
306  this%modeltype = modeltype
307  this%modelfname = modelfname
308  this%nc_fname = nc_fname
309  this%gridmap_name = ''
310  this%ncf_mempath = ''
311  this%wkt = ''
312  this%crs_wkt = ''
313  this%datetime = ''
314  this%xname = ''
315  this%lenunits = ''
316  this%disenum = disenum
317  this%ncid = 0
318  this%totnstp = 0
319  this%deflate = -1
320  this%shuffle = 0
321  this%input_attr = 1
322  this%chunk_time = -1
323  this%iout = iout
324  this%chunking_active = .false.
325 
326  ! set file scoped attributes
327  call this%annotation%set(modelname, modeltype, modelfname, nctype, disenum)
328 
329  ! set dependent variable basename
330  select case (modeltype)
331  case ('GWF')
332  this%xname = 'head'
333  case ('GWT')
334  this%xname = 'concentration'
335  case ('GWE')
336  this%xname = 'temperature'
337  case default
338  errmsg = trim(modeltype)//' models not supported for NetCDF export.'
339  call store_error(errmsg)
340  call store_error_filename(modelfname)
341  end select
342 
343  ! set discretization input mempath
344  if (disenum == dis) then
345  this%dis_mempath = create_mem_path(modelname, 'DIS', idm_context)
346  else if (disenum == disu) then
347  this%dis_mempath = create_mem_path(modelname, 'DISU', idm_context)
348  else if (disenum == disv) then
349  this%dis_mempath = create_mem_path(modelname, 'DISV', idm_context)
350  end if
351 
352  ! set dependent variable pointer
353  model_mempath = create_mem_path(component=modelname)
354  call mem_setptr(this%x, 'X', model_mempath)
355 
356  ! set ncf_mempath if provided
357  if (filein_fname(this%ncf_mempath, 'NCF6_MEMPATH', this%dis_mempath, &
358  modelfname)) then
359  call mem_set_value(this%wkt, 'WKT', this%ncf_mempath, &
360  ncf_found%wkt)
361  call mem_set_value(this%crs_wkt, 'CRS_WKT', this%ncf_mempath, &
362  ncf_found%crs_wkt)
363  call mem_set_value(this%deflate, 'DEFLATE', this%ncf_mempath, &
364  ncf_found%deflate)
365  call mem_set_value(this%shuffle, 'SHUFFLE', this%ncf_mempath, &
366  ncf_found%shuffle)
367  call mem_set_value(this%input_attr, 'ATTR_OFF', this%ncf_mempath, &
368  ncf_found%attr_off)
369  call mem_set_value(this%chunk_time, 'CHUNK_TIME', this%ncf_mempath, &
370  ncf_found%chunk_time)
371  end if
372 
373  if (ncf_found%wkt .or. ncf_found%crs_wkt) then
374  this%gridmap_name = 'projection'
375  end if
376 
377  ! ATTR_OFF turns off modflow 6 input attributes
378  if (ncf_found%attr_off) then
379  this%input_attr = 0
380  end if
381 
382  ! set datetime string
383  if (datetime0 /= '') then
384  this%datetime = 'days since '//trim(datetime0)
385  else
386  ! January 1, 1970 at 00:00:00 UTC
387  this%datetime = 'days since 1970-01-01T00:00:00'
388  end if
389 
390  ! set total nstp
391  if (isim_mode == mvalidate) then
392  this%totnstp = nper
393  else
394  this%totnstp = sum(nstp)
395  end if
396  end subroutine export_init
397 
398  !> @brief retrieve dynamic export object from package list
399  !<
400  function export_get(this, idx) result(res)
401  use listmodule, only: listtype
402  class(ncmodelexporttype), intent(inout) :: this
403  integer(I4B), intent(in) :: idx
404  class(exportpackagetype), pointer :: res
405  class(*), pointer :: obj
406  nullify (res)
407  obj => this%pkglist%GetItem(idx)
408  if (associated(obj)) then
409  select type (obj)
410  class is (exportpackagetype)
411  res => obj
412  end select
413  end if
414  end function export_get
415 
416  !> @brief build modflow_input attribute string
417  !<
418  function input_attribute(this, pkgname, idt) result(attr)
419  use inputoutputmodule, only: lowcase
422  class(ncmodelexporttype), intent(inout) :: this
423  character(len=*), intent(in) :: pkgname
424  type(inputparamdefinitiontype), pointer, intent(in) :: idt
425  character(len=LINELENGTH) :: attr
426  attr = ''
427  if (this%input_attr > 0) then
428  attr = trim(this%modelname)//mempathseparator//trim(pkgname)// &
429  mempathseparator//trim(idt%tagname)
430  call lowcase(attr)
431  end if
432  end function input_attribute
433 
434  !> @brief step index for timeseries data
435  !<
436  function istp(this)
437  use tdismodule, only: kstp, kper, nstp
438  class(ncmodelexporttype), intent(inout) :: this
439  integer(I4B) :: n, istp
440  istp = kstp
441  if (kper > 1) then
442  do n = 1, kper - 1
443  istp = istp + nstp(n)
444  end do
445  end if
446  end function istp
447 
448  !> @brief build netcdf variable name
449  !<
450  function export_varname(pkgname, tagname, mempath, layer, iaux) &
451  result(varname)
454  use inputoutputmodule, only: lowcase
455  character(len=*), intent(in) :: pkgname
456  character(len=*), intent(in) :: tagname
457  character(len=*), intent(in) :: mempath
458  integer(I4B), optional, intent(in) :: layer
459  integer(I4B), optional, intent(in) :: iaux
460  character(len=LINELENGTH) :: varname
461  type(characterstringtype), dimension(:), pointer, &
462  contiguous :: auxnames
463  character(len=LINELENGTH) :: pname, vname
464  vname = tagname
465  pname = pkgname
466 
467  if (present(iaux)) then
468  if (iaux > 0) then
469  if (tagname == 'AUX') then
470  ! reset vname to auxiliary variable name
471  call mem_setptr(auxnames, 'AUXILIARY', mempath)
472  vname = auxnames(iaux)
473  end if
474  end if
475  end if
476 
477  call lowcase(vname)
478  call lowcase(pname)
479  varname = trim(pname)//'_'//trim(vname)
480 
481  if (present(layer)) then
482  if (layer > 0) then
483  !write (varname, '(a,i0)') trim(varname)//'_L', layer
484  write (varname, '(a,i0)') trim(varname)//'_l', layer
485  end if
486  end if
487  end function export_varname
488 
489  !> @brief build netcdf variable longname
490  !<
491  function export_longname(longname, pkgname, tagname, mempath, layer, iaux, &
492  component_type, subcomponent_type) result(lname)
495  use inputoutputmodule, only: lowcase
497  character(len=*), intent(in) :: longname
498  character(len=*), intent(in) :: pkgname
499  character(len=*), intent(in) :: tagname
500  character(len=*), intent(in) :: mempath
501  integer(I4B), optional, intent(in) :: layer
502  integer(I4B), optional, intent(in) :: iaux
503  character(len=*), optional, intent(in) :: component_type
504  character(len=*), optional, intent(in) :: subcomponent_type
505  character(len=LINELENGTH) :: lname
506  type(characterstringtype), dimension(:), pointer, &
507  contiguous :: auxnames
508  character(len=LINELENGTH) :: pname, vname, auxname
509  pname = pkgname
510  vname = tagname
511  call lowcase(pname)
512  call lowcase(vname)
513  if (longname == '') then
514  lname = trim(pname)//' '//trim(vname)
515  else
516  lname = longname
517  if (present(component_type) .and. present(subcomponent_type)) then
518  if (idm_multi_package(component_type, subcomponent_type)) then
519  lname = trim(pname)//' '//trim(lname)
520  end if
521  end if
522  end if
523 
524  if (present(iaux)) then
525  if (iaux > 0) then
526  if (tagname == 'AUX') then
527  ! reset vname to auxiliary variable name
528  call mem_setptr(auxnames, 'AUXILIARY', mempath)
529  auxname = auxnames(iaux)
530  call lowcase(auxname)
531  lname = trim(lname)//' '//trim(auxname)
532  end if
533  end if
534  end if
535 
536  if (present(layer)) then
537  if (layer > 0) then
538  write (lname, '(a,i0)') trim(lname)//' layer ', layer
539  end if
540  end if
541  end function export_longname
542 
543  !> @brief netcdf dynamic package period export
544  !<
545  subroutine export_input(this)
546  use tdismodule, only: kper
547  class(ncbasemodelexporttype), intent(inout) :: this
548  integer(I4B) :: idx
549  class(exportpackagetype), pointer :: export_pkg
550  do idx = 1, this%pkglist%Count()
551  export_pkg => this%get(idx)
552  ! period input already exported
553  if (export_pkg%eper >= kper) cycle
554  ! update export package
555  call this%package_step(export_pkg)
556  ! update exported iper
557  export_pkg%eper = kper
558  end do
559  end subroutine export_input
560 
561  !> @brief map a WKT string to a CF-1.11 grid_mapping_name
562  !!
563  !! Accepts either WKT1 (OGC 01-009, PROJECTION["name"]) or WKT2
564  !! (ISO 19162:2019, METHOD["name"]) format. WKT1 is tried first;
565  !! if PROJECTION[ is absent the WKT2 METHOD[ path is attempted.
566  !! Returns '' for geographic CRS or unrecognised projection names.
567  !! Only common groundwater projections included. Matching is
568  !! case-insensitive.
569  !<
570  function wkt_to_cf_gridmapping(wkt) result(gmname)
571  use inputoutputmodule, only: upcase
572  character(len=*), intent(in) :: wkt
573  character(len=LINELENGTH) :: gmname
574  character(len=LINELENGTH) :: proj_name
575  character(len=LENBIGLINE) :: wkt_upper
576  integer :: istart, iend
577 
578  gmname = ''
579  proj_name = ''
580 
581  ! uppercase copy for case-insensitive keyword search
582  wkt_upper = wkt
583  call upcase(wkt_upper)
584 
585  ! --- WKT1 path: PROJECTION["name"] ---
586  istart = index(wkt_upper, 'PROJECTION[')
587  if (istart /= 0) then
588  istart = istart + len('PROJECTION[')
589  do while (istart <= len(wkt))
590  if (wkt(istart:istart) == '"') exit
591  istart = istart + 1
592  end do
593  if (istart > len(wkt)) return
594  istart = istart + 1
595  iend = index(wkt(istart:), '"')
596  if (iend == 0) return
597  iend = istart + iend - 2
598  if (iend < istart) return
599  proj_name = wkt(istart:iend)
600  call upcase(proj_name)
601  select case (trim(proj_name))
602  case ('TRANSVERSE_MERCATOR')
603  gmname = 'transverse_mercator'
604  case ('LAMBERT_CONFORMAL_CONIC_2SP', 'LAMBERT_CONFORMAL_CONIC_1SP')
605  gmname = 'lambert_conformal_conic'
606  case ('ALBERS_CONIC_EQUAL_AREA')
607  gmname = 'albers_conical_equal_area'
608  case ('MERCATOR_1SP', 'MERCATOR_2SP')
609  gmname = 'mercator'
610  case ('POLAR_STEREOGRAPHIC')
611  gmname = 'polar_stereographic'
612  end select
613  return
614  end if
615 
616  ! --- WKT2 path: METHOD["name"] ---
617  istart = index(wkt_upper, 'METHOD[')
618  if (istart == 0) return
619  istart = istart + len('METHOD[')
620  do while (istart <= len(wkt))
621  if (wkt(istart:istart) == '"') exit
622  istart = istart + 1
623  end do
624  if (istart > len(wkt)) return
625  istart = istart + 1
626  iend = index(wkt(istart:), '"')
627  if (iend == 0) return
628  iend = istart + iend - 2
629  if (iend < istart) return
630  proj_name = wkt(istart:iend)
631  call upcase(proj_name)
632  select case (trim(proj_name))
633  case ('TRANSVERSE MERCATOR')
634  gmname = 'transverse_mercator'
635  case ('LAMBERT CONIC CONFORMAL (2SP)', 'LAMBERT CONIC CONFORMAL (1SP)')
636  gmname = 'lambert_conformal_conic'
637  case ('ALBERS EQUAL AREA')
638  gmname = 'albers_conical_equal_area'
639  case ('MERCATOR (VARIANT A)', 'MERCATOR (VARIANT B)')
640  gmname = 'mercator'
641  case ('POLAR STEREOGRAPHIC (VARIANT A)', 'POLAR STEREOGRAPHIC (VARIANT B)')
642  gmname = 'polar_stereographic'
643  end select
644  end function wkt_to_cf_gridmapping
645 
646  !> @brief destroy model netcdf export object
647  !<
648  subroutine export_destroy(this)
651  class(ncmodelexporttype), intent(inout) :: this
652  ! override in derived class
653  deallocate (this%deflate)
654  deallocate (this%shuffle)
655  deallocate (this%input_attr)
656  deallocate (this%chunk_time)
657  ! Deallocate idm memory
658  if (this%ncf_mempath /= '') then
659  call memorystore_remove(this%modelname, 'NCF', idm_context)
660  end if
661  end subroutine export_destroy
662 
663 end module ncmodelexportmodule
subroutine init()
Definition: GridSorting.f90:25
abstract interfaces for model netcdf export type
Definition: NCModel.f90:120
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 lencomponentname
maximum length of a component name
Definition: Constants.f90:18
@ mvalidate
validation mode - do not run time steps
Definition: Constants.f90:205
integer(i4b), parameter lenmodelname
maximum length of the model name
Definition: Constants.f90:22
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15
@ disu
DISV6 discretization.
Definition: Constants.f90:157
@ dis
DIS6 discretization.
Definition: Constants.f90:155
@ disv
DISU6 discretization.
Definition: Constants.f90:156
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition: Constants.f90:17
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition: Constants.f90:27
logical function, public idm_multi_package(component, subcomponent)
Input definition module.
This module contains the InputLoadTypeModule.
subroutine, public lowcase(word)
Convert to lower case.
subroutine, public upcase(word)
Convert to upper case.
This module defines variable data types.
Definition: kind.f90:8
This module contains the LoadContextModule.
Definition: LoadContext.f90:10
character(len=lenvarname) function, public rsv_name(mf6varname)
create read state variable name
character(len=lenmemseparator), parameter mempathseparator
used to build up the memory address for the stored variables
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains the ModflowInputModule.
Definition: ModflowInput.f90:9
This module contains the NCModelExportModule.
Definition: NCModel.f90:8
class(exportpackagetype) function, pointer export_get(this, idx)
retrieve dynamic export object from package list
Definition: NCModel.f90:401
character(len=linelength) function, public wkt_to_cf_gridmapping(wkt)
map a WKT string to a CF-1.11 grid_mapping_name
Definition: NCModel.f90:571
character(len=linelength) function, public export_varname(pkgname, tagname, mempath, layer, iaux)
build netcdf variable name
Definition: NCModel.f90:452
integer(i4b) function istp(this)
step index for timeseries data
Definition: NCModel.f90:437
subroutine epkg_init(this, mf6_input, mshape, naux, param_names, nparam)
initialize dynamic package export object
Definition: NCModel.f90:149
@, public netcdf_structured
netcdf structrured export
Definition: NCModel.f90:34
subroutine export_destroy(this)
destroy model netcdf export object
Definition: NCModel.f90:649
subroutine export_init(this, modelname, modeltype, modelfname, nc_fname, disenum, nctype, iout)
initialization of model netcdf export
Definition: NCModel.f90:280
@, public netcdf_mesh2d
netcdf ugrid layered mesh export
Definition: NCModel.f90:35
@, public netcdf_undef
undefined netcdf export type
Definition: NCModel.f90:33
subroutine set(this, modelname, modeltype, modelfname, nctype, disenum)
set netcdf file scoped attributes
Definition: NCModel.f90:204
character(len=linelength) function input_attribute(this, pkgname, idt)
build modflow_input attribute string
Definition: NCModel.f90:419
subroutine epkg_destroy(this)
destroy dynamic package export object
Definition: NCModel.f90:196
character(len=linelength) function, public export_longname(longname, pkgname, tagname, mempath, layer, iaux, component_type, subcomponent_type)
build netcdf variable longname
Definition: NCModel.f90:493
subroutine export_input(this)
netcdf dynamic package period export
Definition: NCModel.f90:546
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
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) isim_mode
simulation mode
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
integer(i4b), dimension(:), pointer, public, contiguous nstp
number of time steps in each stress period
Definition: tdis.f90:42
character(len=lendatetime), pointer, public datetime0
starting date and time for the simulation
Definition: tdis.f90:44
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
integer(i4b), pointer, public nper
number of stress period
Definition: tdis.f90:24
This module contains version information.
Definition: version.f90:7
character(len= *), parameter fullversion
Definition: version.f90:24
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Input parameter definition. Describes an input parameter.
type for storing a dynamic package load list
A generic heterogeneous doubly-linked list.
Definition: List.f90:14
Pointer type for read state variable.
Definition: LoadContext.f90:50
derived type for storing input definition for a file
abstract type for model netcdf export type
Definition: NCModel.f90:108
netcdf export attribute annotations
Definition: NCModel.f90:56
base class for an export model
Definition: NCModel.f90:72