51 disenum, nctype, iout)
54 character(len=*),
intent(in) :: modelname
55 character(len=*),
intent(in) :: modeltype
56 character(len=*),
intent(in) :: modelfname
57 character(len=*),
intent(in) :: nc_fname
58 integer(I4B),
intent(in) :: disenum
59 integer(I4B),
intent(in) :: nctype
60 integer(I4B),
intent(in) :: iout
63 this%nlay = this%dis%nlay
66 allocate (this%var_ids%dependent(this%nlay))
67 allocate (this%var_ids%export(this%nlay))
70 call this%mesh_init(modelname, modeltype, modelfname, nc_fname, disenum, &
71 nctype, this%dis%lenuni, iout)
78 deallocate (this%var_ids%dependent)
80 call this%mesh_destroy()
81 call this%NCModelExportType%destroy()
91 call this%add_global_att()
93 call this%define_dim()
95 call this%create_mesh()
98 call this%define_dependent()
101 call this%df_export()
103 call nf_verify(nf90_enddef(this%ncid), this%nc_fname)
105 call this%add_mesh_data()
107 call this%add_pkg_data()
109 call this%define_gridmap()
111 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
121 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
122 integer(I4B) :: n, k, nvals, istp
123 integer(I4B),
dimension(2) :: dis_shape
124 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
133 dis_shape(1) = this%dis%ncol * this%dis%nrow
134 dis_shape(2) = this%dis%nlay
136 nvals = product(dis_shape)
139 if (
size(this%dis%nodeuser) < &
140 size(this%dis%nodereduced))
then
142 allocate (dbl1d(
size(this%dis%nodereduced)))
148 do n = 1,
size(this%dis%nodereduced)
149 if (this%dis%nodereduced(n) > 0)
then
150 dbl1d(n) = this%x(this%dis%nodereduced(n))
154 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)
159 do k = 1, this%dis%nlay
161 call nf_verify(nf90_put_var(this%ncid, &
162 this%var_ids%dependent(k), dbl2d(:, k), &
164 count=(/(this%dis%ncol * this%dis%nrow), 1/)), &
169 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
170 totim, start=(/istp/)), &
173 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
176 if (
associated(dbl1d))
deallocate (dbl1d)
190 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
191 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d, nodes
192 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
193 character(len=LINELENGTH) :: nc_tag
194 integer(I4B) :: iaux, iparam, nvals
196 integer(I4B),
pointer :: nbound
202 do iparam = 1, export_pkg%nparam
204 if (export_pkg%param_reads(iparam)%invar < 1) cycle
209 export_pkg%mf6_input%component_type, &
210 export_pkg%mf6_input%subcomponent_type, &
211 'PERIOD', export_pkg%param_names(iparam),
'')
214 nc_tag = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
218 select case (idt%datatype)
220 call mem_setptr(int1d, idt%mf6varname, export_pkg%mf6_input%mempath)
221 this%var_ids%export(1) = export_pkg%varids_param(iparam, 1)
223 this%y_dim, this%var_ids, this%dis, idt, &
224 export_pkg%mf6_input%mempath, nc_tag, &
225 export_pkg%mf6_input%subcomponent_name, &
226 this%gridmap_name, this%deflate, this%shuffle, &
227 this%chunk_face,
kper, this%nc_fname)
229 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
230 select case (idt%shape)
232 this%var_ids%export(1) = export_pkg%varids_param(iparam, 1)
234 this%y_dim, this%var_ids, this%dis, idt, &
235 export_pkg%mf6_input%mempath, nc_tag, &
236 export_pkg%mf6_input%subcomponent_name, &
237 this%gridmap_name, this%deflate, this%shuffle, &
238 this%chunk_face,
kper, iaux, this%nc_fname)
240 nvals = this%dis%nodesuser
241 allocate (nodes(nvals))
243 do k = 1, this%dis%nlay
244 this%var_ids%export(k) = export_pkg%varids_param(iparam, k)
246 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
247 call mem_setptr(int1d,
'NODEULIST', export_pkg%mf6_input%mempath)
248 call mem_setptr(nbound,
'NBOUND', export_pkg%mf6_input%mempath)
250 nodes(int1d(n)) = dbl1d(n)
253 this%y_dim, this%var_ids, this%dis, idt, &
254 export_pkg%mf6_input%mempath, nc_tag, &
255 export_pkg%mf6_input%subcomponent_name, &
256 this%gridmap_name, this%deflate, this%shuffle, &
257 this%chunk_face,
kper, iaux, this%nc_fname)
262 call mem_setptr(dbl2d, idt%mf6varname, export_pkg%mf6_input%mempath)
263 select case (idt%shape)
265 nvals = this%dis%nrow * this%dis%ncol
266 allocate (nodes(nvals))
267 do iaux = 1,
size(dbl2d, dim=1)
268 this%var_ids%export(1) = export_pkg%varids_aux(iaux, 1)
270 nodes(n) = dbl2d(iaux, n)
273 this%y_dim, this%var_ids, this%dis, idt, &
274 export_pkg%mf6_input%mempath, nc_tag, &
275 export_pkg%mf6_input%subcomponent_name, &
276 this%gridmap_name, this%deflate, this%shuffle, &
277 this%chunk_face,
kper, iaux, this%nc_fname)
281 nvals = this%dis%nodesuser
282 allocate (nodes(nvals))
283 call mem_setptr(int1d,
'NODEULIST', export_pkg%mf6_input%mempath)
284 call mem_setptr(nbound,
'NBOUND', export_pkg%mf6_input%mempath)
285 do iaux = 1,
size(dbl2d, dim=1)
287 do k = 1, this%dis%nlay
288 this%var_ids%export(k) = export_pkg%varids_aux(iaux, k)
291 nodes(int1d(n)) = dbl2d(iaux, n)
294 this%y_dim, this%var_ids, this%dis, idt, &
295 export_pkg%mf6_input%mempath, nc_tag, &
296 export_pkg%mf6_input%subcomponent_name, &
297 this%gridmap_name, this%deflate, this%shuffle, &
298 this%chunk_face,
kper, iaux, this%nc_fname)
310 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
317 character(len=*),
intent(in) :: pkgtype
318 character(len=*),
intent(in) :: pkgname
319 character(len=*),
intent(in) :: mempath
321 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
322 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
323 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
324 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
325 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
326 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
327 character(len=LINELENGTH) :: nc_tag
328 integer(I4B) :: iper, iaux
334 nc_tag = this%input_attribute(pkgname, idt)
336 select case (idt%datatype)
338 call mem_setptr(int1d, idt%mf6varname, mempath)
340 this%y_dim, this%var_ids, this%dis, idt, mempath, &
341 nc_tag, pkgname, this%gridmap_name, this%deflate, &
342 this%shuffle, this%chunk_face, iper, this%nc_fname)
344 call mem_setptr(int2d, idt%mf6varname, mempath)
346 this%dis, idt, mempath, nc_tag, pkgname, &
347 this%gridmap_name, this%deflate, this%shuffle, &
348 this%chunk_face, this%nc_fname)
350 call mem_setptr(int3d, idt%mf6varname, mempath)
352 this%dis, idt, mempath, nc_tag, pkgname, &
353 this%gridmap_name, this%deflate, this%shuffle, &
354 this%chunk_face, this%nc_fname)
356 call mem_setptr(dbl1d, idt%mf6varname, mempath)
358 this%y_dim, this%var_ids, this%dis, idt, mempath, &
359 nc_tag, pkgname, this%gridmap_name, this%deflate, &
360 this%shuffle, this%chunk_face, iper, iaux, &
363 call mem_setptr(dbl2d, idt%mf6varname, mempath)
365 this%dis, idt, mempath, nc_tag, pkgname, &
366 this%gridmap_name, this%deflate, this%shuffle, &
367 this%chunk_face, this%nc_fname)
369 call mem_setptr(dbl3d, idt%mf6varname, mempath)
371 this%dis, idt, mempath, nc_tag, pkgname, &
372 this%gridmap_name, this%deflate, this%shuffle, &
373 this%chunk_face, this%nc_fname)
385 call nf_verify(nf90_def_dim(this%ncid,
'time', this%totnstp, &
386 this%dim_ids%time), this%nc_fname)
387 call nf_verify(nf90_def_var(this%ncid,
'time', nf90_double, &
388 this%dim_ids%time, this%var_ids%time), &
390 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'calendar', &
391 'standard'), this%nc_fname)
392 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'units', &
393 this%datetime), this%nc_fname)
394 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'axis',
'T'), &
396 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'standard_name', &
397 'time'), this%nc_fname)
398 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'long_name', &
399 'time'), this%nc_fname)
402 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_node', &
403 ((this%dis%ncol + 1) * (this%dis%nrow + 1)), &
404 this%dim_ids%nmesh_node), this%nc_fname)
405 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_face', &
406 (this%dis%ncol * this%dis%nrow), &
407 this%dim_ids%nmesh_face), this%nc_fname)
408 call nf_verify(nf90_def_dim(this%ncid,
'max_nmesh_face_nodes', 4, &
409 this%dim_ids%max_nmesh_face_nodes), &
413 call nf_verify(nf90_def_dim(this%ncid,
'nlay', this%dis%nlay, &
414 this%dim_ids%nlay), this%nc_fname)
415 call nf_verify(nf90_def_dim(this%ncid,
'x', this%dis%ncol, &
416 this%x_dim), this%nc_fname)
417 call nf_verify(nf90_def_dim(this%ncid,
'y', this%dis%nrow, &
418 this%y_dim), this%nc_fname)
426 integer(I4B) :: cnt, maxvert, m
427 integer(I4B),
dimension(:),
allocatable :: verts
428 real(DP),
dimension(:),
allocatable :: bnds
430 real(DP) :: x, y, x_transform, y_transform
431 real(DP),
dimension(:),
allocatable :: node_x, node_y
432 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
438 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
442 allocate (verts(maxvert))
443 allocate (bnds(maxvert))
444 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
445 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
446 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
447 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
451 node_x = nf90_fill_double
452 node_y = nf90_fill_double
453 y = sum(this%dis%delc)
454 do j = this%dis%nrow, 0, -1
456 do i = this%dis%ncol, 0, -1
462 x_transform, y_transform)
463 node_x(cnt) = x_transform
464 node_y(cnt) = y_transform
465 if (i > 0) x = x + this%dis%delr(i)
467 if (j > 0) y = y - this%dis%delc(j)
471 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
473 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
478 cell_x = nf90_fill_double
479 cell_y = nf90_fill_double
480 do j = 1, this%dis%nrow
481 y = this%dis%celly(j)
482 do i = 1, this%dis%ncol
483 x = this%dis%cellx(i)
488 x_transform, y_transform)
489 cell_x(cnt) = x_transform
490 cell_y(cnt) = y_transform
496 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
498 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
503 do i = 1, this%dis%nrow
504 do j = 1, this%dis%ncol
506 verts = nf90_fill_int
507 verts(1) = cnt + this%dis%ncol + i
508 verts(2) = cnt + this%dis%ncol + i + 1
511 verts(4) = cnt + i - 1
518 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
519 verts, start=(/1, cnt/), &
520 count=(/maxvert, 1/)), &
524 bnds = nf90_fill_double
526 if (verts(m) /= nf90_fill_int)
then
527 bnds(m) = node_y(verts(m))
530 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
531 bnds, start=(/1, cnt/), &
532 count=(/maxvert, 1/)), &
537 bnds = nf90_fill_double
539 if (verts(m) /= nf90_fill_int)
then
540 bnds(m) = node_x(verts(m))
543 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
544 bnds, start=(/1, cnt/), &
545 count=(/maxvert, 1/)), &
563 idt, mempath, nc_tag, pkgname, gridmap_name, &
564 deflate, shuffle, chunk_face, iper, nc_fname)
566 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
567 integer(I4B),
intent(in) :: ncid
569 integer(I4B),
intent(in) :: x_dim
570 integer(I4B),
intent(in) :: y_dim
572 type(
distype),
pointer,
intent(in) :: dis
574 character(len=*),
intent(in) :: mempath
575 character(len=*),
intent(in) :: nc_tag
576 character(len=*),
intent(in) :: pkgname
577 character(len=*),
intent(in) :: gridmap_name
578 integer(I4B),
intent(in) :: deflate
579 integer(I4B),
intent(in) :: shuffle
580 integer(I4B),
intent(in) :: chunk_face
581 integer(I4B),
intent(in) :: iper
582 character(len=*),
intent(in) :: nc_fname
583 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
584 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
585 integer(I4B) :: axis_dim, nvals, k, istp
586 integer(I4B),
dimension(:),
allocatable :: var_id
587 character(len=LINELENGTH) :: longname, varname
589 if (idt%shape ==
'NROW' .or. &
590 idt%shape ==
'NCOL' .or. &
591 idt%shape ==
'NCPL' .or. &
592 idt%shape ==
'NAUX NCPL')
then
596 select case (idt%shape)
601 case (
'NCPL',
'NAUX NCPL')
602 axis_dim = dim_ids%nmesh_face
607 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath)
612 call nf_verify(nf90_redef(ncid), nc_fname)
613 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
614 (/axis_dim/), var_id(1)), &
618 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
621 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
622 (/nf90_fill_int/)), nc_fname)
623 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
630 call nf_verify(nf90_enddef(ncid), nc_fname)
631 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
635 nvals = dis%nrow * dis%ncol
636 call nf_verify(nf90_put_var(ncid, &
637 var_ids%export(1), p_mem, &
639 count=(/nvals, 1/)), nc_fname)
644 int3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
647 nvals = dis%nrow * dis%ncol
651 allocate (var_id(dis%nlay))
654 call nf_verify(nf90_redef(ncid), nc_fname)
662 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
663 (/dim_ids%nmesh_face/), var_id(k)), &
667 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
669 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
672 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
673 (/nf90_fill_int/)), nc_fname)
674 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
683 call nf_verify(nf90_enddef(ncid), nc_fname)
685 int1d(1:nvals) => int3d(:, :, k)
686 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
695 int1d(1:nvals) => int3d(:, :, k)
696 call nf_verify(nf90_put_var(ncid, &
697 var_ids%export(k), int1d, &
699 count=(/nvals, 1/)), nc_fname)
708 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
709 chunk_face, nc_fname)
710 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
711 integer(I4B),
intent(in) :: ncid
714 type(
distype),
pointer,
intent(in) :: dis
716 character(len=*),
intent(in) :: mempath
717 character(len=*),
intent(in) :: nc_tag
718 character(len=*),
intent(in) :: pkgname
719 character(len=*),
intent(in) :: gridmap_name
720 integer(I4B),
intent(in) :: deflate
721 integer(I4B),
intent(in) :: shuffle
722 integer(I4B),
intent(in) :: chunk_face
723 character(len=*),
intent(in) :: nc_fname
724 integer(I4B) :: var_id, nvals
725 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
726 character(len=LINELENGTH) :: longname, varname
730 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath)
733 call nf_verify(nf90_redef(ncid), nc_fname)
734 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
735 (/dim_ids%nmesh_face/), var_id), &
739 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
744 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
745 (/nf90_fill_int/)), nc_fname)
746 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
754 call nf_verify(nf90_enddef(ncid), nc_fname)
755 nvals = dis%nrow * dis%ncol
756 int1d(1:nvals) => p_mem
757 call nf_verify(nf90_put_var(ncid, var_id, int1d), nc_fname)
763 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
764 chunk_face, nc_fname)
765 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
766 integer(I4B),
intent(in) :: ncid
769 type(
distype),
pointer,
intent(in) :: dis
771 character(len=*),
intent(in) :: mempath
772 character(len=*),
intent(in) :: nc_tag
773 character(len=*),
intent(in) :: pkgname
774 character(len=*),
intent(in) :: gridmap_name
775 integer(I4B),
intent(in) :: deflate
776 integer(I4B),
intent(in) :: shuffle
777 integer(I4B),
intent(in) :: chunk_face
778 character(len=*),
intent(in) :: nc_fname
779 integer(I4B),
dimension(:),
allocatable :: var_id
780 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
781 character(len=LINELENGTH) :: longname, varname
782 integer(I4B) :: k, nvals
784 allocate (var_id(dis%nlay))
787 call nf_verify(nf90_redef(ncid), nc_fname)
794 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
795 (/dim_ids%nmesh_face/), var_id(k)), &
799 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
801 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
804 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
805 (/nf90_fill_int/)), nc_fname)
806 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
815 call nf_verify(nf90_enddef(ncid), nc_fname)
816 nvals = dis%nrow * dis%ncol
818 int1d(1:nvals) => p_mem(:, :, k)
819 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
829 idt, mempath, nc_tag, pkgname, gridmap_name, &
830 deflate, shuffle, chunk_face, iper, iaux, nc_fname)
832 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
833 integer(I4B),
intent(in) :: ncid
835 integer(I4B),
intent(in) :: x_dim
836 integer(I4B),
intent(in) :: y_dim
838 type(
distype),
pointer,
intent(in) :: dis
840 character(len=*),
intent(in) :: mempath
841 character(len=*),
intent(in) :: nc_tag
842 character(len=*),
intent(in) :: pkgname
843 character(len=*),
intent(in) :: gridmap_name
844 integer(I4B),
intent(in) :: deflate
845 integer(I4B),
intent(in) :: shuffle
846 integer(I4B),
intent(in) :: chunk_face
847 integer(I4B),
intent(in) :: iper
848 integer(I4B),
intent(in) :: iaux
849 character(len=*),
intent(in) :: nc_fname
850 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
851 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
852 integer(I4B) :: axis_dim, nvals, k, istp
853 integer(NF90_INT),
dimension(:),
allocatable :: var_id
854 character(len=LINELENGTH) :: longname, varname
856 if (idt%shape ==
'NROW' .or. &
857 idt%shape ==
'NCOL' .or. &
858 idt%shape ==
'NCPL' .or. &
859 idt%shape ==
'NAUX NCPL')
then
863 select case (idt%shape)
868 case (
'NCPL',
'NAUX NCPL')
869 axis_dim = dim_ids%nmesh_face
873 varname =
export_varname(pkgname, idt%tagname, mempath, iaux=iaux)
880 call nf_verify(nf90_redef(ncid), nc_fname)
881 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
882 (/axis_dim/), var_id(1)), &
886 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
889 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
890 (/nf90_fill_double/)), nc_fname)
891 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
895 call ncvar_mf6attr(ncid, var_id(1), 0, iaux, nc_tag, nc_fname)
898 call nf_verify(nf90_enddef(ncid), nc_fname)
899 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
903 nvals = dis%nrow * dis%ncol
904 call nf_verify(nf90_put_var(ncid, &
905 var_ids%export(1), p_mem, &
907 count=(/nvals, 1/)), nc_fname)
912 dbl3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
915 nvals = dis%nrow * dis%ncol
921 allocate (var_id(dis%nlay))
924 call nf_verify(nf90_redef(ncid), nc_fname)
927 varname =
export_varname(pkgname, idt%tagname, mempath, layer=k, &
930 mempath, layer=k, iaux=iaux)
933 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
934 (/dim_ids%nmesh_face/), var_id(k)), &
938 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
940 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
943 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
944 (/nf90_fill_double/)), nc_fname)
945 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
950 call ncvar_mf6attr(ncid, var_id(k), k, iaux, nc_tag, nc_fname)
954 call nf_verify(nf90_enddef(ncid), nc_fname)
958 dbl1d(1:nvals) => dbl3d(:, :, k)
959 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
968 dbl1d(1:nvals) => dbl3d(:, :, k)
969 call nf_verify(nf90_put_var(ncid, &
970 var_ids%export(k), dbl1d, &
972 count=(/nvals, 1/)), nc_fname)
981 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
982 chunk_face, nc_fname)
983 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
984 integer(I4B),
intent(in) :: ncid
987 type(
distype),
pointer,
intent(in) :: dis
989 character(len=*),
intent(in) :: mempath
990 character(len=*),
intent(in) :: nc_tag
991 character(len=*),
intent(in) :: pkgname
992 character(len=*),
intent(in) :: gridmap_name
993 integer(I4B),
intent(in) :: deflate
994 integer(I4B),
intent(in) :: shuffle
995 integer(I4B),
intent(in) :: chunk_face
996 character(len=*),
intent(in) :: nc_fname
997 integer(I4B) :: var_id, nvals
998 character(len=LINELENGTH) :: longname, varname
999 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1003 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath)
1006 call nf_verify(nf90_redef(ncid), nc_fname)
1007 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1008 (/dim_ids%nmesh_face/), var_id), &
1012 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1014 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1017 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1018 (/nf90_fill_double/)), nc_fname)
1019 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1020 longname), nc_fname)
1027 call nf_verify(nf90_enddef(ncid), nc_fname)
1028 nvals = dis%nrow * dis%ncol
1029 dbl1d(1:nvals) => p_mem
1030 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), nc_fname)
1036 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
1037 chunk_face, nc_fname)
1038 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
1039 integer(I4B),
intent(in) :: ncid
1042 type(
distype),
pointer,
intent(in) :: dis
1044 character(len=*),
intent(in) :: mempath
1045 character(len=*),
intent(in) :: nc_tag
1046 character(len=*),
intent(in) :: pkgname
1047 character(len=*),
intent(in) :: gridmap_name
1048 integer(I4B),
intent(in) :: deflate
1049 integer(I4B),
intent(in) :: shuffle
1050 integer(I4B),
intent(in) :: chunk_face
1051 character(len=*),
intent(in) :: nc_fname
1052 integer(I4B),
dimension(:),
allocatable :: var_id
1053 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1054 character(len=LINELENGTH) :: longname, varname
1055 integer(I4B) :: k, nvals
1058 nvals = dis%nrow * dis%ncol
1060 allocate (var_id(dis%nlay))
1063 call nf_verify(nf90_redef(ncid), nc_fname)
1070 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1071 (/dim_ids%nmesh_face/), var_id(k)), &
1075 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1077 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1080 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1081 (/nf90_fill_double/)), nc_fname)
1082 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1083 longname), nc_fname)
1091 call nf_verify(nf90_enddef(ncid), nc_fname)
1093 dbl1d(1:nvals) => p_mem(:, :, k)
1094 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
subroutine, public dis_transform_xy(x, y, xorigin, yorigin, angrot, xglo, yglo)
Get global (x, y) coordinates from cell-local coordinates.
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_dbl2d(p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D double
subroutine nc_export_int1d(p_mem, ncid, dim_ids, x_dim, y_dim, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, iper, nc_fname)
netcdf export 1D integer
subroutine define_dim(this)
netcdf export define dimensions
subroutine add_mesh_data(this)
netcdf export add mesh information
subroutine nc_export_dbl3d(p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, nc_fname)
netcdf export 3D double
subroutine nc_export_int2d(p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D integer
subroutine dis_export_init(this, modelname, modeltype, modelfname, nc_fname, disenum, nctype, iout)
netcdf export dis init
subroutine step(this)
netcdf export step
subroutine package_step(this, export_pkg)
netcdf export package dynamic input
subroutine dis_export_destroy(this)
netcdf export dis destroy
subroutine nc_export_int3d(p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, nc_fname)
netcdf export 3D integer
subroutine nc_export_dbl1d(p_mem, ncid, dim_ids, x_dim, y_dim, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, iper, iaux, nc_fname)
netcdf export 1D 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.
subroutine, public ncvar_mf6attr(ncid, varid, layer, iaux, nc_tag, nc_fname)
put variable internal attributes
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
This module contains the NCModelExportModule.
character(len=linelength) function, public export_varname(pkgname, tagname, mempath, layer, iaux)
build netcdf variable name
character(len=linelength) function, public export_longname(longname, pkgname, tagname, mempath, layer, iaux)
build netcdf variable longname
This module contains the NetCDFCommonModule.
integer(i4b) function, public ixstp()
step index for timeseries data
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