MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
dynamicpackageparamsmodule Module Reference

This module contains the DynamicPackageParamsModule.

Data Types

type  dynamicpackageparamstype
 dynamic parameter filter type More...
 

Functions/Subroutines

subroutine init (this, mf6_input, blockname, readasarrays, iauxiliary, inamedbound)
 initialize dynamic param filter More...
 
subroutine destroy (this)
 destroy More...
 
subroutine set_filtered_grid (this)
 array based input dynamic param filter More...
 
subroutine set_filtered_list (this)
 create array of in scope list input columns More...
 
subroutine package_params (this, params, nparam)
 allocate and set input array to filtered param set More...
 
subroutine, public allocate_param_charstr (strlen, nrow, varname, mempath)
 allocate character string type array More...
 
subroutine, public allocate_param_int1d (nrow, varname, mempath)
 allocate int1d More...
 
subroutine, public allocate_param_int2d (ncol, nrow, varname, mempath)
 allocate int2d More...
 
subroutine, public allocate_param_dbl1d (nrow, varname, mempath)
 allocate dbl1d More...
 
subroutine, public allocate_param_dbl2d (ncol, nrow, varname, mempath)
 allocate dbl2d More...
 
logical(lgp) function pkg_param_in_scope (mf6_input, blockname, tagname)
 determine if input param is in scope for a package More...
 

Function/Subroutine Documentation

◆ allocate_param_charstr()

subroutine, public dynamicpackageparamsmodule::allocate_param_charstr ( integer(i4b), intent(in)  strlen,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath 
)
Parameters
[in]strlenstring number of characters
[in]nrowinteger array number of rows
[in]varnamevariable name
[in]mempathvariable mempath

Definition at line 254 of file DynamicPackageParams.f90.

255  integer(I4B), intent(in) :: strlen !< string number of characters
256  integer(I4B), intent(in) :: nrow !< integer array number of rows
257  character(len=*), intent(in) :: varname !< variable name
258  character(len=*), intent(in) :: mempath !< variable mempath
259  type(CharacterStringType), dimension(:), pointer, &
260  contiguous :: charstr1d
261  integer(I4B) :: n
262  !
263  call mem_allocate(charstr1d, strlen, nrow, varname, mempath)
264  do n = 1, nrow
265  charstr1d(n) = ''
266  end do
Here is the caller graph for this function:

◆ allocate_param_dbl1d()

subroutine, public dynamicpackageparamsmodule::allocate_param_dbl1d ( integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath 
)
Parameters
[in]nrowinteger array number of rows
[in]varnamevariable name
[in]mempathvariable mempath

Definition at line 304 of file DynamicPackageParams.f90.

305  integer(I4B), intent(in) :: nrow !< integer array number of rows
306  character(len=*), intent(in) :: varname !< variable name
307  character(len=*), intent(in) :: mempath !< variable mempath
308  real(DP), dimension(:), pointer, contiguous :: dbl1d
309  integer(I4B) :: n
310  !
311  call mem_allocate(dbl1d, nrow, varname, mempath)
312  do n = 1, nrow
313  dbl1d(n) = dzero
314  end do
Here is the caller graph for this function:

◆ allocate_param_dbl2d()

subroutine, public dynamicpackageparamsmodule::allocate_param_dbl2d ( integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath 
)
Parameters
[in]ncolinteger array number of cols
[in]nrowinteger array number of rows
[in]varnamevariable name
[in]mempathvariable mempath

Definition at line 319 of file DynamicPackageParams.f90.

320  integer(I4B), intent(in) :: ncol !< integer array number of cols
321  integer(I4B), intent(in) :: nrow !< integer array number of rows
322  character(len=*), intent(in) :: varname !< variable name
323  character(len=*), intent(in) :: mempath !< variable mempath
324  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
325  integer(I4B) :: n, m
326  !
327  call mem_allocate(dbl2d, ncol, nrow, varname, mempath)
328  do m = 1, nrow
329  do n = 1, ncol
330  dbl2d(n, m) = dzero
331  end do
332  end do
Here is the caller graph for this function:

◆ allocate_param_int1d()

subroutine, public dynamicpackageparamsmodule::allocate_param_int1d ( integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath 
)
Parameters
[in]nrowinteger array number of rows
[in]varnamevariable name
[in]mempathvariable mempath

Definition at line 271 of file DynamicPackageParams.f90.

272  integer(I4B), intent(in) :: nrow !< integer array number of rows
273  character(len=*), intent(in) :: varname !< variable name
274  character(len=*), intent(in) :: mempath !< variable mempath
275  integer(I4B), dimension(:), pointer, contiguous :: int1d
276  integer(I4B) :: n
277  !
278  call mem_allocate(int1d, nrow, varname, mempath)
279  do n = 1, nrow
280  int1d(n) = izero
281  end do
Here is the caller graph for this function:

◆ allocate_param_int2d()

subroutine, public dynamicpackageparamsmodule::allocate_param_int2d ( integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
character(len=*), intent(in)  varname,
character(len=*), intent(in)  mempath 
)
Parameters
[in]ncolinteger array number of cols
[in]nrowinteger array number of rows
[in]varnamevariable name
[in]mempathvariable mempath

