49 disenum, nctype, iout)
52 character(len=*),
intent(in) :: modelname
53 character(len=*),
intent(in) :: modeltype
54 character(len=*),
intent(in) :: modelfname
55 character(len=*),
intent(in) :: nc_fname
56 integer(I4B),
intent(in) :: disenum
57 integer(I4B),
intent(in) :: nctype
58 integer(I4B),
intent(in) :: iout
61 this%nlay = this%disv%nlay
64 allocate (this%var_ids%dependent(this%nlay))
65 allocate (this%var_ids%export(this%nlay))
68 call this%mesh_init(modelname, modeltype, modelfname, nc_fname, disenum, &
69 nctype, this%disv%lenuni, iout)
76 deallocate (this%var_ids%dependent)
78 call this%mesh_destroy()
79 call this%NCModelExportType%destroy()
89 call this%add_global_att()
91 call this%define_dim()
93 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()
107 call this%add_pkg_data()
110 call this%define_gridmap()
112 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
121 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
122 integer(I4B) :: n, k, nvals, istp
123 integer(I4B),
dimension(2) :: dis_shape
124 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
133 dis_shape(1) = this%disv%ncpl
134 dis_shape(2) = this%disv%nlay
136 nvals = product(dis_shape)
139 if (
size(this%disv%nodeuser) < &
140 size(this%disv%nodereduced))
then
142 allocate (dbl1d(
size(this%disv%nodereduced)))
148 do n = 1,
size(this%disv%nodereduced)
149 if (this%disv%nodereduced(n) > 0)
then
150 dbl1d(n) = this%x(this%disv%nodereduced(n))
154 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => dbl1d(1:nvals)
156 dbl2d(1:dis_shape(1), 1:dis_shape(2)) => this%x(1:nvals)
159 do k = 1, this%disv%nlay
162 this%var_ids%dependent(k), dbl2d(:, k), &
164 count=(/this%disv%ncpl, 1/)), &
169 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
170 totim, start=(/istp/)), &
174 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
177 if (
associated(dbl1d))
deallocate (dbl1d)
191 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
192 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d, nodes
193 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
194 character(len=LINELENGTH) :: nc_tag
195 integer(I4B) :: iaux, iparam, nvals
202 call export_pkg%update_state()
205 do iparam = 1, export_pkg%nparam
207 if (.not. export_pkg%param_state(iparam)) cycle
212 export_pkg%mf6_input%component_type, &
213 export_pkg%mf6_input%subcomponent_type, &
214 'PERIOD', export_pkg%param_names(iparam),
'')
217 nc_tag = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
221 select case (idt%datatype)
223 call mem_setptr(int1d, idt%mf6varname, export_pkg%mf6_input%mempath)
224 this%var_ids%export(1) = export_pkg%varids_param(iparam, 1)
226 this%disv, idt, export_pkg%mf6_input%mempath, &
227 nc_tag, 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%disv, idt, export_pkg%mf6_input%mempath, &
237 nc_tag, export_pkg%mf6_input%subcomponent_name, &
238 this%gridmap_name, this%deflate, this%shuffle, &
239 this%chunk_face,
kper, iaux, this%nc_fname)
241 nvals = this%disv%nodesuser
242 allocate (nodes(nvals))
244 do k = 1, this%disv%nlay
245 this%var_ids%export(k) = export_pkg%varids_param(iparam, k)
247 call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
248 call export_pkg%user_nodes(dbl1d, nodes)
250 this%disv, idt, export_pkg%mf6_input%mempath, &
251 nc_tag, export_pkg%mf6_input%subcomponent_name, &
252 this%gridmap_name, this%deflate, this%shuffle, &
253 this%chunk_face,
kper, iaux, this%nc_fname)
258 call mem_setptr(dbl2d, idt%mf6varname, export_pkg%mf6_input%mempath)
259 select case (idt%shape)
261 nvals = this%disv%ncpl
262 allocate (nodes(nvals))
263 do iaux = 1,
size(dbl2d, dim=1)
264 if (.not. export_pkg%aux_state(iaux)) cycle
265 this%var_ids%export(1) = export_pkg%varids_aux(iaux, 1)
267 nodes(n) = dbl2d(iaux, n)
270 this%disv, idt, export_pkg%mf6_input%mempath, &
271 nc_tag, export_pkg%mf6_input%subcomponent_name, &
272 this%gridmap_name, this%deflate, this%shuffle, &
273 this%chunk_face,
kper, iaux, this%nc_fname)
277 nvals = this%disv%nodesuser
278 allocate (nodes(nvals))
279 do iaux = 1,
size(dbl2d, dim=1)
280 if (.not. export_pkg%aux_state(iaux)) cycle
282 do k = 1, this%disv%nlay
283 this%var_ids%export(k) = export_pkg%varids_aux(iaux, k)
285 call export_pkg%user_nodes(dbl2d(iaux, :), nodes)
287 this%disv, idt, export_pkg%mf6_input%mempath, &
288 nc_tag, export_pkg%mf6_input%subcomponent_name, &
289 this%gridmap_name, this%deflate, this%shuffle, &
290 this%chunk_face,
kper, iaux, this%nc_fname)
301 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
307 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time_bnds, &
309 start=(/1,
kper/), count=(/2, 1/)), &
312 call nf_verify(nf90_put_var(this%ncid, this%var_ids%time_bnds, &
318 call nf_verify(nf90_sync(this%ncid), this%nc_fname)
325 character(len=*),
intent(in) :: pkgtype
326 character(len=*),
intent(in) :: pkgname
327 character(len=*),
intent(in) :: mempath
329 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
330 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
331 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
332 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
333 character(len=LINELENGTH) :: nc_tag
334 integer(I4B) :: iper, iaux
340 nc_tag = this%input_attribute(pkgname, idt)
342 select case (idt%datatype)
344 call mem_setptr(int1d, idt%mf6varname, mempath)
346 this%disv, idt, mempath, nc_tag, pkgname, &
347 this%gridmap_name, this%deflate, this%shuffle, &
348 this%chunk_face, iper, this%nc_fname)
350 call mem_setptr(int2d, idt%mf6varname, mempath)
352 this%disv, idt, mempath, nc_tag, pkgname, &
353 this%gridmap_name, this%deflate, this%shuffle, &
354 this%chunk_face, this%nc_fname)
356 call mem_setptr(dbl1d, idt%mf6varname, mempath)
358 this%disv, idt, mempath, nc_tag, pkgname, &
359 this%gridmap_name, this%deflate, this%shuffle, &
360 this%chunk_face, iper, iaux, this%nc_fname)
362 call mem_setptr(dbl2d, idt%mf6varname, mempath)
364 this%disv, idt, mempath, nc_tag, pkgname, &
365 this%gridmap_name, this%deflate, this%shuffle, &
366 this%chunk_face, this%nc_fname)
378 integer(I4B),
dimension(:),
contiguous,
pointer :: ncvert
380 character(len=LINELENGTH) :: varname
381 character(len=LINELENGTH) :: elev_longname
384 call mem_setptr(ncvert,
'NCVERT', this%dis_mempath)
388 call nf_verify(nf90_def_dim(this%ncid,
'time', this%totnstp, &
389 this%dim_ids%time), this%nc_fname)
390 call nf_verify(nf90_def_var(this%ncid,
'time', nf90_double, &
391 this%dim_ids%time, this%var_ids%time), &
393 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'calendar', &
394 'standard'), this%nc_fname)
395 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'units', &
396 this%datetime), this%nc_fname)
397 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'axis',
'T'), &
399 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'standard_name', &
400 'time'), this%nc_fname)
401 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'long_name', &
402 'time'), this%nc_fname)
405 call nf_verify(nf90_def_dim(this%ncid,
'bnd', 2, this%dim_ids%bnd), &
407 call nf_verify(nf90_put_att(this%ncid, this%var_ids%time,
'bounds', &
408 'time_bnds'), this%nc_fname)
409 call nf_verify(nf90_def_var(this%ncid,
'time_bnds', nf90_double, &
410 (/this%dim_ids%bnd, this%dim_ids%time/), &
411 this%var_ids%time_bnds), this%nc_fname)
416 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_node', this%disv%nvert, &
417 this%dim_ids%nmesh_node), this%nc_fname)
418 call nf_verify(nf90_def_dim(this%ncid,
'nmesh_face', this%disv%ncpl, &
419 this%dim_ids%nmesh_face), this%nc_fname)
420 call nf_verify(nf90_def_dim(this%ncid,
'max_nmesh_face_nodes', &
422 this%dim_ids%max_nmesh_face_nodes), &
426 call nf_verify(nf90_def_dim(this%ncid,
'layer', this%nlay, &
427 this%dim_ids%layer), this%nc_fname)
428 call nf_verify(nf90_def_var(this%ncid,
'layer', nf90_int, &
429 this%dim_ids%layer, this%var_ids%layer), &
431 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'units',
'1'), &
433 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'axis',
'Z'), &
435 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'positive', &
436 'down'), this%nc_fname)
437 call nf_verify(nf90_put_att(this%ncid, this%var_ids%layer,
'long_name', &
438 'model layer'), this%nc_fname)
446 allocate (this%var_ids%elevation(this%nlay))
448 write (varname,
'(a,i0)')
'z_l', k
449 call nf_verify(nf90_def_var(this%ncid, trim(varname), nf90_double, &
450 (/this%dim_ids%nmesh_face/), &
451 this%var_ids%elevation(k)), this%nc_fname)
452 call ncvar_chunk(this%ncid, this%var_ids%elevation(k), this%chunk_face, &
454 call ncvar_deflate(this%ncid, this%var_ids%elevation(k), this%deflate, &
455 this%shuffle, this%nc_fname)
456 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
457 'units', this%lenunits), this%nc_fname)
458 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
459 'standard_name',
'altitude'), this%nc_fname)
460 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
461 'positive',
'up'), this%nc_fname)
462 write (elev_longname,
'(a,i0,a)')
'cell center elevation (layer ', &
464 call nf_verify(nf90_put_att(this%ncid, this%var_ids%elevation(k), &
465 'long_name', trim(elev_longname)), &
467 call ncvar_layer(this%ncid, this%var_ids%elevation(k), k, this%nc_fname)
476 integer(I4B),
dimension(:),
contiguous,
pointer :: ncvert => null()
477 integer(I4B),
dimension(:),
contiguous,
pointer :: icvert => null()
478 real(DP),
dimension(:),
contiguous,
pointer :: cell_xt => null()
479 real(DP),
dimension(:),
contiguous,
pointer :: cell_yt => null()
480 real(DP),
dimension(:),
contiguous,
pointer :: vert_xt => null()
481 real(DP),
dimension(:),
contiguous,
pointer :: vert_yt => null()
482 real(DP) :: x_transform, y_transform
483 integer(I4B) :: n, m, idx, cnt, iv, maxvert, k
484 integer(I4B),
dimension(:),
allocatable :: verts, layers
485 real(DP),
dimension(:),
allocatable :: bnds
486 real(DP),
dimension(:),
allocatable :: elev_face
487 integer(I4B) :: istop
490 call mem_setptr(ncvert,
'NCVERT', this%dis_mempath)
491 call mem_setptr(icvert,
'ICVERT', this%dis_mempath)
494 allocate (cell_xt(this%disv%ncpl))
495 allocate (cell_yt(this%disv%ncpl))
496 allocate (vert_xt(this%disv%nvert))
497 allocate (vert_yt(this%disv%nvert))
500 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh, 1), &
504 allocate (layers(this%nlay))
508 call nf_verify(nf90_put_var(this%ncid, this%var_ids%layer, layers), &
513 do n = 1, this%disv%nvert
518 x_transform, y_transform)
519 vert_xt(n) = x_transform
520 vert_yt(n) = y_transform
524 do n = 1, this%disv%ncpl
529 x_transform, y_transform)
530 cell_xt(n) = x_transform
531 cell_yt(n) = y_transform
535 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_x, &
536 vert_xt), this%nc_fname)
537 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_node_y, &
538 vert_yt), this%nc_fname)
541 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_x, &
542 cell_xt), this%nc_fname)
543 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_y, &
544 cell_yt), this%nc_fname)
548 allocate (elev_face(this%disv%ncpl))
551 elev_face(:) = (this%disv%top1d(:) + this%disv%bot2d(:, k)) * dhalf
553 elev_face(:) = (this%disv%bot2d(:, k - 1) + &
554 this%disv%bot2d(:, k)) * dhalf
556 call nf_verify(nf90_put_var(this%ncid, this%var_ids%elevation(k), &
557 elev_face), this%nc_fname)
559 deallocate (elev_face)
562 maxvert = maxval(ncvert)
565 allocate (verts(maxvert))
566 allocate (bnds(maxvert))
570 do n = 1, this%disv%ncpl
571 verts = nf90_fill_int
572 idx = cnt + ncvert(n)
575 do m = idx, istop, -1
578 verts(iv) = icvert(m)
582 if (verts(iv) == verts(1)) verts(iv) = nf90_fill_int
585 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_nodes, &
586 verts, start=(/1, n/), &
587 count=(/maxvert, 1/)), &
591 bnds = nf90_fill_double
593 if (verts(m) /= nf90_fill_int)
then
594 bnds(m) = vert_yt(verts(m))
597 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_ybnds, &
598 bnds, start=(/1, n/), &
599 count=(/maxvert, 1/)), &
604 bnds = nf90_fill_double
606 if (verts(m) /= nf90_fill_int)
then
607 bnds(m) = vert_xt(verts(m))
610 call nf_verify(nf90_put_var(this%ncid, this%var_ids%mesh_face_xbnds, &
611 bnds, start=(/1, n/), &
612 count=(/maxvert, 1/)), &
629 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
630 chunk_face, iper, nc_fname)
632 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
633 integer(I4B),
intent(in) :: ncid
636 type(
disvtype),
pointer,
intent(in) :: disv
638 character(len=*),
intent(in) :: mempath
639 character(len=*),
intent(in) :: nc_tag
640 character(len=*),
intent(in) :: pkgname
641 character(len=*),
intent(in) :: gridmap_name
642 integer(I4B),
intent(in) :: deflate
643 integer(I4B),
intent(in) :: shuffle
644 integer(I4B),
intent(in) :: chunk_face
645 integer(I4B),
intent(in) :: iper
646 character(len=*),
intent(in) :: nc_fname
647 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
648 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
649 integer(I4B) :: axis_sz, k
650 integer(I4B),
dimension(:),
allocatable :: var_id
651 character(len=LINELENGTH) :: longname, varname
653 if (idt%shape ==
'NCPL' .or. &
654 idt%shape ==
'NAUX NCPL')
then
658 varname = export_varname(pkgname, idt%tagname, mempath)
659 longname = export_longname(idt%longname, pkgname, idt%tagname, mempath, &
660 component_type=idt%component_type, &
661 subcomponent_type=idt%subcomponent_type)
664 axis_sz = dim_ids%nmesh_face
667 call nf_verify(nf90_redef(ncid), nc_fname)
668 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
669 (/axis_sz/), var_id(1)), &
673 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
675 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
678 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
679 (/nf90_fill_int/)), nc_fname)
680 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
684 call ncvar_gridmap(ncid, var_id(1), gridmap_name, 0, nc_fname)
688 call nf_verify(nf90_enddef(ncid), nc_fname)
689 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
694 var_ids%export(1), p_mem, &
696 count=(/disv%ncpl, 1/)), nc_fname)
701 int2d(1:disv%ncpl, 1:disv%nlay) => p_mem(1:disv%nodesuser)
704 allocate (var_id(disv%nlay))
707 call nf_verify(nf90_redef(ncid), nc_fname)
710 varname = export_varname(pkgname, idt%tagname, mempath, layer=k)
711 longname = export_longname(idt%longname, pkgname, idt%tagname, &
713 component_type=idt%component_type, &
714 subcomponent_type=idt%subcomponent_type)
716 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
717 (/dim_ids%nmesh_face/), var_id(k)), &
721 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
723 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
726 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
727 (/nf90_fill_int/)), nc_fname)
728 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
732 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
737 call nf_verify(nf90_enddef(ncid), nc_fname)
739 call nf_verify(nf90_put_var(ncid, var_id(k), int2d(:, k)), nc_fname)
747 int1d(1:disv%ncpl) => int2d(:, k)
749 var_ids%export(k), int1d, &
751 count=(/disv%ncpl, 1/)), nc_fname)
760 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
761 chunk_face, nc_fname)
762 integer(I4B),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
763 integer(I4B),
intent(in) :: ncid
766 type(
disvtype),
pointer,
intent(in) :: disv
768 character(len=*),
intent(in) :: mempath
769 character(len=*),
intent(in) :: nc_tag
770 character(len=*),
intent(in) :: pkgname
771 character(len=*),
intent(in) :: gridmap_name
772 integer(I4B),
intent(in) :: deflate
773 integer(I4B),
intent(in) :: shuffle
774 integer(I4B),
intent(in) :: chunk_face
775 character(len=*),
intent(in) :: nc_fname
776 integer(I4B),
dimension(:),
allocatable :: var_id
777 character(len=LINELENGTH) :: longname, varname
780 allocate (var_id(disv%nlay))
783 call nf_verify(nf90_redef(ncid), nc_fname)
786 varname = export_varname(pkgname, idt%tagname, mempath, layer=k)
787 longname = export_longname(idt%longname, pkgname, idt%tagname, &
789 component_type=idt%component_type, &
790 subcomponent_type=idt%subcomponent_type)
792 call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
793 (/dim_ids%nmesh_face/), var_id(k)), &
797 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
799 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
802 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
803 (/nf90_fill_int/)), nc_fname)
804 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
808 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
813 call nf_verify(nf90_enddef(ncid), nc_fname)
815 call nf_verify(nf90_put_var(ncid, var_id(k), p_mem(:, k)), nc_fname)
824 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
825 chunk_face, iper, iaux, nc_fname)
827 real(DP),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
828 integer(I4B),
intent(in) :: ncid
831 type(
disvtype),
pointer,
intent(in) :: disv
833 character(len=*),
intent(in) :: mempath
834 character(len=*),
intent(in) :: nc_tag
835 character(len=*),
intent(in) :: pkgname
836 character(len=*),
intent(in) :: gridmap_name
837 integer(I4B),
intent(in) :: deflate
838 integer(I4B),
intent(in) :: shuffle
839 integer(I4B),
intent(in) :: chunk_face
840 integer(I4B),
intent(in) :: iper
841 integer(I4B),
intent(in) :: iaux
842 character(len=*),
intent(in) :: nc_fname
843 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
844 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
845 integer(I4B) :: axis_sz, k
846 integer(I4B),
dimension(:),
allocatable :: var_id
847 character(len=LINELENGTH) :: longname, varname
849 if (idt%shape ==
'NCPL' .or. &
850 idt%shape ==
'NAUX NCPL')
then
854 varname = export_varname(pkgname, idt%tagname, mempath, &
856 longname = export_longname(idt%longname, pkgname, idt%tagname, &
857 mempath, iaux=iaux, &
858 component_type=idt%component_type, &
859 subcomponent_type=idt%subcomponent_type)
862 axis_sz = dim_ids%nmesh_face
865 call nf_verify(nf90_redef(ncid), nc_fname)
866 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
867 (/axis_sz/), var_id(1)), &
871 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
873 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
876 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
877 (/nf90_fill_double/)), nc_fname)
878 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
882 call ncvar_gridmap(ncid, var_id(1), gridmap_name, 0, nc_fname)
883 call ncvar_mf6attr(ncid, var_id(1), 0, iaux, nc_tag, nc_fname)
886 call nf_verify(nf90_enddef(ncid), nc_fname)
887 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
892 var_ids%export(1), p_mem, &
894 count=(/disv%ncpl, 1/)), nc_fname)
899 dbl2d(1:disv%ncpl, 1:disv%nlay) => p_mem(1:disv%nodesuser)
902 allocate (var_id(disv%nlay))
905 call nf_verify(nf90_redef(ncid), nc_fname)
908 varname = export_varname(pkgname, idt%tagname, mempath, layer=k, &
910 longname = export_longname(idt%longname, pkgname, idt%tagname, &
911 mempath, layer=k, iaux=iaux, &
912 component_type=idt%component_type, &
913 subcomponent_type=idt%subcomponent_type)
915 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
916 (/dim_ids%nmesh_face/), var_id(k)), &
920 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
922 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
925 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
926 (/nf90_fill_double/)), nc_fname)
927 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
931 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
932 call ncvar_mf6attr(ncid, var_id(k), k, iaux, nc_tag, nc_fname)
936 call nf_verify(nf90_enddef(ncid), nc_fname)
938 call nf_verify(nf90_put_var(ncid, var_id(k), dbl2d(:, k)), nc_fname)
946 dbl1d(1:disv%ncpl) => dbl2d(:, k)
948 var_ids%export(k), dbl1d, &
950 count=(/disv%ncpl, 1/)), nc_fname)
959 nc_tag, pkgname, gridmap_name, deflate, shuffle, &
960 chunk_face, nc_fname)
961 real(DP),
dimension(:, :),
pointer,
contiguous,
intent(in) :: p_mem
962 integer(I4B),
intent(in) :: ncid
965 type(
disvtype),
pointer,
intent(in) :: disv
967 character(len=*),
intent(in) :: mempath
968 character(len=*),
intent(in) :: nc_tag
969 character(len=*),
intent(in) :: pkgname
970 character(len=*),
intent(in) :: gridmap_name
971 integer(I4B),
intent(in) :: deflate
972 integer(I4B),
intent(in) :: shuffle
973 integer(I4B),
intent(in) :: chunk_face
974 character(len=*),
intent(in) :: nc_fname
975 integer(I4B),
dimension(:),
allocatable :: var_id
976 character(len=LINELENGTH) :: longname, varname
979 allocate (var_id(disv%nlay))
982 call nf_verify(nf90_redef(ncid), nc_fname)
985 varname = export_varname(pkgname, idt%tagname, mempath, layer=k)
986 longname = export_longname(idt%longname, pkgname, idt%tagname, &
988 component_type=idt%component_type, &
989 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)
1007 call ncvar_gridmap(ncid, var_id(k), gridmap_name, k, nc_fname)
1012 call nf_verify(nf90_enddef(ncid), nc_fname)
1014 call nf_verify(nf90_put_var(ncid, var_id(k), p_mem(:, k)), 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
@ disv
DISU6 discretization.
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
This module contains the DefinitionSelectModule.
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type(input_definition_types, component_type, subcomponent_type, blockname, tagname, filename, found)
Return parameter definition.
This module defines variable data types.
This module contains the MeshDisvModelModule.
subroutine add_mesh_data(this)
netcdf export add mesh information
subroutine nc_export_dbl1d(p_mem, ncid, dim_ids, var_ids, disv, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, iper, iaux, nc_fname)
netcdf export 1D double array
subroutine disv_export_init(this, modelname, modeltype, modelfname, nc_fname, disenum, nctype, iout)
netcdf export disv init
subroutine nc_export_int2d(p_mem, ncid, dim_ids, var_ids, disv, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D integer array
subroutine package_step(this, export_pkg)
netcdf export package dynamic input
subroutine nc_export_dbl2d(p_mem, ncid, dim_ids, var_ids, disv, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, nc_fname)
netcdf export 2D double array
subroutine define_dim(this)
netcdf export define dimensions
subroutine df(this)
netcdf export define
subroutine nc_export_int1d(p_mem, ncid, dim_ids, var_ids, disv, idt, mempath, nc_tag, pkgname, gridmap_name, deflate, shuffle, chunk_face, iper, nc_fname)
netcdf export 1D integer array
subroutine step(this)
netcdf export step
subroutine disv_export_destroy(this)
netcdf export disv destroy
subroutine export_input_array(this, pkgtype, pkgname, mempath, idt)
netcdf export an input array
This module contains the MeshModelModule.
subroutine, public ncvar_mf6attr(ncid, varid, layer, iaux, nc_tag, nc_fname)
put variable internal attributes
subroutine, public ncvar_gridmap(ncid, varid, gridmap_name, layer, nc_fname)
put variable gridmap attributes
subroutine, public ncvar_chunk(ncid, varid, chunk_face, nc_fname)
define variable chunking
subroutine, public ncvar_layer(ncid, varid, layer, nc_fname)
put the layer attribute (only when layer > 0)
subroutine, public ncvar_deflate(ncid, varid, deflate, shuffle, nc_fname)
define variable compression
This module contains the NCModelExportModule.
character(len=linelength) function, public export_varname(pkgname, tagname, mempath, layer, iaux)
build netcdf variable name
character(len=linelength) function, public export_longname(longname, pkgname, tagname, mempath, layer, iaux, component_type, subcomponent_type)
build netcdf variable longname
This module contains the NetCDFCommonModule.
subroutine, public nf_verify(res, nc_fname)
error check a netcdf-fortran interface call
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
integer(i4b) isim_mode
simulation mode
real(dp), dimension(:), pointer, public, contiguous perlen
length of each stress period
real(dp), pointer, public totim
time relative to start of simulation
integer(i4b), pointer, public kper
current stress period number
This class is used to store a single deferred-length character string. It was designed to work in an ...
Vertex grid discretization.
type for storing model export dimension ids
type for storing model export variable ids