46 logical(LGP) :: ts_active
47 integer(I4B) :: nleading
68 subroutine ainit(this, mf6_input, component_name, component_input_name, &
69 input_name, iperblock, parser, iout)
77 character(len=*),
intent(in) :: component_name
78 character(len=*),
intent(in) :: component_input_name
79 character(len=*),
intent(in) :: input_name
80 integer(I4B),
intent(in) :: iperblock
82 integer(I4B),
intent(in) :: iout
84 character(len=LINELENGTH) :: fname
85 character(len=LENVARNAME),
allocatable :: named_bound(:)
86 character(len=LINELENGTH),
dimension(:),
allocatable :: member_names
87 integer(I4B) :: n, nmembers, isize
89 call this%DynamicPkgLoadType%init(mf6_input, component_name, &
90 component_input_name, input_name, &
92 this%ts_active = .false.
95 allocate (this%tsmanager)
99 call this%static_loader%load(parser, mf6_input, this%nc_vars, &
100 this%input_name, iout)
103 if (this%static_loader%ts_active)
then
104 this%ts_active = .true.
105 call get_isize(
'TS6_FILENAME', mf6_input%mempath, isize)
107 call mem_setptr(ts_fnames,
'TS6_FILENAME', mf6_input%mempath)
108 do n = 1,
size(ts_fnames)
110 call this%tsmanager%add_tsfile(fname,
getunit())
117 do n = 1,
size(mf6_input%param_dfns)
118 if (mf6_input%param_dfns(n)%blockname ==
'DIMENSIONS')
then
120 named_bound(
size(named_bound)) = trim(mf6_input%param_dfns(n)%mf6varname)
125 if (
allocated(named_bound))
then
126 call this%ctx%init(mf6_input, named_bound=named_bound)
128 call this%ctx%init(mf6_input)
131 call this%ctx%tags(this%param_names, this%nparam, this%input_name)
132 this%nleading = this%ctx%nleading
135 call this%ctx%keystring_member_names(member_names, nmembers)
137 this%nparam = this%nparam + 1
139 this%param_names(this%nparam) = trim(member_names(n))
143 call this%ctx%allocate_arrays()
146 call this%create_structarray()
155 call this%tsmanager%tsmanager_df()
157 do n = 1, this%static_loader%ts_sa_count()
158 sa => this%static_loader%get_ts_sa(n)
159 if (
associated(sa))
then
160 call sa%ts_update(this%tsmanager, &
161 this%mf6_input%subcomponent_name, &
162 this%ctx%iprpak, this%input_name, &
163 clear_strlocs=.false.)
169 if (this%ctx%is_dimensions_scoped)
call this%allocate_period_settings()
172 if (this%ctx%is_cellid_scoped)
call this%allocate_period_node_settings()
177 call this%tsmanager%ad()
180 subroutine rp(this, parser)
188 this%mf6_input%subcomponent_name, this%iout)
191 this%structarray%read_from_parser_keystring(parser, this%ts_active, &
192 this%nleading, this%iout, &
195 if (this%ctx%is_dimensions_scoped)
call this%apply_period_settings()
196 if (this%ctx%is_cellid_scoped)
call this%apply_period_node_settings()
198 if (this%ts_active)
then
199 call this%structarray%ts_update(this%tsmanager, &
200 this%mf6_input%subcomponent_name, &
201 this%ctx%iprpak, this%input_name)
205 this%mf6_input%subcomponent_name, this%iout)
216 if (.not. this%ctx%has_setting_dispatch)
then
218 call this%tsmanager%reset(this%mf6_input%subcomponent_name)
223 if (this%ts_active)
then
224 do n = 1, this%static_loader%ts_sa_count()
225 sa => this%static_loader%get_ts_sa(n)
226 if (
associated(sa))
then
227 call sa%ts_update(this%tsmanager, &
228 this%mf6_input%subcomponent_name, &
229 this%ctx%iprpak, this%input_name, &
230 clear_strlocs=.false.)
239 call this%static_loader%cleanup()
241 call this%tsmanager%da()
242 deallocate (this%tsmanager)
243 nullify (this%tsmanager)
245 if (
associated(this%structarray))
then
249 call this%ctx%destroy()
250 call this%DynamicPkgLoadType%destroy()
259 integer(I4B) :: nfeatures
260 character(len=LINELENGTH),
allocatable :: member_names(:)
261 integer(I4B) :: nmembers
264 call this%ctx%keystring_member_names(member_names, nmembers)
265 if (nmembers > 0 .and.
associated(this%ctx%maxbound))
then
266 if (this%ctx%maxbound > 0) nfeatures = this%ctx%maxbound / nmembers
277 integer(I4B),
intent(in) :: icol
281 this%mf6_input%component_type, &
282 this%mf6_input%subcomponent_type, &
283 'PERIOD', this%param_names(icol), &
285 if (idt%datatype /=
'STRING' .or. .not. idt%timeseries) idt => null()
295 integer(I4B),
intent(in) :: nfeatures
296 real(DP),
intent(in) :: init_value
297 real(DP),
dimension(:),
pointer,
contiguous :: featarr => null()
298 integer(I4B) :: isize
300 call get_isize(trim(idt%tagname), this%mf6_input%mempath, isize)
301 if (isize > 0)
return
302 call mem_allocate(featarr, nfeatures, trim(idt%tagname), &
303 this%mf6_input%mempath)
314 intent(in) :: period_val
315 integer(I4B),
intent(in) :: i
316 integer(I4B),
intent(in) :: address
317 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: featarr
318 real(DP),
pointer :: bndElem
319 character(len=LINELENGTH) :: token
321 token = period_val(i)
322 if (len_trim(token) == 0)
return
323 bndelem => featarr(address)
325 this%mf6_input%subcomponent_name, &
326 'BND', this%tsmanager, &
327 this%ctx%iprpak, trim(idt%tagname))
336 integer(I4B) :: icol, nfeatures
338 nfeatures = this%resolve_nfeatures()
339 if (nfeatures < 1)
return
341 do icol = this%nleading + 1, this%nparam
342 idt => this%resolve_in_scope_setting(icol)
343 if (.not.
associated(idt)) cycle
344 call this%allocate_permanent_array(idt, nfeatures,
dzero)
360 integer(I4B),
pointer :: nbound => null()
361 integer(I4B),
dimension(:),
pointer,
contiguous :: period_bndno => null()
363 period_setting => null()
367 real(DP),
dimension(:),
pointer,
contiguous :: featarr => null()
368 integer(I4B) :: i, icol, bndno, isize, nfeatures
369 character(len=LINELENGTH) :: setting
371 call get_isize(
'NBOUND', this%mf6_input%mempath, isize)
372 if (isize < 1)
return
373 call mem_setptr(nbound,
'NBOUND', this%mf6_input%mempath)
374 if (nbound <= 0)
return
376 nfeatures = this%resolve_nfeatures()
377 if (nfeatures < 1)
return
383 this%mf6_input%component_type, &
384 this%mf6_input%subcomponent_type, &
385 'PERIOD', this%param_names(1), &
387 call mem_setptr(period_bndno, trim(idt%mf6varname), this%mf6_input%mempath)
388 call mem_setptr(period_setting,
'SETTING', this%mf6_input%mempath)
390 do icol = this%nleading + 1, this%nparam
391 idt => this%resolve_in_scope_setting(icol)
392 if (.not.
associated(idt)) cycle
393 call mem_setptr(featarr, trim(idt%tagname), this%mf6_input%mempath)
394 call mem_setptr(period_val, trim(idt%mf6varname), this%mf6_input%mempath)
397 setting = period_setting(i)
398 if (trim(setting) /= trim(idt%mf6varname)) cycle
399 bndno = period_bndno(i)
400 if (bndno < 1 .or. bndno > nfeatures)
then
401 write (
errmsg,
'(2(a,1x),i0,a)') &
402 'BNDNO must be greater than 0 and', &
403 'less than or equal to ', nfeatures,
'.'
407 call this%apply_setting_value(idt, period_val, i, bndno, featarr)
423 integer(I4B) :: icol, nfeatures
425 if (.not.
associated(this%ctx%nodes))
return
426 nfeatures = this%ctx%nodes
427 if (nfeatures < 1)
return
429 do icol = this%nleading + 1, this%nparam
430 idt => this%resolve_in_scope_setting(icol)
431 if (.not.
associated(idt)) cycle
432 call this%allocate_permanent_array(idt, nfeatures,
dnodata)
446 integer(I4B),
pointer :: nbound => null()
447 integer(I4B),
dimension(:, :),
pointer,
contiguous :: cellid => null()
449 period_setting => null()
453 real(DP),
dimension(:),
pointer,
contiguous :: featarr => null()
454 integer(I4B) :: i, icol, nodeu, isize, nfeatures, ndim
455 character(len=LINELENGTH) :: setting
457 call get_isize(
'NBOUND', this%mf6_input%mempath, isize)
458 if (isize < 1)
return
459 call mem_setptr(nbound,
'NBOUND', this%mf6_input%mempath)
460 if (nbound <= 0)
return
462 if (.not.
associated(this%ctx%nodes))
return
463 nfeatures = this%ctx%nodes
464 if (nfeatures < 1)
return
465 if (.not.
associated(this%ctx%mshape))
return
466 ndim =
size(this%ctx%mshape)
468 call mem_setptr(cellid,
'CELLID', this%mf6_input%mempath)
469 call mem_setptr(period_setting,
'SETTING', this%mf6_input%mempath)
471 do icol = this%nleading + 1, this%nparam
472 idt => this%resolve_in_scope_setting(icol)
473 if (.not.
associated(idt)) cycle
474 call mem_setptr(featarr, trim(idt%tagname), this%mf6_input%mempath)
475 call mem_setptr(period_val, trim(idt%mf6varname), this%mf6_input%mempath)
478 setting = period_setting(i)
479 if (trim(setting) /= trim(idt%mf6varname)) cycle
482 else if (ndim == 2)
then
483 nodeu =
get_node(cellid(1, i), 1, cellid(2, i), &
484 this%ctx%mshape(1), 1, this%ctx%mshape(2))
486 nodeu =
get_node(cellid(1, i), cellid(2, i), cellid(3, i), &
487 this%ctx%mshape(1), this%ctx%mshape(2), &
490 if (nodeu < 1 .or. nodeu > nfeatures) cycle
491 call this%apply_setting_value(idt, period_val, i, nodeu, featarr)
502 character(len=LINELENGTH),
allocatable :: rec_cols(:)
503 character(len=LINELENGTH) :: kwname, first_col
504 integer(I4B) :: iparam, sa_icol, padj, nrow_prealloc, jparam, nrec_col, nsub
505 logical(LGP) :: has_setting
507 has_setting = this%ctx%has_setting_dispatch
509 if (has_setting) padj = 1
513 if (
associated(this%ctx%maxbound) .and. this%ctx%maxbound > 0)
then
514 nrow_prealloc = this%ctx%maxbound
519 this%structarray => &
521 nrow_prealloc, 0, this%mf6_input%mempath, &
522 this%mf6_input%component_mempath)
525 do iparam = 1, this%nleading
527 this%mf6_input%component_type, &
528 this%mf6_input%subcomponent_type, &
530 this%param_names(iparam), this%input_name)
531 call this%structarray%mem_create_vector(iparam, idt)
536 if (has_setting)
then
537 call this%structarray%mem_create_vector(this%nleading + 1, &
538 this%ctx%setting_idt)
542 do iparam = this%nleading + 1, this%nparam
543 sa_icol = iparam + padj
545 this%mf6_input%component_type, &
546 this%mf6_input%subcomponent_type, &
548 this%param_names(iparam), this%input_name)
549 call this%structarray%mem_create_vector(sa_icol, idt)
554 if (trim(idt%datatype) ==
'KEYWORD')
then
555 kwname = trim(idt%tagname)
558 do jparam = 1,
size(this%mf6_input%param_dfns)
559 pidt => this%mf6_input%param_dfns(jparam)
560 if (pidt%blockname /=
'PERIOD') cycle
561 if (pidt%datatype(1:6) /=
'RECORD') cycle
563 if (nrec_col >= 1)
then
564 first_col = trim(rec_cols(1))
566 if (trim(first_col) == trim(kwname))
then
568 if (
allocated(rec_cols))
deallocate (rec_cols)
572 if (
allocated(rec_cols))
deallocate (rec_cols)
574 this%structarray%struct_vectors(sa_icol)%nsubmembers = nsub
This module contains block parser methods.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
real(dp), parameter dnodata
real no data constant
integer(i4b), parameter lenvarname
maximum length of a variable name
real(dp), parameter dzero
real constant zero
This module contains the DefinitionSelectModule.
subroutine, public idt_parse_rectype(idt, cols, ncol)
allocate and set RECARRAY, KEYSTRING or RECORD param list
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type(input_definition_types, component_type, subcomponent_type, blockname, tagname, filename, found)
Return parameter definition.
integer(i4b) function, public get_node(ilay, irow, icol, nlay, nrow, ncol)
Get node number, given layer, row, and column indices for a structured grid. If any argument is inval...
This module contains the Input Data Model Logger Module.
subroutine, public idm_log_close(component, subcomponent, iout)
@ brief log the closing message
subroutine, public idm_log_header(component, subcomponent, iout)
@ brief log a header message
This module defines variable data types.
This module contains the LoadContextModule.
This module contains the LoadMf6FileModule.
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Period block keystring-based input loader.
subroutine allocate_period_node_settings(this)
Allocate permanent, node-indexed storage for every PERIOD setting in scope, for CELLID-addressed pack...
subroutine apply_setting_value(this, idt, period_val, i, address, featarr)
Resolve token (row i of period_val) as a literal or TS name directly against featarr(address).
subroutine ainit(this, mf6_input, component_name, component_input_name, input_name, iperblock, parser, iout)
integer(i4b) function resolve_nfeatures(this)
Resolve the permanent array's feature count: ctxmaxbound divided by the keystring member count,...
subroutine allocate_permanent_array(this, idt, nfeatures, init_value)
Allocate idt's permanent array with init_value, unless already allocated.
subroutine allocate_period_settings(this)
Allocate permanent, feature-indexed storage for every in-scope PERIOD setting, keyed by the field's p...
subroutine ts_advance(this)
subroutine apply_period_settings(this)
Apply PERIOD settings (SPC) to their permanent, feature-indexed arrays.
subroutine create_structarray(this)
subroutine apply_period_node_settings(this)
Apply PERIOD settings to their permanent, node-indexed arrays, for CELLID-addressed packages (TVK/TVS...
type(inputparamdefinitiontype) function, pointer resolve_in_scope_setting(this, icol)
Return idt for param_names(icol) if it's an in-scope PERIOD setting (STRING type with TIME_SERIES TRU...
subroutine rp(this, parser)
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
This module contains the StructArrayModule.
type(structarraytype) function, pointer, public constructstructarray(mf6_input, ncol, nrow, blocknum, mempath, component_mempath)
constructor for a struct_array
subroutine, public destructstructarray(struct_array)
destructor for a struct_array
subroutine, public read_value_or_time_series_adv(textInput, ii, jj, bndElem, pkgName, auxOrBnd, tsManager, iprpak, varName)
Call this subroutine from advanced packages to define timeseries link for a variable (varName).
subroutine, public tsmanager_cr(this, iout, removeTsLinksOnCompletion, extendTsToEndOfSimulation)
Create the tsmanager.
This class is used to store a single deferred-length character string. It was designed to work in an ...
derived type for boundary package input context
Static parser based input loader.
Keystring period block loader.
type for structured array