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

This module contains the ListLoadModule. More...

Data Types

type  listloadtype
 list input loader for dynamic packages. More...
 

Functions/Subroutines

subroutine ainit (this, mf6_input, component_name, component_input_name, input_name, iperblock, parser, iout)
 
subroutine df (this)
 
subroutine ad (this)
 
subroutine reset (this)
 
subroutine rp (this, parser)
 
subroutine destroy (this)
 
subroutine ts_link_bnd (this, structvector, ts_strloc)
 
subroutine ts_link_aux (this, structvector, ts_strloc)
 
subroutine ts_update (this, structarray)
 
subroutine ts_link (this, structvector, ts_strloc)
 
subroutine create_structarray (this)
 

Detailed Description

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

Function/Subroutine Documentation

◆ ad()

subroutine listloadmodule::ad ( class(listloadtype), intent(inout)  this)
private

Definition at line 117 of file Mf6FileList.f90.

118  class(ListLoadType), intent(inout) :: this
119  ! advance timeseries
120  call this%tsmanager%ad()

◆ ainit()

subroutine listloadmodule::ainit ( class(listloadtype), 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 52 of file Mf6FileList.f90.

54  use inputoutputmodule, only: getunit
58  class(ListLoadType), intent(inout) :: this
59  type(ModflowInputType), intent(in) :: mf6_input
60  character(len=*), intent(in) :: component_name
61  character(len=*), intent(in) :: component_input_name
62  character(len=*), intent(in) :: input_name
63  integer(I4B), intent(in) :: iperblock
64  type(BlockParserType), pointer, intent(inout) :: parser
65  integer(I4B), intent(in) :: iout
66  type(LoadMf6FileType) :: loader
67  type(CharacterStringType), dimension(:), pointer, &
68  contiguous :: ts_fnames
69  character(len=LINELENGTH) :: fname
70  integer(I4B) :: ts6_size, n
71 
72  ! init loader
73  call this%DynamicPkgLoadType%init(mf6_input, component_name, &
74  component_input_name, input_name, &
75  iperblock, iout)
76  ! initialize scalars
77  this%iboundname = 0
78  this%ts_active = 0
79 
80  ! load static input
81  call loader%load(parser, mf6_input, this%nc_vars, this%input_name, iout)
82 
83  ! create tsmanager
84  allocate (this%tsmanager)
85  call tsmanager_cr(this%tsmanager, iout)
86 
87  ! determine if TS6 files were provided in OPTIONS block
88  call get_isize('TS6_FILENAME', this%mf6_input%mempath, ts6_size)
89  if (ts6_size > 0) then
90  this%ts_active = 1
91  call mem_setptr(ts_fnames, 'TS6_FILENAME', this%mf6_input%mempath)
92  do n = 1, size(ts_fnames)
93  fname = ts_fnames(n)
94  call this%tsmanager%add_tsfile(fname, getunit())
95  end do
96  end if
97 
98  ! initialize package input context
99  call this%ctx%init(mf6_input)
100 
101  ! store in scope SA cols for list input
102  call this%ctx%tags(this%param_names, this%nparam, this%input_name)
103 
104  ! construct and set up the struct array object
105  call this%create_structarray()
106 
107  ! finalize input context setup
108  call this%ctx%allocate_arrays()
This module contains block parser methods.
Definition: BlockParser.f90:7
integer(i4b) function, public getunit()
Get a free unit number.
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:47
Here is the call graph for this function:

◆ create_structarray()

subroutine listloadmodule::create_structarray ( class(listloadtype), intent(inout)  this)

Definition at line 292 of file Mf6FileList.f90.

295  class(ListLoadType), intent(inout) :: this
296  type(InputParamDefinitionType), pointer :: idt
297  integer(I4B) :: icol
298 
299  ! construct and set up the struct array object
300  this%structarray => constructstructarray(this%mf6_input, this%nparam, &
301  this%ctx%maxbound, 0, &
302  this%mf6_input%mempath, &
303  this%mf6_input%component_mempath)
304  ! set up struct array
305  do icol = 1, this%nparam
306  idt => get_param_definition_type(this%mf6_input%param_dfns, &
307  this%mf6_input%component_type, &
308  this%mf6_input%subcomponent_type, &
309  'PERIOD', &
310  this%param_names(icol), this%input_name)
311  ! allocate variable in memory manager
312  call this%structarray%mem_create_vector(icol, idt)
313  ! store boundname index when found
314  if (idt%mf6varname == 'BOUNDNAME') this%iboundname = icol
315  end do
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:

◆ destroy()

subroutine listloadmodule::destroy ( class(listloadtype), intent(inout)  this)

Definition at line 168 of file Mf6FileList.f90.

169  class(ListLoadType), intent(inout) :: this
170  !
171  ! deallocate tsmanager
172  call this%tsmanager%da()
173  deallocate (this%tsmanager)
174  nullify (this%tsmanager)
175  !
176  ! deallocate StructArray
177  call destructstructarray(this%structarray)
178  call this%ctx%destroy()
Here is the call graph for this function:

◆ df()

subroutine listloadmodule::df ( class(listloadtype), intent(inout)  this)

Definition at line 111 of file Mf6FileList.f90.

112  class(ListLoadType), intent(inout) :: this
113  ! define tsmanager
114  call this%tsmanager%tsmanager_df()

◆ reset()

subroutine listloadmodule::reset ( class(listloadtype), intent(inout)  this)
private

Definition at line 123 of file Mf6FileList.f90.

124  class(ListLoadType), intent(inout) :: this
125  ! reset tsmanager
126  call this%tsmanager%reset(this%mf6_input%subcomponent_name)

◆ rp()

subroutine listloadmodule::rp ( class(listloadtype), intent(inout)  this,
type(blockparsertype), intent(inout), pointer  parser 
)
private

Definition at line 129 of file Mf6FileList.f90.

134  class(ListLoadType), intent(inout) :: this
135  type(BlockParserType), pointer, intent(inout) :: parser
136  integer(I4B) :: ibinary
137  integer(I4B) :: oc_inunit
138  logical(LGP) :: ts_active
139 
140  call this%reset()
141  ibinary = read_control_record(parser, oc_inunit, this%iout)
142 
143  ! log lst file header
144  call idm_log_header(this%mf6_input%component_name, &
145  this%mf6_input%subcomponent_name, this%iout)
146 
147  if (ibinary == 1) then
148  this%ctx%nbound = &
149  this%structarray%read_from_binary(oc_inunit, this%iout)
150  call parser%terminateblock()
151  close (oc_inunit)
152  else
153  ts_active = (this%ts_active /= 0)
154  this%ctx%nbound = &
155  this%structarray%read_from_parser(parser, ts_active, this%iout)
156  end if
157 
158  ! update ts links
159  if (this%ts_active /= 0) then
160  call this%ts_update(this%structarray)
161  end if
162 
163  ! close logging statement
164  call idm_log_close(this%mf6_input%component_name, &
165  this%mf6_input%subcomponent_name, this%iout)
This module contains the Input Data Model Logger Module.
Definition: IdmLogger.f90:7
subroutine, public idm_log_close(component, subcomponent, iout)
@ brief log the closing message
Definition: IdmLogger.f90:56
subroutine, public idm_log_header(component, subcomponent, iout)
@ brief log a header message
Definition: IdmLogger.f90:44
integer(i4b) function, public read_control_record(parser, oc_inunit, iout)
This module contains the StructVectorModule.
Definition: StructVector.f90:7
derived type for generic vector
Here is the call graph for this function:

◆ ts_link()

subroutine listloadmodule::ts_link ( class(listloadtype), intent(inout)  this,
type(structvectortype), intent(in), pointer  structvector,
type(tsstringloctype), intent(in), pointer  ts_strloc 
)

Definition at line 278 of file Mf6FileList.f90.

280  class(ListLoadType), intent(inout) :: this
281  type(StructVectorType), pointer, intent(in) :: structvector
282  type(TSStringLocType), pointer, intent(in) :: ts_strloc
283  select case (structvector%memtype)
284  case (2) ! dbl1d
285  call this%ts_link_bnd(structvector, ts_strloc)
286  case (6) ! dbl2d
287  call this%ts_link_aux(structvector, ts_strloc)
288  case default
289  end select
derived type which describes time series string field

◆ ts_link_aux()

subroutine listloadmodule::ts_link_aux ( class(listloadtype), intent(inout)  this,
type(structvectortype), intent(in), pointer  structvector,
type(tsstringloctype), intent(in), pointer  ts_strloc 
)

Definition at line 216 of file Mf6FileList.f90.

220  class(ListLoadType), intent(inout) :: this
221  type(StructVectorType), pointer, intent(in) :: structvector
222  type(TSStringLocType), pointer, intent(in) :: ts_strloc
223  real(DP), pointer :: bndElem
224  type(TimeSeriesLinkType), pointer :: tsLinkAux
225  type(StructVectorType), pointer :: sv_bound
226  character(len=LENBOUNDNAME) :: boundname
227 
228  nullify (tslinkaux)
229 
230  ! set bound element
231  bndelem => structvector%dbl2d(ts_strloc%col, ts_strloc%row)
232 
233  ! set link
234  call read_value_or_time_series(ts_strloc%token, ts_strloc%row, &
235  ts_strloc%structarray_col, bndelem, &
236  this%mf6_input%subcomponent_name, &
237  'AUX', this%tsmanager, &
238  this%ctx%iprpak, tslinkaux)
239  if (associated(tslinkaux)) then
240  ! set variable name
241  tslinkaux%Text = this%ctx%auxname_cst(ts_strloc%col)
242  ! set boundname if provided
243  if (this%ctx%boundnames > 0) then
244  sv_bound => this%structarray%get(this%iboundname)
245  boundname = sv_bound%charstr1d(ts_strloc%row)
246  tslinkaux%BndName = boundname
247  end if
248  end if
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:

◆ ts_link_bnd()

subroutine listloadmodule::ts_link_bnd ( class(listloadtype), intent(inout)  this,
type(structvectortype), intent(in), pointer  structvector,
type(tsstringloctype), intent(in), pointer  ts_strloc 
)
private

Definition at line 181 of file Mf6FileList.f90.

185  class(ListLoadType), intent(inout) :: this
186  type(StructVectorType), pointer, intent(in) :: structvector
187  type(TSStringLocType), pointer, intent(in) :: ts_strloc
188  real(DP), pointer :: bndElem
189  type(TimeSeriesLinkType), pointer :: tsLinkBnd
190  type(StructVectorType), pointer :: sv_bound
191  character(len=LENBOUNDNAME) :: boundname
192 
193  nullify (tslinkbnd)
194 
195  ! set bound element
196  bndelem => structvector%dbl1d(ts_strloc%row)
197 
198  ! set link
199  call read_value_or_time_series(ts_strloc%token, ts_strloc%row, &
200  ts_strloc%structarray_col, bndelem, &
201  this%mf6_input%subcomponent_name, &
202  'BND', this%tsmanager, &
203  this%ctx%iprpak, tslinkbnd)
204  if (associated(tslinkbnd)) then
205  ! set variable name
206  tslinkbnd%Text = structvector%idt%mf6varname
207  ! set boundname if provided
208  if (this%ctx%boundnames > 0) then
209  sv_bound => this%structarray%get(this%iboundname)
210  boundname = sv_bound%charstr1d(ts_strloc%row)
211  tslinkbnd%BndName = boundname
212  end if
213  end if
Here is the call graph for this function:

◆ ts_update()

subroutine listloadmodule::ts_update ( class(listloadtype), intent(inout)  this,
type(structarraytype), intent(inout), pointer  structarray 
)

Definition at line 251 of file Mf6FileList.f90.

255  class(ListLoadType), intent(inout) :: this
256  type(StructArrayType), pointer, intent(inout) :: structarray
257  integer(I4B) :: n, m
258  type(TSStringLocType), pointer :: ts_strloc
259  type(StructVectorType), pointer :: sv
260 
261  do m = 1, structarray%count()
262  sv => structarray%get(m)
263  if (sv%idt%timeseries) then
264  do n = 1, sv%ts_strlocs%count()
265  ts_strloc => sv%get_ts_strloc(n)
266  call this%ts_link(sv, ts_strloc)
267  end do
268  call sv%clear()
269  end if
270  end do
271 
272  ! terminate if errors were detected
273  if (count_errors() > 0) then
274  call store_error_filename(this%input_name)
275  end if
This module contains simulation methods.
Definition: Sim.f90:10
integer(i4b) function, public count_errors()
Return number of errors.
Definition: Sim.f90:59
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:203
Here is the call graph for this function: