MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
boundinputcontextmodule Module Reference

This module contains the BoundInputContextModule. More...

Data Types

type  readstatevartype
 Pointer type for read state variable. More...
 
type  boundinputcontexttype
 derived type for boundary package input context More...
 

Functions/Subroutines

subroutine create (this, mf6_input, readasarrays)
 create boundary input context More...
 
subroutine allocate_scalars (this)
 create boundary input context More...
 
subroutine allocate_arrays (this)
 allocate_arrays More...
 
subroutine list_params_create (this, params, nparam, input_name)
 
subroutine array_params_create (this, params, nparam, input_name)
 allocate dfn array input period block parameters More...
 
subroutine destroy (this)
 destroy boundary input context More...
 
character(len=lenvarname) function rsv_alloc (this, mf6varname)
 allocate a read state variable More...
 
subroutine bound_params (this, params, nparam, input_name, create)
 allocate and set input array to filtered param set More...
 

Detailed Description

This module contains a type that stores and creates context relevant to stress package inputs.

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine boundinputcontextmodule::allocate_arrays ( class(boundinputcontexttype this)

allocate bound input context arrays

Definition at line 148 of file BoundInputContext.f90.

149  ! -- modules
152  ! -- dummy
153  class(BoundInputContextType) :: this
154  integer(I4B), dimension(:, :), pointer, contiguous :: cellid
155  ! -- local
156  !
157  ! -- set auxname_cst and iauxmultcol
158  if (this%naux > 0) then
159  call mem_setptr(this%auxname_cst, 'AUXILIARY', this%mf6_input%mempath)
160  else
161  call mem_allocate(this%auxname_cst, lenauxname, 0, &
162  'AUXILIARY', this%mf6_input%mempath)
163  end if
164  !
165  ! -- allocate cellid if this is not list input
166  if (this%readasarrays) then
167  call mem_allocate(cellid, 0, 0, 'CELLID', this%mf6_input%mempath)
168  end if
169  !
170  ! -- allocate or set pointer to BOUNDNAME
171  if (this%inamedbound == 0) then
172  call mem_allocate(this%boundname_cst, lenboundname, 0, &
173  'BOUNDNAME', this%mf6_input%mempath)
174  !
175  else
176  call mem_setptr(this%boundname_cst, 'BOUNDNAME', this%mf6_input%mempath)
177  end if
178  !
179  ! -- allocate or set pointer to AUXVAR
180  if (this%naux == 0) then
181  call mem_allocate(this%auxvar, 0, 0, 'AUXVAR', this%mf6_input%mempath)
182  !
183  else
184  call mem_setptr(this%auxvar, 'AUXVAR', this%mf6_input%mempath)
185  end if
186  !
187  ! -- return
188  return
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:

◆ allocate_scalars()

subroutine boundinputcontextmodule::allocate_scalars ( class(boundinputcontexttype this)
private

Definition at line 91 of file BoundInputContext.f90.

92  ! -- modules
95  ! -- dummy
96  class(BoundInputContextType) :: this
97  logical(LGP) :: found
98  !
99  ! -- set pointers to defined scalars
100  call mem_setptr(this%naux, 'NAUX', this%mf6_input%mempath)
101  !
102  ! -- allocate memory managed scalars
103  call mem_allocate(this%nbound, 'NBOUND', this%mf6_input%mempath)
104  call mem_allocate(this%ncpl, 'NCPL', this%mf6_input%mempath)
105  !
106  ! -- internally allocate package optional scalars
107  allocate (this%maxbound)
108  allocate (this%inamedbound)
109  allocate (this%iprpak)
110  !
111  ! -- initialize allocated and internal scalars
112  this%nbound = 0
113  this%ncpl = 0
114  this%maxbound = 0
115  this%inamedbound = 0
116  this%iprpak = 0
117  !
118  ! -- update optional scalars
119  call mem_set_value(this%inamedbound, 'BOUNDNAMES', this%mf6_input%mempath, &
120  found)
121  call mem_set_value(this%maxbound, 'MAXBOUND', this%mf6_input%mempath, found)
122  call mem_set_value(this%iprpak, 'IPRPAK', this%mf6_input%mempath, found)
123  !
124  ! -- set pointer to model shape
125  call mem_setptr(this%mshape, 'MODEL_SHAPE', &
126  this%mf6_input%component_mempath)
127  !
128  ! -- update ncpl from model shape
129  if (size(this%mshape) == 2) then
130  this%ncpl = this%mshape(2)
131  else if (size(this%mshape) == 3) then
132  this%ncpl = this%mshape(2) * this%mshape(3)
133  end if
134  !
135  ! -- initialize package params object
136  call this%package_params%init(this%mf6_input, this%readasarrays, &
137  this%naux, this%inamedbound)
138  !
139  ! -- return
140  return
Here is the call graph for this function:

◆ array_params_create()

subroutine boundinputcontextmodule::array_params_create ( class(boundinputcontexttype this,
character(len=*), dimension(:), intent(in), allocatable  params,
integer(i4b), intent(in)  nparam,
character(len=*), intent(in)  input_name 
)

Currently supports numeric (i.e. array based) params

Definition at line 269 of file BoundInputContext.f90.

270  ! -- modules
275  ! -- dummy
276  class(BoundInputContextType) :: this
277  character(len=*), dimension(:), allocatable, intent(in) :: params
278  integer(I4B), intent(in) :: nparam
279  character(len=*), intent(in) :: input_name
280  ! -- local
281  type(InputParamDefinitionType), pointer :: idt
282  integer(I4B) :: iparam
283  !
284  ! -- allocate dfn input params
285  do iparam = 1, nparam
286  !
287  ! -- assign param definition pointer
288  idt => get_param_definition_type(this%mf6_input%param_dfns, &
289  this%mf6_input%component_type, &
290  this%mf6_input%subcomponent_type, &
291  'PERIOD', params(iparam), '')
292  !
293  if (idt%blockname == 'PERIOD') then
294  select case (idt%datatype)
295  case ('INTEGER1D')
296  call allocate_param_int1d(this%ncpl, idt%mf6varname, &
297  this%mf6_input%mempath)
298  !
299  case ('DOUBLE1D')
300  call allocate_param_dbl1d(this%ncpl, idt%mf6varname, &
301  this%mf6_input%mempath)
302  !
303  case ('DOUBLE2D')
304  call allocate_param_dbl2d(this%naux, this%ncpl, idt%mf6varname, &
305  this%mf6_input%mempath)
306  !
307  case default
308  errmsg = 'IDM unimplemented. BoundInputContext::array_params_create &
309  &datatype='//trim(idt%datatype)
310  call store_error(errmsg)
311  call store_error_filename(input_name)
312  end select
313  end if
314  end do
315  !
316  ! -- return
317  return
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 DynamicPackageParamsModule.
subroutine, public allocate_param_int1d(nrow, varname, mempath)
allocate int1d
subroutine, public allocate_param_dbl1d(nrow, varname, mempath)
allocate dbl1d
subroutine, public allocate_param_dbl2d(ncol, nrow, varname, mempath)
allocate dbl2d
Here is the call graph for this function:

◆ bound_params()

subroutine boundinputcontextmodule::bound_params ( class(boundinputcontexttype this,
character(len=linelength), dimension(:), intent(inout), allocatable  params,
integer(i4b), intent(inout)  nparam,
character(len=*), intent(in)  input_name,
logical(lgp), intent(in), optional  create 
)

Definition at line 394 of file BoundInputContext.f90.

395  ! -- modules
396  ! -- dummy
397  class(BoundInputContextType) :: this
398  character(len=LINELENGTH), dimension(:), allocatable, &
399  intent(inout) :: params
400  integer(I4B), intent(inout) :: nparam
401  character(len=*), intent(in) :: input_name
402  logical(LGP), optional, intent(in) :: create
403  logical(LGP) :: allocate_params
404  integer(I4B) :: n
405  !
406  ! -- initialize allocate_params
407  allocate_params = .true.
408  !
409  ! -- override default if provided
410  if (present(create)) then
411  allocate_params = create
412  end if
413  !
414  if (allocated(params)) deallocate (params)
415  !
416  nparam = this%package_params%nparam
417  !
418  allocate (params(nparam))
419  !
420  do n = 1, nparam
421  params(n) = this%package_params%params(n)
422  end do
423  !
424  if (allocate_params) then
425  if (this%readasarrays) then
426  !
427  call this%array_params_create(params, nparam, input_name)
428  else
429  !
430  call this%list_params_create(params, nparam, input_name)
431  end if
432  end if
433  !
434  ! -- return
435  return

◆ create()

subroutine boundinputcontextmodule::create ( class(boundinputcontexttype this,
type(modflowinputtype), intent(in)  mf6_input,
logical(lgp), intent(in)  readasarrays 
)
private

Definition at line 71 of file BoundInputContext.f90.

72  ! -- modules
73  ! -- dummy
74  class(BoundInputContextType) :: this
75  type(ModflowInputType), intent(in) :: mf6_input
76  logical(LGP), intent(in) :: readasarrays
77  !
78  this%mf6_input = mf6_input
79  this%readasarrays = readasarrays
80  !
81  ! -- create the dynamic package input context
82  call this%allocate_scalars()
83  !
84  ! --return
85  return

◆ destroy()

subroutine boundinputcontextmodule::destroy ( class(boundinputcontexttype this)

Definition at line 323 of file BoundInputContext.f90.

324  ! -- modules
325  ! -- dummy
326  class(BoundInputContextType) :: this
327  !
328  ! -- destroy package params object
329  call this%package_params%destroy()
330  !
331  ! -- deallocate
332  deallocate (this%maxbound)
333  deallocate (this%inamedbound)
334  deallocate (this%iprpak)
335  !
336  ! -- nullify
337  nullify (this%naux)
338  nullify (this%nbound)
339  nullify (this%ncpl)
340  nullify (this%maxbound)
341  nullify (this%inamedbound)
342  nullify (this%iprpak)
343  nullify (this%auxname_cst)
344  nullify (this%boundname_cst)
345  nullify (this%auxvar)
346  nullify (this%mshape)
347  !
348  ! --return
349  return

◆ list_params_create()

subroutine boundinputcontextmodule::list_params_create ( class(boundinputcontexttype this,
character(len=*), dimension(:), intent(in), allocatable  params,
integer(i4b), intent(in)  nparam,
character(len=*), intent(in)  input_name 
)

Definition at line 191 of file BoundInputContext.f90.

192  ! -- modules
200  ! -- dummy
201  class(BoundInputContextType) :: this
202  character(len=*), dimension(:), allocatable, intent(in) :: params
203  integer(I4B), intent(in) :: nparam
204  character(len=*), intent(in) :: input_name
205  ! -- local
206  type(InputParamDefinitionType), pointer :: idt
207  integer(I4B) :: iparam
208  !
209  ! --
210  do iparam = 1, nparam
211  idt => get_param_definition_type(this%mf6_input%param_dfns, &
212  this%mf6_input%component_type, &
213  this%mf6_input%subcomponent_type, &
214  'PERIOD', params(iparam), '')
215  !
216  ! allocate based on dfn datatype
217  select case (idt%datatype)
218  case ('INTEGER')
219  call allocate_param_int1d(this%maxbound, idt%mf6varname, &
220  this%mf6_input%mempath)
221  !
222  case ('DOUBLE')
223  call allocate_param_dbl1d(this%maxbound, idt%mf6varname, &
224  this%mf6_input%mempath)
225  !
226  case ('STRING')
227  call allocate_param_charstr(lenboundname, this%maxbound, idt%mf6varname, &
228  this%mf6_input%mempath)
229  !
230  case ('INTEGER1D')
231  if (idt%shape == 'NCELLDIM') then
232  call allocate_param_int2d(size(this%mshape), this%maxbound, &
233  idt%mf6varname, this%mf6_input%mempath)
234  else
235  errmsg = 'IDM unimplemented. BoundInputContext::list_params_create &
236  &shape='//trim(idt%shape)
237  call store_error(errmsg)
238  call store_error_filename(input_name)
239  end if
240  !
241  case ('DOUBLE1D')
242  if (idt%shape == 'NAUX') then
243  call allocate_param_dbl2d(this%naux, this%maxbound, &
244  idt%mf6varname, this%mf6_input%mempath)
245  else
246  errmsg = 'IDM unimplemented. BoundInputContext::list_params_create &
247  &tagname='//trim(idt%tagname)
248  call store_error(errmsg)
249  call store_error_filename(input_name)
250  end if
251  !
252  case default
253  errmsg = 'IDM unimplemented. BoundInputContext::list_params_create &
254  &datatype='//trim(idt%datatype)
255  call store_error(errmsg)
256  call store_error_filename(input_name)
257  end select
258  end do
259  !
260  ! -- return
261  return
subroutine, public allocate_param_int2d(ncol, nrow, varname, mempath)
allocate int2d
subroutine, public allocate_param_charstr(strlen, nrow, varname, mempath)
allocate character string type array
This module contains the InputDefinitionModule.
Here is the call graph for this function:

◆ rsv_alloc()

character(len=lenvarname) function boundinputcontextmodule::rsv_alloc ( class(boundinputcontexttype this,
character(len=*), intent(in)  mf6varname 
)
private

Create and set a read state variable, e.g. 'INRECHARGE', which are updated per iper load as follows: -1: unset, not in use 0: not read in most recent period block 1: numeric input read in most recent period block 2: time series input read in most recent period block

Definition at line 362 of file BoundInputContext.f90.

363  ! -- modules
364  use constantsmodule, only: lenvarname
366  ! -- dummy
367  class(BoundInputContextType) :: this
368  character(len=*), intent(in) :: mf6varname
369  ! -- local
370  character(len=LENVARNAME) :: varname
371  integer(I4B) :: ilen
372  integer(I4B), pointer :: intvar
373  character(len=2) :: prefix = 'IN'
374  !
375  ! -- assign first column as the block number
376  ilen = len_trim(mf6varname)
377  !
378  if (ilen > (lenvarname - len(prefix))) then
379  varname = prefix//mf6varname(1:(lenvarname - len(prefix)))
380  else
381  varname = prefix//trim(mf6varname)
382  end if
383  !
384  call mem_allocate(intvar, varname, this%mf6_input%mempath)
385  intvar = -1
386  !
387  ! -- return
388  return
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition: Constants.f90:17