56 character(len=*),
intent(in) :: modelname
57 character(len=*),
intent(in) :: modeltype
58 character(len=*),
intent(in) :: modelfname
59 integer(I4B),
intent(in) :: disenum
60 integer(I4B),
intent(in) :: nctype
61 integer(I4B),
intent(in) :: iout
64 this%nlay = this%dis%nlay
67 allocate (this%var_ids%dependent(this%nlay))
70 call this%mesh_init(modelname, modeltype, modelfname, disenum, nctype, iout)
78 deallocate (this%var_ids%dependent)
81 call this%mesh_destroy()
82 call this%NCModelExportType%destroy()
92 call this%add_global_att()
94 call this%define_dim()
96 call this%create_mesh()
99 call this%define_dependent()
102 call nf_verify(nf90_enddef(this%ncid), this%nc_fname)
104 call this%add_mesh_data()
106 call this%add_pkg_data()
108 call this%define_gridmap()
110 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
119 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
120 integer(I4B) :: n, k, nvals
121 integer(I4B),
dimension(2) :: dis_shape
122 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
129 this%stepcnt = this%stepcnt + 1
131 dis_shape(1) = this%dis%ncol * this%dis%nrow
132 dis_shape(2) = this%dis%nlay
134 nvals = product(dis_shape)
137 if (
size(this%dis%nodeuser) < &
138 size(this%dis%nodereduced))
then
141 allocate (dbl1d(
size(this%dis%nodereduced)))
147 do n = 1,
size(this%dis%nodereduced)
148 if (this%dis%nodereduced(n) > 0)
then
149 dbl1d(n) = this%x(this%dis%nodereduced(n))
153 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => dbl1d(1:nvals)
156 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => this%x(1:nvals)
160 do k = 1, this%dis%nlay
163 this%var_ids%dependent(k), dbl2d(:, k), &
164 start=(/1, this%stepcnt/), &
165 count=(/(this%dis%ncol * this%dis%nrow), 1/)), &
170 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
171 totim, start=(/this%stepcnt/)), &
175 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
178 if (
associated(dbl1d))
deallocate (dbl1d)
192 character(len=*),
intent(in) :: ilayer_varname
193 integer(I4B),
intent(in) :: ilayer
196 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
197 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
198 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
199 integer(I4B),
dimension(:),
pointer,
contiguous :: ialayer
200 real(DP),
dimension(:),
contiguous,
pointer :: dbl1d_ptr
201 character(len=LINELENGTH) :: nc_varname, input_attr
202 integer(I4B) :: n, iparam, nvals
203 logical(LGP) :: ilayer_read
207 ilayer_read = .false.
210 call mem_setptr(ialayer, export_pkg%param_names(ilayer), &
211 export_pkg%mf6_input%mempath)
214 if (export_pkg%param_reads(ilayer)%invar == 1)
then
219 do iparam = 1, export_pkg%nparam
222 if (export_pkg%param_reads(iparam)%invar < 1) cycle
227 export_pkg%mf6_input%component_type, &
228 export_pkg%mf6_input%subcomponent_type, &
229 'PERIOD', export_pkg%param_names(iparam),
'')
232 nc_varname = trim(export_pkg%mf6_input%subcomponent_name)//
'_'// &
234 input_attr = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
238 select case (idt%datatype)
240 call mem_setptr(int1d, idt%mf6varname, export_pkg%mf6_input%mempath)
241 call nc_export_int1d(this%ncid, this%dim_ids, this%x_dim, this%y_dim, &
242 this%var_ids, this%dis, int1d, nc_varname, &
243 export_pkg%mf6_input%subcomponent_name, &
244 idt%tagname, this%gridmap_name, idt%shape, &
245 idt%longname, input_attr, this%deflate, &
246 this%shuffle, this%chunk_face,
kper, this%nc_fname)
248 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
249 call this%export_layer_3d(export_pkg, idt, ilayer_read, ialayer, &
250 dbl1d, nc_varname, input_attr)
252 call mem_setptr(dbl2d, idt%mf6varname, export_pkg%mf6_input%mempath)
253 nvals = this%dis%ncol * this%dis%nrow
255 do n = 1,
size(dbl2d, dim=1)
256 dbl1d_ptr(1:nvals) => dbl2d(n, :)
257 if (all(dbl1d_ptr ==
dzero))
then
259 call this%export_layer_3d(export_pkg, idt, ilayer_read, ialayer, &
260 dbl1d_ptr, nc_varname, input_attr, n)
265 errmsg =
'EXPORT ilayaer unsupported datatype='//trim(idt%datatype)
271 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
283 errmsg =
'NetCDF period export not supported for model='// &
284 trim(this%modelname)//
', package='// &
285 trim(export_pkg%mf6_input%subcomponent_name)
289 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
295 dbl1d, nc_varname, input_attr, iaux)
301 logical(LGP),
intent(in) :: ilayer_read
302 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: ialayer
303 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: dbl1d
304 character(len=*),
intent(in) :: nc_varname
305 character(len=*),
intent(in) :: input_attr
306 integer(I4B),
optional,
intent(in) :: iaux
308 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
309 integer(I4B) :: n, i, j, k, nvals, idxaux
310 real(DP),
dimension(:, :),
contiguous,
pointer :: dbl2d_ptr
314 if (
present(iaux))
then
318 allocate (dbl3d(export_pkg%mshape(3), export_pkg%mshape(2), &
319 export_pkg%mshape(1)))
321 if (ilayer_read)
then
322 do k = 1,
size(dbl3d, dim=3)
324 do i = 1,
size(dbl3d, dim=2)
325 do j = 1,
size(dbl3d, dim=1)
327 if (ialayer(n) == k)
then
328 dbl3d(j, i, k) = dbl1d(n)
337 nvals = export_pkg%mshape(3) * export_pkg%mshape(2)
338 dbl2d_ptr(1:export_pkg%mshape(3), 1:export_pkg%mshape(2)) => dbl1d(1:nvals)
339 dbl3d(:, :, 1) = dbl2d_ptr(:, :)
342 call nc_export_dbl3d(this%ncid, this%dim_ids, this%var_ids, this%dis, dbl3d, &
343 nc_varname, export_pkg%mf6_input%subcomponent_name, &
344 idt%tagname, this%gridmap_name, idt%shape, &
345 idt%longname, input_attr, this%deflate, this%shuffle, &
346 this%chunk_face, export_pkg%iper, idxaux, this%nc_fname)
355 character(len=*),
intent(in) :: pkgtype
356 character(len=*),
intent(in) :: pkgname
357 character(len=*),
intent(in) :: mempath
359 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
360 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
361 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
362 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
363 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
364 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
365 character(len=LINELENGTH) :: nc_varname, input_attr
366 integer(I4B) :: iper, iaux
372 nc_varname = trim(pkgname)//
'_'//trim(idt%mf6varname)
374 input_attr = this%input_attribute(pkgname, idt)
376 select case (idt%datatype)
378 call mem_setptr(int1d, idt%mf6varname, mempath)
379 call nc_export_int1d(this%ncid, this%dim_ids, this%x_dim, this%y_dim, &
380 this%var_ids, this%dis, int1d, nc_varname, pkgname, &
381 idt%tagname, this%gridmap_name, idt%shape, &
382 idt%longname, input_attr, this%deflate, this%shuffle, &
383 this%chunk_face, iper, this%nc_fname)
385 call mem_setptr(int2d, idt%mf6varname, mempath)
386 call nc_export_int2d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
387 int2d, nc_varname, pkgname, idt%tagname, &
388 this%gridmap_name, idt%shape, idt%longname, &
389 input_attr, this%deflate, this%shuffle, &
390 this%chunk_face, this%nc_fname)
392 call mem_setptr(int3d, idt%mf6varname, mempath)
393 call nc_export_int3d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
394 int3d, nc_varname, pkgname, idt%tagname, &
395 this%gridmap_name, idt%shape, idt%longname, &
396 input_attr, this%deflate, this%shuffle, &
397 this%chunk_face, this%nc_fname)
399 call mem_setptr(dbl1d, idt%mf6varname, mempath)
400 call nc_export_dbl1d(this%ncid, this%dim_ids, this%x_dim, this%y_dim, &
401 this%var_ids, this%dis, dbl1d, nc_varname, pkgname, &
402 idt%tagname, this%gridmap_name, idt%shape, &
403 idt%longname, input_attr, this%deflate, this%shuffle, &
404 this%chunk_face, this%nc_fname)
406 call mem_setptr(dbl2d, idt%mf6varname, mempath)
407 call nc_export_dbl2d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
408 dbl2d, nc_varname, pkgname, idt%tagname, &
409 this%gridmap_name, idt%shape, idt%longname, &
410 input_attr, this%deflate, this%shuffle, &
411 this%chunk_face, this%nc_fname)
413 call mem_setptr(dbl3d, idt%mf6varname, mempath)
414 call nc_export_dbl3d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
415 dbl3d, nc_varname, pkgname, idt%tagname, &
416 this%gridmap_name, idt%shape, idt%longname, &
417 input_attr, this%deflate, this%shuffle, &
418 this%chunk_face, iper, iaux, this%nc_fname)
433 call nf_verify(nf90_def_dim(this%ncid,
'time', this%totnstp, &
434 this%dim_ids%time), this%nc_fname)
435 call nf_verify(nf90_def_var(this%ncid,
'time', nf90_double, &
436 this%dim_ids%time, this%var_ids%time), &
438 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'calendar', &
439 'standard'), this%nc_fname)
440 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'units', &
441 this%datetime), this%nc_fname)
442 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'axis',
'T'), &
444 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'standard_name', &
445 'time'), this%nc_fname)
446 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'long_name', &
447 'time'), this%nc_fname)
451 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_node', &
452 ((this%dis%ncol + 1) * (this%dis%nrow + 1)), &
453 this%dim_ids%nmesh_node), this%nc_fname)
454 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_face', &
455 (this%dis%ncol * this%dis%nrow), &
456 this%dim_ids%nmesh_face), this%nc_fname)
457 call nf_verify(nf90_def_dim(this%ncid,
'max_nmesh_face_nodes', 4, &
458 this%dim_ids%max_nmesh_face_nodes), &
462 call nf_verify(nf90_def_dim(this%ncid,
'nlay', this%dis%nlay, &
463 this%dim_ids%nlay), this%nc_fname)
464 call nf_verify(nf90_def_dim(this%ncid,
'x', this%dis%ncol, &
465 this%x_dim), this%nc_fname)
466 call nf_verify(nf90_def_dim(this%ncid,
'y', this%dis%nrow, &
467 this%y_dim), this%nc_fname)
474 integer(I4B) :: cnt, maxvert, m
475 integer(I4B),
dimension(:),
allocatable :: verts
476 real(DP),
dimension(:),
allocatable :: bnds
479 real(DP),
dimension(:),
allocatable :: node_x, node_y
480 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
486 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
490 allocate (verts(maxvert))
491 allocate (bnds(maxvert))
492 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
493 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
494 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
495 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
499 node_x = nf90_fill_double
500 node_y = nf90_fill_double
501 y = this%dis%yorigin + sum(this%dis%delc)
502 do j = this%dis%nrow, 0, -1
504 do i = this%dis%ncol, 0, -1
508 if (i > 0) x = x + this%dis%delr(i)
510 if (j > 0) y = y - this%dis%delc(j)
514 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
516 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
521 cell_x = nf90_fill_double
522 cell_y = nf90_fill_double
523 do j = 1, this%dis%nrow
525 y = this%dis%celly(j) + this%dis%yorigin
526 do i = 1, this%dis%ncol
530 x = this%dis%cellx(i) + this%dis%xorigin
535 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
537 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
542 do i = 1, this%dis%nrow
543 do j = 1, this%dis%ncol
545 verts = nf90_fill_int
546 verts(1) = cnt + this%dis%ncol + i
547 verts(2) = cnt + this%dis%ncol + i + 1
550 verts(4) = cnt + i - 1
557 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
558 verts, start=(/1, cnt/), &
559 count=(/maxvert, 1/)), &
563 bnds = nf90_fill_double
565 if (verts(m) /= nf90_fill_int)
then
566 bnds(m) = node_y(verts(m))
569 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
570 bnds, start=(/1, cnt/), &
571 count=(/maxvert, 1/)), &
576 bnds = nf90_fill_double
578 if (verts(m) /= nf90_fill_int)
then
579 bnds(m) = node_x(verts(m))
582 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
583 bnds, start=(/1, cnt/), &
584 count=(/maxvert, 1/)), &
602 nc_varname, pkgname, tagname, gridmap_name, &
603 shapestr, longname, nc_tag, deflate, shuffle, &
604 chunk_face, iper, nc_fname)
605 integer(I4B),
intent(in) :: ncid
607 integer(I4B),
intent(in) :: x_dim
608 integer(I4B),
intent(in) :: y_dim
610 type(
distype),
pointer,
intent(in) :: dis
611 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
612 character(len=*),
intent(in) :: nc_varname
613 character(len=*),
intent(in) :: pkgname
614 character(len=*),
intent(in) :: tagname
615 character(len=*),
intent(in) :: gridmap_name
616 character(len=*),
intent(in) :: shapestr
617 character(len=*),
intent(in) :: longname
618 character(len=*),
intent(in) :: nc_tag
619 integer(I4B),
intent(in) :: deflate
620 integer(I4B),
intent(in) :: shuffle
621 integer(I4B),
intent(in) :: chunk_face
622 integer(I4B),
intent(in) :: iper
623 character(len=*),
intent(in) :: nc_fname
625 integer(I4B),
dimension(3) :: dis_shape
626 integer(I4B),
dimension(1) :: layer_shape
627 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
628 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
629 integer(I4B) :: axis_dim, nvals, k
630 integer(I4B),
dimension(:),
allocatable :: var_id
631 character(len=LINELENGTH) :: longname_l, varname_l
633 if (shapestr ==
'NROW' .or. &
634 shapestr ==
'NCOL' .or. &
635 shapestr ==
'NCPL')
then
637 select case (shapestr)
643 axis_dim = dim_ids%nmesh_face
648 longname_l =
export_longname(longname, pkgname, tagname, layer=0, iper=iper)
653 call nf_verify(nf90_redef(ncid), nc_fname)
654 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
655 (/axis_dim/), var_id(1)), &
659 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
662 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
663 (/nf90_fill_int/)), nc_fname)
664 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
665 longname_l), nc_fname)
668 call ncvar_mf6attr(ncid, var_id(1), 0, iper, 0, nc_tag, nc_fname)
671 call nf_verify(nf90_enddef(ncid), nc_fname)
672 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
676 allocate (var_id(dis%nlay))
679 call nf_verify(nf90_redef(ncid), nc_fname)
687 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
688 (/dim_ids%nmesh_face/), var_id(k)), &
692 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
694 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
697 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
698 (/nf90_fill_int/)), nc_fname)
699 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
700 longname_l), nc_fname)
704 call ncvar_mf6attr(ncid, var_id(k), k, iper, 0, nc_tag, nc_fname)
708 dis_shape(1) = dis%ncol
709 dis_shape(2) = dis%nrow
710 dis_shape(3) = dis%nlay
711 nvals = product(dis_shape)
712 int3d(1:dis_shape(1), 1:dis_shape(2), 1:dis_shape(3)) => p_mem(1:nvals)
715 call nf_verify(nf90_enddef(ncid), nc_fname)
716 layer_shape(1) = dis%nrow * dis%ncol
718 int1d(1:layer_shape(1)) => int3d(:, :, k)
719 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
730 pkgname, tagname, gridmap_name, shapestr, longname, &
731 nc_tag, deflate, shuffle, chunk_face, nc_fname)
732 integer(I4B),
intent(in) :: ncid
735 type(
distype),
pointer,
intent(in) :: dis
736 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
737 character(len=*),
intent(in) :: nc_varname
738 character(len=*),
intent(in) :: pkgname
739 character(len=*),
intent(in) :: tagname
740 character(len=*),
intent(in) :: gridmap_name
741 character(len=*),
intent(in) :: shapestr
742 character(len=*),
intent(in) :: longname
743 character(len=*),
intent(in) :: nc_tag
744 integer(I4B),
intent(in) :: deflate
745 integer(I4B),
intent(in) :: shuffle
746 integer(I4B),
intent(in) :: chunk_face
747 character(len=*),
intent(in) :: nc_fname
749 integer(I4B) :: var_id
750 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
751 integer(I4B),
dimension(1) :: layer_shape
752 character(len=LINELENGTH) :: longname_l, varname_l
759 call nf_verify(nf90_redef(ncid), nc_fname)
760 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
761 (/dim_ids%nmesh_face/), var_id), &
765 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
770 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
771 (/nf90_fill_int/)), nc_fname)
772 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
773 longname_l), nc_fname)
780 call nf_verify(nf90_enddef(ncid), nc_fname)
781 layer_shape(1) = dis%nrow * dis%ncol
782 int1d(1:layer_shape(1)) => p_mem
783 call nf_verify(nf90_put_var(ncid, var_id, int1d), nc_fname)
789 pkgname, tagname, gridmap_name, shapestr, longname, &
790 nc_tag, deflate, shuffle, chunk_face, nc_fname)
791 integer(I4B),
intent(in) :: ncid
794 type(
distype),
pointer,
intent(in) :: dis
795 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
796 character(len=*),
intent(in) :: nc_varname
797 character(len=*),
intent(in) :: pkgname
798 character(len=*),
intent(in) :: tagname
799 character(len=*),
intent(in) :: gridmap_name
800 character(len=*),
intent(in) :: shapestr
801 character(len=*),
intent(in) :: longname
802 character(len=*),
intent(in) :: nc_tag
803 integer(I4B),
intent(in) :: deflate
804 integer(I4B),
intent(in) :: shuffle
805 integer(I4B),
intent(in) :: chunk_face
806 character(len=*),
intent(in) :: nc_fname
808 integer(I4B),
dimension(:),
allocatable :: var_id
809 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
810 character(len=LINELENGTH) :: longname_l, varname_l
811 integer(I4B),
dimension(1) :: layer_shape
814 allocate (var_id(dis%nlay))
817 call nf_verify(nf90_redef(ncid), nc_fname)
824 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
825 (/dim_ids%nmesh_face/), var_id(k)), &
829 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
831 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
834 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
835 (/nf90_fill_int/)), nc_fname)
836 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
837 longname_l), nc_fname)
841 call ncvar_mf6attr(ncid, var_id(k), k, 0, 0, nc_tag, nc_fname)
845 call nf_verify(nf90_enddef(ncid), nc_fname)
846 layer_shape(1) = dis%nrow * dis%ncol
848 int1d(1:layer_shape(1)) => p_mem(:, :, k)
849 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
859 nc_varname, pkgname, tagname, gridmap_name, &
860 shapestr, longname, nc_tag, deflate, shuffle, &
861 chunk_face, nc_fname)
862 integer(I4B),
intent(in) :: ncid
864 integer(I4B),
intent(in) :: x_dim
865 integer(I4B),
intent(in) :: y_dim
867 type(
distype),
pointer,
intent(in) :: dis
868 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
869 character(len=*),
intent(in) :: nc_varname
870 character(len=*),
intent(in) :: pkgname
871 character(len=*),
intent(in) :: tagname
872 character(len=*),
intent(in) :: gridmap_name
873 character(len=*),
intent(in) :: shapestr
874 character(len=*),
intent(in) :: longname
875 character(len=*),
intent(in) :: nc_tag
876 integer(I4B),
intent(in) :: deflate
877 integer(I4B),
intent(in) :: shuffle
878 integer(I4B),
intent(in) :: chunk_face
879 character(len=*),
intent(in) :: nc_fname
881 integer(I4B),
dimension(3) :: dis_shape
882 integer(I4B),
dimension(1) :: layer_shape
883 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
884 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
885 integer(I4B) :: axis_dim, nvals, k
886 integer(I4B),
dimension(:),
allocatable :: var_id
887 character(len=LINELENGTH) :: longname_l, varname_l
889 if (shapestr ==
'NROW' .or. &
890 shapestr ==
'NCOL')
then
893 select case (shapestr)
909 call nf_verify(nf90_redef(ncid), nc_fname)
910 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
911 (/axis_dim/), var_id(1)), &
915 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
918 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
919 (/nf90_fill_double/)), nc_fname)
920 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
921 longname_l), nc_fname)
924 call ncvar_mf6attr(ncid, var_id(1), 0, 0, 0, nc_tag, nc_fname)
927 call nf_verify(nf90_enddef(ncid), nc_fname)
928 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
932 allocate (var_id(dis%nlay))
935 call nf_verify(nf90_redef(ncid), nc_fname)
942 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
943 (/dim_ids%nmesh_face/), var_id(k)), &
947 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
949 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
952 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
953 (/nf90_fill_double/)), nc_fname)
954 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
955 longname_l), nc_fname)
959 call ncvar_mf6attr(ncid, var_id(k), k, 0, 0, nc_tag, nc_fname)
963 dis_shape(1) = dis%ncol
964 dis_shape(2) = dis%nrow
965 dis_shape(3) = dis%nlay
966 nvals = product(dis_shape)
967 dbl3d(1:dis_shape(1), 1:dis_shape(2), 1:dis_shape(3)) => p_mem(1:nvals)
970 call nf_verify(nf90_enddef(ncid), nc_fname)
971 layer_shape(1) = dis%nrow * dis%ncol
973 dbl1d(1:layer_shape(1)) => dbl3d(:, :, k)
974 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
985 pkgname, tagname, gridmap_name, shapestr, longname, &
986 nc_tag, deflate, shuffle, chunk_face, nc_fname)
987 integer(I4B),
intent(in) :: ncid
990 type(
distype),
pointer,
intent(in) :: dis
991 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
992 character(len=*),
intent(in) :: nc_varname
993 character(len=*),
intent(in) :: pkgname
994 character(len=*),
intent(in) :: tagname
995 character(len=*),
intent(in) :: gridmap_name
996 character(len=*),
intent(in) :: shapestr
997 character(len=*),
intent(in) :: longname
998 character(len=*),
intent(in) :: nc_tag
999 integer(I4B),
intent(in) :: deflate
1000 integer(I4B),
intent(in) :: shuffle
1001 integer(I4B),
intent(in) :: chunk_face
1002 character(len=*),
intent(in) :: nc_fname
1004 integer(I4B) :: var_id
1005 character(len=LINELENGTH) :: longname_l, varname_l
1006 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1007 integer(I4B),
dimension(1) :: layer_shape
1014 call nf_verify(nf90_redef(ncid), nc_fname)
1015 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
1016 (/dim_ids%nmesh_face/), var_id), &
1020 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1022 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1025 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1026 (/nf90_fill_double/)), nc_fname)
1027 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1028 longname_l), nc_fname)
1035 call nf_verify(nf90_enddef(ncid), nc_fname)
1036 layer_shape(1) = dis%nrow * dis%ncol
1037 dbl1d(1:layer_shape(1)) => p_mem
1038 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), nc_fname)
1044 pkgname, tagname, gridmap_name, shapestr, longname, &
1045 nc_tag, deflate, shuffle, chunk_face, iper, iaux, &
1048 integer(I4B),
intent(in) :: ncid
1051 type(
distype),
pointer,
intent(in) :: dis
1052 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
1053 character(len=*),
intent(in) :: nc_varname
1054 character(len=*),
intent(in) :: pkgname
1055 character(len=*),
intent(in) :: tagname
1056 character(len=*),
intent(in) :: gridmap_name
1057 character(len=*),
intent(in) :: shapestr
1058 character(len=*),
intent(in) :: longname
1059 character(len=*),
intent(in) :: nc_tag
1060 integer(I4B),
intent(in) :: deflate
1061 integer(I4B),
intent(in) :: shuffle
1062 integer(I4B),
intent(in) :: chunk_face
1063 integer(I4B),
intent(in) :: iper
1064 integer(I4B),
intent(in) :: iaux
1065 character(len=*),
intent(in) :: nc_fname
1067 integer(I4B),
dimension(:),
allocatable :: var_id
1068 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1069 character(len=LINELENGTH) :: longname_l, varname_l
1070 integer(I4B),
dimension(1) :: layer_shape
1072 real(DP) :: fill_value
1077 fill_value = nf90_fill_double
1080 allocate (var_id(dis%nlay))
1083 call nf_verify(nf90_redef(ncid), nc_fname)
1087 varname_l =
export_varname(nc_varname, layer=k, iper=iper, iaux=iaux)
1088 longname_l =
export_longname(longname, pkgname, tagname, layer=k, iper=iper)
1090 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
1091 (/dim_ids%nmesh_face/), var_id(k)), &
1095 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1097 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1100 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1101 (/fill_value/)), nc_fname)
1102 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1103 longname_l), nc_fname)
1107 call ncvar_mf6attr(ncid, var_id(k), k, iper, iaux, nc_tag, nc_fname)
1112 call nf_verify(nf90_enddef(ncid), nc_fname)
1113 layer_shape(1) = dis%nrow * dis%ncol
1115 dbl1d(1:layer_shape(1)) => p_mem(:, :, k)
1116 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lencomponentname
maximum length of a component name
@ mvalidate
validation mode - do not run time steps
real(dp), parameter dnodata
real no data constant
integer(i4b), parameter lenbigline
maximum length of a big line
real(dp), parameter dhnoflo
real no flow constant
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
This module contains the DefinitionSelectModule.
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type(input_definition_types, component_type, subcomponent_type, blockname, tagname, filename)
Return parameter definition.
This module defines variable data types.
This module contains the MeshDisModelModule.
subroutine nc_export_int3d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 3D integer
subroutine dis_export_init(this, modelname, modeltype, modelfname, disenum, nctype, iout)
netcdf export dis init
subroutine export_layer_3d(this, export_pkg, idt, ilayer_read, ialayer, dbl1d, nc_varname, input_attr, iaux)
export layer variable as full grid
subroutine nc_export_int2d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D integer
subroutine define_dim(this)
netcdf export define dimensions
subroutine add_mesh_data(this)
netcdf export add mesh information
subroutine nc_export_dbl1d(ncid, dim_ids, x_dim, y_dim, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 1D double
subroutine step(this)
netcdf export step
subroutine package_step_ilayer(this, export_pkg, ilayer_varname, ilayer)
netcdf export package dynamic input with ilayer index variable
subroutine package_step(this, export_pkg)
netcdf export package dynamic input
subroutine dis_export_destroy(this)
netcdf export dis destroy
subroutine nc_export_int1d(ncid, dim_ids, x_dim, y_dim, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, iper, nc_fname)
netcdf export 1D integer
subroutine nc_export_dbl3d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, iper, iaux, nc_fname)
netcdf export 3D double
subroutine nc_export_dbl2d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D double
subroutine export_input_array(this, pkgtype, pkgname, mempath, idt)
netcdf export an input array
subroutine df(this)
netcdf export define
This module contains the MeshModelModule.
character(len=linelength) function, public export_varname(varname, layer, iper, iaux)
build netcdf variable name
subroutine, public ncvar_gridmap(ncid, varid, gridmap_name, nc_fname)
put variable gridmap attributes
subroutine, public ncvar_chunk(ncid, varid, chunk_face, nc_fname)
define variable chunking
subroutine, public ncvar_deflate(ncid, varid, deflate, shuffle, nc_fname)
define variable compression
subroutine, public ncvar_mf6attr(ncid, varid, layer, iper, iaux, nc_tag, nc_fname)
put variable internal attributes
This module contains the NCModelExportModule.
character(len=linelength) function, public export_longname(longname, pkgname, tagname, layer, iper)
build netcdf variable longname
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
integer(i4b) isim_mode
simulation mode
real(dp), pointer, public totim
time relative to start of simulation
integer(i4b), pointer, public kper
current stress period number
This class is used to store a single deferred-length character string. It was designed to work in an ...
Structured grid discretization.
type for storing model export dimension ids
type for storing model export variable ids