Definition at line 286 of file DynamicPackageParams.f90.

287  integer(I4B), intent(in) :: ncol !< integer array number of cols
288  integer(I4B), intent(in) :: nrow !< integer array number of rows
289  character(len=*), intent(in) :: varname !< variable name
290  character(len=*), intent(in) :: mempath !< variable mempath
291  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
292  integer(I4B) :: n, m
293  !
294  call mem_allocate(int2d, ncol, nrow, varname, mempath)
295  do m = 1, nrow
296  do n = 1, ncol
297  int2d(n, m) = izero
298  end do
299  end do
Here is the caller graph for this function:

◆ destroy()

subroutine dynamicpackageparamsmodule::destroy ( class(dynamicpackageparamstype this)
private

Definition at line 81 of file DynamicPackageParams.f90.

82  ! -- modules
83  ! -- dummy
84  class(DynamicPackageParamsType) :: this
85  !
86  ! -- deallocate
87  if (allocated(this%params)) deallocate (this%params)

◆ init()

subroutine dynamicpackageparamsmodule::init ( class(dynamicpackageparamstype this,
type(modflowinputtype), intent(in)  mf6_input,
character(len=*)  blockname,
logical(lgp), intent(in)  readasarrays,
integer(i4b), intent(in)  iauxiliary,
integer(i4b), intent(in)  inamedbound 
)
private

Definition at line 51 of file DynamicPackageParams.f90.

53  ! -- modules
54  ! -- dummy
55  class(DynamicPackageParamsType) :: this
56  type(ModflowInputType), intent(in) :: mf6_input
57  character(len=*) :: blockname
58  logical(LGP), intent(in) :: readasarrays
59  integer(I4B), intent(in) :: iauxiliary
60  integer(I4B), intent(in) :: inamedbound
61  !integer(I4B) :: iparam
62  ! -- local
63  !
64  this%mf6_input = mf6_input
65  this%blockname = blockname
66  this%nparam = 0
67  this%iauxiliary = iauxiliary
68  this%inamedbound = inamedbound
69  !
70  ! -- determine in scope input params
71  if (readasarrays) then
72  call this%set_filtered_grid()
73  else
74  call this%set_filtered_list()
75  end if

◆ package_params()

subroutine dynamicpackageparamsmodule::package_params ( class(dynamicpackageparamstype this,
character(len=linelength), dimension(:), intent(inout), allocatable  params,
integer(i4b), intent(inout)  nparam 
)
private

Definition at line 232 of file DynamicPackageParams.f90.

233  ! -- modules
234  ! -- dummy
235  class(DynamicPackageParamsType) :: this
236  character(len=LINELENGTH), dimension(:), allocatable, &
237  intent(inout) :: params
238  integer(I4B), intent(inout) :: nparam
239  integer(I4B) :: n
240  !
241  if (allocated(params)) deallocate (params)
242  !
243  nparam = this%nparam
244  !
245  allocate (params(nparam))
246  !
247  do n = 1, nparam
248  params(n) = this%params(n)
249  end do

◆ pkg_param_in_scope()

logical(lgp) function dynamicpackageparamsmodule::pkg_param_in_scope ( type(modflowinputtype), intent(in)  mf6_input,
character(len=*), intent(in)  blockname,
character(len=*), intent(in)  tagname 
)
private

Definition at line 338 of file DynamicPackageParams.f90.

339  ! -- modules
341  ! -- dummy
342  type(ModflowInputType), intent(in) :: mf6_input
343  character(len=*), intent(in) :: blockname
344  character(len=*), intent(in) :: tagname
345  ! -- return
346  logical(LGP) :: in_scope
347  ! -- local
348  type(InputParamDefinitionType), pointer :: idt
349  integer(I4B) :: pdim_isize, popt_isize
350  integer(I4B), pointer :: pdim
351  !
352  ! -- initialize
353  in_scope = .false.
354  !
355  idt => get_param_definition_type(mf6_input%param_dfns, &
356  mf6_input%component_type, &
357  mf6_input%subcomponent_type, &
358  blockname, tagname, '')
359  !
360  if (idt%required) then
361  ! -- required params always included
362  in_scope = .true.
363  else
364  !
365  ! -- package specific logic to determine if input params to be read
366  select case (mf6_input%subcomponent_type)
367  case ('EVT')
368  !
369  if (tagname == 'PXDP' .or. tagname == 'PETM') then
370  call get_isize('NSEG', mf6_input%mempath, pdim_isize)
371  if (pdim_isize > 0) then
372  call mem_setptr(pdim, 'NSEG', mf6_input%mempath)
373  if (pdim > 1) then
374  in_scope = .true.
375  end if
376  end if
377  else if (tagname == 'PETM0') then
378  call get_isize('SURFRATESPEC', mf6_input%mempath, popt_isize)
379  if (popt_isize > 0) then
380  in_scope = .true.
381  end if
382  end if
383  !
384  case ('NAM')
385  in_scope = .true.
386  case default
387  errmsg = 'IDM unimplemented. DynamicPackageParamsType::pkg_param_in_scope &
388  &add case tagname='//trim(idt%tagname)
389  call store_error(errmsg, .true.)
390  !call store_error_filename(sourcename)
391  end select
392  end if
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_filtered_grid()

subroutine dynamicpackageparamsmodule::set_filtered_grid ( class(dynamicpackageparamstype this)
private

Definition at line 93 of file DynamicPackageParams.f90.

94  ! -- modules
95  ! -- dummy
96  class(DynamicPackageParamsType) :: this
97  ! -- local
98  type(InputParamDefinitionType), pointer :: idt
99  integer(I4B), dimension(:), allocatable :: idt_idxs
100  type(CharacterStringType), dimension(:), pointer, contiguous :: boundname
101  real(DP), dimension(:, :), pointer, contiguous :: auxvar
102  integer(I4B) :: keepcnt, iparam
103  logical(LGP) :: keep
104  !
105  ! -- initialize
106  keepcnt = 0
107  !
108  ! -- allocate dfn input params
109  do iparam = 1, size(this%mf6_input%param_dfns)
110  !
111  keep = .true.
112  !
113  ! -- assign param definition pointer
114  idt => this%mf6_input%param_dfns(iparam)
115  !
116  if (idt%blockname /= this%blockname) then
117  keep = .false.
118  end if
119  !
120  if (idt%tagname == 'AUX') then
121  if (this%iauxiliary == 0) then
122  keep = .false.
123  call mem_allocate(auxvar, 0, 0, 'AUXVAR', this%mf6_input%mempath)
124  end if
125  if (this%inamedbound == 0) then
126  call mem_allocate(boundname, lenboundname, 0, 'BOUNDNAME', &
127  this%mf6_input%mempath)
128  end if
129  end if
130  !
131  if (keep) then
132  keepcnt = keepcnt + 1
133  call expandarray(idt_idxs)
134  idt_idxs(keepcnt) = iparam
135  end if
136  end do
137  !
138  ! -- update nparam
139  this%nparam = keepcnt
140  !
141  ! -- allocate filtcols
142  allocate (this%params(this%nparam))
143  !
144  ! -- set filtcols
145  do iparam = 1, this%nparam
146  idt => this%mf6_input%param_dfns(idt_idxs(iparam))
147  this%params(iparam) = trim(idt%tagname)
148  end do
149  !
150  ! -- cleanup
151  deallocate (idt_idxs)

◆ set_filtered_list()

subroutine dynamicpackageparamsmodule::set_filtered_list ( class(dynamicpackageparamstype this)
private

Filter the recarray description of list input parameters to determine which columns are to be read in this run.

Definition at line 159 of file DynamicPackageParams.f90.

160  ! -- modules
161  ! -- dummy
162  class(DynamicPackageParamsType) :: this
163  ! -- local
164  type(InputParamDefinitionType), pointer :: ra_idt, idt
165  character(len=LINELENGTH), dimension(:), allocatable :: ra_cols
166  type(CharacterStringType), dimension(:), pointer, contiguous :: boundname
167  real(DP), dimension(:, :), pointer, contiguous :: auxvar
168  integer(I4B) :: ra_ncol, icol, keepcnt
169  logical(LGP) :: keep
170  !
171  ! -- initialize
172  keepcnt = 0
173  !
174  ! -- get aggregate param definition for period block
175  ra_idt => &
176  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
177  this%mf6_input%component_type, &
178  this%mf6_input%subcomponent_type, &
179  this%blockname)
180  !
181  ! -- split recarray definition
182  call idt_parse_rectype(ra_idt, ra_cols, ra_ncol)
183  !
184  ! -- determine which columns are in scope
185  do icol = 1, ra_ncol
186  !
187  keep = .false.
188  !
189  ! -- set dfn pointer to recarray parameter
190  idt => get_param_definition_type(this%mf6_input%param_dfns, &
191  this%mf6_input%component_type, &
192  this%mf6_input%subcomponent_type, &
193  this%blockname, ra_cols(icol), '')
194  !
195  if (ra_cols(icol) == 'RECARRAY') then
196  ! no-op
197  else if (ra_cols(icol) == 'AUX') then
198  if (this%iauxiliary > 0) then
199  keep = .true.
200  else
201  call mem_allocate(auxvar, 0, 0, 'AUXVAR', this%mf6_input%mempath)
202  end if
203  else if (ra_cols(icol) == 'BOUNDNAME') then
204  if (this%inamedbound /= 0) then
205  keep = .true.
206  else
207  call mem_allocate(boundname, lenboundname, 0, 'BOUNDNAME', &
208  this%mf6_input%mempath)
209  end if
210  else
211  ! -- determine if the param is scope
212  keep = pkg_param_in_scope(this%mf6_input, this%blockname, ra_cols(icol))
213  end if
214  !
215  if (keep) then
216  keepcnt = keepcnt + 1
217  call expandarray(this%params)
218  this%params(keepcnt) = trim(ra_cols(icol))
219  end if
220  end do
221  !
222  ! -- update nparam
223  this%nparam = keepcnt
224  !
225  ! -- cleanup
226  deallocate (ra_cols)
Here is the call graph for this function: