MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
disncstructuredmodule Module Reference

This module contains the DisNCStructuredModule. More...

Data Types

type  structuredncdimidtype
 
type  structuredncvaridtype
 
type  disncstructuredtype
 
interface  nc_export_array
 

Functions/Subroutines

subroutine dis_export_init (this, modelname, modeltype, modelfname, nc_fname, disenum, nctype, iout)
 netcdf export dis init More...
 
subroutine dis_export_destroy (this)
 netcdf export dis destroy More...
 
subroutine df (this)
 netcdf export define More...
 
subroutine df_export (this)
 define timeseries input variables More...
 
subroutine step (this)
 netcdf export step More...
 
subroutine export_input_array (this, pkgtype, pkgname, mempath, idt)
 netcdf export an input array More...
 
subroutine export_df (this, export_pkg)
 define export package More...
 
subroutine create_timeseries (this, idt, iparam, iaux, export_pkg)
 create timeseries export variable More...
 
subroutine export_input_arrays (this, pkgtype, pkgname, mempath, param_dfns)
 write package gridded input data More...
 
subroutine package_step (this, export_pkg)
 netcdf export package dynamic input More...
 
subroutine add_pkg_data (this)
 determine packages to write gridded input More...
 
subroutine add_global_att (this)
 create file (group) attributes More...
 
subroutine define_dim (this)
 netcdf export define dimensions More...
 
subroutine define_dependent (this)
 create the model layer dependent variables More...
 
subroutine define_gridmap (this)
 create the file grid mapping container variable More...
 
subroutine define_geocoords (this)
 define grid projection variables More...
 
subroutine add_proj_data (this)
 add grid projection data More...
 
subroutine add_grid_data (this)
 add grid coordinates More...
 
subroutine ncvar_chunk2d (ncid, varid, chunk_x, chunk_y, nc_fname)
 define 2d variable chunking More...
 
subroutine ncvar_chunk3d (ncid, varid, chunk_x, chunk_y, chunk_z, nc_fname)
 define 3d variable chunking More...
 
subroutine ncvar_deflate (ncid, varid, deflate, shuffle, nc_fname)
 define variable compression More...
 
subroutine ncvar_gridmap (ncid, varid, gridmap_name, latlon, nc_fname)
 put variable gridmap attributes More...
 
subroutine ncvar_mf6attr (ncid, varid, iaux, nc_tag, nc_fname)
 put variable internal modflow6 attributes More...
 
subroutine nc_export_int1d (p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, latlon, deflate, shuffle, chunk_z, chunk_y, chunk_x, iper, nc_fname)
 netcdf export 1D integer More...
 
subroutine nc_export_int2d (p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, latlon, deflate, shuffle, chunk_z, chunk_y, chunk_x, nc_fname)
 netcdf export 2D integer More...
 
subroutine nc_export_int3d (p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, latlon, deflate, shuffle, chunk_z, chunk_y, chunk_x, nc_fname)
 netcdf export 3D integer More...
 
subroutine nc_export_dbl1d (p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, latlon, deflate, shuffle, chunk_z, chunk_y, chunk_x, iper, iaux, nc_fname)
 netcdf export 1D double More...
 
subroutine nc_export_dbl2d (p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, latlon, deflate, shuffle, chunk_z, chunk_y, chunk_x, nc_fname)
 netcdf export 2D double More...
 
subroutine nc_export_dbl3d (p_mem, ncid, dim_ids, var_ids, dis, idt, mempath, nc_tag, pkgname, gridmap_name, latlon, deflate, shuffle, chunk_z, chunk_y, chunk_x, nc_fname)
 netcdf export 3D double More...
 

Detailed Description

This module defines a STRUCTURED (non-ugrid) netcdf export type for DIS models. It is dependent on netcdf libraries.

Function/Subroutine Documentation

◆ add_global_att()

subroutine disncstructuredmodule::add_global_att ( class(disncstructuredtype), intent(inout)  this)

Definition at line 728 of file DisNCStructured.f90.

729  class(DisNCStructuredType), intent(inout) :: this
730  ! file scoped title
731  call nf_verify(nf90_put_att(this%ncid, nf90_global, 'title', &
732  this%annotation%title), this%nc_fname)
733  ! source (MODFLOW 6)
734  call nf_verify(nf90_put_att(this%ncid, nf90_global, 'source', &
735  this%annotation%source), this%nc_fname)
736  ! grid type (MODFLOW 6)
737  call nf_verify(nf90_put_att(this%ncid, nf90_global, 'modflow_grid', &
738  this%annotation%grid), this%nc_fname)
739  ! MODFLOW 6 model type
740  call nf_verify(nf90_put_att(this%ncid, nf90_global, 'modflow_model', &
741  this%annotation%model), this%nc_fname)
742  ! generation datetime
743  call nf_verify(nf90_put_att(this%ncid, nf90_global, 'history', &
744  this%annotation%history), this%nc_fname)
745  ! supported conventions
746  call nf_verify(nf90_put_att(this%ncid, nf90_global, 'Conventions', &
747  this%annotation%conventions), &
748  this%nc_fname)
Here is the call graph for this function:

◆ add_grid_data()

subroutine disncstructuredmodule::add_grid_data ( class(disncstructuredtype), intent(inout)  this)
private

Definition at line 956 of file DisNCStructured.f90.

957  class(DisNCStructuredType), intent(inout) :: this
958  integer(I4B) :: ibnd, n !, k, i, j
959  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
960  real(DP), dimension(:), allocatable :: x, y
961  real(DP) :: xoff, yoff
962 
963  if (this%dis%angrot /= dzero) then
964  xoff = dzero
965  yoff = dzero
966  else
967  xoff = this%dis%xorigin
968  yoff = this%dis%yorigin
969  end if
970 
971  allocate (x(size(this%dis%cellx)))
972  allocate (y(size(this%dis%celly)))
973 
974  do n = 1, size(this%dis%cellx)
975  x(n) = this%dis%cellx(n) + xoff
976  end do
977 
978  do n = 1, size(this%dis%celly)
979  y(n) = this%dis%celly(n) + yoff
980  end do
981 
982  call nf_verify(nf90_put_var(this%ncid, this%var_ids%x, x), &
983  this%nc_fname)
984  call nf_verify(nf90_put_var(this%ncid, this%var_ids%y, y), &
985  this%nc_fname)
986  ! TODO see cf-conventions 4.3.3. Parametric Vertical Coordinate
987  call nf_verify(nf90_put_var(this%ncid, this%var_ids%z, this%layers), &
988  this%nc_fname)
989 
990  deallocate (x)
991  deallocate (y)
992 
993  ! bounds x
994  allocate (dbl2d(2, size(this%dis%cellx)))
995  ibnd = 1
996  do n = 1, size(this%dis%cellx)
997  if (ibnd == 1) then
998  dbl2d(1, ibnd) = xoff
999  dbl2d(2, ibnd) = xoff + this%dis%delr(ibnd)
1000  else
1001  dbl2d(1, ibnd) = dbl2d(1, ibnd - 1) + this%dis%delr(ibnd)
1002  dbl2d(2, ibnd) = dbl2d(2, ibnd - 1) + this%dis%delr(ibnd)
1003  end if
1004  ibnd = ibnd + 1
1005  end do
1006  call nf_verify(nf90_put_var(this%ncid, this%var_ids%x_bnds, dbl2d), &
1007  this%nc_fname)
1008  deallocate (dbl2d)
1009 
1010  ! bounds y
1011  allocate (dbl2d(2, size(this%dis%celly)))
1012  ibnd = 1
1013  do n = size(this%dis%celly), 1, -1
1014  if (ibnd == 1) then
1015  dbl2d(1, ibnd) = yoff + sum(this%dis%delc) - this%dis%delc(n)
1016  dbl2d(2, ibnd) = yoff + sum(this%dis%delc)
1017  else
1018  dbl2d(1, ibnd) = dbl2d(1, ibnd - 1) - this%dis%delc(n)
1019  dbl2d(2, ibnd) = dbl2d(2, ibnd - 1) - this%dis%delc(n)
1020  end if
1021  ibnd = ibnd + 1
1022  end do
1023  call nf_verify(nf90_put_var(this%ncid, this%var_ids%y_bnds, dbl2d), &
1024  this%nc_fname)
1025  deallocate (dbl2d)
Here is the call graph for this function:

◆ add_pkg_data()

subroutine disncstructuredmodule::add_pkg_data ( class(disncstructuredtype), intent(inout)  this)

Definition at line 671 of file DisNCStructured.f90.

677  class(DisNCStructuredType), intent(inout) :: this
678  character(LENCOMPONENTNAME) :: ptype, pname, pkgtype
679  type(CharacterStringType), dimension(:), contiguous, &
680  pointer :: pkgtypes => null()
681  type(CharacterStringType), dimension(:), contiguous, &
682  pointer :: pkgnames => null()
683  type(CharacterStringType), dimension(:), contiguous, &
684  pointer :: mempaths => null()
685  type(InputParamDefinitionType), dimension(:), pointer :: param_dfns
686  character(len=LENMEMPATH) :: input_mempath, mempath
687  integer(I4B) :: n
688  integer(I4B), pointer :: export_arrays
689  logical(LGP) :: found
690 
691  input_mempath = create_mem_path(component=this%modelname, context=idm_context)
692 
693  ! set pointers to model path package info
694  call mem_setptr(pkgtypes, 'PKGTYPES', input_mempath)
695  call mem_setptr(pkgnames, 'PKGNAMES', input_mempath)
696  call mem_setptr(mempaths, 'MEMPATHS', input_mempath)
697 
698  do n = 1, size(mempaths)
699  ! allocate export_arrays
700  allocate (export_arrays)
701  export_arrays = 0
702 
703  ! set package attributes
704  mempath = mempaths(n)
705  pname = pkgnames(n)
706  ptype = pkgtypes(n)
707 
708  ! export input arrays
709  if (mempath /= '') then
710  ! update export
711  call mem_set_value(export_arrays, 'EXPORT_NC', mempath, found, &
712  release=.false.)
713 
714  if (export_arrays > 0) then
715  pkgtype = idm_subcomponent_type(this%modeltype, ptype)
716  param_dfns => param_definitions(this%modeltype, pkgtype)
717  call this%export_input_arrays(ptype, pname, mempath, param_dfns)
718  end if
719  end if
720 
721  ! cleanup
722  deallocate (export_arrays)
723  end do
type(inputparamdefinitiontype) function, dimension(:), pointer, public param_definitions(component, subcomponent)
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) idm_context
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
character(len=lencomponentname) function, public idm_subcomponent_type(component, subcomponent)
component from package or model type
Here is the call graph for this function:

