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()
66 character(len=*),
intent(in) :: modelname
68 this%modelname = modelname
73 function ncvars_varid(this, tagname, layer, period, iaux)
result(varid)
75 character(len=*),
intent(in) :: tagname
76 integer(I4B),
optional :: layer
77 integer(I4B),
optional :: period
78 integer(I4B),
optional :: iaux
80 integer(I4B) :: n, l, p, a
90 if (
present(layer))
then
95 if (
present(period))
then
99 if (
present(iaux))
then
103 do n = 1, this%nc_vars%Count()
105 if (nc_var%tagname == tagname .and. &
106 nc_var%layer == l .and. &
107 nc_var%period == p .and. &
108 nc_var%iaux == a)
then
114 if (varid == -1)
then
115 if (this%nc_fname /=
'')
then
117 'NetCDF variable not found, tagname="'//trim(tagname)//
'"'
118 if (
present(layer))
then
119 write (
errmsg,
'(a,i0)') trim(
errmsg)//
', ilayer=', layer
121 if (
present(period))
then
122 write (
errmsg,
'(a,i0)') trim(
errmsg)//
', period=', period
124 if (
present(iaux))
then
132 'NetCDF variable not found, tagname="'//trim(tagname)// &
133 '". NetCDF input not provided for model "'//trim(this%modelname)//
'".'
146 do n = 1, this%nc_vars%Count()
151 call this%nc_vars%Clear()
156 subroutine fv_init(this, modelname, nc_fname, ncid, grid)
162 character(len=*),
intent(in) :: modelname
163 character(len=*),
intent(in) :: nc_fname
164 integer(I4B),
intent(in) :: ncid
165 character(len=*),
intent(in) :: grid
166 character(len=LENMEMPATH) :: mempath
176 call mem_allocate(this%grid, ilen,
'NETCDF_GRID', mempath)
177 call mem_allocate(this%nc_fname, ilen,
'NETCDF_FNAME', mempath)
182 this%nc_fname = nc_fname
188 subroutine fv_add(this, pkgname, tagname, layer, period, iaux, varid)
191 character(len=*),
intent(in) :: pkgname
192 character(len=*),
intent(in) :: tagname
193 integer(I4B),
intent(in) :: layer
194 integer(I4B),
intent(in) :: period
195 integer(I4B),
intent(in) :: iaux
196 integer(I4B),
intent(in) :: varid
198 class(*),
pointer :: obj
201 invar%pkgname = pkgname
202 invar%tagname = tagname
204 invar%period = period
208 call this%mf6invar%Add(obj)
217 do n = 1, this%mf6invar%Count()
222 call this%mf6invar%Clear()
229 character(len=*),
intent(in) :: modelname
230 character(len=*),
intent(in) :: pkgname
234 class(*),
pointer :: obj
236 do n = 1, this%mf6invar%count()
238 if (invar%pkgname == pkgname)
then
241 nc_var%pkgname = invar%pkgname
242 nc_var%tagname = invar%tagname
243 nc_var%layer = invar%layer
244 nc_var%period = invar%period
245 nc_var%iaux = invar%iaux
246 nc_var%varid = invar%varid
248 call nc_vars%nc_vars%Add(obj)
253 nc_vars%modelname = modelname
256 nc_vars%ncid => this%ncid
257 nc_vars%nc_fname => this%nc_fname
258 nc_vars%grid => this%grid
265 integer(I4B),
intent(in) :: idx
267 class(*),
pointer :: obj
273 obj => nc_vars%GetItem(idx)
274 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.