MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
sourceloadmodule Module Reference

This module contains the SourceLoadModule. More...

Functions/Subroutines

class(staticpkgloadbasetype) function, pointer, public create_input_loader (component_type, subcomponent_type, component_name, subcomponent_name, input_type, input_fname, component_fname)
 factory function to create and setup model package static loader More...
 
class(staticpkgloadbasetype) function, pointer package_loader (source_type)
 allocate source model package static loader More...
 
integer(i4b) function, public open_source_file (pkgtype, filename, modelfname, iout)
 
subroutine, public load_modelnam (mtype, mfname, mname, iout)
 
subroutine, public load_simnam ()
 
subroutine, public load_simtdis ()
 
integer(i4b) function, public remote_model_ndim (mtype, mfname)
 

Detailed Description

This module contains the routines needed to generate a loader object for an input source and routines that distribute processing to a particular source.

Function/Subroutine Documentation

◆ create_input_loader()

class(staticpkgloadbasetype) function, pointer, public sourceloadmodule::create_input_loader ( character(len=*), intent(in)  component_type,
character(len=*), intent(in)  subcomponent_type,
character(len=*), intent(in)  component_name,
character(len=*), intent(in)  subcomponent_name,
character(len=*), intent(in)  input_type,
character(len=*), intent(in)  input_fname,
character(len=*), intent(in)  component_fname 
)

Definition at line 28 of file SourceLoad.F90.

33  character(len=*), intent(in) :: component_type
34  character(len=*), intent(in) :: subcomponent_type
35  character(len=*), intent(in) :: component_name
36  character(len=*), intent(in) :: subcomponent_name
37  character(len=*), intent(in) :: input_type
38  character(len=*), intent(in) :: input_fname
39  character(len=*), intent(in) :: component_fname
40  class(StaticPkgLoadBaseType), pointer :: loader
41  type(ModflowInputType) :: mf6_input
42  character(len=LENPACKAGENAME) :: source_type
43  character(len=LENPACKAGENAME) :: sc_name
44  !
45  ! -- set subcomponent name
46  sc_name = idm_subcomponent_name(component_type, subcomponent_type, &
47  subcomponent_name)
48  !
49  ! -- create description of input
50  mf6_input = getmodflowinput(input_type, component_type, subcomponent_type, &
51  component_name, sc_name, input_fname)
52  !
53  ! -- set package source
54  source_type = package_source_type(input_fname)
55  !
56  ! -- set source loader for model package
57  loader => package_loader(source_type)
58  !
59  ! -- initialize loader
60  call loader%init(mf6_input, component_name, component_fname, input_fname)
61  !
62  ! -- return
63  return
This module contains the InputLoadTypeModule.
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
character(len=lenpackagename) function, public package_source_type(sourcename)
source identifier from model namfile FNAME array
character(len=lenpackagename) function, public idm_subcomponent_name(component_type, subcomponent_type, sc_name)
model package subcomponent name
Base abstract type for static input loader.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_modelnam()

subroutine, public sourceloadmodule::load_modelnam ( character(len=*), intent(in)  mtype,
character(len=*), intent(in)  mfname,
character(len=*), intent(in)  mname,
integer(i4b), intent(in)  iout 
)

Definition at line 120 of file SourceLoad.F90.

121  use simvariablesmodule, only: simfile
123  use idmmf6filemodule, only: input_load
124  character(len=*), intent(in) :: mtype
125  character(len=*), intent(in) :: mfname
126  character(len=*), intent(in) :: mname
127  integer(I4B), intent(in) :: iout
128  type(ModflowInputType) :: mf6_input
129  character(len=LENPACKAGENAME) :: source_type
130  !
131  ! -- set source type
132  source_type = package_source_type(mfname)
133  !
134  ! -- create description of input
135  mf6_input = getmodflowinput(mtype, idm_component_type(mtype), 'NAM', &
136  mname, 'NAM', mfname)
137  !
138  select case (source_type)
139  case ('MF6FILE')
140  call input_load(mfname, mf6_input, simfile, iout)
141  case default
142  end select
143  !
144  ! -- return
145  return
This module contains the IdmMf6FileModule.
Definition: IdmMf6File.f90:10
subroutine, public input_load(filename, mf6_input, component_filename, iout)
input load for traditional mf6 simulation static input file
Definition: IdmMf6File.f90:58
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) simfile
simulation name file
character(len=lencomponentname) function, public idm_component_type(component)
component from package or model type
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_simnam()

subroutine, public sourceloadmodule::load_simnam

Definition at line 148 of file SourceLoad.F90.

149  use simvariablesmodule, only: simfile, iout
150  use messagemodule, only: write_message
151  use idmmf6filemodule, only: input_load
152  type(ModflowInputType) :: mf6_input
153  character(len=LINELENGTH) :: line
154  logical :: lexist
155  !
156  ! -- load mfsim.nam if it exists
157  inquire (file=trim(adjustl(simfile)), exist=lexist)
158  !
159  if (lexist) then
160  !
161  ! -- write name of namfile to stdout
162  write (line, '(2(1x,a))') 'Using Simulation name file:', &
163  trim(adjustl(simfile))
164  call write_message(line, skipafter=1)
165  !
166  ! -- create description of input
167  mf6_input = getmodflowinput('NAM6', 'SIM', 'NAM', 'SIM', 'NAM', simfile)
168  !
169  ! -- open namfile and load to input context
170  call input_load(simfile, mf6_input, simfile, iout)
171  end if
172  !
173  ! -- return
174  return
Store and issue logging messages to output units.
Definition: Message.f90:2
subroutine, public write_message(text, iunit, fmt, skipbefore, skipafter, advance)
Write a message to an output unit.
Definition: Message.f90:210
integer(i4b) iout
file unit number for simulation output
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_simtdis()

subroutine, public sourceloadmodule::load_simtdis

Definition at line 177 of file SourceLoad.F90.

178  ! -- modules
179  use simvariablesmodule, only: simfile, iout
184  use idmmf6filemodule, only: input_load
185  ! -- dummy
186  ! -- locals
187  character(len=LENMEMPATH) :: input_mempath
188  type(ModflowInputType) :: mf6_input
189  character(len=LENPACKAGENAME) :: source_type
190  character(len=:), pointer :: tdis6
191  logical :: lexist
192  !
193  ! -- set input memory path
194  input_mempath = create_mem_path('SIM', 'NAM', idm_context)
195  !
196  ! -- set pointers to input context timing params
197  call mem_setptr(tdis6, 'TDIS6', input_mempath)
198  !
199  ! -- create timing
200  if (tdis6 /= '') then
201  !
202  ! -- set source type
203  source_type = package_source_type(tdis6)
204  !
205  select case (source_type)
206  case ('MF6FILE')
207  !
208  inquire (file=trim(adjustl(tdis6)), exist=lexist)
209  !
210  if (lexist) then
211  !
212  ! -- create description of input
213  mf6_input = getmodflowinput('TDIS6', 'SIM', 'TDIS', &
214  'SIM', 'TDIS', simfile)
215  !
216  ! -- open namfile and load to input context
217  call input_load(tdis6, mf6_input, simfile, iout)
218  !
219  else
220  write (errmsg, '(a)') &
221  'Simulation TIMING input file "'//trim(tdis6)// &
222  '" does not exist.'
223  call store_error(errmsg)
224  call store_error_filename(simfile)
225  end if
226  case default
227  end select
228  end if
229  !
230  ! -- return
231  return
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
character(len=linelength) idm_context
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_source_file()

integer(i4b) function, public sourceloadmodule::open_source_file ( character(len=*), intent(in)  pkgtype,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  modelfname,
integer(i4b), intent(in)  iout 
)

Definition at line 94 of file SourceLoad.F90.