◆ add_proj_data()

subroutine disncstructuredmodule::add_proj_data ( class(disncstructuredtype), intent(inout)  this)
private

Definition at line 937 of file DisNCStructured.f90.

938  class(DisNCStructuredType), intent(inout) :: this
939  if (this%latlon) then
940  ! lat
941  call nf_verify(nf90_put_var(this%ncid, this%var_ids%latitude, &
942  this%latitude, start=(/1, 1/), &
943  count=(/this%dis%ncol, this%dis%nrow/)), &
944  this%nc_fname)
945 
946  ! lon
947  call nf_verify(nf90_put_var(this%ncid, this%var_ids%longitude, &
948  this%longitude, start=(/1, 1/), &
949  count=(/this%dis%ncol, this%dis%nrow/)), &
950  this%nc_fname)
951  end if
Here is the call graph for this function:

◆ create_timeseries()

subroutine disncstructuredmodule::create_timeseries ( class(disncstructuredtype), intent(inout)  this,
type(inputparamdefinitiontype), intent(in), pointer  idt,
integer(i4b), intent(in)  iparam,
integer(i4b), intent(in)  iaux,
class(exportpackagetype), intent(in), pointer  export_pkg 
)

Definition at line 413 of file DisNCStructured.f90.

415  class(DisNCStructuredType), intent(inout) :: this
416  type(InputParamDefinitionType), pointer, intent(in) :: idt
417  integer(I4B), intent(in) :: iparam
418  integer(I4B), intent(in) :: iaux
419  class(ExportPackageType), pointer, intent(in) :: export_pkg
420  character(len=LINELENGTH) :: varname, longname, nc_tag
421  integer(I4B) :: varid
422 
423  ! set variable input tag
424  nc_tag = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
425  idt)
426 
427  ! set names
428  varname = export_varname(export_pkg%mf6_input%subcomponent_name, &
429  idt%tagname, export_pkg%mf6_input%mempath, &
430  iaux=iaux)
431  longname = export_longname(idt%longname, &
432  export_pkg%mf6_input%subcomponent_name, &
433  idt%tagname, export_pkg%mf6_input%mempath, &
434  iaux=iaux)
435 
436  ! create the netcdf timeseries variable
437  select case (idt%datatype)
438  case ('DOUBLE1D', 'DOUBLE2D')
439  if (idt%shape == 'NCPL' .or. &
440  idt%shape == 'NAUX NCPL') then
441  call nf_verify(nf90_def_var(this%ncid, varname, nf90_double, &
442  (/this%dim_ids%x, &
443  this%dim_ids%y, &
444  this%dim_ids%time/), varid), &
445  this%nc_fname)
446  else
447  call nf_verify(nf90_def_var(this%ncid, varname, nf90_double, &
448  (/this%dim_ids%x, &
449  this%dim_ids%y, &
450  this%dim_ids%z, &
451  this%dim_ids%time/), varid), &
452  this%nc_fname)
453  end if
454  call nf_verify(nf90_put_att(this%ncid, varid, &
455  '_FillValue', (/dnodata/)), &
456  this%nc_fname)
457  case ('INTEGER1D')
458  if (idt%shape == 'NCPL' .or. &
459  idt%shape == 'NAUX NCPL') then
460  call nf_verify(nf90_def_var(this%ncid, varname, nf90_int, &
461  (/this%dim_ids%x, &
462  this%dim_ids%y, &
463  this%dim_ids%time/), varid), &
464  this%nc_fname)
465  else
466  call nf_verify(nf90_def_var(this%ncid, varname, nf90_int, &
467  (/this%dim_ids%x, &
468  this%dim_ids%y, &
469  this%dim_ids%z, &
470  this%dim_ids%time/), varid), &
471  this%nc_fname)
472  end if
473  call nf_verify(nf90_put_att(this%ncid, varid, &
474  '_FillValue', (/nf90_fill_int/)), &
475  this%nc_fname)
476  end select
477 
478  ! apply chunking parameters
479  if (this%chunking_active) then
480  call nf_verify(nf90_def_var_chunking(this%ncid, &
481  varid, &
482  nf90_chunked, &
483  (/this%chunk_x, this%chunk_y, &
484  this%chunk_z, this%chunk_time/)), &
485  this%nc_fname)
486  end if
487 
488  ! deflate and shuffle
489  call ncvar_deflate(this%ncid, varid, this%deflate, &
490  this%shuffle, this%nc_fname)
491 
492  ! variable attributes
493  call nf_verify(nf90_put_att(this%ncid, varid, &
494  'units', this%lenunits), this%nc_fname)
495  call nf_verify(nf90_put_att(this%ncid, varid, &
496  'long_name', longname), this%nc_fname)
497 
498  ! add grid mapping and mf6 attr
499  call ncvar_gridmap(this%ncid, varid, this%gridmap_name, this%latlon, &
500  this%nc_fname)
501  call ncvar_mf6attr(this%ncid, varid, iaux, nc_tag, this%nc_fname)
502 
503  ! store variable id
504  if (idt%tagname == 'AUX') then
505  export_pkg%varids_aux(iaux, 1) = varid
506  else
507  export_pkg%varids_param(iparam, 1) = varid
508  end if
This module contains the NCModelExportModule.
Definition: NCModel.f90:8
Here is the call graph for this function:

◆ define_dependent()

subroutine disncstructuredmodule::define_dependent ( class(disncstructuredtype), intent(inout)  this)

Definition at line 848 of file DisNCStructured.f90.

849  use constantsmodule, only: dhnoflo
850  class(DisNCStructuredType), intent(inout) :: this
851 
852  call nf_verify(nf90_def_var(this%ncid, this%xname, nf90_double, &
853  (/this%dim_ids%x, this%dim_ids%y, &
854  this%dim_ids%z, this%dim_ids%time/), &
855  this%var_ids%dependent), &
856  this%nc_fname)
857 
858  ! apply chunking parameters
859  if (this%chunking_active) then
860  call nf_verify(nf90_def_var_chunking(this%ncid, &
861  this%var_ids%dependent, &
862  nf90_chunked, &
863  (/this%chunk_x, this%chunk_y, &
864  this%chunk_z, this%chunk_time/)), &
865  this%nc_fname)
866  end if
867 
868  ! deflate and shuffle
869  call ncvar_deflate(this%ncid, this%var_ids%dependent, this%deflate, &
870  this%shuffle, this%nc_fname)
871 
872  ! put attr
873  call nf_verify(nf90_put_att(this%ncid, this%var_ids%dependent, &
874  'units', this%lenunits), this%nc_fname)
875  call nf_verify(nf90_put_att(this%ncid, this%var_ids%dependent, &
876  'standard_name', this%annotation%stdname), &
877  this%nc_fname)
878  call nf_verify(nf90_put_att(this%ncid, this%var_ids%dependent, 'long_name', &
879  this%annotation%longname), this%nc_fname)
880  call nf_verify(nf90_put_att(this%ncid, this%var_ids%dependent, '_FillValue', &
881  (/dhnoflo/)), this%nc_fname)
882 
883  ! add grid mapping
884  call ncvar_gridmap(this%ncid, this%var_ids%dependent, this%gridmap_name, &
885  this%latlon, this%nc_fname)
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dhnoflo
real no flow constant
Definition: Constants.f90:93
Here is the call graph for this function:

◆ define_dim()

subroutine disncstructuredmodule::define_dim ( class(disncstructuredtype), intent(inout)  this)
private

Definition at line 753 of file DisNCStructured.f90.

