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,
'x', this%dis%ncol, &
414 this%x_dim), this%nc_fname)
415 call nf_verify(nf90_def_dim(this%ncid,
'y', this%dis%nrow, &
416 this%y_dim), this%nc_fname)
424 integer(I4B) :: cnt, maxvert, m
425 integer(I4B),
dimension(:),
allocatable :: verts
426 real(DP),
dimension(:),
allocatable :: bnds
428 real(DP) :: x, y, x_transform, y_transform
429 real(DP),
dimension(:),
allocatable :: node_x, node_y
430 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
436 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
440 allocate (verts(maxvert))
441 allocate (bnds(maxvert))
442 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
443 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
444 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
445 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
449 node_x = nf90_fill_double
450 node_y = nf90_fill_double
451 y = sum(this%dis%delc)
452 do j = this%dis%nrow, 0, -1
454 do i = this%dis%ncol, 0, -1
460 x_transform, y_transform)
461 node_x(cnt) = x_transform
462 node_y(cnt) = y_transform
463 if (i > 0) x = x + this%dis%delr(i)
465 if (j > 0) y = y - this%dis%delc(j)
469 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
471 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
476 cell_x = nf90_fill_double
477 cell_y = nf90_fill_double
478 do j = 1, this%dis%nrow
479 y = this%dis%celly(j)
480 do i = 1, this%dis%ncol
481 x = this%dis%cellx(i)
486 x_transform, y_transform)
487 cell_x(cnt) = x_transform
488 cell_y(cnt) = y_transform
494 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
496 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
501 do i = 1, this%dis%nrow
502 do j = 1, this%dis%ncol
504 verts = nf90_fill_int
505 verts(1) = cnt + this%dis%ncol + i
506 verts(2) = cnt + this%dis%ncol + i + 1
509 verts(4) = cnt + i - 1
516 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
517 verts, start=(/1, cnt/), &
518 count=(/maxvert, 1/)), &
522 bnds = nf90_fill_double
524 if (verts(m) /= nf90_fill_int)
then
525 bnds(m) = node_y(verts(m))
528 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
529 bnds, start=(/1, cnt/), &
530 count=(/maxvert, 1/)), &
535 bnds = nf90_fill_double
537 if (verts(m) /= nf90_fill_int)
then
538 bnds(m) = node_x(verts(m))
541 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
542 bnds, start=(/1, cnt/), &
543 count=(/maxvert, 1/)), &
561 idt, mempath, nc_tag, pkgname, gridmap_name, &
562 deflate, shuffle, chunk_face, iper, nc_fname)
564 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
565 integer(I4B),
intent(in) :: ncid
567 integer(I4B),
intent(in) :: x_dim
568 integer(I4B),
intent(in) :: y_dim
570 type(
distype),
pointer,
intent(in) :: dis
572 character(len=*),
intent(in) :: mempath
573 character(len=*),
intent(in) :: nc_tag
574 character(len=*),
intent(in) :: pkgname
575 character(len=*),
intent(in) :: gridmap_name
576 integer(I4B),
intent(in) :: deflate
577 integer(I4B),
intent(in) :: shuffle
578 integer(I4B),
intent(in) :: chunk_face
579 integer(I4B),
intent(in) :: iper
580 character(len=*),
intent(in) :: nc_fname
581 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
582 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
583 integer(I4B) :: axis_dim, nvals, k, istp
584 integer(I4B),
dimension(:),
allocatable :: var_id
585 character(len=LINELENGTH) :: longname, varname
587 if (idt%shape ==
'NROW' .or. &
588 idt%shape ==
'NCOL' .or. &
589 idt%shape ==
'NCPL' .or. &
590 idt%shape ==
'NAUX NCPL')
then
594 select case (idt%shape)
599 case (
'NCPL',
'NAUX NCPL')
600 axis_dim = dim_ids%nmesh_face
605 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath)
610 call nf_verify(nf90_redef(ncid), nc_fname)
611 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
612 (/axis_dim/), var_id(1)), &
616 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
619 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
620 (/nf90_fill_int/)), nc_fname)
621 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
628 call nf_verify(nf90_enddef(ncid), nc_fname)
629 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
633 nvals = dis%nrow * dis%ncol
634 call nf_verify(nf90_put_var(ncid, &
635 var_ids%export(1), p_mem, &
637 count=(/nvals, 1/)), nc_fname)
642 int3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
645 nvals = dis%nrow * dis%ncol
649 allocate (var_id(dis%nlay))
652 call nf_verify(nf90_redef(ncid), nc_fname)
660 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
661 (/dim_ids%nmesh_face/), var_id(k)), &
665 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
667 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
670 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
671 (/nf90_fill_int/)), nc_fname)
672 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
681 call nf_verify(nf90_enddef(ncid), nc_fname)
683 int1d(1:nvals) => int3d(:, :, k)
684 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
693 int1d(1:nvals) => int3d(:, :, k)
694 call nf_verify(nf90_put_var(ncid, &
695 var_ids%export(k), int1d, &
697 count=(/nvals, 1/)), nc_fname)
706 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
707 chunk_face, nc_fname)
708 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
709 integer(I4B),
intent(in) :: ncid
712 type(
distype),
pointer,
intent(in) :: dis
714 character(len=*),
intent(in) :: mempath
715 character(len=*),
intent(in) :: nc_tag
716 character(len=*),
intent(in) :: pkgname
717 character(len=*),
intent(in) :: gridmap_name
718 integer(I4B),
intent(in) :: deflate
719 integer(I4B),
intent(in) :: shuffle
720 integer(I4B),
intent(in) :: chunk_face
721 character(len=*),
intent(in) :: nc_fname
722 integer(I4B) :: var_id, nvals
723 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
724 character(len=LINELENGTH) :: longname, varname
728 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath)
731 call nf_verify(nf90_redef(ncid), nc_fname)
732 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
733 (/dim_ids%nmesh_face/), var_id), &
737 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
742 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
743 (/nf90_fill_int/)), nc_fname)
744 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
752 call nf_verify(nf90_enddef(ncid), nc_fname)
753 nvals = dis%nrow * dis%ncol
754 int1d(1:nvals) => p_mem
755 call nf_verify(nf90_put_var(ncid, var_id, int1d), nc_fname)
761 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
762 chunk_face, nc_fname)
763 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
764 integer(I4B),
intent(in) :: ncid
767 type(
distype),
pointer,
intent(in) :: dis
769 character(len=*),
intent(in) :: mempath
770 character(len=*),
intent(in) :: nc_tag
771 character(len=*),
intent(in) :: pkgname
772 character(len=*),
intent(in) :: gridmap_name
773 integer(I4B),
intent(in) :: deflate
774 integer(I4B),
intent(in) :: shuffle
775 integer(I4B),
intent(in) :: chunk_face
776 character(len=*),
intent(in) :: nc_fname
777 integer(I4B),
dimension(:),
allocatable :: var_id
778 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
779 character(len=LINELENGTH) :: longname, varname
780 integer(I4B) :: k, nvals
782 allocate (var_id(dis%nlay))
785 call nf_verify(nf90_redef(ncid), nc_fname)
792 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
793 (/dim_ids%nmesh_face/), var_id(k)), &
797 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
799 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
802 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
803 (/nf90_fill_int/)), nc_fname)
804 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
813 call nf_verify(nf90_enddef(ncid), nc_fname)
814 nvals = dis%nrow * dis%ncol
816 int1d(1:nvals) => p_mem(:, :, k)
817 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
827 idt, mempath, nc_tag, pkgname, gridmap_name, &
828 deflate, shuffle, chunk_face, iper, iaux, nc_fname)
830 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
831 integer(I4B),
intent(in) :: ncid
833 integer(I4B),
intent(in) :: x_dim
834 integer(I4B),
intent(in) :: y_dim
836 type(
distype),
pointer,
intent(in) :: dis
838 character(len=*),
intent(in) :: mempath
839 character(len=*),
intent(in) :: nc_tag
840 character(len=*),
intent(in) :: pkgname
841 character(len=*),
intent(in) :: gridmap_name
842 integer(I4B),
intent(in) :: deflate
843 integer(I4B),
intent(in) :: shuffle
844 integer(I4B),
intent(in) :: chunk_face
845 integer(I4B),
intent(in) :: iper
846 integer(I4B),
intent(in) :: iaux
847 character(len=*),
intent(in) :: nc_fname
848 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
849 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
850 integer(I4B) :: axis_dim, nvals, k, istp
851 integer(NF90_INT),
dimension(:),
allocatable :: var_id
852 character(len=LINELENGTH) :: longname, varname
854 if (idt%shape ==
'NROW' .or. &
855 idt%shape ==
'NCOL' .or. &
856 idt%shape ==
'NCPL' .or. &
857 idt%shape ==
'NAUX NCPL')
then
861 select case (idt%shape)
866 case (
'NCPL',
'NAUX NCPL')
867 axis_dim = dim_ids%nmesh_face
871 varname =
export_varname(pkgname, idt%tagname, mempath, iaux=iaux)
878 call nf_verify(nf90_redef(ncid), nc_fname)
879 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
880 (/axis_dim/), var_id(1)), &
884 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
887 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
888 (/nf90_fill_double/)), nc_fname)
889 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
893 call ncvar_mf6attr(ncid, var_id(1), 0, iaux, nc_tag, nc_fname)
896 call nf_verify(nf90_enddef(ncid), nc_fname)
897 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
901 nvals = dis%nrow * dis%ncol
902 call nf_verify(nf90_put_var(ncid, &
903 var_ids%export(1), p_mem, &
905 count=(/nvals, 1/)), nc_fname)
910 dbl3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
913 nvals = dis%nrow * dis%ncol
919 allocate (var_id(dis%nlay))
922 call nf_verify(nf90_redef(ncid), nc_fname)
925 varname =
export_varname(pkgname, idt%tagname, mempath, layer=k, &
928 mempath, layer=k, iaux=iaux)
931 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
932 (/dim_ids%nmesh_face/), var_id(k)), &
936 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
938 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
941 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
942 (/nf90_fill_double/)), nc_fname)
943 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
948 call ncvar_mf6attr(ncid, var_id(k), k, iaux, nc_tag, nc_fname)
952 call nf_verify(nf90_enddef(ncid), nc_fname)
956 dbl1d(1:nvals) => dbl3d(:, :, k)
957 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
966 dbl1d(1:nvals) => dbl3d(:, :, k)
967 call nf_verify(nf90_put_var(ncid, &
968 var_ids%export(k), dbl1d, &
970 count=(/nvals, 1/)), nc_fname)
979 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
980 chunk_face, nc_fname)
981 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
982 integer(I4B),
intent(in) :: ncid
985 type(
distype),
pointer,
intent(in) :: dis
987 character(len=*),
intent(in) :: mempath
988 character(len=*),
intent(in) :: nc_tag
989 character(len=*),
intent(in) :: pkgname
990 character(len=*),
intent(in) :: gridmap_name
991 integer(I4B),
intent(in) :: deflate
992 integer(I4B),
intent(in) :: shuffle
993 integer(I4B),
intent(in) :: chunk_face
994 character(len=*),
intent(in) :: nc_fname
995 integer(I4B) :: var_id, nvals
996 character(len=LINELENGTH) :: longname, varname
997 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1001 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath)
1004 call nf_verify(nf90_redef(ncid), nc_fname)
1005 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1006 (/dim_ids%nmesh_face/), var_id), &
1010 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1012 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1015 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1016 (/nf90_fill_double/)), nc_fname)
1017 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1018 longname), nc_fname)
1025 call nf_verify(nf90_enddef(ncid), nc_fname)
1026 nvals = dis%nrow * dis%ncol
1027 dbl1d(1:nvals) => p_mem
1028 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), nc_fname)
1034 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
1035 chunk_face, nc_fname)
1036 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
1037 integer(I4B),
intent(in) :: ncid
1040 type(
distype),
pointer,
intent(in) :: dis
1042 character(len=*),
intent(in) :: mempath
1043 character(len=*),
intent(in) :: nc_tag
1044 character(len=*),
intent(in) :: pkgname
1045 character(len=*),
intent(in) :: gridmap_name
1046 integer(I4B),
intent(in) :: deflate
1047 integer(I4B),
intent(in) :: shuffle
1048 integer(I4B),
intent(in) :: chunk_face
1049 character(len=*),
intent(in) :: nc_fname
1050 integer(I4B),
dimension(:),
allocatable :: var_id
1051 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1052 character(len=LINELENGTH) :: longname, varname
1053 integer(I4B) :: k, nvals
1056 nvals = dis%nrow * dis%ncol
1058 allocate (var_id(dis%nlay))
1061 call nf_verify(nf90_redef(ncid), nc_fname)
1068 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1069 (/dim_ids%nmesh_face/), var_id(k)), &
1073 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1075 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1078 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1079 (/nf90_fill_double/)), nc_fname)
1080 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1081 longname), nc_fname)
1089 call nf_verify(nf90_enddef(ncid), nc_fname)
1091 dbl1d(1:nvals) => p_mem(:, :, k)
1092 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