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, &
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)
461 integer(I4B) :: cnt, maxvert, m
462 integer(I4B),
dimension(:),
allocatable :: verts
463 real(DP),
dimension(:),
allocatable :: bnds
466 real(DP),
dimension(:),
allocatable :: node_x, node_y
467 real(DP),
dimension(:),
allocatable :: cell_x, cell_y
473 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
477 allocate (verts(maxvert))
478 allocate (bnds(maxvert))
479 allocate (node_x(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
480 allocate (node_y(((this%dis%ncol + 1) * (this%dis%nrow + 1))))
481 allocate (cell_x((this%dis%ncol * this%dis%nrow)))
482 allocate (cell_y((this%dis%ncol * this%dis%nrow)))
486 node_x = nf90_fill_double
487 node_y = nf90_fill_double
488 y = this%dis%yorigin + sum(this%dis%delc)
489 do j = this%dis%nrow, 0, -1
491 do i = this%dis%ncol, 0, -1
495 if (i > 0) x = x + this%dis%delr(i)
497 if (j > 0) y = y - this%dis%delc(j)
501 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, node_x), &
503 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, node_y), &
508 cell_x = nf90_fill_double
509 cell_y = nf90_fill_double
510 do j = 1, this%dis%nrow
512 y = this%dis%celly(j) + this%dis%yorigin
513 do i = 1, this%dis%ncol
517 x = this%dis%cellx(i) + this%dis%xorigin
522 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, cell_x), &
524 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, cell_y), &
529 do i = 1, this%dis%nrow
530 do j = 1, this%dis%ncol
532 verts = nf90_fill_int
533 verts(1) = cnt + this%dis%ncol + i
534 verts(2) = cnt + this%dis%ncol + i + 1
537 verts(4) = cnt + i - 1
544 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
545 verts, start=(/1, cnt/), &
546 count=(/maxvert, 1/)), &
550 bnds = nf90_fill_double
552 if (verts(m) /= nf90_fill_int)
then
553 bnds(m) = node_y(verts(m))
556 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
557 bnds, start=(/1, cnt/), &
558 count=(/maxvert, 1/)), &
563 bnds = nf90_fill_double
565 if (verts(m) /= nf90_fill_int)
then
566 bnds(m) = node_x(verts(m))
569 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
570 bnds, start=(/1, cnt/), &
571 count=(/maxvert, 1/)), &
589 nc_varname, pkgname, tagname, gridmap_name, &
590 shapestr, longname, nc_tag, deflate, shuffle, &
591 chunk_face, iper, nc_fname)
592 integer(I4B),
intent(in) :: ncid
594 integer(I4B),
intent(in) :: x_dim
595 integer(I4B),
intent(in) :: y_dim
597 type(
distype),
pointer,
intent(in) :: dis
598 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
599 character(len=*),
intent(in) :: nc_varname
600 character(len=*),
intent(in) :: pkgname
601 character(len=*),
intent(in) :: tagname
602 character(len=*),
intent(in) :: gridmap_name
603 character(len=*),
intent(in) :: shapestr
604 character(len=*),
intent(in) :: longname
605 character(len=*),
intent(in) :: nc_tag
606 integer(I4B),
intent(in) :: deflate
607 integer(I4B),
intent(in) :: shuffle
608 integer(I4B),
intent(in) :: chunk_face
609 integer(I4B),
intent(in) :: iper
610 character(len=*),
intent(in) :: nc_fname
611 integer(I4B),
dimension(3) :: dis_shape
612 integer(I4B),
dimension(1) :: layer_shape
613 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
614 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
615 integer(I4B) :: axis_dim, nvals, k
616 integer(I4B),
dimension(:),
allocatable :: var_id
617 character(len=LINELENGTH) :: longname_l, varname_l
619 if (shapestr ==
'NROW' .or. &
620 shapestr ==
'NCOL' .or. &
621 shapestr ==
'NCPL')
then
623 select case (shapestr)
629 axis_dim = dim_ids%nmesh_face
634 longname_l =
export_longname(longname, pkgname, tagname, layer=0, iper=iper)
639 call nf_verify(nf90_redef(ncid), nc_fname)
640 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
641 (/axis_dim/), var_id(1)), &
645 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
648 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
649 (/nf90_fill_int/)), nc_fname)
650 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
651 longname_l), nc_fname)
654 call ncvar_mf6attr(ncid, var_id(1), 0, iper, 0, nc_tag, nc_fname)
657 call nf_verify(nf90_enddef(ncid), nc_fname)
658 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
662 allocate (var_id(dis%nlay))
665 call nf_verify(nf90_redef(ncid), nc_fname)
672 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
673 (/dim_ids%nmesh_face/), var_id(k)), &
677 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
679 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
682 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
683 (/nf90_fill_int/)), nc_fname)
684 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
685 longname_l), nc_fname)
689 call ncvar_mf6attr(ncid, var_id(k), k, iper, 0, nc_tag, nc_fname)
693 dis_shape(1) = dis%ncol
694 dis_shape(2) = dis%nrow
695 dis_shape(3) = dis%nlay
696 nvals = product(dis_shape)
697 int3d(1:dis_shape(1), 1:dis_shape(2), 1:dis_shape(3)) => p_mem(1:nvals)
700 call nf_verify(nf90_enddef(ncid), nc_fname)
701 layer_shape(1) = dis%nrow * dis%ncol
703 int1d(1:layer_shape(1)) => int3d(:, :, k)
704 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
715 pkgname, tagname, gridmap_name, shapestr, longname, &
716 nc_tag, deflate, shuffle, chunk_face, nc_fname)
717 integer(I4B),
intent(in) :: ncid
720 type(
distype),
pointer,
intent(in) :: dis
721 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
722 character(len=*),
intent(in) :: nc_varname
723 character(len=*),
intent(in) :: pkgname
724 character(len=*),
intent(in) :: tagname
725 character(len=*),
intent(in) :: gridmap_name
726 character(len=*),
intent(in) :: shapestr
727 character(len=*),
intent(in) :: longname
728 character(len=*),
intent(in) :: nc_tag
729 integer(I4B),
intent(in) :: deflate
730 integer(I4B),
intent(in) :: shuffle
731 integer(I4B),
intent(in) :: chunk_face
732 character(len=*),
intent(in) :: nc_fname
733 integer(I4B) :: var_id
734 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
735 integer(I4B),
dimension(1) :: layer_shape
736 character(len=LINELENGTH) :: longname_l, varname_l
743 call nf_verify(nf90_redef(ncid), nc_fname)
744 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
745 (/dim_ids%nmesh_face/), var_id), &
749 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
754 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
755 (/nf90_fill_int/)), nc_fname)
756 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
757 longname_l), nc_fname)
764 call nf_verify(nf90_enddef(ncid), nc_fname)
765 layer_shape(1) = dis%nrow * dis%ncol
766 int1d(1:layer_shape(1)) => p_mem
767 call nf_verify(nf90_put_var(ncid, var_id, int1d), nc_fname)
773 pkgname, tagname, gridmap_name, shapestr, longname, &
774 nc_tag, deflate, shuffle, chunk_face, nc_fname)
775 integer(I4B),
intent(in) :: ncid
778 type(
distype),
pointer,
intent(in) :: dis
779 integer(I4B),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
780 character(len=*),
intent(in) :: nc_varname
781 character(len=*),
intent(in) :: pkgname
782 character(len=*),
intent(in) :: tagname
783 character(len=*),
intent(in) :: gridmap_name
784 character(len=*),
intent(in) :: shapestr
785 character(len=*),
intent(in) :: longname
786 character(len=*),
intent(in) :: nc_tag
787 integer(I4B),
intent(in) :: deflate
788 integer(I4B),
intent(in) :: shuffle
789 integer(I4B),
intent(in) :: chunk_face
790 character(len=*),
intent(in) :: nc_fname
791 integer(I4B),
dimension(:),
allocatable :: var_id
792 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
793 character(len=LINELENGTH) :: longname_l, varname_l
794 integer(I4B),
dimension(1) :: layer_shape
797 allocate (var_id(dis%nlay))
800 call nf_verify(nf90_redef(ncid), nc_fname)
806 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
807 (/dim_ids%nmesh_face/), var_id(k)), &
811 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
813 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
816 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
817 (/nf90_fill_int/)), nc_fname)
818 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
819 longname_l), nc_fname)
823 call ncvar_mf6attr(ncid, var_id(k), k, 0, 0, nc_tag, nc_fname)
827 call nf_verify(nf90_enddef(ncid), nc_fname)
828 layer_shape(1) = dis%nrow * dis%ncol
830 int1d(1:layer_shape(1)) => p_mem(:, :, k)
831 call nf_verify(nf90_put_var(ncid, var_id(k), int1d), nc_fname)
841 nc_varname, pkgname, tagname, gridmap_name, &
842 shapestr, longname, nc_tag, deflate, shuffle, &
843 chunk_face, nc_fname)
844 integer(I4B),
intent(in) :: ncid
846 integer(I4B),
intent(in) :: x_dim
847 integer(I4B),
intent(in) :: y_dim
849 type(
distype),
pointer,
intent(in) :: dis
850 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
851 character(len=*),
intent(in) :: nc_varname
852 character(len=*),
intent(in) :: pkgname
853 character(len=*),
intent(in) :: tagname
854 character(len=*),
intent(in) :: gridmap_name
855 character(len=*),
intent(in) :: shapestr
856 character(len=*),
intent(in) :: longname
857 character(len=*),
intent(in) :: nc_tag
858 integer(I4B),
intent(in) :: deflate
859 integer(I4B),
intent(in) :: shuffle
860 integer(I4B),
intent(in) :: chunk_face
861 character(len=*),
intent(in) :: nc_fname
862 integer(I4B),
dimension(3) :: dis_shape
863 integer(I4B),
dimension(1) :: layer_shape
864 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
865 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
866 integer(I4B) :: axis_dim, nvals, k
867 integer(I4B),
dimension(:),
allocatable :: var_id
868 character(len=LINELENGTH) :: longname_l, varname_l
870 if (shapestr ==
'NROW' .or. &
871 shapestr ==
'NCOL')
then
874 select case (shapestr)
890 call nf_verify(nf90_redef(ncid), nc_fname)
891 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
892 (/axis_dim/), var_id(1)), &
896 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
899 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
900 (/nf90_fill_double/)), nc_fname)
901 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
902 longname_l), nc_fname)
905 call ncvar_mf6attr(ncid, var_id(1), 0, 0, 0, nc_tag, nc_fname)
908 call nf_verify(nf90_enddef(ncid), nc_fname)
909 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
913 allocate (var_id(dis%nlay))
916 call nf_verify(nf90_redef(ncid), nc_fname)
922 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
923 (/dim_ids%nmesh_face/), var_id(k)), &
927 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
929 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
932 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
933 (/nf90_fill_double/)), nc_fname)
934 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
935 longname_l), nc_fname)
939 call ncvar_mf6attr(ncid, var_id(k), k, 0, 0, nc_tag, nc_fname)
943 dis_shape(1) = dis%ncol
944 dis_shape(2) = dis%nrow
945 dis_shape(3) = dis%nlay
946 nvals = product(dis_shape)
947 dbl3d(1:dis_shape(1), 1:dis_shape(2), 1:dis_shape(3)) => p_mem(1:nvals)
950 call nf_verify(nf90_enddef(ncid), nc_fname)
951 layer_shape(1) = dis%nrow * dis%ncol
953 dbl1d(1:layer_shape(1)) => dbl3d(:, :, k)
954 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
965 pkgname, tagname, gridmap_name, shapestr, longname, &
966 nc_tag, deflate, shuffle, chunk_face, nc_fname)
967 integer(I4B),
intent(in) :: ncid
970 type(
distype),
pointer,
intent(in) :: dis
971 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
972 character(len=*),
intent(in) :: nc_varname
973 character(len=*),
intent(in) :: pkgname
974 character(len=*),
intent(in) :: tagname
975 character(len=*),
intent(in) :: gridmap_name
976 character(len=*),
intent(in) :: shapestr
977 character(len=*),
intent(in) :: longname
978 character(len=*),
intent(in) :: nc_tag
979 integer(I4B),
intent(in) :: deflate
980 integer(I4B),
intent(in) :: shuffle
981 integer(I4B),
intent(in) :: chunk_face
982 character(len=*),
intent(in) :: nc_fname
983 integer(I4B) :: var_id
984 character(len=LINELENGTH) :: longname_l, varname_l
985 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
986 integer(I4B),
dimension(1) :: layer_shape
993 call nf_verify(nf90_redef(ncid), nc_fname)
994 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
995 (/dim_ids%nmesh_face/), var_id), &
999 call ncvar_chunk(ncid, var_id, chunk_face, nc_fname)
1001 call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1004 call nf_verify(nf90_put_att(ncid, var_id,
'_FillValue', &
1005 (/nf90_fill_double/)), nc_fname)
1006 call nf_verify(nf90_put_att(ncid, var_id,
'long_name', &
1007 longname_l), nc_fname)
1014 call nf_verify(nf90_enddef(ncid), nc_fname)
1015 layer_shape(1) = dis%nrow * dis%ncol
1016 dbl1d(1:layer_shape(1)) => p_mem
1017 call nf_verify(nf90_put_var(ncid, var_id, dbl1d), nc_fname)
1023 pkgname, tagname, gridmap_name, shapestr, longname, &
1024 nc_tag, deflate, shuffle, chunk_face, iper, iaux, &
1027 integer(I4B),
intent(in) :: ncid
1030 type(
distype),
pointer,
intent(in) :: dis
1031 real(DP),
dimension(:, :, :),
pointer,
contiguous,
intent(in) :: p_mem
1032 character(len=*),
intent(in) :: nc_varname
1033 character(len=*),
intent(in) :: pkgname
1034 character(len=*),
intent(in) :: tagname
1035 character(len=*),
intent(in) :: gridmap_name
1036 character(len=*),
intent(in) :: shapestr
1037 character(len=*),
intent(in) :: longname
1038 character(len=*),
intent(in) :: nc_tag
1039 integer(I4B),
intent(in) :: deflate
1040 integer(I4B),
intent(in) :: shuffle
1041 integer(I4B),
intent(in) :: chunk_face
1042 integer(I4B),
intent(in) :: iper
1043 integer(I4B),
intent(in) :: iaux
1044 character(len=*),
intent(in) :: nc_fname
1045 integer(I4B),
dimension(:),
allocatable :: var_id
1046 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1047 character(len=LINELENGTH) :: longname_l, varname_l
1048 integer(I4B),
dimension(1) :: layer_shape
1050 real(DP) :: fill_value
1055 fill_value = nf90_fill_double
1058 allocate (var_id(dis%nlay))
1061 call nf_verify(nf90_redef(ncid), nc_fname)
1064 varname_l =
export_varname(nc_varname, layer=k, iper=iper, iaux=iaux)
1065 longname_l =
export_longname(longname, pkgname, tagname, layer=k, iper=iper)
1067 call nf_verify(nf90_def_var(ncid, varname_l, nf90_double, &
1068 (/dim_ids%nmesh_face/), var_id(k)), &
1072 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
1074 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
1077 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
1078 (/fill_value/)), nc_fname)
1079 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
1080 longname_l), nc_fname)
1084 call ncvar_mf6attr(ncid, var_id(k), k, iper, iaux, nc_tag, nc_fname)
1089 call nf_verify(nf90_enddef(ncid), nc_fname)
1090 layer_shape(1) = dis%nrow * dis%ncol
1092 dbl1d(1:layer_shape(1)) => p_mem(:, :, k)
1093 call nf_verify(nf90_put_var(ncid, var_id(k), dbl1d), nc_fname)
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