97  character(len=*), intent(in) :: pkgtype
98  character(len=*), intent(in) :: filename
99  character(len=*), intent(in) :: modelfname
100  integer(I4B), intent(in) :: iout
101  integer(I4B) :: fd
102  character(len=LENPACKAGENAME) :: source_type
103  !
104  ! -- initialize
105  fd = 0
106  !
107  ! -- set source type
108  source_type = package_source_type(filename)
109  !
110  select case (source_type)
111  case ('MF6FILE')
112  fd = open_mf6file(pkgtype, filename, modelfname, iout)
113  case default
114  end select
115  !
116  ! -- return
117  return
integer(i4b) function, public open_mf6file(filetype, filename, component_fname, iout)
open a model package files
Definition: IdmMf6File.f90:360
Here is the call graph for this function:
Here is the caller graph for this function:

◆ package_loader()

class(staticpkgloadbasetype) function, pointer sourceloadmodule::package_loader ( character(len=*), intent(inout)  source_type)

Definition at line 68 of file SourceLoad.F90.

71  character(len=*), intent(inout) :: source_type
72  class(Mf6FileStaticPkgLoadType), pointer :: mf6file_loader
73  class(StaticPkgLoadBaseType), pointer :: loader
74  !
75  ! -- initialize
76  nullify (loader)
77  !
78  ! -- allocate derived object
79  select case (source_type)
80  case ('MF6FILE')
81  allocate (mf6file_loader)
82  loader => mf6file_loader
83  case default
84  write (errmsg, '(a)') &
85  'Simulation package input source type "'//trim(source_type)// &
86  '" not currently supported.'
87  call store_error(errmsg, .true.)
88  end select
89  !
90  ! -- return
91  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_model_ndim()

integer(i4b) function, public sourceloadmodule::remote_model_ndim ( character(len=*), intent(in)  mtype,
character(len=*), intent(in)  mfname 
)

Definition at line 234 of file SourceLoad.F90.

236  use constantsmodule, only: linelength
239  character(len=*), intent(in) :: mtype
240  character(len=*), intent(in) :: mfname
241  integer(I4B) :: ncelldim
242  character(len=LENPACKAGENAME) :: source_type
243  type(BlockParserType) :: parser
244  integer(I4B) :: ierr, inunit
245  logical(LGP) :: isfound, endOfBlock
246  character(len=LINELENGTH) :: ptype
247  !
248  ! -- initialize
249  ncelldim = 0
250  !
251  ! -- set source type
252  source_type = package_source_type(mfname)
253  !
254  select case (source_type)
255  case ('MF6FILE')
256  !
257  ! -- open name file
258  inunit = getunit()
259  call openfile(inunit, 0, trim(adjustl(mfname)), mtype, &
260  'FORMATTED', 'SEQUENTIAL', 'OLD')
261  !
262  ! -- initialize parser
263  call parser%Initialize(inunit, 0)
264  !
265  ! -- get options block
266  call parser%GetBlock('OPTIONS', isfound, ierr, &
267  supportopenclose=.true., blockrequired=.false.)
268  ! -- iterate through options
269  if (isfound) then
270  do
271  call parser%GetNextLine(endofblock)
272  if (endofblock) exit
273  end do
274  end if
275  !
276  ! -- get packages block
277  call parser%GetBlock('PACKAGES', isfound, ierr, &
278  supportopenclose=.true., blockrequired=.true.)
279  if (isfound) then
280  ! -- read through packages
281  do
282  call parser%GetNextLine(endofblock)
283  if (endofblock) exit
284  !
285  call parser%GetStringCaps(ptype)
286  !
287  select case (ptype)
288  case ('DIS6')
289  ncelldim = 3
290  exit
291  case ('DIS2D6')
292  ncelldim = 2
293  exit
294  case ('DISV6')
295  ncelldim = 2
296  exit
297  case ('DISU6')
298  ncelldim = 1
299  exit
300  case default
301  write (errmsg, '(a)') &
302  'Unknown discretization type "'//trim(ptype)// &
303  '" not currently supported.'
304  call store_error(errmsg, .true.)
305  end select
306  end do
307  end if
308  !
309  call parser%clear()
310  !
311  case default
312  end select
313  !
314  ! -- return
315  return
This module contains block parser methods.
Definition: BlockParser.f90:7
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
Here is the call graph for this function:
Here is the caller graph for this function: