827 real(DP), dimension(:), pointer, contiguous, intent(in) :: p_mem
828 integer(I4B), intent(in) :: ncid
829 type(MeshNCDimIdType), intent(inout) :: dim_ids
830 type(MeshNCVarIdType), intent(inout) :: var_ids
831 type(DisvType), pointer, intent(in) :: disv
832 type(InputParamDefinitionType), pointer :: idt
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
848
849 if (idt%shape == 'NCPL' .or. &
850 idt%shape == 'NAUX NCPL') then
851
852 if (iper == 0) then
853
854 varname = export_varname(pkgname, idt%tagname, mempath, &
855 iaux=iaux)
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)
860
861 allocate (var_id(1))
862 axis_sz = dim_ids%nmesh_face
863
864
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)), &
868 nc_fname)
869
870
871 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
872
873 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
874
875
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', &
879 longname), nc_fname)
880
881
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)
884
885
886 call nf_verify(nf90_enddef(ncid), nc_fname)
887 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
888 nc_fname)
889 else
890
891 call nf_verify(nf90_put_var(ncid, &
892 var_ids%export(1), p_mem, &
894 count=(/disv%ncpl, 1/)), nc_fname)
895 end if
896
897 else
898
899 dbl2d(1:disv%ncpl, 1:disv%nlay) => p_mem(1:disv%nodesuser)
900
901 if (iper == 0) then
902 allocate (var_id(disv%nlay))
903
904
905 call nf_verify(nf90_redef(ncid), nc_fname)
906 do k = 1, disv%nlay
907
908 varname = export_varname(pkgname, idt%tagname, mempath, layer=k, &
909 iaux=iaux)
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)
914
915 call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
916 (/dim_ids%nmesh_face/), var_id(k)), &
917 nc_fname)
918
919
920 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
921
922 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
923
924
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', &
928 longname), nc_fname)
929
930
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)
933 end do
934
935
936 call nf_verify(nf90_enddef(ncid), nc_fname)
937 do k = 1, disv%nlay
938 call nf_verify(nf90_put_var(ncid, var_id(k), dbl2d(:, k)), nc_fname)
939 end do
940
941
942 deallocate (var_id)
943 else
944
945 do k = 1, disv%nlay
946 dbl1d(1:disv%ncpl) => dbl2d(:, k)
947 call nf_verify(nf90_put_var(ncid, &
948 var_ids%export(k), dbl1d, &
950 count=(/disv%ncpl, 1/)), nc_fname)
951 end do
952 end if
953 end if
integer(i4b), pointer, public kper
current stress period number