754  use constantsmodule, only: mvalidate
755  use simvariablesmodule, only: isim_mode
756  class(DisNCStructuredType), intent(inout) :: this
757 
758  ! bound dim
759  call nf_verify(nf90_def_dim(this%ncid, 'bnd', 2, this%dim_ids%bnd), &
760  this%nc_fname)
761 
762  if (isim_mode /= mvalidate .or. this%pkglist%Count() > 0) then
763  ! Time
764  call nf_verify(nf90_def_dim(this%ncid, 'time', this%totnstp, &
765  this%dim_ids%time), this%nc_fname)
766  call nf_verify(nf90_def_var(this%ncid, 'time', nf90_double, &
767  this%dim_ids%time, this%var_ids%time), &
768  this%nc_fname)
769  call nf_verify(nf90_put_att(this%ncid, this%var_ids%time, 'calendar', &
770  'standard'), this%nc_fname)
771  call nf_verify(nf90_put_att(this%ncid, this%var_ids%time, 'units', &
772  this%datetime), this%nc_fname)
773  call nf_verify(nf90_put_att(this%ncid, this%var_ids%time, 'axis', 'T'), &
774  this%nc_fname)
775  !call nf_verify(nf90_put_att(ncid, var_ids%time, 'bounds', 'time_bnds'), this%nc_fname)
776  call nf_verify(nf90_put_att(this%ncid, this%var_ids%time, 'standard_name', &
777  'time'), this%nc_fname)
778  call nf_verify(nf90_put_att(this%ncid, this%var_ids%time, 'long_name', &
779  'time'), this%nc_fname)
780  end if
781 
782  ! Z dimension
783  call nf_verify(nf90_def_dim(this%ncid, 'z', this%dis%nlay, this%dim_ids%z), &
784  this%nc_fname)
785  call nf_verify(nf90_def_var(this%ncid, 'z', nf90_double, this%dim_ids%z, &
786  this%var_ids%z), this%nc_fname)
787  call nf_verify(nf90_put_att(this%ncid, this%var_ids%z, 'units', 'layer'), &
788  this%nc_fname)
789  call nf_verify(nf90_put_att(this%ncid, this%var_ids%z, 'long_name', &
790  'layer number'), this%nc_fname)
791  !call nf_verify(nf90_put_att(this%ncid, this%var_ids%z, 'bounds', 'z_bnds'), &
792  ! this%nc_fname)
793  !call nf_verify(nf90_def_var(this%ncid, 'z_bnds', NF90_DOUBLE, &
794  ! (/this%dim_ids%bnd, this%dim_ids%z/), &
795  ! this%var_ids%z_bnds), this%nc_fname)
796  !call nf_verify(nf90_put_var(this%ncid, this%var_ids%z_bnds, &
797  ! this%elev_bnds), this%nc_fname)
798 
799  ! Y dimension
800  call nf_verify(nf90_def_dim(this%ncid, 'y', this%dis%nrow, this%dim_ids%y), &
801  this%nc_fname)
802  call nf_verify(nf90_def_var(this%ncid, 'y', nf90_double, this%dim_ids%y, &
803  this%var_ids%y), this%nc_fname)
804  call nf_verify(nf90_put_att(this%ncid, this%var_ids%y, 'units', &
805  this%lenunits), this%nc_fname)
806  call nf_verify(nf90_put_att(this%ncid, this%var_ids%y, 'axis', 'Y'), &
807  this%nc_fname)
808  call nf_verify(nf90_put_att(this%ncid, this%var_ids%y, 'standard_name', &
809  'projection_y_coordinate'), this%nc_fname)
810  call nf_verify(nf90_put_att(this%ncid, this%var_ids%y, 'long_name', &
811  'Northing'), this%nc_fname)
812  if (this%wkt /= '') then
813  call nf_verify(nf90_put_att(this%ncid, this%var_ids%y, 'grid_mapping', &
814  this%gridmap_name), this%nc_fname)
815  end if
816  call nf_verify(nf90_put_att(this%ncid, this%var_ids%y, 'bounds', 'y_bnds'), &
817  this%nc_fname)
818  call nf_verify(nf90_def_var(this%ncid, 'y_bnds', nf90_double, &
819  (/this%dim_ids%bnd, this%dim_ids%y/), &
820  this%var_ids%y_bnds), this%nc_fname)
821 
822  ! X dimension
823  call nf_verify(nf90_def_dim(this%ncid, 'x', this%dis%ncol, this%dim_ids%x), &
824  this%nc_fname)
825  call nf_verify(nf90_def_var(this%ncid, 'x', nf90_double, this%dim_ids%x, &
826  this%var_ids%x), this%nc_fname)
827  call nf_verify(nf90_put_att(this%ncid, this%var_ids%x, 'units', &
828  this%lenunits), this%nc_fname)
829  call nf_verify(nf90_put_att(this%ncid, this%var_ids%x, 'axis', 'X'), &
830  this%nc_fname)
831  call nf_verify(nf90_put_att(this%ncid, this%var_ids%x, 'standard_name', &
832  'projection_x_coordinate'), this%nc_fname)
833  call nf_verify(nf90_put_att(this%ncid, this%var_ids%x, 'long_name', &
834  'Easting'), this%nc_fname)
835  if (this%wkt /= '') then
836  call nf_verify(nf90_put_att(this%ncid, this%var_ids%x, 'grid_mapping', &
837  this%gridmap_name), this%nc_fname)
838  end if
839  call nf_verify(nf90_put_att(this%ncid, this%var_ids%x, 'bounds', 'x_bnds'), &
840  this%nc_fname)
841  call nf_verify(nf90_def_var(this%ncid, 'x_bnds', nf90_double, &
842  (/this%dim_ids%bnd, this%dim_ids%x/), &
843  this%var_ids%x_bnds), this%nc_fname)
@ mvalidate
validation mode - do not run time steps
Definition: Constants.f90:205
integer(i4b) isim_mode
simulation mode
Here is the call graph for this function:

◆ define_geocoords()

subroutine disncstructuredmodule::define_geocoords ( class(disncstructuredtype), intent(inout)  this)
private

Definition at line 908 of file DisNCStructured.f90.

909  class(DisNCStructuredType), intent(inout) :: this
910  if (this%latlon) then
911  ! lat
912  call nf_verify(nf90_def_var(this%ncid, 'lat', nf90_double, &
913  (/this%dim_ids%x, this%dim_ids%y/), &
914  this%var_ids%latitude), this%nc_fname)
915  call nf_verify(nf90_put_att(this%ncid, this%var_ids%latitude, &
916  'units', 'degrees_north'), this%nc_fname)
917  call nf_verify(nf90_put_att(this%ncid, this%var_ids%latitude, &
918  'standard_name', 'latitude'), this%nc_fname)
919  call nf_verify(nf90_put_att(this%ncid, this%var_ids%latitude, &
920  'long_name', 'latitude'), this%nc_fname)
921 
922  ! lon
923  call nf_verify(nf90_def_var(this%ncid, 'lon', nf90_double, &
924  (/this%dim_ids%x, this%dim_ids%y/), &
925  this%var_ids%longitude), this%nc_fname)
926  call nf_verify(nf90_put_att(this%ncid, this%var_ids%longitude, &
927  'units', 'degrees_east'), this%nc_fname)
928  call nf_verify(nf90_put_att(this%ncid, this%var_ids%longitude, &
929  'standard_name', 'longitude'), this%nc_fname)
930  call nf_verify(nf90_put_att(this%ncid, this%var_ids%longitude, &
931  'long_name', 'longitude'), this%nc_fname)
932  end if
Here is the call graph for this function:

◆ define_gridmap()

subroutine disncstructuredmodule::define_gridmap ( class(disncstructuredtype), intent(inout)  this)

Definition at line 890 of file DisNCStructured.f90.

891  class(DisNCStructuredType), intent(inout) :: this
892  integer(I4B) :: var_id
893  if (this%wkt /= '') then
894  call nf_verify(nf90_redef(this%ncid), this%nc_fname)
895  call nf_verify(nf90_def_var(this%ncid, this%gridmap_name, nf90_int, &
896  var_id), this%nc_fname)
897  ! TODO: consider variants epsg_code, spatial_ref, esri_pe_string, wkt, etc
898  call nf_verify(nf90_put_att(this%ncid, var_id, 'crs_wkt', this%wkt), &
899  this%nc_fname)
900  call nf_verify(nf90_enddef(this%ncid), this%nc_fname)
901  call nf_verify(nf90_put_var(this%ncid, var_id, 1), &
902  this%nc_fname)
903  end if
Here is the call graph for this function:

◆ df()

subroutine disncstructuredmodule::df ( class(disncstructuredtype), intent(inout)  this)
private

Definition at line 211 of file DisNCStructured.f90.

212  use constantsmodule, only: mvalidate
213  use simvariablesmodule, only: isim_mode
214  class(DisNCStructuredType), intent(inout) :: this
215  ! put root group file scope attributes
216  call this%add_global_att()
217  ! define root group dimensions and coordinate variables
218  call this%define_dim()
219  ! define grid projection variables
220  call this%define_geocoords()
221  if (isim_mode == mvalidate) then
222  ! define period input arrays
223  call this%df_export()
224  else
225  ! define the dependent variable
226  call this%define_dependent()
227  end if
228  ! exit define mode
229  call nf_verify(nf90_enddef(this%ncid), this%nc_fname)
230  ! add data locations
231  call this%add_grid_data()
232  ! add projection data
233  call this%add_proj_data()
234  if (isim_mode == mvalidate) then
235  ! define and set package input griddata
236  call this%add_pkg_data()
237  end if
238  ! define and set gridmap variable
239  call this%define_gridmap()
240  ! synchronize file
241  call nf_verify(nf90_sync(this%ncid), this%nc_fname)
Here is the call graph for this function:

◆ df_export()

subroutine disncstructuredmodule::df_export ( class(disncstructuredtype), intent(inout)  this)

Definition at line 246 of file DisNCStructured.f90.

248  class(DisNCStructuredType), intent(inout) :: this
249  class(ExportPackageType), pointer :: export_pkg
250  integer(I4B) :: idx
251  do idx = 1, this%pkglist%Count()
252  export_pkg => this%get(idx)
253  call this%export_df(export_pkg)
254  end do

◆ dis_export_destroy()

subroutine disncstructuredmodule::dis_export_destroy ( class(disncstructuredtype), intent(inout)  this)

Definition at line 195 of file DisNCStructured.f90.

196  class(DisNCStructuredType), intent(inout) :: this
197  call nf_verify(nf90_close(this%ncid), this%nc_fname)
198  deallocate (this%chunk_z)
199  deallocate (this%chunk_y)
200  deallocate (this%chunk_x)
201  deallocate (this%layers)
202  nullify (this%chunk_z)
203  nullify (this%chunk_y)
204  nullify (this%chunk_x)
205  ! destroy base class
206  call this%NCModelExportType%destroy()
Here is the call graph for this function:

