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)
395 call nf_verify(nf90_def_dim(this%ncid,
'time', this%totnstp, &
396 this%dim_ids%time), this%nc_fname)
397 call nf_verify(nf90_def_var(this%ncid,
'time', nf90_double, &
398 this%dim_ids%time, this%var_ids%time), &
400 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'calendar', &
401 'standard'), this%nc_fname)
402 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'units', &
403 this%datetime), this%nc_fname)
404 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'axis',
'T'), &
406 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'standard_name', &
407 'time'), this%nc_fname)
408 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'long_name', &
409 'time'), this%nc_fname)
413 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_node', &
414 ((this%dis%ncol + 1) * (this%dis%nrow + 1)), &
415 this%dim_ids%nmesh_node), this%nc_fname)
416 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_face', &
417 (this%dis%ncol * this%dis%nrow), &
418 this%dim_ids%nmesh_face), this%nc_fname)
419 call nf_verify(nf90_def_dim(this%ncid,
'max_nmesh_face_nodes', 4, &
420 this%dim_ids%max_nmesh_face_nodes), &
424 call nf_verify(nf90_def_dim(this%ncid,
'x', this%dis%ncol, &
425 this%x_dim), this%nc_fname)
426 call nf_verify(nf90_def_dim(this%ncid,
'y', this%dis%nrow, &
427 this%y_dim), this%nc_fname)
430 call nf_verify(nf90_def_dim(this%ncid,
'layer', this%nlay, &
431 this%dim_ids%layer), this%nc_fname)
432 call nf_verify(nf90_def_var(this%ncid,
'layer', nf90_int, &
433 this%dim_ids%layer, this%var_ids%layer), &
435 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'units',
'1'), &
437 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'axis',
'Z'), &
439 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'positive', &
440 'down'), this%nc_fname)
441 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'long_name', &
442 'model layer'), this%nc_fname)
450 integer(I4B) :: cnt, maxvert, m, k
451 integer(I4B),
dimension(:),
allocatable :: verts, layers
452 real(DP),
dimension(:),
allocatable :: bnds
454 real(DP) :: x, y, x_transform, y_transform
455 real(DP),
dimension(:),
allocatable :: node_x, node_y
456 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
462 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
466 allocate (layers(this%nlay))
470 call nf_verify(nf90_put_var(this%ncid, this%var_ids%layer, layers), &
475 allocate (verts(maxvert))
476 allocate (bnds(maxvert))
477 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
478 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
479 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
480 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
484 node_x = nf90_fill_double
485 node_y = nf90_fill_double
486 y = sum(this%dis%delc)
487 do j = this%dis%nrow, 0, -1
489 do i = this%dis%ncol, 0, -1
495 x_transform, y_transform)
496 node_x(cnt) = x_transform
497 node_y(cnt) = y_transform
498 if (i > 0) x = x + this%dis%delr(i)
500 if (j > 0) y = y - this%dis%delc(j)
504 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
506 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
511 cell_x = nf90_fill_double
512 cell_y = nf90_fill_double
513 do j = 1, this%dis%nrow
514 y = this%dis%celly(j)
515 do i = 1, this%dis%ncol
516 x = this%dis%cellx(i)
521 x_transform, y_transform)
522 cell_x(cnt) = x_transform
523 cell_y(cnt) = y_transform
529 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
531 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
536 do i = 1, this%dis%nrow
537 do j = 1, this%dis%ncol
539 verts = nf90_fill_int
540 verts(1) = cnt + this%dis%ncol + i
541 verts(2) = cnt + this%dis%ncol + i + 1
544 verts(4) = cnt + i - 1
551 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
552 verts, start=(/1, cnt/), &
553 count=(/maxvert, 1/)), &
557 bnds = nf90_fill_double
559 if (verts(m) /= nf90_fill_int)
then
560 bnds(m) = node_y(verts(m))
563 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
564 bnds, start=(/1, cnt/), &
565 count=(/maxvert, 1/)), &
570 bnds = nf90_fill_double
572 if (verts(m) /= nf90_fill_int)
then
573 bnds(m) = node_x(verts(m))
576 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
577 bnds, start=(/1, cnt/), &
578 count=(/maxvert, 1/)), &
596 idt, mempath, nc_tag, pkgname, gridmap_name, &
597 deflate, shuffle, chunk_face, iper, nc_fname)
599 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
600 integer(I4B),
intent(in) :: ncid
602 integer(I4B),
intent(in) :: x_dim
603 integer(I4B),
intent(in) :: y_dim
605 type(
distype),
pointer,
intent(in) :: dis
607 character(len=*),
intent(in) :: mempath
608 character(len=*),
intent(in) :: nc_tag
609 character(len=*),
intent(in) :: pkgname
610 character(len=*),
intent(in) :: gridmap_name
611 integer(I4B),
intent(in) :: deflate
612 integer(I4B),
intent(in) :: shuffle
613 integer(I4B),
intent(in) :: chunk_face
614 integer(I4B),
intent(in) :: iper
615 character(len=*),
intent(in) :: nc_fname
616 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
617 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
618 integer(I4B) :: axis_dim, nvals, k
619 integer(I4B),
dimension(:),
allocatable :: var_id
620 character(len=LINELENGTH) :: longname, varname
622 if (idt%shape ==
'NROW' .or. &
623 idt%shape ==
'NCOL' .or. &
624 idt%shape ==
'NCPL' .or. &
625 idt%shape ==
'NAUX NCPL')
then
629 select case (idt%shape)
634 case (
'NCPL',
'NAUX NCPL')
635 axis_dim = dim_ids%nmesh_face
640 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath, &
641 component_type=idt%component_type, &
642 subcomponent_type=idt%subcomponent_type)
647 call nf_verify(nf90_redef(ncid), nc_fname)
648 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
649 (/axis_dim/), var_id(1)), &
653 if (axis_dim == dim_ids%nmesh_face)
then
654 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
656 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
659 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
660 (/nf90_fill_int/)), nc_fname)
661 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
665 if (axis_dim == dim_ids%nmesh_face)
then
673 call nf_verify(nf90_enddef(ncid), nc_fname)
674 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
677 nvals = dis%nrow * dis%ncol
679 var_ids%export(1), p_mem, &
681 count=(/nvals, 1/)), nc_fname)
686 int3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
689 nvals = dis%nrow * dis%ncol
693 allocate (var_id(dis%nlay))
696 call nf_verify(nf90_redef(ncid), nc_fname)
703 component_type=idt%component_type, &
704 subcomponent_type=idt%subcomponent_type)
706 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
707 (/dim_ids%nmesh_face/), var_id(k)), &
711 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
713 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
716 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
717 (/nf90_fill_int/)), nc_fname)
718 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
727 call nf_verify(nf90_enddef(ncid), nc_fname)
729 int1d(1:nvals) => int3d(:, :, k)
730 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
738 int1d(1:nvals) => int3d(:, :, k)
740 var_ids%export(k), int1d, &
742 count=(/nvals, 1/)), nc_fname)
751 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
752 chunk_face, nc_fname)
753 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
754 integer(I4B),
intent(in) :: ncid
757 type(
distype),
pointer,
intent(in) :: dis
759 character(len=*),
intent(in) :: mempath
760 character(len=*),
intent(in) :: nc_tag
761 character(len=*),
intent(in) :: pkgname
762 character(len=*),
intent(in) :: gridmap_name
763 integer(I4B),
intent(in) :: deflate
764 integer(I4B),
intent(in) :: shuffle
765 integer(I4B),
intent(in) :: chunk_face
766 character(len=*),
intent(in) :: nc_fname
767 integer(I4B) :: var_id, nvals
768 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
769 character(len=LINELENGTH) :: longname, varname
773 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath, &
774 component_type=idt%component_type, &
775 subcomponent_type=idt%subcomponent_type)
778 call nf_verify(nf90_redef(ncid), nc_fname)
779 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
780 (/dim_ids%nmesh_face/), var_id), &
784 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
789 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
790 (/nf90_fill_int/)), nc_fname)
791 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
799 call nf_verify(nf90_enddef(ncid), nc_fname)
800 nvals = dis%nrow * dis%ncol
801 int1d(1:nvals) => p_mem
802 call nf_verify(nf90_put_var(ncid, var_id, int1d), 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),
dimension(:),
allocatable :: var_id
825 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
826 character(len=LINELENGTH) :: longname, varname
827 integer(I4B) :: k, nvals
829 allocate (var_id(dis%nlay))
832 call nf_verify(nf90_redef(ncid), nc_fname)
838 component_type=idt%component_type, &
839 subcomponent_type=idt%subcomponent_type)
841 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
842 (/dim_ids%nmesh_face/), var_id(k)), &
846 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
848 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
851 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
852 (/nf90_fill_int/)), nc_fname)
853 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
862 call nf_verify(nf90_enddef(ncid), nc_fname)
863 nvals = dis%nrow * dis%ncol
865 int1d(1:nvals) => p_mem(:, :, k)
866 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
876 idt, mempath, nc_tag, pkgname, gridmap_name, &
877 deflate, shuffle, chunk_face, iper, iaux, nc_fname)
879 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
880 integer(I4B),
intent(in) :: ncid
882 integer(I4B),
intent(in) :: x_dim
883 integer(I4B),
intent(in) :: y_dim
885 type(
distype),
pointer,
intent(in) :: dis
887 character(len=*),
intent(in) :: mempath
888 character(len=*),
intent(in) :: nc_tag
889 character(len=*),
intent(in) :: pkgname
890 character(len=*),
intent(in) :: gridmap_name
891 integer(I4B),
intent(in) :: deflate
892 integer(I4B),
intent(in) :: shuffle
893 integer(I4B),
intent(in) :: chunk_face
894 integer(I4B),
intent(in) :: iper
895 integer(I4B),
intent(in) :: iaux
896 character(len=*),
intent(in) :: nc_fname
897 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
898 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
899 integer(I4B) :: axis_dim, nvals, k
900 integer(I4B),
dimension(:),
allocatable :: var_id
901 character(len=LINELENGTH) :: longname, varname
903 if (idt%shape ==
'NROW' .or. &
904 idt%shape ==
'NCOL' .or. &
905 idt%shape ==
'NCPL' .or. &
906 idt%shape ==
'NAUX NCPL')
then
910 select case (idt%shape)
915 case (
'NCPL',
'NAUX NCPL')
916 axis_dim = dim_ids%nmesh_face
920 varname =
export_varname(pkgname, idt%tagname, mempath, iaux=iaux)
922 mempath, iaux=iaux, &
923 component_type=idt%component_type, &
924 subcomponent_type=idt%subcomponent_type)
929 call nf_verify(nf90_redef(ncid), nc_fname)
930 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
931 (/axis_dim/), var_id(1)), &
935 if (axis_dim == dim_ids%nmesh_face)
then
936 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
938 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
941 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
942 (/nf90_fill_double/)), nc_fname)
943 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
947 if (axis_dim == dim_ids%nmesh_face)
then
952 call ncvar_mf6attr(ncid, var_id(1), 0, iaux, nc_tag, nc_fname)
955 call nf_verify(nf90_enddef(ncid), nc_fname)
956 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
959 nvals = dis%nrow * dis%ncol
961 var_ids%export(1), p_mem, &
963 count=(/nvals, 1/)), nc_fname)
968 dbl3d(1:dis%ncol, 1:dis%nrow, 1:dis%nlay) => p_mem(1:dis%nodesuser)
971 nvals = dis%nrow * dis%ncol
977 allocate (var_id(dis%nlay))
980 call nf_verify(nf90_redef(ncid), nc_fname)
983 varname =
export_varname(pkgname, idt%tagname, mempath, layer=k, &
986 mempath, layer=k, iaux=iaux, &
987 component_type=idt%component_type, &
988 subcomponent_type=idt%subcomponent_type)
991 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
992 (/dim_ids%nmesh_face/), var_id(k)), &
996 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
998 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1001 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1002 (/nf90_fill_double/)), nc_fname)
1003 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1004 longname), nc_fname)
1008 call ncvar_mf6attr(ncid, var_id(k), k, iaux, nc_tag, nc_fname)
1012 call nf_verify(nf90_enddef(ncid), nc_fname)
1016 dbl1d(1:nvals) => dbl3d(:, :, k)
1017 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
1025 dbl1d(1:nvals) => dbl3d(:, :, k)
1027 var_ids%export(k), dbl1d, &
1028 start=(/1,
kper/), &
1029 count=(/nvals, 1/)), nc_fname)
1038 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
1039 chunk_face, nc_fname)
1040 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
1041 integer(I4B),
intent(in) :: ncid
1044 type(
distype),
pointer,
intent(in) :: dis
1046 character(len=*),
intent(in) :: mempath
1047 character(len=*),
intent(in) :: nc_tag
1048 character(len=*),
intent(in) :: pkgname
1049 character(len=*),
intent(in) :: gridmap_name
1050 integer(I4B),
intent(in) :: deflate
1051 integer(I4B),
intent(in) :: shuffle
1052 integer(I4B),
intent(in) :: chunk_face
1053 character(len=*),
intent(in) :: nc_fname
1054 integer(I4B) :: var_id, nvals
1055 character(len=LINELENGTH) :: longname, varname
1056 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1060 longname =
export_longname(idt%longname, pkgname, idt%tagname, mempath, &
1061 component_type=idt%component_type, &
1062 subcomponent_type=idt%subcomponent_type)
1065 call nf_verify(nf90_redef(ncid), nc_fname)
1066 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1067 (/dim_ids%nmesh_face/), var_id), &
1071 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1073 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1076 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1077 (/nf90_fill_double/)), nc_fname)
1078 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1079 longname), nc_fname)
1086 call nf_verify(nf90_enddef(ncid), nc_fname)
1087 nvals = dis%nrow * dis%ncol
1088 dbl1d(1:nvals) => p_mem
1089 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), 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),
dimension(:),
allocatable :: var_id
1112 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1113 character(len=LINELENGTH) :: longname, varname
1114 integer(I4B) :: k, nvals
1117 nvals = dis%nrow * dis%ncol
1119 allocate (var_id(dis%nlay))
1122 call nf_verify(nf90_redef(ncid), nc_fname)
1128 component_type=idt%component_type, &
1129 subcomponent_type=idt%subcomponent_type)
1131 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1132 (/dim_ids%nmesh_face/), var_id(k)), &
1136 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1138 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1141 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1142 (/nf90_fill_double/)), nc_fname)
1143 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1144 longname), nc_fname)
1152 call nf_verify(nf90_enddef(ncid), nc_fname)
1154 dbl1d(1:nvals) => p_mem(:, :, k)
1155 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, 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, 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, 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