MODFLOW 6  version 6.7.0.dev3
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 224 of file Mf6FileSetting.f90.

226  class(SettingLoadType), intent(inout) :: this
227  integer(I4B) :: icol
228 
229  if (associated(this%structarray)) then
230  ! destroy the structured array reader
231  call destructstructarray(this%structarray)
232  end if
233 
234  do icol = 1, size(this%idts)
235  !deallocate (this%idts(icol)%idt)
236  nullify (this%idts(icol)%idt)
237  end do
238 
239  if (allocated(this%idts)) deallocate (this%idts)
240 
241  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 107 of file Mf6FileSetting.f90.

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

◆ set_idts()

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

Definition at line 146 of file Mf6FileSetting.f90.

151  class(SettingLoadType), intent(inout) :: this
152  integer(I4B) :: nset
153  type(InputParamDefinitionType), pointer :: aidt, idt
154  character(len=LINELENGTH), dimension(:), allocatable :: cols
155  integer(I4B) :: nparam, iparam, ip, ilen
156 
157  nset = 0
158 
159  aidt => &
160  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
161  this%mf6_input%component_type, &
162  this%mf6_input%subcomponent_type, &
163  'PERIOD')
164 
165  call idt_parse_rectype(aidt, cols, nparam)
166 
167  ! allocate idts
168  ilen = len_trim(cols(nparam))
169  if (cols(nparam) (ilen - 6:ilen) == 'SETTING') then
170  allocate (this%idts(nparam))
171  nset = nparam - 1
172  else
173  call store_error('Internal IDM error: trailing setting param not found')
174  call store_error_filename(this%input_name)
175  end if
176 
177  ! set leading idts
178  do iparam = 1, nset
179  do ip = 1, size(this%mf6_input%param_dfns)
180  idt => this%mf6_input%param_dfns(ip)
181  if (idt%tagname == cols(iparam)) then
182  this%idts(iparam)%idt => idt
183  end if
184  end do
185  end do
186 
187  if (allocated(cols)) deallocate (cols)
188  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
This module contains the InputDefinitionModule.
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
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 127 of file Mf6FileSetting.f90.

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

◆ set_oc_idts()

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

Definition at line 191 of file Mf6FileSetting.f90.

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