◆ dis_export_init()

subroutine disncstructuredmodule::dis_export_init ( class(disncstructuredtype), intent(inout)  this,
character(len=*), intent(in)  modelname,
character(len=*), intent(in)  modeltype,
character(len=*), intent(in)  modelfname,
character(len=*), intent(in)  nc_fname,
integer(i4b), intent(in)  disenum,
integer(i4b), intent(in)  nctype,
integer(i4b), intent(in)  iout 
)
private

Definition at line 95 of file DisNCStructured.f90.

99  class(DisNCStructuredType), intent(inout) :: this
100  character(len=*), intent(in) :: modelname
101  character(len=*), intent(in) :: modeltype
102  character(len=*), intent(in) :: modelfname
103  character(len=*), intent(in) :: nc_fname
104  integer(I4B), intent(in) :: disenum
105  integer(I4B), intent(in) :: nctype
106  integer(I4B), intent(in) :: iout
107  integer(I4B) :: k, latsz, lonsz
108  logical(LGP) :: found
109 
110  ! set nlay
111  this%nlay = this%dis%nlay
112 
113  ! allocate
114  allocate (this%chunk_z)
115  allocate (this%chunk_y)
116  allocate (this%chunk_x)
117  allocate (this%layers(this%nlay))
118 
119  ! initialize
120  this%chunk_z = -1
121  this%chunk_y = -1
122  this%chunk_x = -1
123  do k = 1, this%nlay
124  this%layers(k) = k
125  end do
126 
127  this%latlon = .false.
128 
129  ! initialize base class
130  call this%NCModelExportType%init(modelname, modeltype, modelfname, nc_fname, &
131  disenum, nctype, iout)
132 
133  ! update values from input context
134  if (this%ncf_mempath /= '') then
135  call mem_set_value(this%chunk_z, 'CHUNK_Z', this%ncf_mempath, found)
136  call mem_set_value(this%chunk_y, 'CHUNK_Y', this%ncf_mempath, found)
137  call mem_set_value(this%chunk_x, 'CHUNK_X', this%ncf_mempath, found)
138 
139  if (this%chunk_time > 0 .and. this%chunk_z > 0 .and. &
140  this%chunk_y > 0 .and. this%chunk_x > 0) then
141  this%chunking_active = .true.
142  else if (this%chunk_time > 0 .or. this%chunk_z > 0 .or. &
143  this%chunk_y > 0 .or. this%chunk_x > 0) then
144  this%chunk_time = -1
145  this%chunk_z = -1
146  this%chunk_y = -1
147  this%chunk_x = -1
148  write (warnmsg, '(a)') 'Ignoring user provided NetCDF chunking &
149  &parameters. Define chunk_time, chunk_x, chunk_y and chunk_z input &
150  &parameters to see an effect in file "'//trim(nc_fname)//'".'
151  call store_warning(warnmsg)
152  end if
153 
154  call get_isize('LATITUDE', this%ncf_mempath, latsz)
155  call get_isize('LONGITUDE', this%ncf_mempath, lonsz)
156 
157  if (latsz > 0 .and. lonsz > 0) then
158  this%latlon = .true.
159  if (this%wkt /= '') then
160  write (warnmsg, '(a)') 'Ignoring user provided NetCDF wkt parameter &
161  &as longitude and latitude arrays have been provided. &
162  &Applies to file "'//trim(nc_fname)//'".'
163  call store_warning(warnmsg)
164  this%wkt = ''
165  this%gridmap_name = ''
166  end if
167  call mem_setptr(this%latitude, 'LATITUDE', this%ncf_mempath)
168  call mem_setptr(this%longitude, 'LONGITUDE', this%ncf_mempath)
169  end if
170 
171  if (this%wkt /= '') then
172  if (this%dis%angrot /= dzero) then
173  write (warnmsg, '(a)') 'WKT parameter set with structured rotated &
174  &grid. Projected coordinates will have grid local values. &
175  &Applies to file "'//trim(nc_fname)//'".'
176  call store_warning(warnmsg)
177  end if
178  end if
179  end if
180 
181  if (this%dis%lenuni == 1) then
182  this%lenunits = 'ft'
183  else
184  this%lenunits = 'm'
185  end if
186 
187  ! create the netcdf file
188  call nf_verify(nf90_create(this%nc_fname, &
189  ior(nf90_clobber, nf90_netcdf4), this%ncid), &
190  this%nc_fname)
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Here is the call graph for this function:

◆ export_df()

subroutine disncstructuredmodule::export_df ( class(disncstructuredtype), intent(inout)  this,
class(exportpackagetype), intent(in), pointer  export_pkg 
)
private

Definition at line 381 of file DisNCStructured.f90.

384  class(DisNCStructuredType), intent(inout) :: this
385  class(ExportPackageType), pointer, intent(in) :: export_pkg
386  type(InputParamDefinitionType), pointer :: idt
387  integer(I4B) :: iparam, iaux
388 
389  ! export defined period input
390  do iparam = 1, export_pkg%nparam
391  ! initialize
392  iaux = 0
393  ! set input definition
394  idt => &
395  get_param_definition_type(export_pkg%mf6_input%param_dfns, &
396  export_pkg%mf6_input%component_type, &
397  export_pkg%mf6_input%subcomponent_type, &
398  'PERIOD', export_pkg%param_names(iparam), '')
399  select case (idt%shape)
400  case ('NCPL', 'NODES')
401  call this%create_timeseries(idt, iparam, iaux, export_pkg)
402  case ('NAUX NCPL', 'NAUX NODES')
403  do iaux = 1, export_pkg%naux
404  call this%create_timeseries(idt, iparam, iaux, export_pkg)
405  end do
406  case default
407  end select
408  end do
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.
Here is the call graph for this function:

◆ export_input_array()

subroutine disncstructuredmodule::export_input_array ( class(disncstructuredtype), intent(inout)  this,
character(len=*), intent(in)  pkgtype,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  mempath,
type(inputparamdefinitiontype), intent(in), pointer  idt 
)

Definition at line 309 of file DisNCStructured.f90.

310  class(DisNCStructuredType), intent(inout) :: this
311  character(len=*), intent(in) :: pkgtype
312  character(len=*), intent(in) :: pkgname
313  character(len=*), intent(in) :: mempath
314  type(InputParamDefinitionType), pointer, intent(in) :: idt
315  integer(I4B), dimension(:), pointer, contiguous :: int1d
316  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
317  integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d
318  real(DP), dimension(:), pointer, contiguous :: dbl1d
319  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
320  real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d
321  character(len=LINELENGTH) :: nc_tag
322  integer(I4B) :: iper, iaux
323 
324  ! initialize
325  iper = 0
326  iaux = 0
327 
328  ! set variable name and input attribute string
329  nc_tag = this%input_attribute(pkgname, idt)
330 
331  select case (idt%datatype)
332  case ('INTEGER1D')
333  call mem_setptr(int1d, idt%mf6varname, mempath)
334  call nc_export_array(int1d, this%ncid, this%dim_ids, this%var_ids, &
335  this%dis, idt, mempath, nc_tag, pkgname, &
336  this%gridmap_name, this%latlon, this%deflate, &
337  this%shuffle, this%chunk_z, this%chunk_y, &
338  this%chunk_x, iper, this%nc_fname)
339  case ('INTEGER2D')
340  call mem_setptr(int2d, idt%mf6varname, mempath)
341  call nc_export_array(int2d, this%ncid, this%dim_ids, this%var_ids, &
342  this%dis, idt, mempath, nc_tag, pkgname, &
343  this%gridmap_name, this%latlon, this%deflate, &
344  this%shuffle, this%chunk_z, this%chunk_y, &
345  this%chunk_x, this%nc_fname)
346  case ('INTEGER3D')
347  call mem_setptr(int3d, idt%mf6varname, mempath)
348  call nc_export_array(int3d, this%ncid, this%dim_ids, this%var_ids, &
349  this%dis, idt, mempath, nc_tag, pkgname, &
350  this%gridmap_name, this%latlon, this%deflate, &
351  this%shuffle, this%chunk_z, this%chunk_y, &
352  this%chunk_x, this%nc_fname)
353  case ('DOUBLE1D')
354  call mem_setptr(dbl1d, idt%mf6varname, mempath)
355  call nc_export_array(dbl1d, this%ncid, this%dim_ids, this%var_ids, &
356  this%dis, idt, mempath, nc_tag, pkgname, &
357  this%gridmap_name, this%latlon, this%deflate, &
358  this%shuffle, this%chunk_z, this%chunk_y, &
359  this%chunk_x, iper, iaux, this%nc_fname)
360  case ('DOUBLE2D')
361  call mem_setptr(dbl2d, idt%mf6varname, mempath)
362  call nc_export_array(dbl2d, this%ncid, this%dim_ids, this%var_ids, &
363  this%dis, idt, mempath, nc_tag, pkgname, &
364  this%gridmap_name, this%latlon, this%deflate, &
365  this%shuffle, this%chunk_z, this%chunk_y, &
366  this%chunk_x, this%nc_fname)
367  case ('DOUBLE3D')
368  call mem_setptr(dbl3d, idt%mf6varname, mempath)
369  call nc_export_array(dbl3d, this%ncid, this%dim_ids, this%var_ids, &
370  this%dis, idt, mempath, nc_tag, pkgname, &
371  this%gridmap_name, this%latlon, this%deflate, &
372  this%shuffle, this%chunk_z, this%chunk_y, &
373  this%chunk_x, this%nc_fname)
374  case default
375  ! no-op, no other datatypes exported
376  end select

