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
198 integer(I4B),
pointer :: nbound
204 do iparam = 1, export_pkg%nparam
206 if (export_pkg%param_reads(iparam)%invar < 1) cycle
211 export_pkg%mf6_input%component_type, &
212 export_pkg%mf6_input%subcomponent_type, &
213 'PERIOD', export_pkg%param_names(iparam),
'')
216 nc_tag = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
220 select case (idt%datatype)
222 call mem_setptr(int1d, idt%mf6varname, export_pkg%mf6_input%mempath)
223 this%var_ids%export(1) = export_pkg%varids_param(iparam, 1)
225 this%y_dim, this%var_ids, this%dis, idt, &
226 export_pkg%mf6_input%mempath, nc_tag, &
227 export_pkg%mf6_input%subcomponent_name, &
228 this%gridmap_name, this%deflate, this%shuffle, &
229 this%chunk_face,
kper, this%nc_fname)
231 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
232 select case (idt%shape)
234 this%var_ids%export(1) = export_pkg%varids_param(iparam, 1)
236 this%y_dim, this%var_ids, this%dis, idt, &
237 export_pkg%mf6_input%mempath, nc_tag, &
238 export_pkg%mf6_input%subcomponent_name, &
239 this%gridmap_name, this%deflate, this%shuffle, &
240 this%chunk_face,
kper, iaux, this%nc_fname)
242 nvals = this%dis%nodesuser
243 allocate (nodes(nvals))
245 do k = 1, this%dis%nlay
246 this%var_ids%export(k) = export_pkg%varids_param(iparam, k)
248 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
249 call mem_setptr(int1d,
'NODEULIST', export_pkg%mf6_input%mempath)
250 call mem_setptr(nbound,
'NBOUND', export_pkg%mf6_input%mempath)
252 nodes(int1d(n)) = dbl1d(n)
255 this%y_dim, this%var_ids, this%dis, idt, &
256 export_pkg%mf6_input%mempath, nc_tag, &
257 export_pkg%mf6_input%subcomponent_name, &
258 this%gridmap_name, this%deflate, this%shuffle, &
259 this%chunk_face,
kper, iaux, this%nc_fname)
264 call mem_setptr(dbl2d, idt%mf6varname, export_pkg%mf6_input%mempath)
265 select case (idt%shape)
267 nvals = this%dis%nrow * this%dis%ncol
268 allocate (nodes(nvals))
269 do iaux = 1,
size(dbl2d, dim=1)
270 this%var_ids%export(1) = export_pkg%varids_aux(iaux, 1)
272 nodes(n) = dbl2d(iaux, n)
275 this%y_dim, this%var_ids, this%dis, idt, &
276 export_pkg%mf6_input%mempath, nc_tag, &
277 export_pkg%mf6_input%subcomponent_name, &
278 this%gridmap_name, this%deflate, this%shuffle, &
279 this%chunk_face,
kper, iaux, this%nc_fname)
283 nvals = this%dis%nodesuser
284 allocate (nodes(nvals))
285 call mem_setptr(int1d,
'NODEULIST', export_pkg%mf6_input%mempath)
286 call mem_setptr(nbound,
'NBOUND', export_pkg%mf6_input%mempath)
287 do iaux = 1,
size(dbl2d, dim=1)
289 do k = 1, this%dis%nlay
290 this%var_ids%export(k) = export_pkg%varids_aux(iaux, k)
293 nodes(int1d(n)) = dbl2d(iaux, n)
296 this%y_dim, this%var_ids, this%dis, idt, &
297 export_pkg%mf6_input%mempath, nc_tag, &
298 export_pkg%mf6_input%subcomponent_name, &
299 this%gridmap_name, this%deflate, this%shuffle, &
300 this%chunk_face,
kper, iaux, this%nc_fname)
312 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
317 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
324 character(len=*),
intent(in) :: pkgtype
325 character(len=*),
intent(in) :: pkgname
326 character(len=*),
intent(in) :: mempath
328 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
329 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
330 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
331 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
332 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
333 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
334 character(len=LINELENGTH) :: nc_tag
335 integer(I4B) :: iper, iaux
341 nc_tag = this%input_attribute(pkgname, idt)
343 select case (idt%datatype)
345 call mem_setptr(int1d, idt%mf6varname, mempath)
347 this%y_dim, this%var_ids, this%dis, idt, mempath, &
348 nc_tag, pkgname, this%gridmap_name, this%deflate, &
349 this%shuffle, this%chunk_face, iper, this%nc_fname)
351 call mem_setptr(int2d, idt%mf6varname, mempath)
353 this%dis, idt, mempath, nc_tag, pkgname, &
354 this%gridmap_name, this%deflate, this%shuffle, &
355 this%chunk_face, this%nc_fname)
357 call mem_setptr(int3d, idt%mf6varname, mempath)
359 this%dis, idt, mempath, nc_tag, pkgname, &
360 this%gridmap_name, this%deflate, this%shuffle, &
361 this%chunk_face, this%nc_fname)
363 call mem_setptr(dbl1d, idt%mf6varname, mempath)
365 this%y_dim, this%var_ids, this%dis, idt, mempath, &
366 nc_tag, pkgname, this%gridmap_name, this%deflate, &
367 this%shuffle, this%chunk_face, iper, iaux, &
370 call mem_setptr(dbl2d, idt%mf6varname, mempath)
372 this%dis, idt, mempath, nc_tag, pkgname, &
373 this%gridmap_name, this%deflate, this%shuffle, &
374 this%chunk_face, this%nc_fname)
376 call mem_setptr(dbl3d, idt%mf6varname, mempath)
378 this%dis, idt, mempath, nc_tag, pkgname, &
379 this%gridmap_name, this%deflate, this%shuffle, &
380 this%chunk_face, this%nc_fname)
393 character(len=LINELENGTH) :: varname
394 character(len=LINELENGTH) :: elev_longname
398 call nf_verify(nf90_def_dim(this%ncid,
'time', this%totnstp, &
399 this%dim_ids%time), this%nc_fname)
400 call nf_verify(nf90_def_var(this%ncid,
'time', nf90_double, &
401 this%dim_ids%time, this%var_ids%time), &
403 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'calendar', &
404 'standard'), this%nc_fname)
405 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'units', &
406 this%datetime), this%nc_fname)
407 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'axis',
'T'), &
409 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'standard_name', &
410 'time'), this%nc_fname)
411 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'long_name', &
412 'time'), this%nc_fname)
416 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_node', &
417 ((this%dis%ncol + 1) * (this%dis%nrow + 1)), &
418 this%dim_ids%nmesh_node), this%nc_fname)
419 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_face', &
420 (this%dis%ncol * this%dis%nrow), &
421 this%dim_ids%nmesh_face), this%nc_fname)
422 call nf_verify(nf90_def_dim(this%ncid,
'max_nmesh_face_nodes', 4, &
423 this%dim_ids%max_nmesh_face_nodes), &
427 call nf_verify(nf90_def_dim(this%ncid,
'x', this%dis%ncol, &
428 this%x_dim), this%nc_fname)
429 call nf_verify(nf90_def_dim(this%ncid,
'y', this%dis%nrow, &
430 this%y_dim), this%nc_fname)
433 call nf_verify(nf90_def_dim(this%ncid,
'layer', this%nlay, &
434 this%dim_ids%layer), this%nc_fname)
435 call nf_verify(nf90_def_var(this%ncid,
'layer', nf90_int, &
436 this%dim_ids%layer, this%var_ids%layer), &
438 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'units',
'1'), &
440 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'axis',
'Z'), &
442 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'positive', &
443 'down'), this%nc_fname)
444 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'long_name', &
445 'model layer'), this%nc_fname)
453 allocate (this%var_ids%elevation(this%nlay))
455 write (varname,
'(a,i0)')
'z_l', k
456 call nf_verify(nf90_def_var(this%ncid, trim(varname), nf90_double, &
457 (/this%dim_ids%nmesh_face/), &
458 this%var_ids%elevation(k)), this%nc_fname)
459 call ncvar_chunk(this%ncid, this%var_ids%elevation(k), this%chunk_face, &
461 call ncvar_deflate(this%ncid, this%var_ids%elevation(k), this%deflate, &
462 this%shuffle, this%nc_fname)
463 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
464 'units', this%lenunits), this%nc_fname)
465 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
466 'standard_name',
'altitude'), this%nc_fname)
467 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
468 'positive',
'up'), this%nc_fname)
469 write (elev_longname,
'(a,i0,a)')
'cell center elevation (layer ', &
471 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
472 'long_name', trim(elev_longname)), &
474 call ncvar_layer(this%ncid, this%var_ids%elevation(k), k, this%nc_fname)
483 integer(I4B) :: cnt, maxvert, m, k
484 integer(I4B),
dimension(:),
allocatable :: verts, layers
485 real(DP),
dimension(:),
allocatable :: bnds
487 real(DP) :: x, y, x_transform, y_transform
488 real(DP),
dimension(:),
allocatable :: node_x, node_y
489 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
490 real(DP),
dimension(:),
allocatable :: elev_face
496 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
500 allocate (layers(this%nlay))
504 call nf_verify(nf90_put_var(this%ncid, this%var_ids%layer, layers), &
509 allocate (verts(maxvert))
510 allocate (bnds(maxvert))
511 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
512 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
513 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
514 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
518 node_x = nf90_fill_double
519 node_y = nf90_fill_double
520 y = sum(this%dis%delc)
521 do j = this%dis%nrow, 0, -1
523 do i = this%dis%ncol, 0, -1
529 x_transform, y_transform)
530 node_x(cnt) = x_transform
531 node_y(cnt) = y_transform
532 if (i > 0) x = x + this%dis%delr(i)
534 if (j > 0) y = y - this%dis%delc(j)
538 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
540 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
545 cell_x = nf90_fill_double
546 cell_y = nf90_fill_double
547 do j = 1, this%dis%nrow
548 y = this%dis%celly(j)
549 do i = 1, this%dis%ncol
550 x = this%dis%cellx(i)
555 x_transform, y_transform)
556 cell_x(cnt) = x_transform
557 cell_y(cnt) = y_transform
563 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
565 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
571 allocate (elev_face((this%dis%ncol * this%dis%nrow)))
574 do j = 1, this%dis%nrow
575 do i = 1, this%dis%ncol
577 elev_face(cnt) = (this%dis%top2d(i, j) + &
578 this%dis%bot3d(i, j, k)) *
dhalf
580 elev_face(cnt) = (this%dis%bot3d(i, j, k - 1) + &
581 this%dis%bot3d(i, j, k)) *
dhalf
586 call nf_verify(nf90_put_var(this%ncid, this%var_ids%elevation(k), &
587 elev_face), this%nc_fname)
589 deallocate (elev_face)
593 do i = 1, this%dis%nrow
594 do j = 1, this%dis%ncol
596 verts = nf90_fill_int
597 verts(1) = cnt + this%dis%ncol + i
598 verts(2) = cnt + this%dis%ncol + i + 1
601 verts(4) = cnt + i - 1
608 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
609 verts, start=(/1, cnt/), &
610 count=(/maxvert, 1/)), &
614 bnds = nf90_fill_double
616 if (verts(m) /= nf90_fill_int)
then
617 bnds(m) = node_y(verts(m))
620 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
621 bnds, start=(/1, cnt/), &
622 count=(/maxvert, 1/)), &
627 bnds = nf90_fill_double
629 if (verts(m) /= nf90_fill_int)
then
630 bnds(m) = node_x(verts(m))
633 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
634 bnds, start=(/1, cnt/), &
635 count=(/maxvert, 1/)), &
653 idt, mempath, nc_tag, pkgname, gridmap_name, &
654 deflate, shuffle, chunk_face, iper, nc_fname)
656 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
657 integer(I4B),
intent(in) :: ncid
659 integer(I4B),
intent(in) :: x_dim
660 integer(I4B),
intent(in) :: y_dim
662 type(
distype),
pointer,
intent(in) :: dis
664 character(len=*),
intent(in) :: mempath
665 character(len=*),
intent(in) :: nc_tag
666 character(len=*),
intent(in) :: pkgname
667 character(len=*),
intent(in) :: gridmap_name
668 integer(I4B),
intent(in) :: deflate
669 integer(I4B),
intent(in) :: shuffle
670 integer(I4B),
intent(in) :: chunk_face
671 integer(I4B),
intent(in) :: iper
672 character(len=*),
intent(in) :: nc_fname
673 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
674 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
675 integer(I4B) :: axis_dim, nvals, k
676 integer(I4B),
dimension(:),
allocatable :: var_id
677 character(len=LINELENGTH) :: longname, varname
679 if (idt%shape ==
'NROW' .or. &
680 idt%shape ==
'NCOL' .or. &
681 idt%shape ==
'NCPL' .or. &
682 idt%shape ==
'NAUX NCPL')
then
686 select case (idt%shape)
691 case (
'NCPL',
'NAUX NCPL')
692 axis_dim = dim_ids%nmesh_face
697 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath, &
698 component_type=idt%component_type, &
699 subcomponent_type=idt%subcomponent_type)
704 call nf_verify(nf90_redef(ncid), nc_fname)
705 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
706 (/axis_dim/), var_id(1)), &
710 if (axis_dim == dim_ids%nmesh_face)
then
711 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
713 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
716 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
717 (/nf90_fill_int/)), nc_fname)
718 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
722 if (axis_dim == dim_ids%nmesh_face)
then
723 call ncvar_gridmap(ncid, var_id(1), gridmap_name, 0, nc_fname)
730 call nf_verify(nf90_enddef(ncid), nc_fname)
731 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
734 nvals = dis%nrow * dis%ncol
736 var_ids%export(1), p_mem, &
738 count=(/nvals, 1/)), nc_fname)
743 int3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
746 nvals = dis%nrow * dis%ncol
750 allocate (var_id(dis%nlay))
753 call nf_verify(nf90_redef(ncid), nc_fname)
760 component_type=idt%component_type, &
761 subcomponent_type=idt%subcomponent_type)
763 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
764 (/dim_ids%nmesh_face/), var_id(k)), &
768 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
770 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
773 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
774 (/nf90_fill_int/)), nc_fname)
775 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
779 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
784 call nf_verify(nf90_enddef(ncid), nc_fname)
786 int1d(1:nvals) => int3d(:, :, k)
787 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
795 int1d(1:nvals) => int3d(:, :, k)
797 var_ids%export(k), int1d, &
799 count=(/nvals, 1/)), nc_fname)
808 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
809 chunk_face, nc_fname)
810 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
811 integer(I4B),
intent(in) :: ncid
814 type(
distype),
pointer,
intent(in) :: dis
816 character(len=*),
intent(in) :: mempath
817 character(len=*),
intent(in) :: nc_tag
818 character(len=*),
intent(in) :: pkgname
819 character(len=*),
intent(in) :: gridmap_name
820 integer(I4B),
intent(in) :: deflate
821 integer(I4B),
intent(in) :: shuffle
822 integer(I4B),
intent(in) :: chunk_face
823 character(len=*),
intent(in) :: nc_fname
824 integer(I4B) :: var_id, nvals
825 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
826 character(len=LINELENGTH) :: longname, varname
830 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath, &
831 component_type=idt%component_type, &
832 subcomponent_type=idt%subcomponent_type)
835 call nf_verify(nf90_redef(ncid), nc_fname)
836 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
837 (/dim_ids%nmesh_face/), var_id), &
841 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
846 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
847 (/nf90_fill_int/)), nc_fname)
848 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
856 call nf_verify(nf90_enddef(ncid), nc_fname)
857 nvals = dis%nrow * dis%ncol
858 int1d(1:nvals) => p_mem
859 call nf_verify(nf90_put_var(ncid, var_id, int1d), nc_fname)
865 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
866 chunk_face, nc_fname)
867 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
868 integer(I4B),
intent(in) :: ncid
871 type(
distype),
pointer,
intent(in) :: dis
873 character(len=*),
intent(in) :: mempath
874 character(len=*),
intent(in) :: nc_tag
875 character(len=*),
intent(in) :: pkgname
876 character(len=*),
intent(in) :: gridmap_name
877 integer(I4B),
intent(in) :: deflate
878 integer(I4B),
intent(in) :: shuffle
879 integer(I4B),
intent(in) :: chunk_face
880 character(len=*),
intent(in) :: nc_fname
881 integer(I4B),
dimension(:),
allocatable :: var_id
882 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
883 character(len=LINELENGTH) :: longname, varname
884 integer(I4B) :: k, nvals
886 allocate (var_id(dis%nlay))
889 call nf_verify(nf90_redef(ncid), nc_fname)
895 component_type=idt%component_type, &
896 subcomponent_type=idt%subcomponent_type)
898 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
899 (/dim_ids%nmesh_face/), var_id(k)), &
903 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
905 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
908 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
909 (/nf90_fill_int/)), nc_fname)
910 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
914 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
919 call nf_verify(nf90_enddef(ncid), nc_fname)
920 nvals = dis%nrow * dis%ncol
922 int1d(1:nvals) => p_mem(:, :, k)
923 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
933 idt, mempath, nc_tag, pkgname, gridmap_name, &
934 deflate, shuffle, chunk_face, iper, iaux, nc_fname)
936 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
937 integer(I4B),
intent(in) :: ncid
939 integer(I4B),
intent(in) :: x_dim
940 integer(I4B),
intent(in) :: y_dim
942 type(
distype),
pointer,
intent(in) :: dis
944 character(len=*),
intent(in) :: mempath
945 character(len=*),
intent(in) :: nc_tag
946 character(len=*),
intent(in) :: pkgname
947 character(len=*),
intent(in) :: gridmap_name
948 integer(I4B),
intent(in) :: deflate
949 integer(I4B),
intent(in) :: shuffle
950 integer(I4B),
intent(in) :: chunk_face
951 integer(I4B),
intent(in) :: iper
952 integer(I4B),
intent(in) :: iaux
953 character(len=*),
intent(in) :: nc_fname
954 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
955 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
956 integer(I4B) :: axis_dim, nvals, k
957 integer(I4B),
dimension(:),
allocatable :: var_id
958 character(len=LINELENGTH) :: longname, varname
960 if (idt%shape ==
'NROW' .or. &
961 idt%shape ==
'NCOL' .or. &
962 idt%shape ==
'NCPL' .or. &
963 idt%shape ==
'NAUX NCPL')
then
967 select case (idt%shape)
972 case (
'NCPL',
'NAUX NCPL')
973 axis_dim = dim_ids%nmesh_face
977 varname =
export_varname(pkgname, idt%tagname, mempath, iaux=iaux)
979 mempath, iaux=iaux, &
980 component_type=idt%component_type, &
981 subcomponent_type=idt%subcomponent_type)
986 call nf_verify(nf90_redef(ncid), nc_fname)
987 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
988 (/axis_dim/), var_id(1)), &
992 if (axis_dim == dim_ids%nmesh_face)
then
993 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
995 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
998 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
999 (/nf90_fill_double/)), nc_fname)
1000 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
1001 longname), nc_fname)
1004 if (axis_dim == dim_ids%nmesh_face)
then
1005 call ncvar_gridmap(ncid, var_id(1), gridmap_name, 0, nc_fname)
1009 call ncvar_mf6attr(ncid, var_id(1), 0, iaux, nc_tag, nc_fname)
1012 call nf_verify(nf90_enddef(ncid), nc_fname)
1013 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
1016 nvals = dis%nrow * dis%ncol
1018 var_ids%export(1), p_mem, &
1019 start=(/1,
kper/), &
1020 count=(/nvals, 1/)), nc_fname)
1025 dbl3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
1028 nvals = dis%nrow * dis%ncol
1034 allocate (var_id(dis%nlay))
1037 call nf_verify(nf90_redef(ncid), nc_fname)
1040 varname =
export_varname(pkgname, idt%tagname, mempath, layer=k, &
1043 mempath, layer=k, iaux=iaux, &
1044 component_type=idt%component_type, &
1045 subcomponent_type=idt%subcomponent_type)
1048 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1049 (/dim_ids%nmesh_face/), var_id(k)), &
1053 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1055 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1058 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1059 (/nf90_fill_double/)), nc_fname)
1060 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1061 longname), nc_fname)
1064 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
1065 call ncvar_mf6attr(ncid, var_id(k), k, iaux, nc_tag, nc_fname)
1069 call nf_verify(nf90_enddef(ncid), nc_fname)
1073 dbl1d(1:nvals) => dbl3d(:, :, k)
1074 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
1082 dbl1d(1:nvals) => dbl3d(:, :, k)
1084 var_ids%export(k), dbl1d, &
1085 start=(/1,
kper/), &
1086 count=(/nvals, 1/)), nc_fname)
1095 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
1096 chunk_face, nc_fname)
1097 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
1098 integer(I4B),
intent(in) :: ncid
1101 type(
distype),
pointer,
intent(in) :: dis
1103 character(len=*),
intent(in) :: mempath
1104 character(len=*),
intent(in) :: nc_tag
1105 character(len=*),
intent(in) :: pkgname
1106 character(len=*),
intent(in) :: gridmap_name
1107 integer(I4B),
intent(in) :: deflate
1108 integer(I4B),
intent(in) :: shuffle
1109 integer(I4B),
intent(in) :: chunk_face
1110 character(len=*),
intent(in) :: nc_fname
1111 integer(I4B) :: var_id, nvals
1112 character(len=LINELENGTH) :: longname, varname
1113 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1117 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath, &
1118 component_type=idt%component_type, &
1119 subcomponent_type=idt%subcomponent_type)
1122 call nf_verify(nf90_redef(ncid), nc_fname)
1123 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1124 (/dim_ids%nmesh_face/), var_id), &
1128 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1130 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1133 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1134 (/nf90_fill_double/)), nc_fname)
1135 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1136 longname), nc_fname)
1143 call nf_verify(nf90_enddef(ncid), nc_fname)
1144 nvals = dis%nrow * dis%ncol
1145 dbl1d(1:nvals) => p_mem
1146 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), nc_fname)
1152 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
1153 chunk_face, nc_fname)
1154 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
1155 integer(I4B),
intent(in) :: ncid
1158 type(
distype),
pointer,
intent(in) :: dis
1160 character(len=*),
intent(in) :: mempath
1161 character(len=*),
intent(in) :: nc_tag
1162 character(len=*),
intent(in) :: pkgname
1163 character(len=*),
intent(in) :: gridmap_name
1164 integer(I4B),
intent(in) :: deflate
1165 integer(I4B),
intent(in) :: shuffle
1166 integer(I4B),
intent(in) :: chunk_face
1167 character(len=*),
intent(in) :: nc_fname
1168 integer(I4B),
dimension(:),
allocatable :: var_id
1169 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1170 character(len=LINELENGTH) :: longname, varname
1171 integer(I4B) :: k, nvals
1174 nvals = dis%nrow * dis%ncol
1176 allocate (var_id(dis%nlay))
1179 call nf_verify(nf90_redef(ncid), nc_fname)
1185 component_type=idt%component_type, &
1186 subcomponent_type=idt%subcomponent_type)
1188 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1189 (/dim_ids%nmesh_face/), var_id(k)), &
1193 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1195 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1198 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1199 (/nf90_fill_double/)), nc_fname)
1200 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1201 longname), nc_fname)
1204 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
1209 call nf_verify(nf90_enddef(ncid), nc_fname)
1211 dbl1d(1:nvals) => p_mem(:, :, k)
1212 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 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), 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