53 disenum, nctype, iout)
56 character(len=*),
intent(in) :: modelname
57 character(len=*),
intent(in) :: modeltype
58 character(len=*),
intent(in) :: modelfname
59 character(len=*),
intent(in) :: nc_fname
60 integer(I4B),
intent(in) :: disenum
61 integer(I4B),
intent(in) :: nctype
62 integer(I4B),
intent(in) :: iout
65 this%nlay = this%dis%nlay
68 allocate (this%var_ids%dependent(this%nlay))
71 call this%mesh_init(modelname, modeltype, modelfname, nc_fname, disenum, &
72 nctype, this%dis%lenuni, iout)
79 deallocate (this%var_ids%dependent)
81 call this%mesh_destroy()
82 call this%NCModelExportType%destroy()
92 call this%add_global_att()
94 call this%define_dim()
96 call this%create_mesh()
99 call this%define_dependent()
102 call nf_verify(nf90_enddef(this%ncid), this%nc_fname)
104 call this%add_mesh_data()
106 call this%add_pkg_data()
108 call this%define_gridmap()
110 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
119 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
120 integer(I4B) :: n, k, nvals
121 integer(I4B),
dimension(2) :: dis_shape
122 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
129 this%stepcnt = this%stepcnt + 1
131 dis_shape(1) = this%dis%ncol * this%dis%nrow
132 dis_shape(2) = this%dis%nlay
134 nvals = product(dis_shape)
137 if (
size(this%dis%nodeuser) < &
138 size(this%dis%nodereduced))
then
140 allocate (dbl1d(
size(this%dis%nodereduced)))
146 do n = 1,
size(this%dis%nodereduced)
147 if (this%dis%nodereduced(n) > 0)
then
148 dbl1d(n) = this%x(this%dis%nodereduced(n))
152 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => dbl1d(1:nvals)
154 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => this%x(1:nvals)
157 do k = 1, this%dis%nlay
160 this%var_ids%dependent(k), dbl2d(:, k), &
161 start=(/1, this%stepcnt/), &
162 count=(/(this%dis%ncol * this%dis%nrow), 1/)), &
167 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
168 totim, start=(/this%stepcnt/)), &
171 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
174 if (
associated(dbl1d))
deallocate (dbl1d)
188 character(len=*),
intent(in) :: ilayer_varname
189 integer(I4B),
intent(in) :: ilayer
191 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
192 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
193 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
194 integer(I4B),
dimension(:),
pointer,
contiguous :: ialayer
195 real(DP),
dimension(:),
contiguous,
pointer :: dbl1d_ptr
196 character(len=LINELENGTH) :: nc_varname, input_attr
197 integer(I4B) :: n, iparam, nvals
198 logical(LGP) :: ilayer_read
202 ilayer_read = .false.
205 call mem_setptr(ialayer, export_pkg%param_names(ilayer), &
206 export_pkg%mf6_input%mempath)
209 if (export_pkg%param_reads(ilayer)%invar == 1)
then
214 do iparam = 1, export_pkg%nparam
216 if (export_pkg%param_reads(iparam)%invar < 1) cycle
221 export_pkg%mf6_input%component_type, &
222 export_pkg%mf6_input%subcomponent_type, &
223 'PERIOD', export_pkg%param_names(iparam),
'')
225 nc_varname = trim(export_pkg%mf6_input%subcomponent_name)//
'_'// &
227 input_attr = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
230 select case (idt%datatype)
232 call mem_setptr(int1d, idt%mf6varname, export_pkg%mf6_input%mempath)
233 call nc_export_int1d(this%ncid, this%dim_ids, this%x_dim, this%y_dim, &
234 this%var_ids, this%dis, int1d, nc_varname, &
235 export_pkg%mf6_input%subcomponent_name, &
236 idt%tagname, this%gridmap_name, idt%shape, &
237 idt%longname, input_attr, this%deflate, &
238 this%shuffle, this%chunk_face,
kper, this%nc_fname)
240 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
241 call this%export_layer_3d(export_pkg, idt, ilayer_read, ialayer, &
242 dbl1d, nc_varname, input_attr)
244 call mem_setptr(dbl2d, idt%mf6varname, export_pkg%mf6_input%mempath)
245 nvals = this%dis%ncol * this%dis%nrow
247 do n = 1,
size(dbl2d, dim=1)
248 dbl1d_ptr(1:nvals) => dbl2d(n, :)
249 if (all(dbl1d_ptr ==
dzero))
then
251 call this%export_layer_3d(export_pkg, idt, ilayer_read, ialayer, &
252 dbl1d_ptr, nc_varname, input_attr, n)
256 errmsg =
'EXPORT ilayaer unsupported datatype='//trim(idt%datatype)
262 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
271 errmsg =
'NetCDF period export not supported for model='// &
272 trim(this%modelname)//
', package='// &
273 trim(export_pkg%mf6_input%subcomponent_name)
277 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
283 dbl1d, nc_varname, input_attr, iaux)
289 logical(LGP),
intent(in) :: ilayer_read
290 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: ialayer
291 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: dbl1d
292 character(len=*),
intent(in) :: nc_varname
293 character(len=*),
intent(in) :: input_attr
294 integer(I4B),
optional,
intent(in) :: iaux
295 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
296 integer(I4B) :: n, i, j, k, nvals, idxaux
297 real(DP),
dimension(:, :),
contiguous,
pointer :: dbl2d_ptr
301 if (
present(iaux))
then
305 allocate (dbl3d(export_pkg%mshape(3), export_pkg%mshape(2), &
306 export_pkg%mshape(1)))
308 if (ilayer_read)
then
309 do k = 1,
size(dbl3d, dim=3)
311 do i = 1,
size(dbl3d, dim=2)
312 do j = 1,
size(dbl3d, dim=1)
314 if (ialayer(n) == k)
then
315 dbl3d(j, i, k) = dbl1d(n)
324 nvals = export_pkg%mshape(3) * export_pkg%mshape(2)
325 dbl2d_ptr(1:export_pkg%mshape(3), 1:export_pkg%mshape(2)) => dbl1d(1:nvals)
326 dbl3d(:, :, 1) = dbl2d_ptr(:, :)
329 call nc_export_dbl3d(this%ncid, this%dim_ids, this%var_ids, this%dis, dbl3d, &
330 nc_varname, export_pkg%mf6_input%subcomponent_name, &
331 idt%tagname, this%gridmap_name, idt%shape, &
332 idt%longname, input_attr, this%deflate, this%shuffle, &
333 this%chunk_face, export_pkg%iper, idxaux, this%nc_fname)
342 character(len=*),
intent(in) :: pkgtype
343 character(len=*),
intent(in) :: pkgname
344 character(len=*),
intent(in) :: mempath
346 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
347 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
348 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
349 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
350 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
351 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
352 character(len=LINELENGTH) :: nc_varname, input_attr
353 integer(I4B) :: iper, iaux
359 nc_varname = trim(pkgname)//
'_'//trim(idt%mf6varname)
361 input_attr = this%input_attribute(pkgname, idt)
363 select case (idt%datatype)
365 call mem_setptr(int1d, idt%mf6varname, mempath)
366 call nc_export_int1d(this%ncid, this%dim_ids, this%x_dim, this%y_dim, &
367 this%var_ids, this%dis, int1d, nc_varname, pkgname, &
368 idt%tagname, this%gridmap_name, idt%shape, &
369 idt%longname, input_attr, this%deflate, this%shuffle, &
370 this%chunk_face, iper, this%nc_fname)
372 call mem_setptr(int2d, idt%mf6varname, mempath)
373 call nc_export_int2d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
374 int2d, nc_varname, pkgname, idt%tagname, &
375 this%gridmap_name, idt%shape, idt%longname, &
376 input_attr, this%deflate, this%shuffle, &
377 this%chunk_face, this%nc_fname)
379 call mem_setptr(int3d, idt%mf6varname, mempath)
380 call nc_export_int3d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
381 int3d, nc_varname, pkgname, idt%tagname, &
382 this%gridmap_name, idt%shape, idt%longname, &
383 input_attr, this%deflate, this%shuffle, &
384 this%chunk_face, this%nc_fname)
386 call mem_setptr(dbl1d, idt%mf6varname, mempath)
387 call nc_export_dbl1d(this%ncid, this%dim_ids, this%x_dim, this%y_dim, &
388 this%var_ids, this%dis, dbl1d, nc_varname, pkgname, &
389 idt%tagname, this%gridmap_name, idt%shape, &
390 idt%longname, input_attr, this%deflate, this%shuffle, &
391 this%chunk_face, this%nc_fname)
393 call mem_setptr(dbl2d, idt%mf6varname, mempath)
394 call nc_export_dbl2d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
395 dbl2d, nc_varname, pkgname, idt%tagname, &
396 this%gridmap_name, idt%shape, idt%longname, &
397 input_attr, this%deflate, this%shuffle, &
398 this%chunk_face, this%nc_fname)
400 call mem_setptr(dbl3d, idt%mf6varname, mempath)
401 call nc_export_dbl3d(this%ncid, this%dim_ids, this%var_ids, this%dis, &
402 dbl3d, nc_varname, pkgname, idt%tagname, &
403 this%gridmap_name, idt%shape, idt%longname, &
404 input_attr, this%deflate, this%shuffle, &
405 this%chunk_face, iper, iaux, this%nc_fname)
420 call nf_verify(nf90_def_dim(this%ncid,
'time', this%totnstp, &
421 this%dim_ids%time), this%nc_fname)
422 call nf_verify(nf90_def_var(this%ncid,
'time', nf90_double, &
423 this%dim_ids%time, this%var_ids%time), &
425 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'calendar', &
426 'standard'), this%nc_fname)
427 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'units', &
428 this%datetime), this%nc_fname)
429 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'axis',
'T'), &
431 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'standard_name', &
432 'time'), this%nc_fname)
433 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'long_name', &
434 'time'), this%nc_fname)
438 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_node', &
439 ((this%dis%ncol + 1) * (this%dis%nrow + 1)), &
440 this%dim_ids%nmesh_node), this%nc_fname)
441 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_face', &
442 (this%dis%ncol * this%dis%nrow), &
443 this%dim_ids%nmesh_face), this%nc_fname)
444 call nf_verify(nf90_def_dim(this%ncid,
'max_nmesh_face_nodes', 4, &
445 this%dim_ids%max_nmesh_face_nodes), &
449 call nf_verify(nf90_def_dim(this%ncid,
'nlay', this%dis%nlay, &
450 this%dim_ids%nlay), this%nc_fname)
451 call nf_verify(nf90_def_dim(this%ncid,
'x', this%dis%ncol, &
452 this%x_dim), this%nc_fname)
453 call nf_verify(nf90_def_dim(this%ncid,
'y', this%dis%nrow, &
454 this%y_dim), this%nc_fname)
462 integer(I4B) :: cnt, maxvert, m
463 integer(I4B),
dimension(:),
allocatable :: verts
464 real(DP),
dimension(:),
allocatable :: bnds
466 real(DP) :: x, y, x_transform, y_transform
467 real(DP),
dimension(:),
allocatable :: node_x, node_y
468 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
474 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
478 allocate (verts(maxvert))
479 allocate (bnds(maxvert))
480 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
481 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
482 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
483 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
487 node_x = nf90_fill_double
488 node_y = nf90_fill_double
489 y = sum(this%dis%delc)
490 do j = this%dis%nrow, 0, -1
492 do i = this%dis%ncol, 0, -1
498 x_transform, y_transform)
499 node_x(cnt) = x_transform
500 node_y(cnt) = y_transform
501 if (i > 0) x = x + this%dis%delr(i)
503 if (j > 0) y = y - this%dis%delc(j)
507 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
509 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
514 cell_x = nf90_fill_double
515 cell_y = nf90_fill_double
516 do j = 1, this%dis%nrow
517 y = this%dis%celly(j)
518 do i = 1, this%dis%ncol
519 x = this%dis%cellx(i)
524 x_transform, y_transform)
525 cell_x(cnt) = x_transform
526 cell_y(cnt) = y_transform
532 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
534 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
539 do i = 1, this%dis%nrow
540 do j = 1, this%dis%ncol
542 verts = nf90_fill_int
543 verts(1) = cnt + this%dis%ncol + i
544 verts(2) = cnt + this%dis%ncol + i + 1
547 verts(4) = cnt + i - 1
554 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
555 verts, start=(/1, cnt/), &
556 count=(/maxvert, 1/)), &
560 bnds = nf90_fill_double
562 if (verts(m) /= nf90_fill_int)
then
563 bnds(m) = node_y(verts(m))
566 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
567 bnds, start=(/1, cnt/), &
568 count=(/maxvert, 1/)), &
573 bnds = nf90_fill_double
575 if (verts(m) /= nf90_fill_int)
then
576 bnds(m) = node_x(verts(m))
579 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
580 bnds, start=(/1, cnt/), &
581 count=(/maxvert, 1/)), &
599 nc_varname, pkgname, tagname, gridmap_name, &
600 shapestr, longname, nc_tag, deflate, shuffle, &
601 chunk_face, iper, nc_fname)
602 integer(I4B),
intent(in) :: ncid
604 integer(I4B),
intent(in) :: x_dim
605 integer(I4B),
intent(in) :: y_dim
607 type(
distype),
pointer,
intent(in) :: dis
608 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
609 character(len=*),
intent(in) :: nc_varname
610 character(len=*),
intent(in) :: pkgname
611 character(len=*),
intent(in) :: tagname
612 character(len=*),
intent(in) :: gridmap_name
613 character(len=*),
intent(in) :: shapestr
614 character(len=*),
intent(in) :: longname
615 character(len=*),
intent(in) :: nc_tag
616 integer(I4B),
intent(in) :: deflate
617 integer(I4B),
intent(in) :: shuffle
618 integer(I4B),
intent(in) :: chunk_face
619 integer(I4B),
intent(in) :: iper
620 character(len=*),
intent(in) :: nc_fname
621 integer(I4B),
dimension(3) :: dis_shape
622 integer(I4B),
dimension(1) :: layer_shape
623 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
624 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
625 integer(I4B) :: axis_dim, nvals, k
626 integer(I4B),
dimension(:),
allocatable :: var_id
627 character(len=LINELENGTH) :: longname_l, varname_l
629 if (shapestr ==
'NROW' .or. &
630 shapestr ==
'NCOL' .or. &
631 shapestr ==
'NCPL')
then
633 select case (shapestr)
639 axis_dim = dim_ids%nmesh_face
644 longname_l =
export_longname(longname, pkgname, tagname, layer=0, iper=iper)
649 call nf_verify(nf90_redef(ncid), nc_fname)
650 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
651 (/axis_dim/), var_id(1)), &
655 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
658 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
659 (/nf90_fill_int/)), nc_fname)
660 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
661 longname_l), nc_fname)
664 call ncvar_mf6attr(ncid, var_id(1), 0, iper, 0, nc_tag, nc_fname)
667 call nf_verify(nf90_enddef(ncid), nc_fname)
668 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
672 allocate (var_id(dis%nlay))
675 call nf_verify(nf90_redef(ncid), nc_fname)
682 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
683 (/dim_ids%nmesh_face/), var_id(k)), &
687 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
689 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
692 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
693 (/nf90_fill_int/)), nc_fname)
694 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
695 longname_l), nc_fname)
699 call ncvar_mf6attr(ncid, var_id(k), k, iper, 0, nc_tag, nc_fname)
703 dis_shape(1) = dis%ncol
704 dis_shape(2) = dis%nrow
705 dis_shape(3) = dis%nlay
706 nvals = product(dis_shape)
707 int3d(1:dis_shape(1), 1:dis_shape(2), 1:dis_shape(3)) => p_mem(1:nvals)
710 call nf_verify(nf90_enddef(ncid), nc_fname)
711 layer_shape(1) = dis%nrow * dis%ncol
713 int1d(1:layer_shape(1)) => int3d(:, :, k)
714 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
725 pkgname, tagname, gridmap_name, shapestr, longname, &
726 nc_tag, deflate, shuffle, chunk_face, nc_fname)
727 integer(I4B),
intent(in) :: ncid
730 type(
distype),
pointer,
intent(in) :: dis
731 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
732 character(len=*),
intent(in) :: nc_varname
733 character(len=*),
intent(in) :: pkgname
734 character(len=*),
intent(in) :: tagname
735 character(len=*),
intent(in) :: gridmap_name
736 character(len=*),
intent(in) :: shapestr
737 character(len=*),
intent(in) :: longname
738 character(len=*),
intent(in) :: nc_tag
739 integer(I4B),
intent(in) :: deflate
740 integer(I4B),
intent(in) :: shuffle
741 integer(I4B),
intent(in) :: chunk_face
742 character(len=*),
intent(in) :: nc_fname
743 integer(I4B) :: var_id
744 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
745 integer(I4B),
dimension(1) :: layer_shape
746 character(len=LINELENGTH) :: longname_l, varname_l
753 call nf_verify(nf90_redef(ncid), nc_fname)
754 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
755 (/dim_ids%nmesh_face/), var_id), &
759 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
764 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
765 (/nf90_fill_int/)), nc_fname)
766 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
767 longname_l), nc_fname)
774 call nf_verify(nf90_enddef(ncid), nc_fname)
775 layer_shape(1) = dis%nrow * dis%ncol
776 int1d(1:layer_shape(1)) => p_mem
777 call nf_verify(nf90_put_var(ncid, var_id, int1d), nc_fname)
783 pkgname, tagname, gridmap_name, shapestr, longname, &
784 nc_tag, deflate, shuffle, chunk_face, nc_fname)
785 integer(I4B),
intent(in) :: ncid
788 type(
distype),
pointer,
intent(in) :: dis
789 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
790 character(len=*),
intent(in) :: nc_varname
791 character(len=*),
intent(in) :: pkgname
792 character(len=*),
intent(in) :: tagname
793 character(len=*),
intent(in) :: gridmap_name
794 character(len=*),
intent(in) :: shapestr
795 character(len=*),
intent(in) :: longname
796 character(len=*),
intent(in) :: nc_tag
797 integer(I4B),
intent(in) :: deflate
798 integer(I4B),
intent(in) :: shuffle
799 integer(I4B),
intent(in) :: chunk_face
800 character(len=*),
intent(in) :: nc_fname
801 integer(I4B),
dimension(:),
allocatable :: var_id
802 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
803 character(len=LINELENGTH) :: longname_l, varname_l
804 integer(I4B),
dimension(1) :: layer_shape
807 allocate (var_id(dis%nlay))
810 call nf_verify(nf90_redef(ncid), nc_fname)
816 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
817 (/dim_ids%nmesh_face/), var_id(k)), &
821 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
823 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
826 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
827 (/nf90_fill_int/)), nc_fname)
828 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
829 longname_l), nc_fname)
833 call ncvar_mf6attr(ncid, var_id(k), k, 0, 0, nc_tag, nc_fname)
837 call nf_verify(nf90_enddef(ncid), nc_fname)
838 layer_shape(1) = dis%nrow * dis%ncol
840 int1d(1:layer_shape(1)) => p_mem(:, :, k)
841 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
851 nc_varname, pkgname, tagname, gridmap_name, &
852 shapestr, longname, nc_tag, deflate, shuffle, &
853 chunk_face, nc_fname)
854 integer(I4B),
intent(in) :: ncid
856 integer(I4B),
intent(in) :: x_dim
857 integer(I4B),
intent(in) :: y_dim
859 type(
distype),
pointer,
intent(in) :: dis
860 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
861 character(len=*),
intent(in) :: nc_varname
862 character(len=*),
intent(in) :: pkgname
863 character(len=*),
intent(in) :: tagname
864 character(len=*),
intent(in) :: gridmap_name
865 character(len=*),
intent(in) :: shapestr
866 character(len=*),
intent(in) :: longname
867 character(len=*),
intent(in) :: nc_tag
868 integer(I4B),
intent(in) :: deflate
869 integer(I4B),
intent(in) :: shuffle
870 integer(I4B),
intent(in) :: chunk_face
871 character(len=*),
intent(in) :: nc_fname
872 integer(I4B),
dimension(3) :: dis_shape
873 integer(I4B),
dimension(1) :: layer_shape
874 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
875 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
876 integer(I4B) :: axis_dim, nvals, k
877 integer(I4B),
dimension(:),
allocatable :: var_id
878 character(len=LINELENGTH) :: longname_l, varname_l
880 if (shapestr ==
'NROW' .or. &
881 shapestr ==
'NCOL')
then
884 select case (shapestr)
900 call nf_verify(nf90_redef(ncid), nc_fname)
901 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
902 (/axis_dim/), var_id(1)), &
906 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
909 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
910 (/nf90_fill_double/)), nc_fname)
911 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
912 longname_l), nc_fname)
915 call ncvar_mf6attr(ncid, var_id(1), 0, 0, 0, nc_tag, nc_fname)
918 call nf_verify(nf90_enddef(ncid), nc_fname)
919 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
923 allocate (var_id(dis%nlay))
926 call nf_verify(nf90_redef(ncid), nc_fname)
932 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
933 (/dim_ids%nmesh_face/), var_id(k)), &
937 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
939 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
942 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
943 (/nf90_fill_double/)), nc_fname)
944 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
945 longname_l), nc_fname)
949 call ncvar_mf6attr(ncid, var_id(k), k, 0, 0, nc_tag, nc_fname)
953 dis_shape(1) = dis%ncol
954 dis_shape(2) = dis%nrow
955 dis_shape(3) = dis%nlay
956 nvals = product(dis_shape)
957 dbl3d(1:dis_shape(1), 1:dis_shape(2), 1:dis_shape(3)) => p_mem(1:nvals)
960 call nf_verify(nf90_enddef(ncid), nc_fname)
961 layer_shape(1) = dis%nrow * dis%ncol
963 dbl1d(1:layer_shape(1)) => dbl3d(:, :, k)
964 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
975 pkgname, tagname, gridmap_name, shapestr, longname, &
976 nc_tag, deflate, shuffle, chunk_face, nc_fname)
977 integer(I4B),
intent(in) :: ncid
980 type(
distype),
pointer,
intent(in) :: dis
981 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
982 character(len=*),
intent(in) :: nc_varname
983 character(len=*),
intent(in) :: pkgname
984 character(len=*),
intent(in) :: tagname
985 character(len=*),
intent(in) :: gridmap_name
986 character(len=*),
intent(in) :: shapestr
987 character(len=*),
intent(in) :: longname
988 character(len=*),
intent(in) :: nc_tag
989 integer(I4B),
intent(in) :: deflate
990 integer(I4B),
intent(in) :: shuffle
991 integer(I4B),
intent(in) :: chunk_face
992 character(len=*),
intent(in) :: nc_fname
993 integer(I4B) :: var_id
994 character(len=LINELENGTH) :: longname_l, varname_l
995 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
996 integer(I4B),
dimension(1) :: layer_shape
1003 call nf_verify(nf90_redef(ncid), nc_fname)
1004 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
1005 (/dim_ids%nmesh_face/), var_id), &
1009 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1011 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1014 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1015 (/nf90_fill_double/)), nc_fname)
1016 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1017 longname_l), nc_fname)
1024 call nf_verify(nf90_enddef(ncid), nc_fname)
1025 layer_shape(1) = dis%nrow * dis%ncol
1026 dbl1d(1:layer_shape(1)) => p_mem
1027 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), nc_fname)
1033 pkgname, tagname, gridmap_name, shapestr, longname, &
1034 nc_tag, deflate, shuffle, chunk_face, iper, iaux, &
1037 integer(I4B),
intent(in) :: ncid
1040 type(
distype),
pointer,
intent(in) :: dis
1041 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
1042 character(len=*),
intent(in) :: nc_varname
1043 character(len=*),
intent(in) :: pkgname
1044 character(len=*),
intent(in) :: tagname
1045 character(len=*),
intent(in) :: gridmap_name
1046 character(len=*),
intent(in) :: shapestr
1047 character(len=*),
intent(in) :: longname
1048 character(len=*),
intent(in) :: nc_tag
1049 integer(I4B),
intent(in) :: deflate
1050 integer(I4B),
intent(in) :: shuffle
1051 integer(I4B),
intent(in) :: chunk_face
1052 integer(I4B),
intent(in) :: iper
1053 integer(I4B),
intent(in) :: iaux
1054 character(len=*),
intent(in) :: nc_fname
1055 integer(I4B),
dimension(:),
allocatable :: var_id
1056 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1057 character(len=LINELENGTH) :: longname_l, varname_l
1058 integer(I4B),
dimension(1) :: layer_shape
1060 real(DP) :: fill_value
1065 fill_value = nf90_fill_double
1068 allocate (var_id(dis%nlay))
1071 call nf_verify(nf90_redef(ncid), nc_fname)
1074 varname_l =
export_varname(nc_varname, layer=k, iper=iper, iaux=iaux)
1075 longname_l =
export_longname(longname, pkgname, tagname, layer=k, iper=iper)
1077 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
1078 (/dim_ids%nmesh_face/), var_id(k)), &
1082 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1084 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1087 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1088 (/fill_value/)), nc_fname)
1089 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1090 longname_l), nc_fname)
1094 call ncvar_mf6attr(ncid, var_id(k), k, iper, iaux, nc_tag, nc_fname)
1099 call nf_verify(nf90_enddef(ncid), nc_fname)
1100 layer_shape(1) = dis%nrow * dis%ncol
1102 dbl1d(1:layer_shape(1)) => p_mem(:, :, k)
1103 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_int3d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 3D integer
subroutine export_layer_3d(this, export_pkg, idt, ilayer_read, ialayer, dbl1d, nc_varname, input_attr, iaux)
export layer variable as full grid
subroutine nc_export_int2d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D integer
subroutine define_dim(this)
netcdf export define dimensions
subroutine add_mesh_data(this)
netcdf export add mesh information
subroutine nc_export_dbl1d(ncid, dim_ids, x_dim, y_dim, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 1D double
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_ilayer(this, export_pkg, ilayer_varname, ilayer)
netcdf export package dynamic input with ilayer index variable
subroutine package_step(this, export_pkg)
netcdf export package dynamic input
subroutine dis_export_destroy(this)
netcdf export dis destroy
subroutine nc_export_int1d(ncid, dim_ids, x_dim, y_dim, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, iper, nc_fname)
netcdf export 1D integer
subroutine nc_export_dbl3d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, iper, iaux, nc_fname)
netcdf export 3D double
subroutine nc_export_dbl2d(ncid, dim_ids, var_ids, dis, p_mem, nc_varname, pkgname, tagname, gridmap_name, shapestr, longname, nc_tag, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D 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.
character(len=linelength) function, public export_varname(varname, layer, iper, iaux)
build netcdf variable name
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
subroutine, public ncvar_mf6attr(ncid, varid, layer, iper, iaux, nc_tag, nc_fname)
put variable internal attributes
This module contains the NCModelExportModule.
character(len=linelength) function, public export_longname(longname, pkgname, tagname, layer, iper)
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