MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
mf6filesettingloadmodule Module Reference

This module contains the Mf6FileSettingLoadModule. More...

Data Types

type  idtptrtype
 Pointer type for read state variable. More...
 
type  settingloadtype
 Setting package loader. More...
 

Functions/Subroutines

subroutine settingload_init (this, mf6_input, component_name, component_input_name, input_name, iperblock, parser, iout)
 
subroutine df (this)
 
subroutine rp (this, parser)
 
subroutine reset (this)
 
integer(i4b) function set_leading_idts (this)
 
integer(i4b) function set_idts (this)
 
integer(i4b) function set_oc_idts (this)
 
subroutine destroy (this)
 

Detailed Description

This module contains the routines for reading a dfn setting with multiple tokens into a single CharacterStringType array using the StructArrayType.

Preceding param columns can be configured per package (e.g. OC)

Function/Subroutine Documentation

◆ destroy()

subroutine mf6filesettingloadmodule::destroy ( class(settingloadtype), intent(inout)  this)

Definition at line 225 of file Mf6FileSetting.f90.

227  class(SettingLoadType), intent(inout) :: this
228  integer(I4B) :: icol
229 
230  if (associated(this%structarray)) then
231  ! destroy the structured array reader
232  call destructstructarray(this%structarray)
233  end if
234 
235  do icol = 1, size(this%idts)
236  !deallocate (this%idts(icol)%idt)
237  nullify (this%idts(icol)%idt)
238  end do
239 
240  if (allocated(this%idts)) deallocate (this%idts)
241 
242  call this%DynamicPkgLoadType%destroy()
Here is the call graph for this function:

◆ df()

subroutine mf6filesettingloadmodule::df ( class(settingloadtype), intent(inout)  this)

Definition at line 91 of file Mf6FileSetting.f90.

92  class(SettingLoadType), intent(inout) :: this

◆ reset()

subroutine mf6filesettingloadmodule::reset ( class(settingloadtype), intent(inout)  this)
private

Definition at line 108 of file Mf6FileSetting.f90.

109  class(SettingLoadType), intent(inout) :: this
110  integer(I4B) :: icol
111 
112  if (associated(this%structarray)) then
113  ! destroy the structured array reader
114  call destructstructarray(this%structarray)
115  end if
116 
117  ! construct and set up the struct array object
118  this%structarray => constructstructarray(this%mf6_input, size(this%idts), &
119  -1, 0, this%mf6_input%mempath, &
120  this%mf6_input%component_mempath)
121  ! set up struct array
122  do icol = 1, size(this%idts)
123  ! allocate variable in memory manager
124  call this%structarray%mem_create_vector(icol, this%idts(icol)%idt)
125  end do
Here is the call graph for this function:

◆ rp()

subroutine mf6filesettingloadmodule::rp ( class(settingloadtype), intent(inout)  this,
type(blockparsertype), intent(inout), pointer  parser 
)
private

Definition at line 95 of file Mf6FileSetting.f90.

96  class(SettingLoadType), intent(inout) :: this
97  type(BlockParserType), pointer, intent(inout) :: parser
98 
99  ! recreate structarray for period load
100  call this%reset()
101 
102  ! read from ascii
103  this%ctx%nbound = &
104  this%structarray%read_from_parser(parser, .false., this%iout, &
105  this%input_name)

◆ set_idts()

integer(i4b) function mf6filesettingloadmodule::set_idts ( class(settingloadtype), intent(inout)  this)
private

Definition at line 147 of file Mf6FileSetting.f90.

152  class(SettingLoadType), intent(inout) :: this
153  integer(I4B) :: nset
154  type(InputParamDefinitionType), pointer :: aidt, idt
155  character(len=LINELENGTH), dimension(:), allocatable :: cols
156  integer(I4B) :: nparam, iparam, ip, ilen
157 
158  nset = 0
159 
160  aidt => &
161  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
162  this%mf6_input%component_type, &
163  this%mf6_input%subcomponent_type, &
164  'PERIOD')
165 
166  call idt_parse_rectype(aidt, cols, nparam)
167 
168  ! allocate idts
169  ilen = len_trim(cols(nparam))
170  if (cols(nparam) (ilen - 6:ilen) == 'SETTING') then
171  allocate (this%idts(nparam))
172  nset = nparam - 1
173  else
174  call store_error('Internal IDM error: trailing setting param not found')
175  call store_error_filename(this%input_name)
176  end if
177 
178  ! set leading idts
179  do iparam = 1, nset
180  do ip = 1, size(this%mf6_input%param_dfns)
181  idt => this%mf6_input%param_dfns(ip)
182  if (idt%tagname == cols(iparam)) then
183  this%idts(iparam)%idt => idt
184  end if
185  end do
186  end do
187 
188  if (allocated(cols)) deallocate (cols)
189  return
This module contains the DefinitionSelectModule.
type(inputparamdefinitiontype) function, pointer, public get_aggregate_definition_type(input_definition_types, component_type, subcomponent_type, blockname)
Return aggregate definition.
subroutine, public idt_parse_rectype(idt, cols, ncol)
allocate and set RECARRAY, KEYSTRING or RECORD param list
Input definition module.
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:203
Input parameter definition. Describes an input parameter.
Here is the call graph for this function:

◆ set_leading_idts()

integer(i4b) function mf6filesettingloadmodule::set_leading_idts ( class(settingloadtype), intent(inout)  this)
private

Definition at line 128 of file Mf6FileSetting.f90.

129  class(SettingLoadType), intent(inout) :: this
130  integer(I4B) :: nset
131 
132  ! This loader is intended to be generic for LIST based dynamic input that
133  ! includes any number of columns preceding a final keystring type
134  ! setting column. This routine handles exception cases. OC, for example,
135  ! which could adhere to this format however changes to the dfn to make it
136  ! so would introduce breaking changes to existing FloPy3 user scripts.
137 
138  ! set leading idts
139  select case (this%mf6_input%subcomponent_type)
140  case ('OC')
141  nset = this%set_oc_idts()
142  case default
143  nset = this%set_idts()
144  end select

◆ set_oc_idts()

integer(i4b) function mf6filesettingloadmodule::set_oc_idts ( class(settingloadtype), intent(inout)  this)

Definition at line 192 of file Mf6FileSetting.f90.

195  class(SettingLoadType), intent(inout) :: this
196  integer(I4B) :: nset
197  type(InputParamDefinitionType), pointer :: idt, idt_ocaction
198  integer(I4B) :: nparam, ip
199 
200  ! generalize first kw field to a string
201  idt_ocaction => &
202  idt_default(this%mf6_input%component_type, &
203  this%mf6_input%subcomponent_type, &
204  'PERIOD', 'OCACTION', 'OCACTION', 'STRING')
205 
206  ! set 2 leading params
207  nset = 2
208 
209  ! allocate for 3 including ocsetting
210  nparam = nset + 1
211  allocate (this%idts(nparam))
212 
213  ! first generalized idt
214  this%idts(1)%idt => idt_ocaction
215 
216  ! set rtype idt
217  do ip = 1, size(this%mf6_input%param_dfns)
218  idt => this%mf6_input%param_dfns(ip)
219  if (idt%tagname == 'RTYPE') then
220  this%idts(2)%idt => idt
221  end if
222  end do
type(inputparamdefinitiontype) function, pointer, public idt_default(component_type, subcomponent_type, blockname, tagname, mf6varname, datatype)
return allocated input definition type
Here is the call graph for this function:

◆ settingload_init()

subroutine mf6filesettingloadmodule::settingload_init ( class(settingloadtype), 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 Mf6FileSetting.f90.

57  class(SettingLoadType), intent(inout) :: this
58  type(ModflowInputType), intent(in) :: mf6_input
59  character(len=*), intent(in) :: component_name
60  character(len=*), intent(in) :: component_input_name
61  character(len=*), intent(in) :: input_name
62  integer(I4B), intent(in) :: iperblock
63  type(BlockParserType), pointer, intent(inout) :: parser
64  integer(I4B), intent(in) :: iout
65  type(LoadMf6FileType) :: loader
66  integer(I4B) :: icol, numset
67 
68  ! init loader
69  call this%DynamicPkgLoadType%init(mf6_input, component_name, &
70  component_input_name, input_name, &
71  iperblock, iout)
72  ! initialize static loader
73  call loader%load(parser, mf6_input, this%nc_vars, this%input_name, iout)
74 
75  ! create and allocate load context
76  call this%ctx%init(mf6_input)
77  call this%ctx%allocate_arrays()
78 
79  ! allocate idt arrays and set idts for leading cols
80  numset = this%set_leading_idts()
81  icol = numset + 1
82 
83  ! set setting idt
84  this%idts(icol)%idt => &
85  idt_default(mf6_input%component_type, mf6_input%subcomponent_type, &
86  'PERIOD', 'SETTING', 'SETTING', 'STRING')
87  ! force all setting tokens to be read
88  this%idts(icol)%idt%shape = 'LINELENGTH'
This module contains the LoadMf6FileModule.
Definition: LoadMf6File.f90:8
Static parser based input loader.
Definition: LoadMf6File.f90:54
Here is the call graph for this function: