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

This module contains the Mf6FileListInputModule. More...

Data Types

type  listinputbasetype
 Abstract base class for ascii list loaders. More...
 
type  boundlistinputtype
 Boundary package list loader. More...
 

Functions/Subroutines

subroutine bndlist_init (this, mf6_input, component_name, component_input_name, input_name, iperblock, parser, iout)
 
subroutine bndlist_rp (this, parser)
 
subroutine bndlist_destroy (this)
 
subroutine bndlist_ts_link_bnd (this, structvector, ts_strloc)
 
subroutine bndlist_ts_link_aux (this, structvector, ts_strloc)
 
subroutine bndlist_ts_update (this, structarray)
 
subroutine bndlist_ts_link (this, structvector, ts_strloc)
 
subroutine bndlist_create_structarray (this)
 
subroutine base_init (this, mf6_input, component_name, component_input_name, input_name, iperblock, parser, loader, iout)
 
subroutine base_destroy (this)
 
subroutine df (this)
 
subroutine ad (this)
 
subroutine reset (this)
 
subroutine read_control_record (this, parser)
 

Detailed Description

This module contains the routines for reading period block list based input.

Function/Subroutine Documentation

◆ ad()

subroutine mf6filelistinputmodule::ad ( class(listinputbasetype), intent(inout)  this)
private
Parameters
[in,out]thisListInputType

Definition at line 487 of file Mf6FileListInput.f90.

488  ! -- modules
489  class(ListInputBaseType), intent(inout) :: this !< ListInputType
490  !
491  ! -- advance timeseries
492  call this%tsmanager%ad()
493  !
494  ! -- return
495  return

◆ base_destroy()

subroutine mf6filelistinputmodule::base_destroy ( class(listinputbasetype), intent(inout)  this)
Parameters
[in,out]thisListInputType

Definition at line 462 of file Mf6FileListInput.f90.

463  ! -- modules
464  class(ListInputBaseType), intent(inout) :: this !< ListInputType
465  !
466  deallocate (this%tsmanager)
467  !
468  ! -- deallocate StructArray
469  call destructstructarray(this%structarray)
470  !
471  ! -- return
472  return
Here is the call graph for this function:

◆ base_init()

subroutine mf6filelistinputmodule::base_init ( class(listinputbasetype), intent(inout)  this,
type(modflowinputtype), intent(in)  mf6_input,
character(len=*), intent(in)  component_name,
character(len=*), intent(in)  component_input_name,
character(len=*), intent(in)  input_name,
integer(i4b), intent(in)  iperblock,
type(blockparsertype), intent(inout)  parser,
type(loadmf6filetype), intent(inout)  loader,
integer(i4b), intent(in)  iout 
)

Definition at line 386 of file Mf6FileListInput.f90.

391  use memorymanagermodule, only: get_isize
393  class(ListInputBaseType), intent(inout) :: this
394  type(ModflowInputType), intent(in) :: mf6_input
395  character(len=*), intent(in) :: component_name
396  character(len=*), intent(in) :: component_input_name
397  character(len=*), intent(in) :: input_name
398  integer(I4B), intent(in) :: iperblock
399  type(BlockParserType), intent(inout) :: parser
400  type(LoadMf6FileType), intent(inout) :: loader
401  integer(I4B), intent(in) :: iout
402  type(CharacterStringType), dimension(:), pointer, &
403  contiguous :: ts_fnames
404  character(len=LINELENGTH) :: fname
405  integer(I4B) :: ts6_size, n
406  character(len=LINELENGTH) :: blockname
407  integer(I4B) :: iblk
408  !
409  ! -- init loader
410  call this%DynamicPkgLoadType%init(mf6_input, component_name, &
411  component_input_name, input_name, &
412  iperblock, iout)
413  !
414  ! -- initialize
415  this%ts_active = 0
416  this%ibinary = 0
417  this%oc_inunit = 0
418  !
419  ! -- initialize static loader
420  call loader%init(parser, mf6_input, this%input_name, iout)
421  !
422  ! -- load OPTIONS and DIMENSIONS blocks
423  do iblk = 1, size(this%mf6_input%block_dfns)
424  !
425  ! -- set blockname
426  blockname = this%mf6_input%block_dfns(iblk)%blockname
427  !
428  ! -- step 1 loads OPTIONS and DIMENSIONS blocks if defined
429  if (blockname /= 'OPTIONS' .and. blockname /= 'DIMENSIONS') exit
430  !
431  ! -- load block
432  call loader%load_block(iblk)
433  !
434  end do
435  !
436  ! -- create tsmanager
437  allocate (this%tsmanager)
438  call tsmanager_cr(this%tsmanager, iout)
439  !
440  ! -- determine if TS6 files were provided in OPTIONS block
441  call get_isize('TS6_FILENAME', this%mf6_input%mempath, ts6_size)
442  !
443  if (ts6_size > 0) then
444  !
445  this%ts_active = 1
446  call mem_setptr(ts_fnames, 'TS6_FILENAME', this%mf6_input%mempath)
447  !
448  do n = 1, size(ts_fnames)
449  fname = ts_fnames(n)
450  call this%tsmanager%add_tsfile(fname, getunit())
451  end do
452  !
453  end if
454  !
455  ! -- define TS manager
456  call this%tsmanager%tsmanager_df()
457  !
458  ! -- return
459  return
This module contains block parser methods.
Definition: BlockParser.f90:7
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lencomponentname
maximum length of a component name
Definition: Constants.f90:18
This module contains the Input Data Model Logger Module.
Definition: IdmLogger.f90:7
subroutine, public idm_log_header(component, subcomponent, iout)
@ brief log a header message
Definition: IdmLogger.f90:44
This module contains the LoadMf6FileModule.
Definition: LoadMf6File.f90:8
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Static parser based input loader.
Definition: LoadMf6File.f90:46
Here is the call graph for this function:

◆ bndlist_create_structarray()

subroutine mf6filelistinputmodule::bndlist_create_structarray ( class(boundlistinputtype), intent(inout)  this)

Definition at line 349 of file Mf6FileListInput.f90.

350  ! -- modules
353  ! -- dummy
354  class(BoundListInputType), intent(inout) :: this
355  ! -- local
356  type(InputParamDefinitionType), pointer :: idt
357  integer(I4B) :: icol
358  !
359  ! -- construct and set up the struct array object
360  this%structarray => constructstructarray(this%mf6_input, this%nparam, &
361  this%bound_context%maxbound, 0, &
362  this%mf6_input%mempath, &
363  this%mf6_input%component_mempath)
364  !
365  ! -- set up struct array
366  do icol = 1, this%nparam
367  !
368  idt => get_param_definition_type(this%mf6_input%param_dfns, &
369  this%mf6_input%component_type, &
370  this%mf6_input%subcomponent_type, &
371  'PERIOD', &
372  this%param_names(icol), this%input_name)
373  !
374  ! -- allocate variable in memory manager
375  call this%structarray%mem_create_vector(icol, idt)
376  !
377  ! -- store boundname index when found
378  if (idt%mf6varname == 'BOUNDNAME') this%iboundname = icol
379  !
380  end do
381  !
382  ! -- return
383  return
This module contains the DefinitionSelectModule.
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type(input_definition_types, component_type, subcomponent_type, blockname, tagname, filename)
Return parameter definition.
This module contains the InputDefinitionModule.
Here is the call graph for this function:

◆ bndlist_destroy()

subroutine mf6filelistinputmodule::bndlist_destroy ( class(boundlistinputtype), intent(inout)  this)
Parameters
[in,out]thisBoundListInputType

Definition at line 193 of file Mf6FileListInput.f90.

194  ! -- modules
195  class(BoundListInputType), intent(inout) :: this !< BoundListInputType
196  !
197  call this%base_destroy()
198  call this%bound_context%destroy()
199  !
200  ! -- return
201  return

◆ bndlist_init()

subroutine mf6filelistinputmodule::bndlist_init ( class(boundlistinputtype), intent(inout)  this,
type(modflowinputtype), intent(in)  mf6_input,
character(len=*), intent(in)  component_name,
character(len=*), intent(in)  component_input_name,
character(len=*), intent(in)  input_name,
integer(i4b), intent(in)  iperblock,
type(blockparsertype), intent(inout), pointer  parser,
integer(i4b), intent(in)  iout 
)
private

Definition at line 75 of file Mf6FileListInput.f90.

79  class(BoundListInputType), intent(inout) :: this
80  type(ModflowInputType), intent(in) :: mf6_input
81  character(len=*), intent(in) :: component_name
82  character(len=*), intent(in) :: component_input_name
83  character(len=*), intent(in) :: input_name
84  integer(I4B), intent(in) :: iperblock
85  type(BlockParserType), pointer, intent(inout) :: parser
86  integer(I4B), intent(in) :: iout
87  type(LoadMf6FileType) :: loader
88  character(len=LINELENGTH) :: blockname
89  integer(I4B) :: iblk
90  !
91  ! -- initialize scalars
92  this%iboundname = 0
93  !
94  ! -- initialize base class
95  call this%base_init(mf6_input, component_name, component_input_name, &
96  input_name, iperblock, parser, loader, iout)
97  !
98  ! -- initialize package input context
99  call this%bound_context%create(mf6_input, this%readasarrays)
100  !
101  ! -- load blocks after OPTIONS and DIMENSIONS
102  do iblk = 1, size(this%mf6_input%block_dfns)
103  !
104  ! -- log block header via loader or directly here?
105  !
106  ! -- set blockname
107  blockname = this%mf6_input%block_dfns(iblk)%blockname
108  !
109  ! -- base_init loads OPTIONS and DIMENSIONS blocks if defined
110  if (blockname == 'OPTIONS' .or. blockname == 'DIMENSIONS') cycle
111  if (blockname == 'PERIOD') exit
112  !
113  ! -- load block
114  call loader%load_block(iblk)
115  !
116  if (this%mf6_input%block_dfns(iblk)%aggregate) then
117  if (this%mf6_input%block_dfns(iblk)%timeseries) then
118  if (this%ts_active > 0) then
119  call this%ts_update(loader%structarray)
120  end if
121  end if
122  end if
123  !
124  end do
125  !
126  call loader%finalize()
127  !
128  ! -- store in scope SA cols for list input
129  call this%bound_context%bound_params(this%param_names, this%nparam, &
130  this%input_name, create=.false.)
131  !
132  ! -- construct and set up the struct array object
133  call this%create_structarray()
134  !
135  ! -- finalize input context setup
136  call this%bound_context%allocate_arrays()
137  !
138  ! -- return
139  return

◆ bndlist_rp()

subroutine mf6filelistinputmodule::bndlist_rp ( class(boundlistinputtype), intent(inout)  this,
type(blockparsertype), intent(inout), pointer  parser 
)

Definition at line 142 of file Mf6FileListInput.f90.

143  ! -- modules
147  ! -- dummy
148  class(BoundListInputType), intent(inout) :: this
149  type(BlockParserType), pointer, intent(inout) :: parser
150  ! -- local
151  logical(LGP) :: ts_active
152  !
153  call this%reset()
154  !
155  call this%read_control_record(parser)
156  !
157  ! -- log lst file header
158  call idm_log_header(this%mf6_input%component_name, &
159  this%mf6_input%subcomponent_name, this%iout)
160  !
161  if (this%ibinary == 1) then
162  !
163  this%bound_context%nbound = &
164  this%structarray%read_from_binary(this%oc_inunit, this%iout)
165  !
166  call parser%terminateblock()
167  !
168  close (this%oc_inunit)
169  this%ibinary = 0
170  this%oc_inunit = 0
171  !
172  else
173  !
174  ts_active = (this%ts_active /= 0)
175  !
176  this%bound_context%nbound = &
177  this%structarray%read_from_parser(parser, ts_active, this%iout)
178  end if
179  !
180  ! update ts links
181  if (this%ts_active /= 0) then
182  call this%ts_update(this%structarray)
183  end if
184  !
185  ! -- close logging statement
186  call idm_log_close(this%mf6_input%component_name, &
187  this%mf6_input%subcomponent_name, this%iout)
188  !
189  ! -- return
190  return
subroutine, public idm_log_close(component, subcomponent, iout)
@ brief log the closing message
Definition: IdmLogger.f90:57
This module contains the StructVectorModule.
Definition: StructVector.f90:7
derived type for generic vector
Here is the call graph for this function:

◆ bndlist_ts_link()

subroutine mf6filelistinputmodule::bndlist_ts_link ( class(boundlistinputtype), intent(inout)  this,
type(structvectortype), intent(in), pointer  structvector,
type(tsstringloctype), intent(in), pointer  ts_strloc 
)

Definition at line 324 of file Mf6FileListInput.f90.

325  ! -- modules
327  ! -- dummy
328  class(BoundListInputType), intent(inout) :: this
329  type(StructVectorType), pointer, intent(in) :: structvector
330  type(TSStringLocType), pointer, intent(in) :: ts_strloc
331  ! -- local
332  !
333  select case (structvector%memtype)
334  case (2) ! -- dbl1d
335  !
336  call this%ts_link_bnd(structvector, ts_strloc)
337  !
338  case (6) ! -- dbl2d
339  !
340  call this%ts_link_aux(structvector, ts_strloc)
341  !
342  case default
343  end select
344  !
345  ! -- return
346  return
derived type which describes time series string field

