MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
modelexportmodule Module Reference

This module contains the ModelExportModule. More...

Data Types

type  exportmodeltype
 export model type More...

Functions/Subroutines

logical(lgp) function, public nc_export_active ()
 is netcdf export configured for any model
subroutine, public modelexports_create (iout)
 create export container variable for all local models
subroutine, public modelexports_post_prepare ()
 export model list post prepare step
subroutine, public modelexports_post_step ()
 export model list post step
subroutine, public modelexports_destroy ()
 destroy export model list
subroutine init (this, loaders, disenum, iout)
 initialize model export container variable
subroutine post_prepare (this)
 model export container post prepare step actions
subroutine post_step (this)
 model export container post step actions
subroutine destroy (this)
 destroy model export container
subroutine add_export_model (export_model)
 add model export object to list
class(exportmodeltype) function, pointer, public get_export_model (idx)
 get model export object by index

Variables

type(listtype), public export_models

Detailed Description

This modeule defines the local list of model exports. It is not dependent on netcdf or other external libraries.

Function/Subroutine Documentation

◆ add_export_model()

subroutine modelexportmodule::add_export_model ( type(exportmodeltype), intent(inout), pointer export_model)
private

Definition at line 253 of file ModelExport.f90.

254 type(ExportModelType), pointer, intent(inout) :: export_model
255 class(*), pointer :: obj
256 obj => export_model
257 call export_models%Add(obj)
Here is the caller graph for this function:

◆ destroy()

subroutine modelexportmodule::destroy ( class(exportmodeltype), intent(inout) this)
private

Definition at line 241 of file ModelExport.f90.

242 class(ExportModelType), intent(inout) :: this
243 if (associated(this%nc_export)) then
244 call this%nc_export%destroy()
245 deallocate (this%nc_export)
246 nullify (this%nc_export)
247 end if

◆ get_export_model()

class(exportmodeltype) function, pointer, public modelexportmodule::get_export_model ( integer(i4b), intent(in) idx)
Parameters
[in]idxpackage number

Definition at line 263 of file ModelExport.f90.

264 integer(I4B), intent(in) :: idx !< package number
265 class(ExportModelType), pointer :: res
266 class(*), pointer :: obj
267 ! initialize res
268 nullify (res)
269 ! get the object from the list
270 obj => export_models%GetItem(idx)
271 if (associated(obj)) then
272 select type (obj)
273 class is (exportmodeltype)
274 res => obj
275 end select
276 end if
Here is the caller graph for this function:

◆ init()

subroutine modelexportmodule::init ( class(exportmodeltype), intent(inout) this,
type(modeldynamicpkgstype), intent(in), pointer loaders,
integer(i4b), intent(in) disenum,
integer(i4b), intent(in) iout )
private

Definition at line 201 of file ModelExport.f90.

203 class(ExportModelType), intent(inout) :: this
204 type(ModelDynamicPkgsType), pointer, intent(in) :: loaders
205 integer(I4B), intent(in) :: disenum
206 integer(I4B), intent(in) :: iout
207 this%loaders => loaders
208 this%modelname = loaders%modelname
209 this%modeltype = loaders%modeltype
210 this%modelfname = loaders%modelfname
211 this%nc_fname = ''
212 this%nctype = netcdf_undef
213 this%disenum = disenum
214 this%iout = iout
215 nullify (this%nc_export)
This module contains the NCModelExportModule.
Definition NCModel.f90:8
@ netcdf_undef
undefined netcdf export type
Definition NCModel.f90:37

◆ modelexports_create()

subroutine, public modelexportmodule::modelexports_create ( integer(i4b), intent(in) iout)

Definition at line 76 of file ModelExport.f90.

85 integer(I4B), intent(in) :: iout
86 type(ModelDynamicPkgsType), pointer :: model_input
87 type(ExportModelType), pointer :: export_model
88 character(len=LENMEMPATH) :: modelnam_mempath, model_mempath, ext
89 integer(I4B), pointer :: disenum
90 integer(I4B) :: n
91 logical(LGP) :: found
92
93 do n = 1, model_inputs%Count()
94 ! allocate and initialize
95 allocate (export_model)
96
97 ! set pointer to dynamic input model instance
98 model_input => getdynamicmodelfromlist(model_inputs, n)
99
100 ! set input mempaths
101 modelnam_mempath = &
102 create_mem_path(component=model_input%modelname, &
103 subcomponent='NAM', context=idm_context)
104 model_mempath = create_mem_path(component=model_input%modelname, &
105 context=idm_context)
106 ! set pointer to dis enum type
107 call mem_setptr(disenum, 'DISENUM', model_mempath)
108
109 ! initialize model
110 call export_model%init(model_input, disenum, iout)
111
112 ! update NetCDF fileout name if provided
113 call mem_set_value(export_model%nc_fname, 'NCMESH2DFILE', &
114 modelnam_mempath, found)
115 if (found) then
116 export_model%nctype = netcdf_mesh2d
117 else
118 call mem_set_value(export_model%nc_fname, 'NCSTRUCTFILE', &
119 modelnam_mempath, found)
120 if (found) then
121 export_model%nctype = netcdf_structured
122 end if
123 end if
124
125 if (found) then
126 ext = file_ext(export_model%nc_fname)
127 if (ext /= 'nc') then
128 errmsg = 'NetCDF output file name must use ".nc" extension. '// &
129 'Filename="'//trim(export_model%nc_fname)//'".'
130 call store_error(errmsg)
131 call store_error_filename(export_model%modelfname)
132 end if
133 end if
134
135 ! add model to list
136 call add_export_model(export_model)
137 end do
This module contains the InputLoadTypeModule.
class(modeldynamicpkgstype) function, pointer, public getdynamicmodelfromlist(list, idx)
get model dynamic packages object from list
type(listtype), public model_inputs
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
@ netcdf_mesh2d
netcdf ugrid layered mesh export
Definition NCModel.f90:39
@ netcdf_structured
netcdf structrured export
Definition NCModel.f90:38
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
integer(i4b) iout
file unit number for simulation output
This module contains the SourceCommonModule.
character(len=lenpackagetype) function, public file_ext(filename)
input file extension
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modelexports_destroy()

subroutine, public modelexportmodule::modelexports_destroy

Definition at line 178 of file ModelExport.f90.

179 class(*), pointer :: obj
180 class(ExportModelType), pointer :: export_model
181 integer(I4B) :: n
182 do n = 1, export_models%Count()
183 obj => export_models%GetItem(n)
184 if (associated(obj)) then
185 select type (obj)
186 class is (exportmodeltype)
187 export_model => obj
188 call export_model%destroy()
189 deallocate (export_model)
190 nullify (export_model)
191 end select
192 end if
193 end do
194 !
195 call export_models%clear()
Here is the caller graph for this function:

◆ modelexports_post_prepare()

subroutine, public modelexportmodule::modelexports_post_prepare

Definition at line 142 of file ModelExport.f90.

143 class(*), pointer :: obj
144 class(ExportModelType), pointer :: export_model
145 integer(I4B) :: n
146 do n = 1, export_models%Count()
147 obj => export_models%GetItem(n)
148 if (associated(obj)) then
149 select type (obj)
150 class is (exportmodeltype)
151 export_model => obj
152 call export_model%post_prepare()
153 end select
154 end if
155 end do
Here is the caller graph for this function:

◆ modelexports_post_step()

subroutine, public modelexportmodule::modelexports_post_step

Definition at line 160 of file ModelExport.f90.

161 class(*), pointer :: obj
162 class(ExportModelType), pointer :: export_model
163 integer(I4B) :: n
164 do n = 1, export_models%Count()
165 obj => export_models%GetItem(n)
166 if (associated(obj)) then
167 select type (obj)
168 class is (exportmodeltype)
169 export_model => obj
170 call export_model%post_step()
171 end select
172 end if
173 end do
Here is the caller graph for this function:

◆ nc_export_active()

logical(lgp) function, public modelexportmodule::nc_export_active

Definition at line 59 of file ModelExport.f90.

61 logical(LGP) :: active
62 integer(I4B) :: n
63 type(ExportModelType), pointer :: export_model
64 active = .false.
65 do n = 1, export_models%Count()
66 export_model => get_export_model(n)
67 if (export_model%nctype /= netcdf_undef) then
68 active = .true.
69 exit
70 end if
71 end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ post_prepare()

subroutine modelexportmodule::post_prepare ( class(exportmodeltype), intent(inout) this)
private

Definition at line 221 of file ModelExport.f90.

222 class(ExportModelType), intent(inout) :: this
223 if (associated(this%nc_export)) then
224 call this%nc_export%export_input()
225 end if

◆ post_step()

subroutine modelexportmodule::post_step ( class(exportmodeltype), intent(inout) this)
private

Definition at line 231 of file ModelExport.f90.

232 class(ExportModelType), intent(inout) :: this
233 if (associated(this%nc_export)) then
234 call this%nc_export%step()
235 end if

Variable Documentation

◆ export_models

type(listtype), public modelexportmodule::export_models

Definition at line 30 of file ModelExport.f90.

30 type(ListType) :: export_models