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()
101 call this%define_dependent()
104 call nf_verify(nf90_enddef(this%ncid), this%nc_fname)
106 call this%add_mesh_data()
109 call this%add_pkg_data()
112 call this%define_gridmap()
114 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
123 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
124 integer(I4B) :: n, k, nvals, istp
125 integer(I4B),
dimension(2) :: dis_shape
126 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
135 dis_shape(1) = this%dis%ncol * this%dis%nrow
136 dis_shape(2) = this%dis%nlay
138 nvals = product(dis_shape)
141 if (
size(this%dis%nodeuser) < &
142 size(this%dis%nodereduced))
then
144 allocate (dbl1d(
size(this%dis%nodereduced)))
150 do n = 1,
size(this%dis%nodereduced)
151 if (this%dis%nodereduced(n) > 0)
then
152 dbl1d(n) = this%x(this%dis%nodereduced(n))
156 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => dbl1d(1:nvals)
158 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => this%x(1:nvals)
161 do k = 1, this%dis%nlay
164 this%var_ids%dependent(k), dbl2d(:, k), &
166 count=(/(this%dis%ncol * this%dis%nrow), 1/)), &
171 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
172 totim, start=(/istp/)), &
175 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
178 if (
associated(dbl1d))
deallocate (dbl1d)
192 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
193 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d, nodes
194 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
195 character(len=LINELENGTH) :: nc_tag
196 integer(I4B) :: iaux, iparam, nvals
203 call export_pkg%update_state()
206 do iparam = 1, export_pkg%nparam
208 if (.not. export_pkg%param_state(iparam)) cycle
213 export_pkg%mf6_input%component_type, &
214 export_pkg%mf6_input%subcomponent_type, &
215 'PERIOD', export_pkg%param_names(iparam),
'')
218 nc_tag = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
222 select case (idt%datatype)
224 call mem_setptr(int1d, idt%mf6varname, export_pkg%mf6_input%mempath)
225 this%var_ids%export(1) = export_pkg%varids_param(iparam, 1)
227 this%y_dim, this%var_ids, this%dis, idt, &
228 export_pkg%mf6_input%mempath, nc_tag, &
229 export_pkg%mf6_input%subcomponent_name, &
230 this%gridmap_name, this%deflate, this%shuffle, &
231 this%chunk_face,
kper, this%nc_fname)
233 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
234 select case (idt%shape)
236 this%var_ids%export(1) = export_pkg%varids_param(iparam, 1)
238 this%y_dim, this%var_ids, this%dis, idt, &
239 export_pkg%mf6_input%mempath, nc_tag, &
240 export_pkg%mf6_input%subcomponent_name, &
241 this%gridmap_name, this%deflate, this%shuffle, &
242 this%chunk_face,
kper, iaux, this%nc_fname)
244 nvals = this%dis%nodesuser
245 allocate (nodes(nvals))
247 do k = 1, this%dis%nlay
248 this%var_ids%export(k) = export_pkg%varids_param(iparam, k)
250 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
251 call export_pkg%user_nodes(dbl1d, nodes)
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 if (.not. export_pkg%aux_state(iaux)) cycle
269 this%var_ids%export(1) = export_pkg%varids_aux(iaux, 1)
271 nodes(n) = dbl2d(iaux, n)
274 this%y_dim, this%var_ids, this%dis, idt, &
275 export_pkg%mf6_input%mempath, nc_tag, &
276 export_pkg%mf6_input%subcomponent_name, &
277 this%gridmap_name, this%deflate, this%shuffle, &
278 this%chunk_face,
kper, iaux, this%nc_fname)
282 nvals = this%dis%nodesuser
283 allocate (nodes(nvals))
284 do iaux = 1,
size(dbl2d, dim=1)
285 if (.not. export_pkg%aux_state(iaux)) cycle
287 do k = 1, this%dis%nlay
288 this%var_ids%export(k) = export_pkg%varids_aux(iaux, k)
290 call export_pkg%user_nodes(dbl2d(iaux, :), nodes)
292 this%y_dim, this%var_ids, this%dis, idt, &
293 export_pkg%mf6_input%mempath, nc_tag, &
294 export_pkg%mf6_input%subcomponent_name, &
295 this%gridmap_name, this%deflate, this%shuffle, &
296 this%chunk_face,
kper, iaux, this%nc_fname)
308 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
314 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time_bnds, &
316 start=(/1,
kper/), count=(/2, 1/)), &
319 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time_bnds, &
325 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
332 character(len=*),
intent(in) :: pkgtype
333 character(len=*),
intent(in) :: pkgname
334 character(len=*),
intent(in) :: mempath
336 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
337 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
338 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
339 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
340 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
341 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
342 character(len=LINELENGTH) :: nc_tag
343 integer(I4B) :: iper, iaux
349 nc_tag = this%input_attribute(pkgname, idt)
351 select case (idt%datatype)
353 call mem_setptr(int1d, idt%mf6varname, mempath)
355 this%y_dim, this%var_ids, this%dis, idt, mempath, &
356 nc_tag, pkgname, this%gridmap_name, this%deflate, &
357 this%shuffle, this%chunk_face, iper, this%nc_fname)
359 call mem_setptr(int2d, idt%mf6varname, mempath)
361 this%dis, idt, mempath, nc_tag, pkgname, &
362 this%gridmap_name, this%deflate, this%shuffle, &
363 this%chunk_face, this%nc_fname)
365 call mem_setptr(int3d, idt%mf6varname, mempath)
367 this%dis, idt, mempath, nc_tag, pkgname, &
368 this%gridmap_name, this%deflate, this%shuffle, &
369 this%chunk_face, this%nc_fname)
371 call mem_setptr(dbl1d, idt%mf6varname, mempath)
373 this%y_dim, this%var_ids, this%dis, idt, mempath, &
374 nc_tag, pkgname, this%gridmap_name, this%deflate, &
375 this%shuffle, this%chunk_face, iper, iaux, &
378 call mem_setptr(dbl2d, idt%mf6varname, mempath)
380 this%dis, idt, mempath, nc_tag, pkgname, &
381 this%gridmap_name, this%deflate, this%shuffle, &
382 this%chunk_face, this%nc_fname)
384 call mem_setptr(dbl3d, idt%mf6varname, mempath)
386 this%dis, idt, mempath, nc_tag, pkgname, &
387 this%gridmap_name, this%deflate, this%shuffle, &
388 this%chunk_face, this%nc_fname)
401 character(len=LINELENGTH) :: varname
402 character(len=LINELENGTH) :: elev_longname
406 call nf_verify(nf90_def_dim(this%ncid,
'time', this%totnstp, &
407 this%dim_ids%time), this%nc_fname)
408 call nf_verify(nf90_def_var(this%ncid,
'time', nf90_double, &
409 this%dim_ids%time, this%var_ids%time), &
411 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'calendar', &
412 'standard'), this%nc_fname)
413 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'units', &
414 this%datetime), this%nc_fname)
415 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'axis',
'T'), &
417 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'standard_name', &
418 'time'), this%nc_fname)
419 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'long_name', &
420 'time'), this%nc_fname)
423 call nf_verify(nf90_def_dim(this%ncid,
'bnd', 2, this%dim_ids%bnd), &
425 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'bounds', &
426 'time_bnds'), this%nc_fname)
427 call nf_verify(nf90_def_var(this%ncid,
'time_bnds', nf90_double, &
428 (/this%dim_ids%bnd, this%dim_ids%time/), &
429 this%var_ids%time_bnds), this%nc_fname)
434 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_node', &
435 ((this%dis%ncol + 1) * (this%dis%nrow + 1)), &
436 this%dim_ids%nmesh_node), this%nc_fname)
437 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_face', &
438 (this%dis%ncol * this%dis%nrow), &
439 this%dim_ids%nmesh_face), this%nc_fname)
440 call nf_verify(nf90_def_dim(this%ncid,
'max_nmesh_face_nodes', 4, &
441 this%dim_ids%max_nmesh_face_nodes), &
445 call nf_verify(nf90_def_dim(this%ncid,
'x', this%dis%ncol, &
446 this%x_dim), this%nc_fname)
447 call nf_verify(nf90_def_dim(this%ncid,
'y', this%dis%nrow, &
448 this%y_dim), this%nc_fname)
451 call nf_verify(nf90_def_dim(this%ncid,
'layer', this%nlay, &
452 this%dim_ids%layer), this%nc_fname)
453 call nf_verify(nf90_def_var(this%ncid,
'layer', nf90_int, &
454 this%dim_ids%layer, this%var_ids%layer), &
456 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'units',
'1'), &
458 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'axis',
'Z'), &
460 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'positive', &
461 'down'), this%nc_fname)
462 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'long_name', &
463 'model layer'), this%nc_fname)
471 allocate (this%var_ids%elevation(this%nlay))
473 write (varname,
'(a,i0)')
'z_l', k
474 call nf_verify(nf90_def_var(this%ncid, trim(varname), nf90_double, &
475 (/this%dim_ids%nmesh_face/), &
476 this%var_ids%elevation(k)), this%nc_fname)
477 call ncvar_chunk(this%ncid, this%var_ids%elevation(k), this%chunk_face, &
479 call ncvar_deflate(this%ncid, this%var_ids%elevation(k), this%deflate, &
480 this%shuffle, this%nc_fname)
481 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
482 'units', this%lenunits), this%nc_fname)
483 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
484 'standard_name',
'altitude'), this%nc_fname)
485 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
486 'positive',
'up'), this%nc_fname)
487 write (elev_longname,
'(a,i0,a)')
'cell center elevation (layer ', &
489 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
490 'long_name', trim(elev_longname)), &
492 call ncvar_layer(this%ncid, this%var_ids%elevation(k), k, this%nc_fname)
501 integer(I4B) :: cnt, maxvert, m, k
502 integer(I4B),
dimension(:),
allocatable :: verts, layers
503 real(DP),
dimension(:),
allocatable :: bnds
505 real(DP) :: x, y, x_transform, y_transform
506 real(DP),
dimension(:),
allocatable :: node_x, node_y
507 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
508 real(DP),
dimension(:),
allocatable :: elev_face
514 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
518 allocate (layers(this%nlay))
522 call nf_verify(nf90_put_var(this%ncid, this%var_ids%layer, layers), &
527 allocate (verts(maxvert))
528 allocate (bnds(maxvert))
529 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
530 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
531 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
532 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
536 node_x = nf90_fill_double
537 node_y = nf90_fill_double
538 y = sum(this%dis%delc)
539 do j = this%dis%nrow, 0, -1
541 do i = this%dis%ncol, 0, -1
547 x_transform, y_transform)
548 node_x(cnt) = x_transform
549 node_y(cnt) = y_transform
550 if (i > 0) x = x + this%dis%delr(i)
552 if (j > 0) y = y - this%dis%delc(j)
556 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
558 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
563 cell_x = nf90_fill_double
564 cell_y = nf90_fill_double
565 do j = 1, this%dis%nrow
566 y = this%dis%celly(j)
567 do i = 1, this%dis%ncol
568 x = this%dis%cellx(i)
573 x_transform, y_transform)
574 cell_x(cnt) = x_transform
575 cell_y(cnt) = y_transform
581 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
583 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
589 allocate (elev_face((this%dis%ncol * this%dis%nrow)))
592 do j = 1, this%dis%nrow
593 do i = 1, this%dis%ncol
595 elev_face(cnt) = (this%dis%top2d(i, j) + &
596 this%dis%bot3d(i, j, k)) * dhalf
598 elev_face(cnt) = (this%dis%bot3d(i, j, k - 1) + &
599 this%dis%bot3d(i, j, k)) * dhalf
604 call nf_verify(nf90_put_var(this%ncid, this%var_ids%elevation(k), &
605 elev_face), this%nc_fname)
607 deallocate (elev_face)
611 do i = 1, this%dis%nrow
612 do j = 1, this%dis%ncol
614 verts = nf90_fill_int
615 verts(1) = cnt + this%dis%ncol + i
616 verts(2) = cnt + this%dis%ncol + i + 1
619 verts(4) = cnt + i - 1
626 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
627 verts, start=(/1, cnt/), &
628 count=(/maxvert, 1/)), &
632 bnds = nf90_fill_double
634 if (verts(m) /= nf90_fill_int)
then
635 bnds(m) = node_y(verts(m))
638 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
639 bnds, start=(/1, cnt/), &
640 count=(/maxvert, 1/)), &
645 bnds = nf90_fill_double
647 if (verts(m) /= nf90_fill_int)
then
648 bnds(m) = node_x(verts(m))
651 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
652 bnds, start=(/1, cnt/), &
653 count=(/maxvert, 1/)), &
671 idt, mempath, nc_tag, pkgname, gridmap_name, &
672 deflate, shuffle, chunk_face, iper, nc_fname)
674 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
675 integer(I4B),
intent(in) :: ncid
677 integer(I4B),
intent(in) :: x_dim
678 integer(I4B),
intent(in) :: y_dim
680 type(
distype),
pointer,
intent(in) :: dis
682 character(len=*),
intent(in) :: mempath
683 character(len=*),
intent(in) :: nc_tag
684 character(len=*),
intent(in) :: pkgname
685 character(len=*),
intent(in) :: gridmap_name
686 integer(I4B),
intent(in) :: deflate
687 integer(I4B),
intent(in) :: shuffle
688 integer(I4B),
intent(in) :: chunk_face
689 integer(I4B),
intent(in) :: iper
690 character(len=*),
intent(in) :: nc_fname
691 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
692 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
693 integer(I4B) :: axis_dim, nvals, k
694 integer(I4B),
dimension(:),
allocatable :: var_id
695 character(len=LINELENGTH) :: longname, varname
697 if (idt%shape ==
'NROW' .or. &
698 idt%shape ==
'NCOL' .or. &
699 idt%shape ==
'NCPL' .or. &
700 idt%shape ==
'NAUX NCPL')
then
704 select case (idt%shape)
709 case (
'NCPL',
'NAUX NCPL')
710 axis_dim = dim_ids%nmesh_face
714 varname = export_varname(pkgname, idt%tagname, mempath)
715 longname = export_longname(idt%longname, pkgname, idt%tagname, mempath, &
716 component_type=idt%component_type, &
717 subcomponent_type=idt%subcomponent_type)
722 call nf_verify(nf90_redef(ncid), nc_fname)
723 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
724 (/axis_dim/), var_id(1)), &
728 if (axis_dim == dim_ids%nmesh_face)
then
729 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
731 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
734 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
735 (/nf90_fill_int/)), nc_fname)
736 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
740 if (axis_dim == dim_ids%nmesh_face)
then
741 call ncvar_gridmap(ncid, var_id(1), gridmap_name, 0, nc_fname)
748 call nf_verify(nf90_enddef(ncid), nc_fname)
749 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
752 nvals = dis%nrow * dis%ncol
754 var_ids%export(1), p_mem, &
756 count=(/nvals, 1/)), nc_fname)
761 int3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
764 nvals = dis%nrow * dis%ncol
768 allocate (var_id(dis%nlay))
771 call nf_verify(nf90_redef(ncid), nc_fname)
774 varname = export_varname(pkgname, idt%tagname, mempath, &
776 longname = export_longname(idt%longname, pkgname, idt%tagname, &
778 component_type=idt%component_type, &
779 subcomponent_type=idt%subcomponent_type)
781 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
782 (/dim_ids%nmesh_face/), var_id(k)), &
786 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
788 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
791 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
792 (/nf90_fill_int/)), nc_fname)
793 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
797 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
802 call nf_verify(nf90_enddef(ncid), nc_fname)
804 int1d(1:nvals) => int3d(:, :, k)
805 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
813 int1d(1:nvals) => int3d(:, :, k)
815 var_ids%export(k), int1d, &
817 count=(/nvals, 1/)), nc_fname)
826 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
827 chunk_face, nc_fname)
828 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
829 integer(I4B),
intent(in) :: ncid
832 type(
distype),
pointer,
intent(in) :: dis
834 character(len=*),
intent(in) :: mempath
835 character(len=*),
intent(in) :: nc_tag
836 character(len=*),
intent(in) :: pkgname
837 character(len=*),
intent(in) :: gridmap_name
838 integer(I4B),
intent(in) :: deflate
839 integer(I4B),
intent(in) :: shuffle
840 integer(I4B),
intent(in) :: chunk_face
841 character(len=*),
intent(in) :: nc_fname
842 integer(I4B) :: var_id, nvals
843 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
844 character(len=LINELENGTH) :: longname, varname
847 varname = export_varname(pkgname, idt%tagname, mempath)
848 longname = export_longname(idt%longname, pkgname, idt%tagname, mempath, &
849 component_type=idt%component_type, &
850 subcomponent_type=idt%subcomponent_type)
853 call nf_verify(nf90_redef(ncid), nc_fname)
854 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
855 (/dim_ids%nmesh_face/), var_id), &
859 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
864 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
865 (/nf90_fill_int/)), nc_fname)
866 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
874 call nf_verify(nf90_enddef(ncid), nc_fname)
875 nvals = dis%nrow * dis%ncol
876 int1d(1:nvals) => p_mem
877 call nf_verify(nf90_put_var(ncid, var_id, int1d), nc_fname)
883 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
884 chunk_face, nc_fname)
885 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
886 integer(I4B),
intent(in) :: ncid
889 type(
distype),
pointer,
intent(in) :: dis
891 character(len=*),
intent(in) :: mempath
892 character(len=*),
intent(in) :: nc_tag
893 character(len=*),
intent(in) :: pkgname
894 character(len=*),
intent(in) :: gridmap_name
895 integer(I4B),
intent(in) :: deflate
896 integer(I4B),
intent(in) :: shuffle
897 integer(I4B),
intent(in) :: chunk_face
898 character(len=*),
intent(in) :: nc_fname
899 integer(I4B),
dimension(:),
allocatable :: var_id
900 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
901 character(len=LINELENGTH) :: longname, varname
902 integer(I4B) :: k, nvals
904 allocate (var_id(dis%nlay))
907 call nf_verify(nf90_redef(ncid), nc_fname)
910 varname = export_varname(pkgname, idt%tagname, mempath, layer=k)
911 longname = export_longname(idt%longname, pkgname, idt%tagname, &
913 component_type=idt%component_type, &
914 subcomponent_type=idt%subcomponent_type)
916 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
917 (/dim_ids%nmesh_face/), var_id(k)), &
921 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
923 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
926 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
927 (/nf90_fill_int/)), nc_fname)
928 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
932 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
937 call nf_verify(nf90_enddef(ncid), nc_fname)
938 nvals = dis%nrow * dis%ncol
940 int1d(1:nvals) => p_mem(:, :, k)
941 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
951 idt, mempath, nc_tag, pkgname, gridmap_name, &
952 deflate, shuffle, chunk_face, iper, iaux, nc_fname)
954 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
955 integer(I4B),
intent(in) :: ncid
957 integer(I4B),
intent(in) :: x_dim
958 integer(I4B),
intent(in) :: y_dim
960 type(
distype),
pointer,
intent(in) :: dis
962 character(len=*),
intent(in) :: mempath
963 character(len=*),
intent(in) :: nc_tag
964 character(len=*),
intent(in) :: pkgname
965 character(len=*),
intent(in) :: gridmap_name
966 integer(I4B),
intent(in) :: deflate
967 integer(I4B),
intent(in) :: shuffle
968 integer(I4B),
intent(in) :: chunk_face
969 integer(I4B),
intent(in) :: iper
970 integer(I4B),
intent(in) :: iaux
971 character(len=*),
intent(in) :: nc_fname
972 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
973 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
974 integer(I4B) :: axis_dim, nvals, k
975 integer(I4B),
dimension(:),
allocatable :: var_id
976 character(len=LINELENGTH) :: longname, varname
978 if (idt%shape ==
'NROW' .or. &
979 idt%shape ==
'NCOL' .or. &
980 idt%shape ==
'NCPL' .or. &
981 idt%shape ==
'NAUX NCPL')
then
985 select case (idt%shape)
990 case (
'NCPL',
'NAUX NCPL')
991 axis_dim = dim_ids%nmesh_face
995 varname = export_varname(pkgname, idt%tagname, mempath, iaux=iaux)
996 longname = export_longname(idt%longname, pkgname, idt%tagname, &
997 mempath, iaux=iaux, &
998 component_type=idt%component_type, &
999 subcomponent_type=idt%subcomponent_type)
1001 allocate (var_id(1))
1004 call nf_verify(nf90_redef(ncid), nc_fname)
1005 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1006 (/axis_dim/), var_id(1)), &
1010 if (axis_dim == dim_ids%nmesh_face)
then
1011 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
1013 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
1016 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
1017 (/nf90_fill_double/)), nc_fname)
1018 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
1019 longname), nc_fname)
1022 if (axis_dim == dim_ids%nmesh_face)
then
1023 call ncvar_gridmap(ncid, var_id(1), gridmap_name, 0, nc_fname)
1027 call ncvar_mf6attr(ncid, var_id(1), 0, iaux, nc_tag, nc_fname)
1030 call nf_verify(nf90_enddef(ncid), nc_fname)
1031 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
1034 nvals = dis%nrow * dis%ncol
1036 var_ids%export(1), p_mem, &
1037 start=(/1,
kper/), &
1038 count=(/nvals, 1/)), nc_fname)
1043 dbl3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
1046 nvals = dis%nrow * dis%ncol
1052 allocate (var_id(dis%nlay))
1055 call nf_verify(nf90_redef(ncid), nc_fname)
1058 varname = export_varname(pkgname, idt%tagname, mempath, layer=k, &
1060 longname = export_longname(idt%longname, pkgname, idt%tagname, &
1061 mempath, layer=k, iaux=iaux, &
1062 component_type=idt%component_type, &
1063 subcomponent_type=idt%subcomponent_type)
1066 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1067 (/dim_ids%nmesh_face/), var_id(k)), &
1071 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1073 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1076 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1077 (/nf90_fill_double/)), nc_fname)
1078 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1079 longname), nc_fname)
1082 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
1083 call ncvar_mf6attr(ncid, var_id(k), k, iaux, nc_tag, nc_fname)
1087 call nf_verify(nf90_enddef(ncid), nc_fname)
1091 dbl1d(1:nvals) => dbl3d(:, :, k)
1092 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
1100 dbl1d(1:nvals) => dbl3d(:, :, k)
1102 var_ids%export(k), dbl1d, &
1103 start=(/1,
kper/), &
1104 count=(/nvals, 1/)), nc_fname)
1113 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
1114 chunk_face, nc_fname)
1115 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
1116 integer(I4B),
intent(in) :: ncid
1119 type(
distype),
pointer,
intent(in) :: dis
1121 character(len=*),
intent(in) :: mempath
1122 character(len=*),
intent(in) :: nc_tag
1123 character(len=*),
intent(in) :: pkgname
1124 character(len=*),
intent(in) :: gridmap_name
1125 integer(I4B),
intent(in) :: deflate
1126 integer(I4B),
intent(in) :: shuffle
1127 integer(I4B),
intent(in) :: chunk_face
1128 character(len=*),
intent(in) :: nc_fname
1129 integer(I4B) :: var_id, nvals
1130 character(len=LINELENGTH) :: longname, varname
1131 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1134 varname = export_varname(pkgname, idt%tagname, mempath)
1135 longname = export_longname(idt%longname, pkgname, idt%tagname, mempath, &
1136 component_type=idt%component_type, &
1137 subcomponent_type=idt%subcomponent_type)
1140 call nf_verify(nf90_redef(ncid), nc_fname)
1141 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1142 (/dim_ids%nmesh_face/), var_id), &
1146 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1148 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1151 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1152 (/nf90_fill_double/)), nc_fname)
1153 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1154 longname), nc_fname)
1161 call nf_verify(nf90_enddef(ncid), nc_fname)
1162 nvals = dis%nrow * dis%ncol
1163 dbl1d(1:nvals) => p_mem
1164 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), nc_fname)
1170 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
1171 chunk_face, nc_fname)
1172 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
1173 integer(I4B),
intent(in) :: ncid
1176 type(
distype),
pointer,
intent(in) :: dis
1178 character(len=*),
intent(in) :: mempath
1179 character(len=*),
intent(in) :: nc_tag
1180 character(len=*),
intent(in) :: pkgname
1181 character(len=*),
intent(in) :: gridmap_name
1182 integer(I4B),
intent(in) :: deflate
1183 integer(I4B),
intent(in) :: shuffle
1184 integer(I4B),
intent(in) :: chunk_face
1185 character(len=*),
intent(in) :: nc_fname
1186 integer(I4B),
dimension(:),
allocatable :: var_id
1187 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1188 character(len=LINELENGTH) :: longname, varname
1189 integer(I4B) :: k, nvals
1192 nvals = dis%nrow * dis%ncol
1194 allocate (var_id(dis%nlay))
1197 call nf_verify(nf90_redef(ncid), nc_fname)
1200 varname = export_varname(pkgname, idt%tagname, mempath, layer=k)
1201 longname = export_longname(idt%longname, pkgname, idt%tagname, &
1203 component_type=idt%component_type, &
1204 subcomponent_type=idt%subcomponent_type)
1206 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1207 (/dim_ids%nmesh_face/), var_id(k)), &
1211 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1213 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1216 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1217 (/nf90_fill_double/)), nc_fname)
1218 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1219 longname), nc_fname)
1222 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
1227 call nf_verify(nf90_enddef(ncid), nc_fname)
1229 dbl1d(1:nvals) => p_mem(:, :, k)
1230 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
@ dis
DIS6 discretization.
real(dp), parameter dhalf
real constant 1/2
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, found)
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, layer, nc_fname)
put variable gridmap attributes
subroutine, public ncvar_chunk(ncid, varid, chunk_face, nc_fname)
define variable chunking
subroutine, public ncvar_layer(ncid, varid, layer, nc_fname)
put the layer attribute (only when layer > 0)
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, component_type, subcomponent_type)
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), dimension(:), pointer, public, contiguous perlen
length of each stress period
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