◆ bndlist_ts_link_aux()

subroutine mf6filelistinputmodule::bndlist_ts_link_aux ( class(boundlistinputtype), intent(inout)  this,
type(structvectortype), intent(in), pointer  structvector,
type(tsstringloctype), intent(in), pointer  ts_strloc 
)

Definition at line 248 of file Mf6FileListInput.f90.

249  ! -- modules
253  ! -- dummy
254  class(BoundListInputType), intent(inout) :: this
255  type(StructVectorType), pointer, intent(in) :: structvector
256  type(TSStringLocType), pointer, intent(in) :: ts_strloc
257  ! -- local
258  real(DP), pointer :: bndElem
259  type(TimeSeriesLinkType), pointer :: tsLinkAux
260  type(StructVectorType), pointer :: sv_bound
261  character(len=LENBOUNDNAME) :: boundname
262  !
263  nullify (tslinkaux)
264  !
265  ! -- set bound element
266  bndelem => structvector%dbl2d(ts_strloc%col, ts_strloc%row)
267  !
268  ! -- set link
269  call read_value_or_time_series(ts_strloc%token, ts_strloc%row, &
270  ts_strloc%structarray_col, bndelem, &
271  this%mf6_input%subcomponent_name, &
272  'AUX', this%tsmanager, &
273  this%bound_context%iprpak, tslinkaux)
274 
275  if (associated(tslinkaux)) then
276  !
277  ! -- set variable name
278  tslinkaux%Text = this%bound_context%auxname_cst(ts_strloc%col)
279  !
280  ! -- set boundname if provided
281  if (this%bound_context%inamedbound > 0) then
282  sv_bound => this%structarray%get(this%iboundname)
283  boundname = sv_bound%charstr1d(ts_strloc%row)
284  tslinkaux%BndName = boundname
285  end if
286  !
287  end if
288  !
289  ! -- return
290  return
subroutine, public read_value_or_time_series(textInput, ii, jj, bndElem, pkgName, auxOrBnd, tsManager, iprpak, tsLink)
Call this subroutine if the time-series link is available or needed.
Here is the call graph for this function:

◆ bndlist_ts_link_bnd()

subroutine mf6filelistinputmodule::bndlist_ts_link_bnd ( class(boundlistinputtype), intent(inout)  this,
type(structvectortype), intent(in), pointer  structvector,
type(tsstringloctype), intent(in), pointer  ts_strloc 
)
private

Definition at line 204 of file Mf6FileListInput.f90.

205  ! -- modules
209  ! -- dummy
210  class(BoundListInputType), intent(inout) :: this
211  type(StructVectorType), pointer, intent(in) :: structvector
212  type(TSStringLocType), pointer, intent(in) :: ts_strloc
213  ! -- local
214  real(DP), pointer :: bndElem
215  type(TimeSeriesLinkType), pointer :: tsLinkBnd
216  type(StructVectorType), pointer :: sv_bound
217  character(len=LENBOUNDNAME) :: boundname
218  !
219  nullify (tslinkbnd)
220  !
221  ! -- set bound element
222  bndelem => structvector%dbl1d(ts_strloc%row)
223  !
224  ! -- set link
225  call read_value_or_time_series(ts_strloc%token, ts_strloc%row, &
226  ts_strloc%structarray_col, bndelem, &
227  this%mf6_input%subcomponent_name, &
228  'BND', this%tsmanager, &
229  this%bound_context%iprpak, tslinkbnd)
230  !
231  if (associated(tslinkbnd)) then
232  !
233  ! -- set variable name
234  tslinkbnd%Text = structvector%idt%mf6varname
235  !
236  ! -- set boundname if provided
237  if (this%bound_context%inamedbound > 0) then
238  sv_bound => this%structarray%get(this%iboundname)
239  boundname = sv_bound%charstr1d(ts_strloc%row)
240  tslinkbnd%BndName = boundname
241  end if
242  end if
243  !
244  ! -- return
245  return
Here is the call graph for this function:

◆ bndlist_ts_update()

subroutine mf6filelistinputmodule::bndlist_ts_update ( class(boundlistinputtype), intent(inout)  this,
type(structarraytype), intent(inout), pointer  structarray 
)

Definition at line 293 of file Mf6FileListInput.f90.

294  ! -- modules
297  ! -- dummy
298  class(BoundListInputType), intent(inout) :: this
299  type(StructArrayType), pointer, intent(inout) :: structarray
300  ! -- local
301  integer(I4B) :: n, m
302  type(TSStringLocType), pointer :: ts_strloc
303  type(StructVectorType), pointer :: sv
304  !
305  do m = 1, structarray%count()
306 
307  sv => structarray%get(m)
308 
309  if (sv%idt%timeseries) then
310  !
311  do n = 1, sv%ts_strlocs%count()
312  ts_strloc => sv%get_ts_strloc(n)
313  call this%ts_link(sv, ts_strloc)
314  end do
315  !
316  call sv%clear()
317  end if
318  end do
319  !
320  ! -- return
321  return

◆ df()

subroutine mf6filelistinputmodule::df ( class(listinputbasetype), intent(inout)  this)
private
Parameters
[in,out]thisListInputType

Definition at line 475 of file Mf6FileListInput.f90.

476  ! -- modules
477  ! -- dummy
478  class(ListInputBaseType), intent(inout) :: this !< ListInputType
479  !
480  ! -- define tsmanager
481  !call this%tsmanager%tsmanager_df()
482  !
483  ! -- return
484  return

◆ read_control_record()

subroutine mf6filelistinputmodule::read_control_record ( class(listinputbasetype), intent(inout)  this,
type(blockparsertype), intent(inout)  parser 
)
private

Definition at line 509 of file Mf6FileListInput.f90.

510  ! -- modules
511  use inputoutputmodule, only: urword
512  use openspecmodule, only: form, access
513  use constantsmodule, only: linelength
515  ! -- dummy
516  class(ListInputBaseType), intent(inout) :: this
517  type(BlockParserType), intent(inout) :: parser
518  ! -- local
519  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
520  integer(I4B) :: nunopn = 99
521  character(len=:), allocatable :: line
522  character(len=LINELENGTH) :: fname
523  logical :: exists
524  real(DP) :: r
525  ! -- formats
526  character(len=*), parameter :: fmtocne = &
527  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
528  character(len=*), parameter :: fmtobf = &
529  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
530  !
531  inunit = parser%getunit()
532  !
533  ! -- Read to the first non-commented line
534  lloc = 1
535  call parser%line_reader%rdcom(inunit, this%iout, line, ierr)
536  call urword(line, lloc, istart, istop, 1, idum, r, this%iout, inunit)
537  !
538  if (line(istart:istop) == 'OPEN/CLOSE') then
539  !
540  ! -- get filename
541  call urword(line, lloc, istart, istop, 0, idum, r, &
542  this%iout, inunit)
543  !
544  fname = line(istart:istop)
545  !
546  ! -- check to see if file OPEN/CLOSE file exists
547  inquire (file=fname, exist=exists)
548  !
549  if (.not. exists) then
550  write (errmsg, fmtocne) line(istart:istop)
551  call store_error(errmsg)
552  call store_error('Specified OPEN/CLOSE file does not exist')
553  call store_error_unit(inunit)
554  end if
555  !
556  ! -- Check for (BINARY) keyword
557  call urword(line, lloc, istart, istop, 1, idum, r, &
558  this%iout, inunit)
559  !
560  if (line(istart:istop) == '(BINARY)') this%ibinary = 1
561  !
562  ! -- Open the file depending on ibinary flag
563  if (this%ibinary == 1) then
564  this%oc_inunit = nunopn
565  itmp = this%iout
566  !
567  if (this%iout > 0) then
568  itmp = 0
569  write (this%iout, fmtobf) this%oc_inunit, trim(adjustl(fname))
570  end if
571  !
572  call openfile(this%oc_inunit, itmp, fname, 'OPEN/CLOSE', &
573  fmtarg_opt=form, accarg_opt=access)
574  end if
575  end if
576  !
577  if (this%ibinary == 0) then
578  call parser%line_reader%bkspc(parser%getunit())
579  end if
580  !
581  ! -- return
582  return
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
Here is the call graph for this function:

◆ reset()

subroutine mf6filelistinputmodule::reset ( class(listinputbasetype), intent(inout)  this)
private
Parameters
[in,out]thisListInputType

Definition at line 498 of file Mf6FileListInput.f90.

499  ! -- modules
500  class(ListInputBaseType), intent(inout) :: this !< ListInputType
501  !
502  ! -- reset tsmanager
503  call this%tsmanager%reset(this%mf6_input%subcomponent_name)
504  !
505  ! -- return
506  return