23 character(len=LENMODELNAME) :: modelname
25 character(len=LINELENGTH),
pointer :: grid => null()
26 character(len=LINELENGTH),
pointer :: nc_fname => null()
27 integer(I4B),
pointer :: ncid => null()
37 character(LINELENGTH) :: pkgname
38 character(LINELENGTH) :: tagname
40 integer(I4B) :: period
50 character(len=LINELENGTH),
pointer :: grid => null()
51 character(len=LINELENGTH),
pointer :: nc_fname => null()
52 integer(I4B),
pointer :: ncid => null()
68 character(len=*),
intent(in) :: modelname
72 this%modelname = modelname
80 function ncvars_varid(this, tagname, layer, period, iaux)
result(varid)
84 character(len=*),
intent(in) :: tagname
85 integer(I4B),
optional :: layer
86 integer(I4B),
optional :: period
87 integer(I4B),
optional :: iaux
91 integer(I4B) :: n, l, p, a
101 if (
present(layer))
then
106 if (
present(period))
then
110 if (
present(iaux))
then
114 do n = 1, this%nc_vars%Count()
116 if (nc_var%tagname == tagname .and. &
117 nc_var%layer == l .and. &
118 nc_var%period == p .and. &
119 nc_var%iaux == a)
then
125 if (varid == -1)
then
126 if (this%nc_fname /=
'')
then
128 'NetCDF variable not found, tagname="'//trim(tagname)//
'"'
129 if (
present(layer))
then
130 write (
errmsg,
'(a,i0)') trim(
errmsg)//
', ilayer=', layer
132 if (
present(period))
then
133 write (
errmsg,
'(a,i0)') trim(
errmsg)//
', period=', period
135 if (
present(iaux))
then
143 'NetCDF variable not found, tagname="'//trim(tagname)// &
144 '". NetCDF input not provided for model "'//trim(this%modelname)//
'".'
164 do n = 1, this%nc_vars%Count()
170 call this%nc_vars%Clear()
178 subroutine fv_init(this, modelname, nc_fname, ncid, grid)
186 character(len=*),
intent(in) :: modelname
187 character(len=*),
intent(in) :: nc_fname
188 integer(I4B),
intent(in) :: ncid
189 character(len=*),
intent(in) :: grid
191 character(len=LENMEMPATH) :: mempath
201 call mem_allocate(this%grid, ilen,
'NETCDF_GRID', mempath)
202 call mem_allocate(this%nc_fname, ilen,
'NETCDF_FNAME', mempath)
207 this%nc_fname = nc_fname
216 subroutine fv_add(this, pkgname, tagname, layer, period, iaux, varid)
221 character(len=*),
intent(in) :: pkgname
222 character(len=*),
intent(in) :: tagname
223 integer(I4B),
intent(in) :: layer
224 integer(I4B),
intent(in) :: period
225 integer(I4B),
intent(in) :: iaux
226 integer(I4B),
intent(in) :: varid
229 class(*),
pointer :: obj
233 invar%pkgname = pkgname
234 invar%tagname = tagname
236 invar%period = period
241 call this%mf6invar%Add(obj)
256 do n = 1, this%mf6invar%Count()
262 call this%mf6invar%Clear()
273 character(len=*),
intent(in) :: modelname
274 character(len=*),
intent(in) :: pkgname
279 class(*),
pointer :: obj
281 do n = 1, this%mf6invar%count()
283 if (invar%pkgname == pkgname)
then
286 nc_var%pkgname = invar%pkgname
287 nc_var%tagname = invar%tagname
288 nc_var%layer = invar%layer
289 nc_var%period = invar%period
290 nc_var%iaux = invar%iaux
291 nc_var%varid = invar%varid
293 call nc_vars%nc_vars%Add(obj)
298 nc_vars%modelname = modelname
301 nc_vars%ncid => this%ncid
302 nc_vars%nc_fname => this%nc_fname
303 nc_vars%grid => this%grid
314 integer(I4B),
intent(in) :: idx
317 class(*),
pointer :: obj
323 obj => nc_vars%GetItem(idx)
324 if (
associated(obj))
then
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenmodelname
maximum length of the model name
integer(i4b), parameter lenmempath
maximum length of the memory path
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains the NCFileVarsModule.
subroutine create_varlists(this, modelname, pkgname, nc_vars)
create list of variables that correspond to a package
subroutine fv_add(this, pkgname, tagname, layer, period, iaux, varid)
add netcdf modflow6 input variable to list
subroutine fv_init(this, modelname, nc_fname, ncid, grid)
initialize netcdf model variable description type
class(ncfilemf6vartype) function, pointer ncvar_get(nc_vars, idx)
get modflow6 input variable description at position idx
subroutine fv_destroy(this)
destroy netcdf model variable description type
integer(i4b) function ncvars_varid(this, tagname, layer, period, iaux)
return a netcdf variable id for a package tagname
subroutine ncvars_destroy(this)
destroy netcdf package variable lists
subroutine ncvars_init(this, modelname)
create netcdf package variable lists
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
A generic heterogeneous doubly-linked list.
Type which describes a modflow input variable in a netcdf file.
Type describing modflow6 input variables in model NetCDF file.
Type describing input variables for a package in NetCDF file.