◆ export_input_arrays()

subroutine disncstructuredmodule::export_input_arrays ( class(disncstructuredtype), intent(inout)  this,
character(len=*), intent(in)  pkgtype,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  mempath,
type(inputparamdefinitiontype), dimension(:), intent(in), pointer  param_dfns 
)

Definition at line 513 of file DisNCStructured.f90.

514  use memorymanagermodule, only: get_isize
515  class(DisNCStructuredType), intent(inout) :: this
516  character(len=*), intent(in) :: pkgtype
517  character(len=*), intent(in) :: pkgname
518  character(len=*), intent(in) :: mempath
519  type(InputParamDefinitionType), dimension(:), pointer, &
520  intent(in) :: param_dfns
521  type(InputParamDefinitionType), pointer :: idt
522  integer(I4B) :: iparam, isize
523  do iparam = 1, size(param_dfns)
524  ! assign param definition pointer
525  idt => param_dfns(iparam)
526  ! for now only griddata is exported
527  if (idt%blockname == 'GRIDDATA') then
528  ! check if variable is already allocated
529  call get_isize(idt%mf6varname, mempath, isize)
530  if (isize > 0) then
531  call this%export_input_array(pkgtype, pkgname, mempath, idt)
532  end if
533  end if
534  end do
Here is the call graph for this function:

◆ nc_export_dbl1d()

subroutine disncstructuredmodule::nc_export_dbl1d ( real(dp), dimension(:), intent(in), pointer, contiguous  p_mem,
integer(i4b), intent(in)  ncid,
type(structuredncdimidtype), intent(inout)  dim_ids,
type(structuredncvaridtype), intent(inout)  var_ids,
type(distype), intent(in), pointer  dis,
type(inputparamdefinitiontype), intent(in), pointer  idt,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  nc_tag,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  gridmap_name,
logical(lgp), intent(in)  latlon,
integer(i4b), intent(in)  deflate,
integer(i4b), intent(in)  shuffle,
integer(i4b), intent(in)  chunk_z,
integer(i4b), intent(in)  chunk_y,
integer(i4b), intent(in)  chunk_x,
integer(i4b), intent(in)  iper,
integer(i4b), intent(in)  iaux,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1337 of file DisNCStructured.f90.

1341  use tdismodule, only: kper
1342  real(DP), dimension(:), pointer, contiguous, intent(in) :: p_mem
1343  integer(I4B), intent(in) :: ncid
1344  type(StructuredNCDimIdType), intent(inout) :: dim_ids
1345  type(StructuredNCVarIdType), intent(inout) :: var_ids
1346  type(DisType), pointer, intent(in) :: dis
1347  type(InputParamDefinitionType), pointer, intent(in) :: idt
1348  character(len=*), intent(in) :: mempath
1349  character(len=*), intent(in) :: nc_tag
1350  character(len=*), intent(in) :: pkgname
1351  character(len=*), intent(in) :: gridmap_name
1352  logical(LGP), intent(in) :: latlon
1353  integer(I4B), intent(in) :: deflate
1354  integer(I4B), intent(in) :: shuffle
1355  integer(I4B), intent(in) :: chunk_z
1356  integer(I4B), intent(in) :: chunk_y
1357  integer(I4B), intent(in) :: chunk_x
1358  integer(I4B), intent(in) :: iper
1359  integer(I4B), intent(in) :: iaux
1360  character(len=*), intent(in) :: nc_fname
1361  integer(I4B) :: var_id, axis_sz
1362  character(len=LINELENGTH) :: varname, longname
1363 
1364  if (idt%shape == 'NROW' .or. &
1365  idt%shape == 'NCOL' .or. &
1366  idt%shape == 'NCPL' .or. &
1367  idt%shape == 'NAUX NCPL') then
1368 
1369  if (iper == 0) then
1370  select case (idt%shape)
1371  case ('NROW')
1372  axis_sz = dim_ids%y
1373  case ('NCOL')
1374  axis_sz = dim_ids%x
1375  end select
1376 
1377  varname = export_varname(pkgname, idt%tagname, mempath)
1378  longname = export_longname(idt%longname, pkgname, idt%tagname, mempath, &
1379  iaux=iaux)
1380 
1381  ! reenter define mode and create variable
1382  call nf_verify(nf90_redef(ncid), nc_fname)
1383  call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1384  (/axis_sz/), var_id), &
1385  nc_fname)
1386 
1387  ! NROW/NCOL shapes use default chunking
1388  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1389 
1390  ! put attr
1391  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1392  (/nf90_fill_double/)), nc_fname)
1393  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1394  longname), nc_fname)
1395 
1396  ! add mf6 attr
1397  call ncvar_mf6attr(ncid, var_id, iaux, nc_tag, nc_fname)
1398 
1399  ! exit define mode and write data
1400  call nf_verify(nf90_enddef(ncid), nc_fname)
1401  call nf_verify(nf90_put_var(ncid, var_id, p_mem), &
1402  nc_fname)
1403  else
1404  ! timeseries
1405  call nf_verify(nf90_put_var(ncid, &
1406  var_ids%export, p_mem, &
1407  start=(/1, kper/), &
1408  count=(/dis%ncol, dis%nrow, 1/)), nc_fname)
1409  end if
1410 
1411  else
1412 
1413  if (iper == 0) then
1414  varname = export_varname(pkgname, idt%tagname, mempath, iaux=iaux)
1415  longname = export_longname(idt%longname, pkgname, idt%tagname, mempath, &
1416  iaux=iaux)
1417 
1418  ! reenter define mode and create variable
1419  call nf_verify(nf90_redef(ncid), nc_fname)
1420  call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1421  (/dim_ids%x, dim_ids%y, dim_ids%z/), &
1422  var_id), nc_fname)
1423 
1424  ! apply chunking parameters
1425  call ncvar_chunk3d(ncid, var_id, chunk_x, chunk_y, chunk_z, nc_fname)
1426  ! deflate and shuffle
1427  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1428 
1429  ! put attr
1430  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1431  (/nf90_fill_double/)), nc_fname)
1432  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1433  longname), nc_fname)
1434 
1435  ! add grid mapping and mf6 attr
1436  call ncvar_gridmap(ncid, var_id, gridmap_name, latlon, nc_fname)
1437  call ncvar_mf6attr(ncid, var_id, iaux, nc_tag, nc_fname)
1438 
1439  ! exit define mode and write data
1440  call nf_verify(nf90_enddef(ncid), nc_fname)
1441  call nf_verify(nf90_put_var(ncid, var_id, p_mem, start=(/1, 1, 1/), &
1442  count=(/dis%ncol, dis%nrow, dis%nlay/)), &
1443  nc_fname)
1444  else
1445  ! timeseries
1446  call nf_verify(nf90_put_var(ncid, &
1447  var_ids%export, p_mem, &
1448  start=(/1, 1, 1, kper/), &
1449  count=(/dis%ncol, dis%nrow, dis%nlay, 1/)), &
1450  nc_fname)
1451  end if
1452  end if
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:26

◆ nc_export_dbl2d()

subroutine disncstructuredmodule::nc_export_dbl2d ( real(dp), dimension(:, :), intent(in), pointer, contiguous  p_mem,
integer(i4b), intent(in)  ncid,
type(structuredncdimidtype), intent(inout)  dim_ids,
type(structuredncvaridtype), intent(inout)  var_ids,
type(distype), intent(in), pointer  dis,
type(inputparamdefinitiontype), intent(in), pointer  idt,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  nc_tag,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  gridmap_name,
logical(lgp), intent(in)  latlon,
integer(i4b), intent(in)  deflate,
integer(i4b), intent(in)  shuffle,
integer(i4b), intent(in)  chunk_z,
integer(i4b), intent(in)  chunk_y,
integer(i4b), intent(in)  chunk_x,
character(len=*), intent(in)  nc_fname 
)

Definition at line 1457 of file DisNCStructured.f90.

1460  real(DP), dimension(:, :), pointer, contiguous, intent(in) :: p_mem
1461  integer(I4B), intent(in) :: ncid
1462  type(StructuredNCDimIdType), intent(inout) :: dim_ids
1463  type(StructuredNCVarIdType), intent(inout) :: var_ids
1464  type(DisType), pointer, intent(in) :: dis
1465  type(InputParamDefinitionType), pointer, intent(in) :: idt
1466  character(len=*), intent(in) :: mempath
1467  character(len=*), intent(in) :: nc_tag
1468  character(len=*), intent(in) :: pkgname
1469  character(len=*), intent(in) :: gridmap_name
1470  logical(LGP), intent(in) :: latlon
1471  integer(I4B), intent(in) :: deflate
1472  integer(I4B), intent(in) :: shuffle
1473  integer(I4B), intent(in) :: chunk_z
1474  integer(I4B), intent(in) :: chunk_y
1475  integer(I4B), intent(in) :: chunk_x
1476  character(len=*), intent(in) :: nc_fname
1477  character(len=LINELENGTH) :: varname
1478  integer(I4B) :: var_id
1479 
1480  varname = export_varname(pkgname, idt%tagname, mempath)
1481 
1482  ! reenter define mode and create variable
1483  call nf_verify(nf90_redef(ncid), nc_fname)
1484  call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1485  (/dim_ids%x, dim_ids%y/), var_id), &
1486  nc_fname)
1487 
1488  ! apply chunking parameters
1489  call ncvar_chunk2d(ncid, var_id, chunk_x, chunk_y, nc_fname)
1490  ! deflate and shuffle
1491  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1492 
1493  ! put attr
1494  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1495  (/nf90_fill_double/)), nc_fname)
1496  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1497  idt%longname), nc_fname)
1498 
1499  ! add grid mapping and mf6 attr
1500  call ncvar_gridmap(ncid, var_id, gridmap_name, latlon, nc_fname)
1501  call ncvar_mf6attr(ncid, var_id, 0, nc_tag, nc_fname)
1502 
1503  ! exit define mode and write data
1504  call nf_verify(nf90_enddef(ncid), nc_fname)
1505  call nf_verify(nf90_put_var(ncid, var_id, p_mem, start=(/1, 1/), &
1506  count=(/dis%ncol, dis%nrow/)), &
1507  nc_fname)

