MODFLOW 6  version 6.7.0.dev2
USGS Modular Hydrologic Model
ncexportcreatemodule Module Reference

This module contains the NCExportCreateModule. More...

Functions/Subroutines

subroutine create_nc_export (export_model, num_model)
 create model netcdf export type More...
 
subroutine create_export_pkglist (pkglist, loaders, iout)
 
subroutine, public nc_export_create ()
 initialize netcdf model export type More...
 

Detailed Description

This module creates derived model netcdf export objects. It is dependent on netcdf libraries.

Function/Subroutine Documentation

◆ create_export_pkglist()

subroutine ncexportcreatemodule::create_export_pkglist ( type(listtype), intent(inout)  pkglist,
type(modeldynamicpkgstype), intent(in), pointer  loaders,
integer(i4b), intent(in)  iout 
)

Definition at line 141 of file NCExportCreate.f90.

142  use listmodule, only: listtype
150  type(ListType), intent(inout) :: pkglist
151  type(ModelDynamicPkgsType), pointer, intent(in) :: loaders
152  integer(I4B), intent(in) :: iout
153  class(DynamicPkgLoadBaseType), pointer :: dynamic_pkg
154  class(AsciiDynamicPkgLoadBaseType), pointer :: rp_loader
155  type(ExportPackageType), pointer :: export_pkg
156  integer(I4B), pointer :: export_arrays
157  class(*), pointer :: obj
158  logical(LGP) :: found, readasarrays
159  integer(I4B) :: n
160 
161  ! create list of in scope loaders
162  allocate (export_arrays)
163 
164  do n = 1, loaders%pkglist%Count()
165  ! initialize export arrays option
166  export_arrays = 0
167 
168  dynamic_pkg => loaders%get(n)
169 
170  ! update export arrays option
171  call mem_set_value(export_arrays, 'EXPORT_NC', &
172  dynamic_pkg%mf6_input%mempath, found)
173 
174  readasarrays = (dynamic_pkg%readasarrays .or. dynamic_pkg%readarraygrid)
175  if (export_arrays > 0 .and. readasarrays) then
176  select type (dynamic_pkg)
177  type is (mf6filedynamicpkgloadtype)
178  rp_loader => dynamic_pkg%rp_loader
179  select type (rp_loader)
180  type is (layerarrayloadtype)
181  ! create the export object
182  allocate (export_pkg)
183  call export_pkg%init(rp_loader%mf6_input, &
184  rp_loader%ctx%mshape, &
185  rp_loader%ctx%naux, &
186  rp_loader%param_names, rp_loader%nparam)
187  obj => export_pkg
188  call pkglist%add(obj)
189  type is (gridarrayloadtype)
190  ! create the export object
191  allocate (export_pkg)
192  call export_pkg%init(rp_loader%mf6_input, &
193  rp_loader%ctx%mshape, &
194  rp_loader%ctx%naux, &
195  rp_loader%param_names, rp_loader%nparam)
196  obj => export_pkg
197  call pkglist%add(obj)
198  end select
199  end select
200  end if
201  end do
202 
203  ! cleanup
204  deallocate (export_arrays)
This module contains the AsciiInputLoadTypeModule.
This module contains the GridArrayLoadModule.
This module contains the IdmMf6FileModule.
Definition: IdmMf6File.f90:10
This module contains the InputLoadTypeModule.
This module contains the LayerArrayLoadModule.
base abstract type for ascii source dynamic load
Ascii grid based dynamic loader type.
MF6File dynamic loader type.
Definition: IdmMf6File.f90:39
Base abstract type for dynamic input loader.
type for storing a dynamic package load list
Ascii array layer dynamic loader type.
A generic heterogeneous doubly-linked list.
Definition: List.f90:14
Here is the caller graph for this function:

◆ create_nc_export()

subroutine ncexportcreatemodule::create_nc_export ( type(exportmodeltype), intent(inout), pointer  export_model,
class(numericalmodeltype), intent(in), pointer  num_model 
)
private

Definition at line 30 of file NCExportCreate.f90.

36  type(ExportModelType), pointer, intent(inout) :: export_model
37  class(NumericalModelType), pointer, intent(in) :: num_model
38  class(Mesh2dDisExportType), pointer :: ugrid_dis
39  class(Mesh2dDisvExportType), pointer :: ugrid_disv
40  class(DisNCStructuredType), pointer :: structured_dis
41  class(DisBaseType), pointer :: disbase
42 
43  select case (export_model%disenum)
44  case (dis)
45  ! allocate nc structured grid export object
46  if (export_model%nctype == netcdf_mesh2d) then
47  ! allocate nc structured grid export object
48  allocate (ugrid_dis)
49 
50  ! set dis base type
51  disbase => num_model%dis
52  select type (disbase)
53  type is (distype)
54  ugrid_dis%dis => disbase
55  end select
56 
57  ! set dynamic loaders
58  call create_export_pkglist(ugrid_dis%pkglist, export_model%loaders, &
59  export_model%iout)
60 
61  ! initialize export object
62  call ugrid_dis%init(export_model%modelname, export_model%modeltype, &
63  export_model%modelfname, export_model%nc_fname, &
64  export_model%disenum, netcdf_mesh2d, &
65  export_model%iout)
66 
67  ! define export object
68  call ugrid_dis%df()
69 
70  ! set base pointer
71  export_model%nc_export => ugrid_dis
72  else if (export_model%nctype == netcdf_structured) then
73  ! allocate nc structured grid export object
74  allocate (structured_dis)
75 
76  ! set dis base type
77  disbase => num_model%dis
78  select type (disbase)
79  type is (distype)
80  structured_dis%dis => disbase
81  end select
82 
83  ! set dynamic loaders
84  call create_export_pkglist(structured_dis%pkglist, export_model%loaders, &
85  export_model%iout)
86 
87  ! initialize export object
88  call structured_dis%init(export_model%modelname, export_model%modeltype, &
89  export_model%modelfname, export_model%nc_fname, &
90  export_model%disenum, netcdf_structured, &
91  export_model%iout)
92 
93  ! define export object
94  call structured_dis%df()
95 
96  ! set base pointer
97  export_model%nc_export => structured_dis
98  end if
99  case (disv)
100  if (export_model%nctype == netcdf_mesh2d) then
101  ! allocate nc structured grid export object
102  allocate (ugrid_disv)
103 
104  ! set dis base type
105  disbase => num_model%dis
106  select type (disbase)
107  type is (disvtype)
108  ugrid_disv%disv => disbase
109  end select
110 
111  ! set dynamic loaders
112  call create_export_pkglist(ugrid_disv%pkglist, export_model%loaders, &
113  export_model%iout)
114 
115  ! initialize export object
116  call ugrid_disv%init(export_model%modelname, export_model%modeltype, &
117  export_model%modelfname, export_model%nc_fname, &
118  export_model%disenum, netcdf_mesh2d, &
119  export_model%iout)
120 
121  ! define export object
122  call ugrid_disv%df()
123 
124  ! set base pointer
125  export_model%nc_export => ugrid_disv
126  else
127  errmsg = 'DISV model discretization only &
128  &supported as UGRID NetCDF export. &
129  &Model='//trim(export_model%modelname)//'.'
130  call store_error(errmsg)
131  call store_error_filename(export_model%modelfname)
132  end if
133  case default
134  errmsg = 'Unsupported discretization for NetCDF model export. &
135  &Model='//trim(export_model%modelname)//'.'
136  call store_error(errmsg)
137  call store_error_filename(export_model%modelfname)
138  end select
This module contains the DisNCStructuredModule.
This module contains the MeshDisModelModule.
Definition: DisNCMesh.f90:8
This module contains the MeshDisvModelModule.
Definition: DisvNCMesh.f90:8
This module contains the NCModelExportModule.
Definition: NCModel.f90:8
@, public netcdf_structured
netcdf structrured export
Definition: NCModel.f90:33
@, public netcdf_mesh2d
netcdf ugrid layered mesh export
Definition: NCModel.f90:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nc_export_create()

subroutine, public ncexportcreatemodule::nc_export_create

Definition at line 209 of file NCExportCreate.f90.

211  use listsmodule, only: basemodellist
213  integer(I4B) :: n
214  type(ExportModelType), pointer :: export_model
215  class(NumericalModelType), pointer :: num_model
216  integer(I4B) :: im
217  do n = 1, export_models%Count()
218  ! set pointer to export model
219  export_model => get_export_model(n)
220  if (export_model%nctype /= netcdf_undef) then
221  ! netcdf export is active identify model
222  do im = 1, basemodellist%Count()
223  ! set model pointer
224  num_model => getnumericalmodelfromlist(basemodellist, im)
225  if (num_model%name == export_model%modelname .and. &
226  num_model%macronym == export_model%modeltype) then
227  ! allocate and initialize nc export model
228  call create_nc_export(export_model, num_model)
229  exit
230  end if
231  end do
232  end if
233  end do
type(listtype), public basemodellist
Definition: mf6lists.f90:16
@, public netcdf_undef
undefined netcdf export type
Definition: NCModel.f90:32
class(numericalmodeltype) function, pointer, public getnumericalmodelfromlist(list, idx)
Here is the call graph for this function:
Here is the caller graph for this function: