36 character(len=*),
intent(in) :: grid
37 logical(LGP) :: layered
51 input_fname, iout, kper)
52 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: int1d
53 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
57 character(len=*),
intent(in) :: input_fname
58 integer(I4B),
intent(in) :: iout
59 integer(I4B),
optional,
intent(in) :: kper
61 logical(LGP) :: layered
63 layered = (idt%layered .and.
is_layered(nc_vars%grid))
69 if (
present(kper))
then
70 varid = nc_vars%varid(idt%mf6varname, period=kper)
72 varid = nc_vars%varid(idt%mf6varname)
83 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: int2d
84 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
88 character(len=*),
intent(in) :: input_fname
89 integer(I4B),
intent(in) :: iout
91 logical(LGP) :: layered
93 layered = (idt%layered .and.
is_layered(nc_vars%grid))
99 varid = nc_vars%varid(idt%mf6varname)
109 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: int3d
110 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
114 character(len=*),
intent(in) :: input_fname
115 integer(I4B),
intent(in) :: iout
116 integer(I4B) :: varid
117 logical(LGP) :: layered
119 layered = (idt%layered .and.
is_layered(nc_vars%grid))
125 varid = nc_vars%varid(idt%mf6varname)
134 input_fname, iout, kper, iaux)
135 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: dbl1d
136 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
140 character(len=*),
intent(in) :: input_fname
141 integer(I4B),
intent(in) :: iout
142 integer(I4B),
optional,
intent(in) :: kper
143 integer(I4B),
optional,
intent(in) :: iaux
144 integer(I4B) :: varid
145 logical(LGP) :: layered
147 if (
present(kper))
then
148 layered = (kper > 0 .and.
is_layered(nc_vars%grid))
150 layered = (idt%layered .and.
is_layered(nc_vars%grid))
154 if (
present(kper))
then
156 kper, input_fname, iaux)
162 if (
present(kper))
then
164 kper, input_fname, iaux)
166 varid = nc_vars%varid(idt%mf6varname)
177 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: dbl2d
178 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
182 character(len=*),
intent(in) :: input_fname
183 integer(I4B),
intent(in) :: iout
184 integer(I4B) :: varid
185 logical(LGP) :: layered
187 layered = (idt%layered .and.
is_layered(nc_vars%grid))
193 varid = nc_vars%varid(idt%mf6varname)
203 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: dbl3d
204 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
208 character(len=*),
intent(in) :: input_fname
209 integer(I4B),
intent(in) :: iout
210 integer(I4B) :: varid
211 logical(LGP) :: layered
213 layered = (idt%layered .and.
is_layered(nc_vars%grid))
219 varid = nc_vars%varid(idt%mf6varname)
229 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: int1d
231 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
234 integer(I4B),
intent(in) :: varid
235 character(len=*),
intent(in) :: input_fname
236 integer(I4B),
dimension(:),
allocatable :: array_shape
237 integer(I4B),
dimension(:, :, :),
contiguous,
pointer :: int3d_ptr
238 integer(I4B),
dimension(:, :),
contiguous,
pointer :: int2d_ptr
239 integer(I4B) :: nvals
244 if (idt%shape ==
'NODES')
then
246 nvals = product(mshape)
247 if (
size(mshape) == 3)
then
248 int3d_ptr(1:mshape(3), 1:mshape(2), 1:mshape(1)) => int1d(1:nvals)
249 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int3d_ptr), &
251 else if (
size(mshape) == 2)
then
252 int2d_ptr(1:mshape(2), 1:mshape(1)) => int1d(1:nvals)
253 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int2d_ptr), &
255 else if (
size(mshape) == 1)
then
256 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d), nc_vars%nc_fname)
262 nvals = array_shape(1)
264 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d), nc_vars%nc_fname)
272 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: int1d
274 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
277 character(len=*),
intent(in) :: input_fname
278 integer(I4B),
dimension(:),
allocatable :: layer_shape
279 integer(I4B) :: nlay, varid
280 integer(I4B) :: k, ncpl
281 integer(I4B) :: index_start, index_stop
282 integer(I4B),
dimension(:),
contiguous,
pointer :: int1d_ptr
288 ncpl = product(layer_shape)
291 varid = nc_vars%varid(idt%mf6varname, layer=k)
292 index_stop = index_start + ncpl - 1
293 int1d_ptr(1:ncpl) => int1d(index_start:index_stop)
294 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
296 index_start = index_stop + 1
304 integer(I4B),
dimension(:, :),
contiguous,
pointer,
intent(in) :: int2d
306 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
309 integer(I4B),
intent(in) :: varid
310 character(len=*),
intent(in) :: input_fname
311 integer(I4B),
dimension(:),
contiguous,
pointer :: int1d_ptr
312 integer(I4B),
dimension(:),
allocatable :: array_shape
313 integer(I4B) :: ncpl, nlay
317 if (nc_vars%grid ==
'STRUCTURED')
then
318 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int2d), nc_vars%nc_fname)
319 else if (nc_vars%grid ==
'LAYERED MESH')
then
321 ncpl = product(array_shape)
322 int1d_ptr(1:ncpl) => int2d(:, :)
323 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
332 integer(I4B),
dimension(:, :),
contiguous,
pointer,
intent(in) :: int2d
334 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
337 character(len=*),
intent(in) :: input_fname
338 integer(I4B),
dimension(:),
allocatable :: layer_shape
340 integer(I4B) :: ncpl, nlay, varid
341 integer(I4B),
dimension(:),
contiguous,
pointer :: int1d_ptr
345 if (
size(mshape) == 3)
then
346 write (
errmsg,
'(a,a,a)') &
347 'Layered netcdf read not supported for DIS int2d type ('// &
348 trim(idt%tagname)//
').'
351 else if (
size(mshape) == 2)
then
353 ncpl = layer_shape(1)
355 varid = nc_vars%varid(idt%mf6varname, layer=k)
356 int1d_ptr(1:ncpl) => int2d(1:ncpl, k)
357 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
367 integer(I4B),
dimension(:, :, :),
contiguous,
pointer,
intent(in) :: int3d
369 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
372 integer(I4B),
intent(in) :: varid
373 character(len=*),
intent(in) :: input_fname
374 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int3d), nc_vars%nc_fname)
381 integer(I4B),
dimension(:, :, :),
contiguous,
pointer,
intent(in) :: int3d
383 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
386 character(len=*),
intent(in) :: input_fname
387 integer(I4B),
dimension(:),
allocatable :: layer_shape
389 integer(I4B) :: ncpl, nlay, varid
390 integer(I4B) :: index_start, index_stop
391 integer(I4B),
dimension(:),
contiguous,
pointer :: int1d_ptr
396 ncpl = product(layer_shape)
399 varid = nc_vars%varid(idt%mf6varname, layer=k)
400 index_stop = index_start + ncpl - 1
401 int1d_ptr(1:ncpl) => int3d(:, :, k:k)
402 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
404 index_start = index_stop + 1
412 real(DP),
dimension(:),
contiguous,
pointer,
intent(in) :: dbl1d
414 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
417 integer(I4B),
intent(in) :: varid
418 character(len=*),
intent(in) :: input_fname
419 integer(I4B),
dimension(:),
allocatable :: array_shape
420 real(DP),
dimension(:, :, :),
contiguous,
pointer :: dbl3d_ptr
421 real(DP),
dimension(:, :),
contiguous,
pointer :: dbl2d_ptr
422 integer(I4B) :: nvals
427 if (idt%shape ==
'NODES')
then
429 nvals = product(mshape)
430 if (
size(mshape) == 3)
then
431 dbl3d_ptr(1:mshape(3), 1:mshape(2), 1:mshape(1)) => dbl1d(1:nvals)
432 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d_ptr), &
434 else if (
size(mshape) == 2)
then
435 dbl2d_ptr(1:mshape(2), 1:mshape(1)) => dbl1d(1:nvals)
436 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl2d_ptr), &
438 else if (
size(mshape) == 1)
then
439 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d), nc_vars%nc_fname)
445 nvals = array_shape(1)
447 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d), nc_vars%nc_fname)
454 iper, input_fname, iaux)
456 real(DP),
dimension(:),
contiguous,
pointer,
intent(in) :: dbl1d
458 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
461 integer(I4B),
intent(in) :: iper
462 character(len=*),
intent(in) :: input_fname
463 integer(I4B),
optional,
intent(in) :: iaux
464 real(DP),
dimension(:, :, :),
contiguous,
pointer :: dbl3d
465 integer(I4B) :: nvals, varid
466 integer(I4B) :: n, i, j, k
472 if (
present(iaux))
then
473 varid = nc_vars%varid(idt%mf6varname, period=iper, iaux=iaux)
475 varid = nc_vars%varid(idt%mf6varname, period=iper)
478 if (idt%shape ==
'NODES')
then
481 'IDM NetCDF load_double1d_spd NODES var shape not supported => '// &
485 else if (idt%shape ==
'NCPL' .or. idt%shape ==
'NAUX NCPL')
then
487 if (
size(mshape) == 3)
then
488 allocate (dbl3d(mshape(3), mshape(2), mshape(1)))
489 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d), &
492 do k = 1,
size(dbl3d, dim=3)
493 do i = 1,
size(dbl3d, dim=2)
494 do j = 1,
size(dbl3d, dim=1)
495 if (n <
size(dbl1d))
then
500 if (dbl3d(j, i, k) /=
dnodata)
then
501 dbl1d(n) = dbl3d(j, i, k)
507 else if (
size(mshape) == 2)
then
510 'IDM NetCDF load_double1d_spd DISV model not supported => '// &
522 real(DP),
dimension(:),
contiguous,
pointer,
intent(in) :: dbl1d
524 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
527 character(len=*),
intent(in) :: input_fname
528 integer(I4B),
dimension(:),
allocatable :: layer_shape
529 integer(I4B) :: nlay, varid
530 integer(I4B) :: k, ncpl
531 integer(I4B) :: index_start, index_stop
532 real(DP),
dimension(:),
contiguous,
pointer :: dbl1d_ptr
537 ncpl = product(layer_shape)
540 varid = nc_vars%varid(idt%mf6varname, layer=k)
541 index_stop = index_start + ncpl - 1
542 dbl1d_ptr(1:ncpl) => dbl1d(index_start:index_stop)
543 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
545 index_start = index_stop + 1
552 iper, input_fname, iaux)
554 real(DP),
dimension(:),
contiguous,
pointer,
intent(in) :: dbl1d
556 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
559 integer(I4B),
intent(in) :: iper
560 character(len=*),
intent(in) :: input_fname
561 integer(I4B),
optional,
intent(in) :: iaux
562 integer(I4B),
dimension(:),
allocatable :: layer_shape
563 integer(I4B) :: nlay, varid
564 integer(I4B) :: k, n, ncpl
565 integer(I4B) :: index_start, index_stop
566 real(DP),
dimension(:),
contiguous,
pointer :: dbl1d_ptr
569 ncpl = product(layer_shape)
570 allocate (dbl1d_ptr(ncpl))
574 index_stop = index_start + ncpl - 1
575 if (
present(iaux))
then
576 varid = nc_vars%varid(idt%mf6varname, layer=k, period=iper, iaux=iaux)
578 varid = nc_vars%varid(idt%mf6varname, layer=k, period=iper)
580 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
583 if (dbl1d_ptr(n) /=
dnodata)
then
584 dbl1d(n) = dbl1d_ptr(n)
590 deallocate (dbl1d_ptr)
597 real(DP),
dimension(:, :),
contiguous,
pointer,
intent(in) :: dbl2d
599 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
602 integer(I4B),
intent(in) :: varid
603 character(len=*),
intent(in) :: input_fname
604 real(DP),
dimension(:),
contiguous,
pointer :: dbl1d_ptr
605 integer(I4B),
dimension(:),
allocatable :: array_shape
606 integer(I4B) :: ncpl, nlay
610 if (nc_vars%grid ==
'STRUCTURED')
then
611 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl2d), nc_vars%nc_fname)
612 else if (nc_vars%grid ==
'LAYERED MESH')
then
614 ncpl = product(array_shape)
615 dbl1d_ptr(1:ncpl) => dbl2d(:, :)
616 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
625 real(DP),
dimension(:, :),
contiguous,
pointer,
intent(in) :: dbl2d
627 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
630 character(len=*),
intent(in) :: input_fname
631 integer(I4B),
dimension(:),
allocatable :: layer_shape
633 integer(I4B) :: ncpl, nlay, varid
634 real(DP),
dimension(:),
contiguous,
pointer :: dbl1d_ptr
638 if (
size(mshape) == 3)
then
639 write (
errmsg,
'(a,a,a)') &
640 'Layered netcdf read not supported for DIS dbl2d type ('// &
641 trim(idt%tagname)//
').'
644 else if (
size(mshape) == 2)
then
646 ncpl = layer_shape(1)
648 varid = nc_vars%varid(idt%mf6varname, layer=k)
649 dbl1d_ptr(1:ncpl) => dbl2d(1:ncpl, k)
650 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
660 real(DP),
dimension(:, :, :),
contiguous,
pointer,
intent(in) :: dbl3d
662 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
665 integer(I4B),
intent(in) :: varid
666 character(len=*),
intent(in) :: input_fname
668 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d), nc_vars%nc_fname)
675 real(DP),
dimension(:, :, :),
contiguous,
pointer,
intent(in) :: dbl3d
677 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
680 character(len=*),
intent(in) :: input_fname
681 integer(I4B),
dimension(:),
allocatable :: layer_shape
683 integer(I4B) :: ncpl, nlay, varid
684 integer(I4B) :: index_start, index_stop
685 real(DP),
dimension(:),
contiguous,
pointer :: dbl1d_ptr
691 ncpl = product(layer_shape)
694 varid = nc_vars%varid(idt%mf6varname, layer=k)
695 index_stop = index_start + ncpl - 1
696 dbl1d_ptr(1:ncpl) => dbl3d(:, :, k:k)
697 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
699 index_start = index_stop + 1
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dnodata
real no data constant
This module defines variable data types.
This module contains the NCArrayReaderModule.
subroutine load_double1d_layered(dbl1d, mf6_input, mshape, idt, nc_vars, input_fname)
load type 1d double layered
subroutine nc_array_load_int2d(int2d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
Load NetCDF integer 2D array.
subroutine load_double3d_layered(dbl3d, mf6_input, mshape, idt, nc_vars, input_fname)
load type 3d double layered
subroutine nc_array_load_dbl2d(dbl2d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
Load NetCDF double 2D array.
subroutine load_integer3d_layered(int3d, mf6_input, mshape, idt, nc_vars, input_fname)
load type 3d integer layered
subroutine load_integer1d_type(int1d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
load type 1d integer
subroutine load_double3d_type(dbl3d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
load type 3d double
logical(lgp) function is_layered(grid)
does the grid support per layer variables
subroutine nc_array_load_int3d(int3d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
Load NetCDF integer 3D array.
subroutine load_double2d_type(dbl2d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
load type 2d double
subroutine load_integer3d_type(int3d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
load type 3d integer
subroutine load_integer2d_layered(int2d, mf6_input, mshape, idt, nc_vars, input_fname)
load type 2d integer layered
subroutine load_integer2d_type(int2d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
load type 2d integer
subroutine nc_array_load_int1d(int1d, mshape, idt, mf6_input, nc_vars, input_fname, iout, kper)
Load NetCDF integer 1D array.
subroutine load_double1d_layered_spd(dbl1d, mf6_input, mshape, idt, nc_vars, iper, input_fname, iaux)
load type 1d double layered
subroutine load_integer1d_layered(int1d, mf6_input, mshape, idt, nc_vars, input_fname)
load type 1d integer layered
subroutine load_double1d_type(dbl1d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
load type 1d double
subroutine load_double2d_layered(dbl2d, mf6_input, mshape, idt, nc_vars, input_fname)
load type 2d double layered
subroutine nc_array_load_dbl3d(dbl3d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
Load NetCDF double 3D array.
subroutine nc_array_load_dbl1d(dbl1d, mshape, idt, mf6_input, nc_vars, input_fname, iout, kper, iaux)
Load NetCDF double 1D array.
subroutine load_double1d_spd(dbl1d, mf6_input, mshape, idt, nc_vars, iper, input_fname, iaux)
load type 1d double
This module contains the NCFileVarsModule.
This module contains the NetCDFCommonModule.
subroutine, public nf_verify(res, nc_fname)
error check a netcdf-fortran interface call
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
This module contains the SourceCommonModule.
subroutine, public get_layered_shape(mshape, nlay, layer_shape)
subroutine, public get_shape_from_string(shape_string, array_shape, memoryPath)
Type describing input variables for a package in NetCDF file.