◆ nc_export_dbl3d()

subroutine disncstructuredmodule::nc_export_dbl3d ( real(dp), dimension(:, :, :), intent(in), pointer, contiguous  p_mem,
integer(i4b), intent(in)  ncid,
type(structuredncdimidtype), intent(inout)  dim_ids,
type(structuredncvaridtype), intent(inout)  var_ids,
type(distype), intent(in), pointer  dis,
type(inputparamdefinitiontype), intent(in), pointer  idt,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  nc_tag,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  gridmap_name,
logical(lgp), intent(in)  latlon,
integer(i4b), intent(in)  deflate,
integer(i4b), intent(in)  shuffle,
integer(i4b), intent(in)  chunk_z,
integer(i4b), intent(in)  chunk_y,
integer(i4b), intent(in)  chunk_x,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1512 of file DisNCStructured.f90.

1515  real(DP), dimension(:, :, :), pointer, contiguous, intent(in) :: p_mem
1516  integer(I4B), intent(in) :: ncid
1517  type(StructuredNCDimIdType), intent(inout) :: dim_ids
1518  type(StructuredNCVarIdType), intent(inout) :: var_ids
1519  type(DisType), pointer, intent(in) :: dis
1520  type(InputParamDefinitionType), pointer, intent(in) :: idt
1521  character(len=*), intent(in) :: mempath
1522  character(len=*), intent(in) :: nc_tag
1523  character(len=*), intent(in) :: pkgname
1524  character(len=*), intent(in) :: gridmap_name
1525  logical(LGP), intent(in) :: latlon
1526  integer(I4B), intent(in) :: deflate
1527  integer(I4B), intent(in) :: shuffle
1528  integer(I4B), intent(in) :: chunk_z
1529  integer(I4B), intent(in) :: chunk_y
1530  integer(I4B), intent(in) :: chunk_x
1531  character(len=*), intent(in) :: nc_fname
1532  integer(I4B) :: var_id
1533  character(len=LINELENGTH) :: varname, longname
1534 
1535  varname = export_varname(pkgname, idt%tagname, mempath)
1536  longname = export_longname(idt%longname, pkgname, idt%tagname, mempath)
1537 
1538  ! reenter define mode and create variable
1539  call nf_verify(nf90_redef(ncid), nc_fname)
1540  call nf_verify(nf90_def_var(ncid, varname, nf90_double, &
1541  (/dim_ids%x, dim_ids%y, dim_ids%z/), var_id), &
1542  nc_fname)
1543 
1544  ! apply chunking parameters
1545  call ncvar_chunk3d(ncid, var_id, chunk_x, chunk_y, chunk_z, nc_fname)
1546  ! deflate and shuffle
1547  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1548 
1549  ! put attr
1550  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1551  (/nf90_fill_double/)), nc_fname)
1552  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1553  longname), nc_fname)
1554 
1555  ! add grid mapping and mf6 attr
1556  call ncvar_gridmap(ncid, var_id, gridmap_name, latlon, nc_fname)
1557  call ncvar_mf6attr(ncid, var_id, 0, nc_tag, nc_fname)
1558 
1559  ! exit define mode and write data
1560  call nf_verify(nf90_enddef(ncid), nc_fname)
1561  call nf_verify(nf90_put_var(ncid, var_id, p_mem, start=(/1, 1, 1/), &
1562  count=(/dis%ncol, dis%nrow, dis%nlay/)), &
1563  nc_fname)

◆ nc_export_int1d()

subroutine disncstructuredmodule::nc_export_int1d ( integer(i4b), dimension(:), intent(in), pointer, contiguous  p_mem,
integer(i4b), intent(in)  ncid,
type(structuredncdimidtype), intent(inout)  dim_ids,
type(structuredncvaridtype), intent(inout)  var_ids,
type(distype), intent(in), pointer  dis,
type(inputparamdefinitiontype), intent(in), pointer  idt,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  nc_tag,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  gridmap_name,
logical(lgp), intent(in)  latlon,
integer(i4b), intent(in)  deflate,
integer(i4b), intent(in)  shuffle,
integer(i4b), intent(in)  chunk_z,
integer(i4b), intent(in)  chunk_y,
integer(i4b), intent(in)  chunk_x,
integer(i4b), intent(in)  iper,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1113 of file DisNCStructured.f90.

1116  use tdismodule, only: kper
1117  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: p_mem
1118  integer(I4B), intent(in) :: ncid
1119  type(StructuredNCDimIdType), intent(inout) :: dim_ids
1120  type(StructuredNCVarIdType), intent(inout) :: var_ids
1121  type(DisType), pointer, intent(in) :: dis
1122  type(InputParamDefinitionType), pointer, intent(in) :: idt
1123  character(len=*), intent(in) :: mempath
1124  character(len=*), intent(in) :: nc_tag
1125  character(len=*), intent(in) :: pkgname
1126  character(len=*), intent(in) :: gridmap_name
1127  logical(LGP), intent(in) :: latlon
1128  integer(I4B), intent(in) :: deflate
1129  integer(I4B), intent(in) :: shuffle
1130  integer(I4B), intent(in) :: chunk_z
1131  integer(I4B), intent(in) :: chunk_y
1132  integer(I4B), intent(in) :: chunk_x
1133  integer(I4B), intent(in) :: iper
1134  character(len=*), intent(in) :: nc_fname
1135  integer(I4B) :: var_id, axis_sz
1136  character(len=LINELENGTH) :: varname, longname
1137 
1138  varname = export_varname(pkgname, idt%tagname, mempath)
1139 
1140  if (idt%shape == 'NROW' .or. &
1141  idt%shape == 'NCOL' .or. &
1142  idt%shape == 'NCPL' .or. &
1143  idt%shape == 'NAUX NCPL') then
1144 
1145  if (iper == 0) then
1146  select case (idt%shape)
1147  case ('NROW')
1148  axis_sz = dim_ids%y
1149  case ('NCOL')
1150  axis_sz = dim_ids%x
1151  end select
1152 
1153  longname = export_longname(idt%longname, pkgname, idt%tagname, mempath)
1154 
1155  ! reenter define mode and create variable
1156  call nf_verify(nf90_redef(ncid), nc_fname)
1157  call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
1158  (/axis_sz/), var_id), &
1159  nc_fname)
1160 
1161  ! NROW/NCOL shapes use default chunking
1162  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1163 
1164  ! put attr
1165  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1166  (/nf90_fill_int/)), nc_fname)
1167  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1168  longname), nc_fname)
1169 
1170  ! add mf6 attr
1171  call ncvar_mf6attr(ncid, var_id, 0, nc_tag, nc_fname)
1172 
1173  ! exit define mode and write data
1174  call nf_verify(nf90_enddef(ncid), nc_fname)
1175  call nf_verify(nf90_put_var(ncid, var_id, p_mem), &
1176  nc_fname)
1177  else
1178  ! timeseries
1179  call nf_verify(nf90_put_var(ncid, &
1180  var_ids%export, p_mem, &
1181  start=(/1, kper/), &
1182  count=(/dis%ncol, dis%nrow, 1/)), nc_fname)
1183  end if
1184 
1185  else
1186 
1187  if (iper == 0) then
1188  ! reenter define mode and create variable
1189  call nf_verify(nf90_redef(ncid), nc_fname)
1190  call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
1191  (/dim_ids%x, dim_ids%y, dim_ids%z/), &
1192  var_id), nc_fname)
1193 
1194  ! apply chunking parameters
1195  call ncvar_chunk3d(ncid, var_id, chunk_x, chunk_y, chunk_z, nc_fname)
1196  ! deflate and shuffle
1197  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1198 
1199  ! put attr
1200  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1201  (/nf90_fill_int/)), nc_fname)
1202  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1203  idt%longname), nc_fname)
1204 
1205  ! add grid mapping and mf6 attr
1206  call ncvar_gridmap(ncid, var_id, gridmap_name, latlon, nc_fname)
1207  call ncvar_mf6attr(ncid, var_id, 0, nc_tag, nc_fname)
1208 
1209  ! exit define mode and write data
1210  call nf_verify(nf90_enddef(ncid), nc_fname)
1211  call nf_verify(nf90_put_var(ncid, var_id, p_mem, start=(/1, 1, 1/), &
1212  count=(/dis%ncol, dis%nrow, dis%nlay/)), &
1213  nc_fname)
1214  else
1215  ! timeseries
1216  call nf_verify(nf90_put_var(ncid, &
1217  var_ids%export, p_mem, &
1218  start=(/1, 1, 1, kper/), &
1219  count=(/dis%ncol, dis%nrow, dis%nlay, 1/)), &
1220  nc_fname)
1221  end if
1222  end if

◆ nc_export_int2d()

subroutine disncstructuredmodule::nc_export_int2d ( integer(i4b), dimension(:, :), intent(in), pointer, contiguous  p_mem,
integer(i4b), intent(in)  ncid,
type(structuredncdimidtype), intent(inout)  dim_ids,
type(structuredncvaridtype), intent(inout)  var_ids,
type(distype), intent(in), pointer  dis,
type(inputparamdefinitiontype), intent(in), pointer  idt,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  nc_tag,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  gridmap_name,
logical(lgp), intent(in)  latlon,
integer(i4b), intent(in)  deflate,
integer(i4b), intent(in)  shuffle,
integer(i4b), intent(in)  chunk_z,
integer(i4b), intent(in)  chunk_y,
integer(i4b), intent(in)  chunk_x,
character(len=*), intent(in)  nc_fname 
)

Definition at line 1227 of file DisNCStructured.f90.

1230  integer(I4B), dimension(:, :), pointer, contiguous, intent(in) :: p_mem
1231  integer(I4B), intent(in) :: ncid
1232  type(StructuredNCDimIdType), intent(inout) :: dim_ids
1233  type(StructuredNCVarIdType), intent(inout) :: var_ids
1234  type(DisType), pointer, intent(in) :: dis
1235  type(InputParamDefinitionType), pointer, intent(in) :: idt
1236  character(len=*), intent(in) :: mempath
1237  character(len=*), intent(in) :: nc_tag
1238  character(len=*), intent(in) :: pkgname
1239  character(len=*), intent(in) :: gridmap_name
1240  logical(LGP), intent(in) :: latlon
1241  integer(I4B), intent(in) :: deflate
1242  integer(I4B), intent(in) :: shuffle
1243  integer(I4B), intent(in) :: chunk_z
1244  integer(I4B), intent(in) :: chunk_y
1245  integer(I4B), intent(in) :: chunk_x
1246  character(len=*), intent(in) :: nc_fname
1247  character(len=LINELENGTH) :: varname
1248  integer(I4B) :: var_id
1249 
1250  varname = export_varname(pkgname, idt%tagname, mempath)
1251 
1252  ! reenter define mode and create variable
1253  call nf_verify(nf90_redef(ncid), nc_fname)
1254  call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
1255  (/dim_ids%x, dim_ids%y/), var_id), &
1256  nc_fname)
1257 
1258  ! apply chunking parameters
1259  call ncvar_chunk2d(ncid, var_id, chunk_x, chunk_y, nc_fname)
1260  ! deflate and shuffle
1261  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1262 
1263  ! put attr
1264  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1265  (/nf90_fill_int/)), nc_fname)
1266  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1267  idt%longname), nc_fname)
1268 
1269  ! add grid mapping and mf6 attr
1270  call ncvar_gridmap(ncid, var_id, gridmap_name, latlon, nc_fname)
1271  call ncvar_mf6attr(ncid, var_id, 0, nc_tag, nc_fname)
1272 
1273  ! exit define mode and write data
1274  call nf_verify(nf90_enddef(ncid), nc_fname)
1275  call nf_verify(nf90_put_var(ncid, var_id, p_mem, start=(/1, 1/), &
1276  count=(/dis%ncol, dis%nrow/)), &
1277  nc_fname)

◆ nc_export_int3d()

subroutine disncstructuredmodule::nc_export_int3d ( integer(i4b), dimension(:, :, :), intent(in), pointer, contiguous  p_mem,
integer(i4b), intent(in)  ncid,
type(structuredncdimidtype), intent(inout)  dim_ids,
type(structuredncvaridtype), intent(inout)  var_ids,
type(distype), intent(in), pointer  dis,
type(inputparamdefinitiontype), intent(in), pointer  idt,
character(len=*), intent(in)  mempath,
character(len=*), intent(in)  nc_tag,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  gridmap_name,
logical(lgp), intent(in)  latlon,
integer(i4b), intent(in)  deflate,
integer(i4b), intent(in)  shuffle,
integer(i4b), intent(in)  chunk_z,
integer(i4b), intent(in)  chunk_y,
integer(i4b), intent(in)  chunk_x,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1282 of file DisNCStructured.f90.

1285  integer(I4B), dimension(:, :, :), pointer, contiguous, intent(in) :: p_mem
1286  integer(I4B), intent(in) :: ncid
1287  type(StructuredNCDimIdType), intent(inout) :: dim_ids
1288  type(StructuredNCVarIdType), intent(inout) :: var_ids
1289  type(DisType), pointer, intent(in) :: dis
1290  type(InputParamDefinitionType), pointer, intent(in) :: idt
1291  character(len=*), intent(in) :: mempath
1292  character(len=*), intent(in) :: nc_tag
1293  character(len=*), intent(in) :: pkgname
1294  character(len=*), intent(in) :: gridmap_name
1295  logical(LGP), intent(in) :: latlon
1296  integer(I4B), intent(in) :: deflate
1297  integer(I4B), intent(in) :: shuffle
1298  integer(I4B), intent(in) :: chunk_z
1299  integer(I4B), intent(in) :: chunk_y
1300  integer(I4B), intent(in) :: chunk_x
1301  character(len=*), intent(in) :: nc_fname
1302  character(len=LINELENGTH) :: varname
1303  integer(I4B) :: var_id
1304 
1305  varname = export_varname(pkgname, idt%tagname, mempath)
1306 
1307  ! reenter define mode and create variable
1308  call nf_verify(nf90_redef(ncid), nc_fname)
1309  call nf_verify(nf90_def_var(ncid, varname, nf90_int, &
1310  (/dim_ids%x, dim_ids%y, dim_ids%z/), var_id), &
1311  nc_fname)
1312 
1313  ! apply chunking parameters
1314  call ncvar_chunk3d(ncid, var_id, chunk_x, chunk_y, chunk_z, nc_fname)
1315  ! deflate and shuffle
1316  call ncvar_deflate(ncid, var_id, deflate, shuffle, nc_fname)
1317 
1318  ! put attr
1319  call nf_verify(nf90_put_att(ncid, var_id, '_FillValue', &
1320  (/nf90_fill_int/)), nc_fname)
1321  call nf_verify(nf90_put_att(ncid, var_id, 'long_name', &
1322  idt%longname), nc_fname)
1323 
1324  ! add grid mapping and mf6 attr
1325  call ncvar_gridmap(ncid, var_id, gridmap_name, latlon, nc_fname)
1326  call ncvar_mf6attr(ncid, var_id, 0, nc_tag, nc_fname)
1327 
1328  ! exit define mode and write data
1329  call nf_verify(nf90_enddef(ncid), nc_fname)
1330  call nf_verify(nf90_put_var(ncid, var_id, p_mem, start=(/1, 1, 1/), &
1331  count=(/dis%ncol, dis%nrow, dis%nlay/)), &
1332  nc_fname)

◆ ncvar_chunk2d()

subroutine disncstructuredmodule::ncvar_chunk2d ( integer(i4b), intent(in)  ncid,
integer(i4b), intent(in)  varid,
integer(i4b), intent(in)  chunk_x,
integer(i4b), intent(in)  chunk_y,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1030 of file DisNCStructured.f90.

1031  integer(I4B), intent(in) :: ncid
1032  integer(I4B), intent(in) :: varid
1033  integer(I4B), intent(in) :: chunk_x
1034  integer(I4B), intent(in) :: chunk_y
1035  character(len=*), intent(in) :: nc_fname
1036  if (chunk_y > 0 .and. chunk_x > 0) then
1037  call nf_verify(nf90_def_var_chunking(ncid, varid, nf90_chunked, &
1038  (/chunk_x, chunk_y/)), nc_fname)
1039  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncvar_chunk3d()

subroutine disncstructuredmodule::ncvar_chunk3d ( integer(i4b), intent(in)  ncid,
integer(i4b), intent(in)  varid,
integer(i4b), intent(in)  chunk_x,
integer(i4b), intent(in)  chunk_y,
integer(i4b), intent(in)  chunk_z,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1044 of file DisNCStructured.f90.

1045  integer(I4B), intent(in) :: ncid
1046  integer(I4B), intent(in) :: varid
1047  integer(I4B), intent(in) :: chunk_x
1048  integer(I4B), intent(in) :: chunk_y
1049  integer(I4B), intent(in) :: chunk_z
1050  character(len=*), intent(in) :: nc_fname
1051  if (chunk_z > 0 .and. chunk_y > 0 .and. chunk_x > 0) then
1052  call nf_verify(nf90_def_var_chunking(ncid, varid, nf90_chunked, &
1053  (/chunk_x, chunk_y, chunk_z/)), &
1054  nc_fname)
1055  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncvar_deflate()

subroutine disncstructuredmodule::ncvar_deflate ( integer(i4b), intent(in)  ncid,
integer(i4b), intent(in)  varid,
integer(i4b), intent(in)  deflate,
integer(i4b), intent(in)  shuffle,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1060 of file DisNCStructured.f90.

1061  integer(I4B), intent(in) :: ncid
1062  integer(I4B), intent(in) :: varid
1063  integer(I4B), intent(in) :: deflate
1064  integer(I4B), intent(in) :: shuffle
1065  character(len=*), intent(in) :: nc_fname
1066  ! deflate and shuffle
1067  if (deflate >= 0) then
1068  call nf_verify(nf90_def_var_deflate(ncid, varid, shuffle=shuffle, &
1069  deflate=1, deflate_level=deflate), &
1070  nc_fname)
1071  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncvar_gridmap()

subroutine disncstructuredmodule::ncvar_gridmap ( integer(i4b), intent(in)  ncid,
integer(i4b), intent(in)  varid,
character(len=*), intent(in)  gridmap_name,
logical(lgp), intent(in)  latlon,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1076 of file DisNCStructured.f90.

1077  integer(I4B), intent(in) :: ncid
1078  integer(I4B), intent(in) :: varid
1079  character(len=*), intent(in) :: gridmap_name
1080  logical(LGP), intent(in) :: latlon
1081  character(len=*), intent(in) :: nc_fname
1082  if (gridmap_name /= '') then
1083  call nf_verify(nf90_put_att(ncid, varid, 'coordinates', 'x y'), &
1084  nc_fname)
1085  call nf_verify(nf90_put_att(ncid, varid, 'grid_mapping', gridmap_name), &
1086  nc_fname)
1087  else if (latlon) then
1088  call nf_verify(nf90_put_att(ncid, varid, 'coordinates', 'lon lat'), &
1089  nc_fname)
1090  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncvar_mf6attr()

subroutine disncstructuredmodule::ncvar_mf6attr ( integer(i4b), intent(in)  ncid,
integer(i4b), intent(in)  varid,
integer(i4b), intent(in)  iaux,
character(len=*), intent(in)  nc_tag,
character(len=*), intent(in)  nc_fname 
)
private

Definition at line 1095 of file DisNCStructured.f90.

1096  integer(I4B), intent(in) :: ncid
1097  integer(I4B), intent(in) :: varid
1098  integer(I4B), intent(in) :: iaux
1099  character(len=*), intent(in) :: nc_tag
1100  character(len=*), intent(in) :: nc_fname
1101  if (nc_tag /= '') then
1102  call nf_verify(nf90_put_att(ncid, varid, 'modflow_input', &
1103  nc_tag), nc_fname)
1104  if (iaux > 0) then
1105  call nf_verify(nf90_put_att(ncid, varid, 'modflow_iaux', &
1106  iaux), nc_fname)
1107  end if
1108  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ package_step()

subroutine disncstructuredmodule::package_step ( class(disncstructuredtype), intent(inout)  this,
class(exportpackagetype), intent(in), pointer  export_pkg 
)

Definition at line 539 of file DisNCStructured.f90.

540  use tdismodule, only: totim, kper
543  class(DisNCStructuredType), intent(inout) :: this
544  class(ExportPackageType), pointer, intent(in) :: export_pkg
545  type(InputParamDefinitionType), pointer :: idt
546  integer(I4B), dimension(:), pointer, contiguous :: int1d
547  real(DP), dimension(:), pointer, contiguous :: dbl1d, nodes
548  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
549  character(len=LINELENGTH) :: nc_tag
550  integer(I4B) :: iaux, iparam, nvals, n
551  integer(I4B), pointer :: nbound
552 
553  ! initialize
554  iaux = 0
555 
556  ! export defined period input
557  do iparam = 1, export_pkg%nparam
558  if (export_pkg%iper /= kper) cycle
559  ! check if variable was read this period
560  if (export_pkg%param_reads(iparam)%invar < 1) cycle
561 
562  ! set input definition
563  idt => &
564  get_param_definition_type(export_pkg%mf6_input%param_dfns, &
565  export_pkg%mf6_input%component_type, &
566  export_pkg%mf6_input%subcomponent_type, &
567  'PERIOD', export_pkg%param_names(iparam), '')
568 
569  ! set variable input tag
570  nc_tag = this%input_attribute(export_pkg%mf6_input%subcomponent_name, &
571  idt)
572 
573  ! export arrays
574  select case (idt%datatype)
575  case ('INTEGER1D')
576  call mem_setptr(int1d, idt%mf6varname, export_pkg%mf6_input%mempath)
577  this%var_ids%export = export_pkg%varids_param(iparam, 1)
578  call nc_export_array(int1d, this%ncid, this%dim_ids, this%var_ids, &
579  this%dis, idt, export_pkg%mf6_input%mempath, &
580  nc_tag, export_pkg%mf6_input%subcomponent_name, &
581  this%gridmap_name, this%latlon, this%deflate, &
582  this%shuffle, this%chunk_z, this%chunk_y, &
583  this%chunk_x, kper, this%nc_fname)
584  case ('DOUBLE1D')
585  call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
586  this%var_ids%export = export_pkg%varids_param(iparam, 1)
587  select case (idt%shape)
588  case ('NCPL')
589  call nc_export_array(dbl1d, this%ncid, this%dim_ids, this%var_ids, &
590  this%dis, idt, export_pkg%mf6_input%mempath, &
591  nc_tag, export_pkg%mf6_input%subcomponent_name, &
592  this%gridmap_name, this%latlon, this%deflate, &
593  this%shuffle, this%chunk_z, this%chunk_y, &
594  this%chunk_x, kper, iaux, this%nc_fname)
595  case ('NODES')
596  nvals = this%dis%nodesuser
597  allocate (nodes(nvals))
598  nodes = dnodata
599  call mem_setptr(dbl1d, idt%mf6varname, export_pkg%mf6_input%mempath)
600  call mem_setptr(int1d, 'NODEULIST', export_pkg%mf6_input%mempath)
601  call mem_setptr(nbound, 'NBOUND', export_pkg%mf6_input%mempath)
602  do n = 1, nbound
603  nodes(int1d(n)) = dbl1d(n)
604  end do
605  call nc_export_array(nodes, this%ncid, this%dim_ids, this%var_ids, &
606  this%dis, idt, export_pkg%mf6_input%mempath, &
607  nc_tag, export_pkg%mf6_input%subcomponent_name, &
608  this%gridmap_name, this%latlon, this%deflate, &
609  this%shuffle, this%chunk_z, this%chunk_y, &
610  this%chunk_x, kper, iaux, this%nc_fname)
611  deallocate (nodes)
612  case default
613  end select
614  case ('DOUBLE2D')
615  call mem_setptr(dbl2d, idt%mf6varname, export_pkg%mf6_input%mempath)
616  select case (idt%shape)
617  case ('NAUX NCPL')
618  nvals = this%dis%nrow * this%dis%ncol
619  allocate (nodes(nvals))
620  do iaux = 1, size(dbl2d, dim=1) !naux
621  this%var_ids%export = export_pkg%varids_aux(iaux, 1)
622  do n = 1, nvals
623  nodes(n) = dbl2d(iaux, n)
624  end do
625  call nc_export_array(nodes, this%ncid, this%dim_ids, this%var_ids, &
626  this%dis, idt, export_pkg%mf6_input%mempath, &
627  nc_tag, export_pkg%mf6_input%subcomponent_name, &
628  this%gridmap_name, this%latlon, this%deflate, &
629  this%shuffle, this%chunk_z, this%chunk_y, &
630  this%chunk_x, kper, iaux, this%nc_fname)
631  end do
632  deallocate (nodes)
633  case ('NAUX NODES')
634  nvals = this%dis%nodesuser
635  allocate (nodes(nvals))
636  call mem_setptr(int1d, 'NODEULIST', export_pkg%mf6_input%mempath)
637  call mem_setptr(nbound, 'NBOUND', export_pkg%mf6_input%mempath)
638  do iaux = 1, size(dbl2d, dim=1) ! naux
639  nodes = dnodata
640  this%var_ids%export = export_pkg%varids_aux(iaux, 1)
641  do n = 1, nbound
642  nodes(int1d(n)) = dbl2d(iaux, n)
643  end do
644  call nc_export_array(nodes, this%ncid, this%dim_ids, this%var_ids, &
645  this%dis, idt, export_pkg%mf6_input%mempath, &
646  nc_tag, export_pkg%mf6_input%subcomponent_name, &
647  this%gridmap_name, this%latlon, this%deflate, &
648  this%shuffle, this%chunk_z, this%chunk_y, &
649  this%chunk_x, kper, iaux, this%nc_fname)
650 
651  end do
652  deallocate (nodes)
653  case default
654  end select
655  case default
656  ! no-op, no other datatypes exported
657  end select
658  end do
659 
660  ! write to time coordinate variable
661  call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
662  totim, start=(/kper/)), &
663  this%nc_fname)
664 
665  ! synchronize file
666  call nf_verify(nf90_sync(this%ncid), this%nc_fname)
real(dp), pointer, public totim
time relative to start of simulation
Definition: tdis.f90:35
Here is the call graph for this function:

◆ step()

subroutine disncstructuredmodule::step ( class(disncstructuredtype), intent(inout)  this)

Definition at line 259 of file DisNCStructured.f90.

260  use constantsmodule, only: dhnoflo
261  use tdismodule, only: totim
262  class(DisNCStructuredType), intent(inout) :: this
263  real(DP), dimension(:), pointer, contiguous :: dbl1d
264  integer(I4B) :: n, istp
265 
266  ! set global step index
267  istp = this%istp()
268 
269  if (size(this%dis%nodeuser) < &
270  size(this%dis%nodereduced)) then
271  allocate (dbl1d(size(this%dis%nodereduced)))
272  dbl1d = dhnoflo
273  do n = 1, size(this%dis%nodereduced)
274  if (this%dis%nodereduced(n) > 0) then
275  dbl1d(n) = this%x(this%dis%nodereduced(n))
276  end if
277  end do
278  ! write step data to dependent variable
279  call nf_verify(nf90_put_var(this%ncid, &
280  this%var_ids%dependent, dbl1d, &
281  start=(/1, 1, 1, istp/), &
282  count=(/this%dis%ncol, &
283  this%dis%nrow, &
284  this%dis%nlay, 1/)), &
285  this%nc_fname)
286  deallocate (dbl1d)
287  else
288  ! write step data to dependent variable
289  call nf_verify(nf90_put_var(this%ncid, &
290  this%var_ids%dependent, this%x, &
291  start=(/1, 1, 1, istp/), &
292  count=(/this%dis%ncol, &
293  this%dis%nrow, &
294  this%dis%nlay, 1/)), &
295  this%nc_fname)
296  end if
297 
298  ! write to time coordinate variable
299  call nf_verify(nf90_put_var(this%ncid, this%var_ids%time, &
300  totim, start=(/istp/)), &
301  this%nc_fname)
302 
303  ! synchronize file
304  call nf_verify(nf90_sync(this%ncid), this%nc_fname)
Here is the call graph for this function: