MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
idmloadmodule Module Reference

This module contains the IdmLoadModule. More...

Functions/Subroutines

subroutine, public idm_df ()
 advance package dynamic data for period steps More...
 
subroutine, public idm_rp ()
 load package dynamic data for period More...
 
subroutine, public idm_ad ()
 advance package dynamic data for period steps More...
 
subroutine, public idm_da (iout)
 idm deallocate routine More...
 
recursive subroutine input_load (component_type, subcomponent_type, modelname, pkgname, pkgtype, filename, modelfname, nc_vars, iout)
 load an integrated model package from supported source More...
 
subroutine load_model_pkgs (model_pkg_inputs, iout)
 load integrated model package files More...
 
subroutine, public load_models (iout)
 load model namfiles and model package files More...
 
subroutine, public load_exchanges (iout)
 load exchange files More...
 
subroutine, public simnam_load (paramlog)
 MODFLOW 6 mfsim.nam input load routine. More...
 
subroutine, public simtdis_load ()
 MODFLOW 6 tdis input load routine. More...
 
class(modeldynamicpkgstype) function, pointer dynamic_model_pkgs (modeltype, modelname, modelfname, nc_fname, ncid, iout)
 retrieve list of model dynamic loaders More...
 
subroutine dynamic_da (iout)
 deallocate all model dynamic loader collections More...
 
integer(i4b) function input_param_log ()
 return sim input context PRINT_INPUT value More...
 
subroutine simnam_load_dim ()
 load simulation summary info to input context More...
 
subroutine allocate_simnam_int (input_mempath, idt)
 set sim nam input context default integer value More...
 
subroutine allocate_simnam_param (input_mempath, idt)
 MODFLOW 6 mfsim.nam parameter allocate and set. More...
 
subroutine simnam_allocate ()
 MODFLOW 6 mfsim.nam input context parameter allocation. More...
 

Detailed Description

This module contains routines for managing static and dynamic input loading for supported sources.

Function/Subroutine Documentation

◆ allocate_simnam_int()

subroutine idmloadmodule::allocate_simnam_int ( character(len=lenmempath), intent(in)  input_mempath,
type(inputparamdefinitiontype), intent(in), pointer  idt 
)

Definition at line 646 of file IdmLoad.f90.

649  character(len=LENMEMPATH), intent(in) :: input_mempath
650  type(InputParamDefinitionType), pointer, intent(in) :: idt
651  integer(I4B), pointer :: intvar
652  !
653  ! -- allocate and set default
654  call mem_allocate(intvar, idt%mf6varname, input_mempath)
655  !
656  select case (idt%mf6varname)
657  case ('CONTINUE')
658  intvar = isimcontinue
659  case ('NOCHECK')
660  intvar = isimcheck
661  case ('MAXERRORS')
662  intvar = 1000 !< MessageType max_message
663  case ('MXITER')
664  intvar = 1
665  case ('PRINT_INPUT')
666  intvar = 0
667  case default
668  write (errmsg, '(a,a)') &
669  'Idm SIMNAM Load default value setting '&
670  &'is unhandled for this variable: ', &
671  trim(idt%mf6varname)
672  call store_error(errmsg)
673  call store_error_filename(simfile)
674  end select
675  !
676  ! -- return
677  return
This module contains simulation variables.
Definition: SimVariables.f90:9
integer(i4b) isimcheck
simulation input check flag (1) to check input, (0) to ignore checks
integer(i4b) isimcontinue
simulation continue flag (1) to continue if isimcnvg = 0, (0) to terminate
character(len=linelength) simfile
simulation name file
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocate_simnam_param()

subroutine idmloadmodule::allocate_simnam_param ( character(len=lenmempath), intent(in)  input_mempath,
type(inputparamdefinitiontype), intent(in), pointer  idt 
)

Definition at line 682 of file IdmLoad.f90.

683  use simvariablesmodule, only: simfile
687  character(len=LENMEMPATH), intent(in) :: input_mempath
688  type(InputParamDefinitionType), pointer, intent(in) :: idt
689  character(len=LINELENGTH), pointer :: cstr
690  type(CharacterStringType), dimension(:), &
691  pointer, contiguous :: acharstr1d
692  !
693  ! -- initialize
694  !
695  select case (idt_datatype(idt))
696  case ('KEYWORD', 'INTEGER')
697  !
698  if (idt%in_record) then
699  ! -- no-op
700  else
701  ! -- allocate and set default
702  call allocate_simnam_int(input_mempath, idt)
703  end if
704  !
705  case ('STRING')
706  !
707  ! -- did this param originate from sim namfile RECARRAY type
708  if (idt%in_record) then
709  !
710  ! -- allocate 0 size CharacterStringType array
711  call mem_allocate(acharstr1d, linelength, 0, idt%mf6varname, &
712  input_mempath)
713  else
714  !
715  ! -- allocate empty string
716  call mem_allocate(cstr, linelength, idt%mf6varname, input_mempath)
717  cstr = ''
718  end if
719  case ('RECORD')
720  ! -- no-op
721  case default
722  write (errmsg, '(a,a)') &
723  'IdmLoad allocate simnam param unhandled datatype: ', &
724  trim(idt%datatype)
725  call store_error(errmsg)
726  call store_error_filename(simfile)
727  end select
728  !
729  ! -- return
730  return
This module contains the DefinitionSelectModule.
character(len=linelength) function, public idt_datatype(idt)
return input definition type datatype
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dynamic_da()

subroutine idmloadmodule::dynamic_da ( integer(i4b), intent(in)  iout)

Definition at line 565 of file IdmLoad.f90.

567  use sourceloadmodule, only: nc_close
568  integer(I4B), intent(in) :: iout
569  class(ModelDynamicPkgsType), pointer :: model_dynamic_input
570  integer(I4B) :: n
571  !
572  do n = 1, model_dynamic_pkgs%Count()
573  model_dynamic_input => getdynamicmodelfromlist(model_dynamic_pkgs, n)
574  call nc_close(model_dynamic_input%ncid, model_dynamic_input%nc_fname)
575  call model_dynamic_input%destroy()
576  deallocate (model_dynamic_input)
577  nullify (model_dynamic_input)
578  end do
579  !
580  call model_dynamic_pkgs%Clear()
581  !
582  ! -- return
583  return
This module contains the InputLoadTypeModule.
class(modeldynamicpkgstype) function, pointer, public getdynamicmodelfromlist(list, idx)
get model dynamic packages object from list
This module contains the SourceLoadModule.
Definition: SourceLoad.F90:8
subroutine, public nc_close(ncid, nc_fname)
close an open netcdf file
Definition: SourceLoad.F90:393
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dynamic_model_pkgs()

class(modeldynamicpkgstype) function, pointer idmloadmodule::dynamic_model_pkgs ( character(len=*), intent(in)  modeltype,
character(len=*), intent(in)  modelname,
character(len=*), intent(in)  modelfname,
character(len=*), intent(in)  nc_fname,
integer(i4b), intent(in)  ncid,
integer(i4b), intent(in)  iout 
)

Definition at line 526 of file IdmLoad.f90.

529  character(len=*), intent(in) :: modeltype
530  character(len=*), intent(in) :: modelname
531  character(len=*), intent(in) :: modelfname
532  character(len=*), intent(in) :: nc_fname
533  integer(I4B), intent(in) :: ncid
534  integer(I4B), intent(in) :: iout
535  class(ModelDynamicPkgsType), pointer :: model_dynamic_input
536  class(ModelDynamicPkgsType), pointer :: temp
537  integer(I4B) :: id
538  !
539  ! -- initialize
540  nullify (model_dynamic_input)
541  !
542  ! -- assign model loader object if found
543  do id = 1, model_dynamic_pkgs%Count()
544  temp => getdynamicmodelfromlist(model_dynamic_pkgs, id)
545  if (temp%modelname == modelname) then
546  model_dynamic_input => temp
547  exit
548  end if
549  end do
550  !
551  ! -- create if not found
552  if (.not. associated(model_dynamic_input)) then
553  allocate (model_dynamic_input)
554  call model_dynamic_input%init(modeltype, modelname, modelfname, &
555  nc_fname, ncid, iout)
556  call adddynamicmodeltolist(model_dynamic_pkgs, model_dynamic_input)
557  end if
558  !
559  ! -- return
560  return
subroutine, public adddynamicmodeltolist(list, model_dynamic)
add model dynamic packages object to list
Here is the call graph for this function:
Here is the caller graph for this function:

◆ idm_ad()

subroutine, public idmloadmodule::idm_ad

Definition at line 69 of file IdmLoad.f90.

71  class(ModelDynamicPkgsType), pointer :: model_dynamic_input
72  integer(I4B) :: n
73  !
74  do n = 1, model_dynamic_pkgs%Count()
75  model_dynamic_input => getdynamicmodelfromlist(model_dynamic_pkgs, n)
76  call model_dynamic_input%ad()
77  end do
78  !
79  ! -- return
80  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ idm_da()

subroutine, public idmloadmodule::idm_da ( integer(i4b), intent(in)  iout)

Definition at line 85 of file IdmLoad.f90.

91  integer(I4B), intent(in) :: iout
92  type(CharacterStringType), dimension(:), contiguous, &
93  pointer :: mempaths
94  character(len=LENCOMPONENTNAME) :: exg_comp, exg_subcomp
95  character(len=LENMEMPATH) :: input_mempath, mempath
96  integer(I4B) :: n
97  !
98  ! -- deallocate dynamic loaders
99  call dynamic_da(iout)
100  !
101  ! -- deallocate EXG mempaths
102  input_mempath = create_mem_path('SIM', 'NAM', idm_context)
103  call mem_setptr(mempaths, 'EXGMEMPATHS', input_mempath)
104  do n = 1, size(mempaths)
105  mempath = mempaths(n)
106  if (mempath /= '') then
107  call split_mem_path(mempath, exg_comp, exg_subcomp)
108  call memorystore_remove(exg_comp, exg_subcomp, idm_context)
109  end if
110  end do
111  !
112  ! -- deallocate input context SIM paths
113  call memorystore_remove('UTL', 'HPC', idm_context)
114  call memorystore_remove('SIM', 'TDIS', idm_context)
115  call memorystore_remove('SIM', 'NAM', idm_context)
116  call memorystore_remove(component='SIM', context=idm_context)
117  !
118  ! -- return
119  return
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine split_mem_path(mem_path, component, subcomponent)
Split the memory path into component(s)
subroutine, public memorystore_remove(component, subcomponent, context)
character(len=linelength) idm_context
Here is the call graph for this function:
Here is the caller graph for this function:

◆ idm_df()

subroutine, public idmloadmodule::idm_df

Definition at line 37 of file IdmLoad.f90.

39  class(ModelDynamicPkgsType), pointer :: model_dynamic_input
40  integer(I4B) :: n
41  !
42  do n = 1, model_dynamic_pkgs%Count()
43  model_dynamic_input => getdynamicmodelfromlist(model_dynamic_pkgs, n)
44  call model_dynamic_input%df()
45  end do
46  !
47  ! -- return
48  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ idm_rp()

subroutine, public idmloadmodule::idm_rp

Definition at line 53 of file IdmLoad.f90.

55  class(ModelDynamicPkgsType), pointer :: model_dynamic_input
56  integer(I4B) :: n
57  !
58  do n = 1, model_dynamic_pkgs%Count()
59  model_dynamic_input => getdynamicmodelfromlist(model_dynamic_pkgs, n)
60  call model_dynamic_input%rp()
61  end do
62  !
63  ! -- return
64  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ input_load()

recursive subroutine idmloadmodule::input_load ( character(len=*), intent(in)  component_type,
character(len=*), intent(in)  subcomponent_type,
character(len=*), intent(in)  modelname,
character(len=*), intent(in)  pkgname,
character(len=*), intent(in)  pkgtype,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  modelfname,
type(ncfilevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  iout 
)

Definition at line 124 of file IdmLoad.f90.

130  character(len=*), intent(in) :: component_type
131  character(len=*), intent(in) :: subcomponent_type
132  character(len=*), intent(in) :: pkgname
133  character(len=*), intent(in) :: pkgtype
134  character(len=*), intent(in) :: filename
135  character(len=*), intent(in) :: modelname
136  character(len=*), intent(in) :: modelfname
137  type(NCFileVarsType), pointer, intent(in) :: nc_vars
138  integer(I4B), intent(in) :: iout
139  class(StaticPkgLoadBaseType), pointer :: static_loader
140  class(DynamicPkgLoadBaseType), pointer :: dynamic_loader
141  class(ModelDynamicPkgsType), pointer :: dynamic_pkgs
142  integer(I4B) :: n
143  !
144  ! -- create model package loader
145  static_loader => &
146  create_input_loader(component_type, subcomponent_type, modelname, pkgname, &
147  pkgtype, filename, modelfname, nc_vars)
148  !
149  ! -- load static input and set dynamic loader
150  dynamic_loader => static_loader%load(iout)
151  !
152  if (associated(dynamic_loader)) then
153  !
154  ! -- set pointer to model dynamic packages list
155  dynamic_pkgs => &
156  dynamic_model_pkgs(static_loader%mf6_input%component_type, modelname, &
157  static_loader%component_input_name, nc_vars%nc_fname, &
158  nc_vars%ncid, iout)
159  !
160  ! -- add dynamic pkg loader to list
161  call dynamic_pkgs%add(dynamic_loader)
162  !
163  end if
164  !
165  ! -- create subpackage list
166  call static_loader%create_subpkg_list()
167  !
168  ! -- load idm integrated subpackages
169  do n = 1, static_loader%subpkg_list%pnum
170  !
171  ! -- load subpackage
172  call input_load(static_loader%subpkg_list%component_types(n), &
173  static_loader%subpkg_list%subcomponent_types(n), &
174  static_loader%mf6_input%component_name, &
175  static_loader%subpkg_list%subcomponent_types(n), &
176  static_loader%subpkg_list%pkgtypes(n), &
177  static_loader%subpkg_list%filenames(n), &
178  modelfname, nc_vars, iout)
179  end do
180  !
181  ! -- cleanup
182  call static_loader%destroy()
183  deallocate (static_loader)
184  !
185  ! -- return
186  return
This module contains the ModelPackageInputsModule.
This module contains the NCFileVarsModule.
Definition: NCFileVars.f90:7
class(staticpkgloadbasetype) function, pointer, public create_input_loader(component_type, subcomponent_type, component_name, subcomponent_name, input_type, input_fname, component_fname, nc_vars)
factory function to create and setup model package static loader
Definition: SourceLoad.F90:37
derived type for model package inputs type
Type describing modflow6 input variables in model NetCDF file.
Definition: NCFileVars.f90:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ input_param_log()

integer(i4b) function idmloadmodule::input_param_log

Definition at line 588 of file IdmLoad.f90.

592  character(len=LENMEMPATH) :: simnam_mempath
593  integer(I4B) :: paramlog
594  integer(I4B), pointer :: p
595  !
596  ! -- read and set input value of PRINT_INPUT
597  simnam_mempath = create_mem_path('SIM', 'NAM', idm_context)
598  call mem_setptr(p, 'PRINT_INPUT', simnam_mempath)
599  paramlog = p
600  !
601  ! -- return
602  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_exchanges()

subroutine, public idmloadmodule::load_exchanges ( integer(i4b), intent(in)  iout)

Definition at line 325 of file IdmLoad.f90.

326  ! -- modules
336  ! -- dummy
337  integer(I4B), intent(in) :: iout
338  ! -- local
339  type(DistributedSimType), pointer :: ds
340  integer(I4B), dimension(:), pointer :: model_loadmask
341  type(CharacterStringType), dimension(:), contiguous, &
342  pointer :: etypes !< exg types
343  type(CharacterStringType), dimension(:), contiguous, &
344  pointer :: efiles !< exg file names
345  type(CharacterStringType), dimension(:), contiguous, &
346  pointer :: emnames_a !< model a names
347  type(CharacterStringType), dimension(:), contiguous, &
348  pointer :: emnames_b !< model b names
349  type(CharacterStringType), dimension(:), contiguous, &
350  pointer :: emempaths !< exg mempaths
351  type(CharacterStringType), dimension(:), contiguous, &
352  pointer :: mtypes !< model types
353  type(CharacterStringType), dimension(:), contiguous, &
354  pointer :: mfnames !< model file names
355  type(CharacterStringType), dimension(:), contiguous, &
356  pointer :: mnames !< model names
357  character(len=LENMEMPATH) :: input_mempath, mempath
358  integer(I4B), pointer :: exgid, ncelldim
359  character(len=LINELENGTH) :: exgtype, efname, mfname
360  character(len=LENMODELNAME) :: mname1, mname2, mname
361  character(len=LENCOMPONENTNAME) :: sc_type, sc_name, mtype
362  class(StaticPkgLoadBaseType), pointer :: static_loader
363  class(DynamicPkgLoadBaseType), pointer :: dynamic_loader
364  integer(I4B) :: n, m1_idx, m2_idx, irem, isize
365  !
366  ! -- get model mask
367  ds => get_dsim()
368  model_loadmask => ds%get_load_mask()
369  !
370  ! -- set input memory path
371  input_mempath = create_mem_path('SIM', 'NAM', idm_context)
372  !
373  ! -- set pointers to input context exg and model attribute arrays
374  call mem_setptr(etypes, 'EXGTYPE', input_mempath)
375  call mem_setptr(efiles, 'EXGFILE', input_mempath)
376  call mem_setptr(emnames_a, 'EXGMNAMEA', input_mempath)
377  call mem_setptr(emnames_b, 'EXGMNAMEB', input_mempath)
378  call mem_setptr(mtypes, 'MTYPE', input_mempath)
379  call mem_setptr(mfnames, 'MFNAME', input_mempath)
380  call mem_setptr(mnames, 'MNAME', input_mempath)
381  !
382  ! -- allocate mempaths array for exchanges
383  call mem_allocate(emempaths, lenmempath, size(etypes), 'EXGMEMPATHS', &
384  input_mempath)
385  !
386  ! -- load exchanges for local models
387  do n = 1, size(etypes)
388  !
389  ! -- attributes for this exchange
390  exgtype = etypes(n)
391  efname = efiles(n)
392  call inlen_check(emnames_a(n), mname1, lenmodelname, 'MODELNAME')
393  call inlen_check(emnames_b(n), mname2, lenmodelname, 'MODELNAME')
394  !
395  ! initialize mempath as no path
396  emempaths(n) = ''
397  irem = 0
398  !
399  ! -- set indexes for exchange model names
400  m1_idx = ifind_charstr(mnames, mname1)
401  m2_idx = ifind_charstr(mnames, mname2)
402  !
403  if (m1_idx <= 0 .or. m2_idx <= 0) then
404  errmsg = 'Exchange has invalid (unrecognized) model name(s):'
405  if (m1_idx <= 0) errmsg = trim(errmsg)//' '//trim(mname1)
406  if (m2_idx <= 0) errmsg = trim(errmsg)//' '//trim(mname2)
407  call store_error(errmsg)
408  end if
409  !
410  ! -- terminate if errors were detected
411  if (count_errors() > 0) then
412  call store_error_filename(simfile)
413  end if
414  !
415  ! -- load the exchange input if either model local
416  if (model_loadmask(m1_idx) > 0 .or. model_loadmask(m2_idx) > 0) then
417  !
418  ! -- set index if either model is remote
419  if (model_loadmask(m1_idx) == 0) then
420  irem = m1_idx
421  else if (model_loadmask(m2_idx) == 0) then
422  irem = m2_idx
423  end if
424  !
425  ! -- allocate and set remote model NCELLDIM
426  if (irem > 0) then
427  mtype = mtypes(irem)
428  mfname = mfnames(irem)
429  mname = mnames(irem)
430  mempath = create_mem_path(component=mname, context=idm_context)
431  call get_isize('NCELLDIM', mempath, isize)
432  if (isize < 0) then
433  call mem_allocate(ncelldim, 'NCELLDIM', mempath)
434  ncelldim = remote_model_ndim(mtype, mfname)
435  else
436  call mem_setptr(ncelldim, 'NCELLDIM', mempath)
437  end if
438  else
439  nullify (ncelldim)
440  end if
441  !
442  ! -- set subcomponent strings
443  sc_type = trim(idm_subcomponent_type('EXG', exgtype))
444  write (sc_name, '(a,i0)') trim(sc_type)//'_', n
445  !
446  ! -- create and set exchange mempath
447  mempath = create_mem_path('EXG', sc_name, idm_context)
448  emempaths(n) = mempath
449  !
450  ! -- allocate and set exgid
451  call mem_allocate(exgid, 'EXGID', mempath)
452  exgid = n
453  !
454  ! -- create exchange loader
455  static_loader => create_input_loader('EXG', sc_type, 'EXG', sc_name, &
456  exgtype, efname, simfile)
457  ! -- load static input
458  dynamic_loader => static_loader%load(iout)
459  !
460  if (associated(dynamic_loader)) then
461  errmsg = 'IDM unimplemented. Dynamic Exchanges not supported.'
462  call store_error(errmsg)
463  call store_error_filename(efname)
464  else
465  call static_loader%destroy()
466  deallocate (static_loader)
467  end if
468  !
469  end if
470  !
471  end do
472  !
473  ! -- clean up temporary NCELLDIM for remote models
474  do n = 1, size(mnames)
475  if (model_loadmask(n) == 0) then
476  mname = mnames(n)
477  mempath = create_mem_path(component=mname, context=idm_context)
478  call get_isize('NCELLDIM', mempath, isize)
479  if (isize > 0) then
480  call mem_setptr(ncelldim, 'NCELLDIM', mempath)
481  call mem_deallocate(ncelldim)
482  end if
483  end if
484  end do
485  !
486  ! -- return
487  return
class(distributedsimtype) function, pointer, public get_dsim()
Get pointer to the distributed simulation object.
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
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
subroutine, public inlen_check(input_name, mf6_name, maxlen, name_type)
store an error for input exceeding internal name length
integer(i4b) function, public ifind_charstr(array, str)
integer(i4b) function, public remote_model_ndim(mtype, mfname)
Definition: SourceLoad.F90:260
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_model_pkgs()

subroutine idmloadmodule::load_model_pkgs ( type(modelpackageinputstype), intent(inout)  model_pkg_inputs,
integer(i4b), intent(in)  iout 
)

Definition at line 191 of file IdmLoad.f90.

196  type(ModelPackageInputsType), intent(inout) :: model_pkg_inputs
197  integer(i4B), intent(in) :: iout
198  type(NCFileVarsType), pointer :: nc_vars
199  integer(I4B) :: itype, ipkg
200  !
201  nc_vars => netcdf_context(model_pkg_inputs%modeltype, &
202  model_pkg_inputs%component_type, &
203  model_pkg_inputs%modelname, &
204  model_pkg_inputs%modelfname, iout)
205  !
206  ! -- load package instances by type
207  do itype = 1, size(model_pkg_inputs%pkglist)
208  !
209  ! -- load package instances
210  do ipkg = 1, model_pkg_inputs%pkglist(itype)%pnum
211 
212  if (idm_integrated(model_pkg_inputs%component_type, &
213  model_pkg_inputs%pkglist(itype)%subcomponent_type)) &
214  then
215  !
216  ! -- only load if model pkg can read from input context
217  call input_load(model_pkg_inputs%component_type, &
218  model_pkg_inputs%pkglist(itype)%subcomponent_type, &
219  model_pkg_inputs%modelname, &
220  model_pkg_inputs%pkglist(itype)%pkgnames(ipkg), &
221  model_pkg_inputs%pkglist(itype)%pkgtype, &
222  model_pkg_inputs%pkglist(itype)%filenames(ipkg), &
223  model_pkg_inputs%modelfname, nc_vars, iout)
224  else
225  !
226  ! -- open input file for package parser
227  model_pkg_inputs%pkglist(itype)%inunits(ipkg) = &
228  open_source_file(model_pkg_inputs%pkglist(itype)%pkgtype, &
229  model_pkg_inputs%pkglist(itype)%filenames(ipkg), &
230  model_pkg_inputs%modelfname, iout)
231  end if
232  end do
233  end do
234  !
235  ! -- cleanup
236  call nc_vars%destroy()
237  deallocate (nc_vars)
238  nullify (nc_vars)
239  !
240  ! -- return
241  return
logical function, public idm_integrated(component, subcomponent)
integer(i4b) function, public open_source_file(pkgtype, filename, modelfname, iout)
Definition: SourceLoad.F90:110
type(ncfilevarstype) function, pointer, public netcdf_context(modeltype, component_type, modelname, modelfname, iout)
create model netcdf context
Definition: SourceLoad.F90:412
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_models()

subroutine, public idmloadmodule::load_models ( integer(i4b), intent(in)  iout)

Definition at line 246 of file IdmLoad.f90.

247  ! -- modules
256  ! -- dummy
257  integer(I4B), intent(in) :: iout
258  ! -- local
259  type(DistributedSimType), pointer :: ds
260  integer(I4B), dimension(:), pointer :: model_loadmask
261  character(len=LENMEMPATH) :: input_mempath
262  type(CharacterStringType), dimension(:), contiguous, &
263  pointer :: mtypes !< model types
264  type(CharacterStringType), dimension(:), contiguous, &
265  pointer :: mfnames !< model file names
266  type(CharacterStringType), dimension(:), contiguous, &
267  pointer :: mnames !< model names
268  character(len=LINELENGTH) :: mtype, mfname
269  character(len=LENMODELNAME) :: mname
270  type(ModelPackageInputsType), allocatable :: model_pkg_inputs
271  integer(I4B) :: n
272  !
273  ! -- get model mask
274  ds => get_dsim()
275  model_loadmask => ds%get_load_mask()
276  !
277  ! -- set input memory path
278  input_mempath = create_mem_path('SIM', 'NAM', idm_context)
279  !
280  ! -- set pointers to input context model attribute arrays
281  call mem_setptr(mtypes, 'MTYPE', input_mempath)
282  call mem_setptr(mfnames, 'MFNAME', input_mempath)
283  call mem_setptr(mnames, 'MNAME', input_mempath)
284  !
285  do n = 1, size(mtypes)
286  !
287  ! -- attributes for this model
288  mtype = mtypes(n)
289  mfname = mfnames(n)
290  call inlen_check(mnames(n), mname, lenmodelname, 'MODELNAME')
291  !
292  ! -- terminate if errors were detected
293  if (count_errors() > 0) then
294  call store_error_filename(simfile)
295  end if
296  !
297  ! -- load specified model inputs
298  if (model_loadmask(n) > 0) then
299  !
300  ! -- load model nam file
301  call load_modelnam(mtype, mfname, mname, iout)
302  !
303  ! -- create description of model packages
304  allocate (model_pkg_inputs)
305  call model_pkg_inputs%init(mtype, mfname, mname, iout)
306  !
307  ! -- load packages
308  call load_model_pkgs(model_pkg_inputs, iout)
309  !
310  ! -- publish pkg info to input context
311  call model_pkg_inputs%memload()
312  !
313  ! -- cleanup
314  call model_pkg_inputs%destroy()
315  deallocate (model_pkg_inputs)
316  end if
317  end do
318  !
319  ! -- return
320  return
character(len=lencomponentname) function, public idm_component_type(component)
component from package or model type
subroutine, public load_modelnam(mtype, mfname, mname, iout)
Definition: SourceLoad.F90:136
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simnam_allocate()

subroutine idmloadmodule::simnam_allocate

Definition at line 735 of file IdmLoad.f90.

740  character(len=LENMEMPATH) :: input_mempath
741  type(ModflowInputType) :: mf6_input
742  type(InputParamDefinitionType), pointer :: idt
743  integer(I4B) :: iparam, isize
744  !
745  ! -- set memory path
746  input_mempath = create_mem_path('SIM', 'NAM', idm_context)
747  !
748  ! -- create description of input
749  mf6_input = getmodflowinput('NAM6', 'SIM', 'NAM', 'SIM', 'NAM')
750  !
751  ! -- allocate sim namfile parameters if not in input context
752  do iparam = 1, size(mf6_input%param_dfns)
753  !
754  ! -- assign param definition pointer
755  idt => mf6_input%param_dfns(iparam)
756  !
757  ! -- check if variable is already allocated
758  call get_isize(idt%mf6varname, input_mempath, isize)
759  !
760  if (isize < 0) then
761  !
762  ! -- allocate and set parameter
763  call allocate_simnam_param(input_mempath, idt)
764  !
765  end if
766  end do
767  !
768  ! -- return
769  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simnam_load()

subroutine, public idmloadmodule::simnam_load ( integer(i4b), intent(inout)  paramlog)

Definition at line 492 of file IdmLoad.f90.

493  use sourceloadmodule, only: load_simnam
494  integer(I4B), intent(inout) :: paramlog
495  !
496  ! -- load sim nam file
497  call load_simnam()
498  !
499  ! -- allocate any unallocated simnam params
500  call simnam_allocate()
501  !
502  ! -- read and set input parameter logging keyword
503  paramlog = input_param_log()
504  !
505  ! -- memload summary info
506  call simnam_load_dim()
507  !
508  ! --return
509  return
subroutine, public load_simnam()
Definition: SourceLoad.F90:164
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simnam_load_dim()

subroutine idmloadmodule::simnam_load_dim

Definition at line 607 of file IdmLoad.f90.

612  character(len=LENMEMPATH) :: sim_mempath, simnam_mempath
613  type(CharacterStringType), dimension(:), contiguous, &
614  pointer :: mtypes !< model types
615  type(CharacterStringType), dimension(:), contiguous, &
616  pointer :: etypes !< model types
617  integer(I4B), pointer :: nummodels
618  integer(I4B), pointer :: numexchanges
619  !
620  ! -- initialize
621  nullify (nummodels)
622  nullify (numexchanges)
623  !
624  ! -- set memory paths
625  sim_mempath = create_mem_path(component='SIM', context=idm_context)
626  simnam_mempath = create_mem_path('SIM', 'NAM', idm_context)
627  !
628  ! -- set pointers to loaded simnam arrays
629  call mem_setptr(mtypes, 'MTYPE', simnam_mempath)
630  call mem_setptr(etypes, 'EXGTYPE', simnam_mempath)
631  !
632  ! -- allocate variables
633  call mem_allocate(nummodels, 'NUMMODELS', sim_mempath)
634  call mem_allocate(numexchanges, 'NUMEXCHANGES', sim_mempath)
635  !
636  ! -- set values
637  nummodels = size(mtypes)
638  numexchanges = size(etypes)
639  !
640  ! -- return
641  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simtdis_load()

subroutine, public idmloadmodule::simtdis_load

Definition at line 514 of file IdmLoad.f90.

515  use sourceloadmodule, only: load_simtdis
516  !
517  ! -- load sim tdis file
518  call load_simtdis()
519  !
520  ! --return
521  return
subroutine, public load_simtdis()
Definition: SourceLoad.F90:203
Here is the call graph for this function:
Here is the caller graph for this function: