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

Data Types

type  timearrayseriesmanagertype
 

Functions/Subroutines

subroutine, public tasmanager_cr (this, dis, modelname, iout)
 Create the time-array series manager. More...
 
subroutine tasmanager_df (this)
 Define the time-array series manager. More...
 
subroutine tasmgr_ad (this)
 Time step (or subtime step) advance. More...
 
subroutine tasmgr_da (this)
 Deallocate. More...
 
subroutine add_tasfile (this, fname)
 Add a time-array series file. More...
 
subroutine reset (this, pkgName)
 Zero out arrays that are represented with time series. More...
 
subroutine maketaslink (this, pkgName, bndArray, iprpak, tasName, text, convertFlux, nodelist, inunit)
 Make link from time-array series to package array. More...
 
type(timearrayserieslinktype) function, pointer getlink (this, indx)
 Get link from the boundtaslinks list. More...
 
integer(i4b) function countlinks (this)
 Count number of links in the boundtaslinks list. More...
 
subroutine tasmgr_convert_flux (this, tasLink)
 Convert the array from a flux to a flow rate by multiplying by the cell area. More...
 
subroutine tasmgr_add_link (this, tasLink)
 Add a time arrays series link. More...
 

Function/Subroutine Documentation

◆ add_tasfile()

subroutine timearrayseriesmanagermodule::add_tasfile ( class(timearrayseriesmanagertype this,
character(len=*), intent(in)  fname 
)
private

Definition at line 233 of file TimeArraySeriesManager.f90.

234  ! -- modules
236  ! -- dummy
237  class(TimeArraySeriesManagerType) :: this
238  character(len=*), intent(in) :: fname
239  ! -- local
240  integer(I4B) :: indx
241  !
242  call expandarray(this%tasfiles, 1)
243  indx = size(this%tasfiles)
244  this%tasfiles(indx) = fname
245  !
246  ! -- Return
247  return

◆ countlinks()

integer(i4b) function timearrayseriesmanagermodule::countlinks ( class(timearrayseriesmanagertype this)
private

Definition at line 363 of file TimeArraySeriesManager.f90.

364  ! -- return
365  integer(I4B) :: CountLinks
366  ! -- dummy
367  class(TimeArraySeriesManagerType) :: this
368  !
369  if (associated(this%boundtaslinks)) then
370  countlinks = this%boundTasLinks%Count()
371  else
372  countlinks = 0
373  end if
374  !
375  ! -- Return
376  return

◆ getlink()

type(timearrayserieslinktype) function, pointer timearrayseriesmanagermodule::getlink ( class(timearrayseriesmanagertype this,
integer(i4b), intent(in)  indx 
)
private

Definition at line 344 of file TimeArraySeriesManager.f90.

345  ! -- dummy
346  class(TimeArraySeriesManagerType) :: this
347  integer(I4B), intent(in) :: indx
348  ! -- return
349  type(TimeArraySeriesLinkType), pointer :: tasLink
350  !
351  taslink => null()
352  !
353  if (associated(this%boundTasLinks)) then
354  taslink => gettimearrayserieslinkfromlist(this%boundTasLinks, indx)
355  end if
356  !
357  ! -- Return
358  return
Here is the call graph for this function:

◆ maketaslink()

subroutine timearrayseriesmanagermodule::maketaslink ( class(timearrayseriesmanagertype this,
character(len=*), intent(in)  pkgName,
real(dp), dimension(:), pointer  bndArray,
integer(i4b), intent(in)  iprpak,
character(len=*), intent(in)  tasName,
character(len=*), intent(in)  text,
logical, intent(in)  convertFlux,
integer(i4b), dimension(:), intent(in), pointer, contiguous  nodelist,
integer(i4b), intent(in)  inunit 
)
private

Definition at line 293 of file TimeArraySeriesManager.f90.

295  ! -- dummy
296  class(TimeArraySeriesManagerType) :: this
297  character(len=*), intent(in) :: pkgName
298  real(DP), dimension(:), pointer :: bndArray
299  integer(I4B), intent(in) :: iprpak
300  character(len=*), intent(in) :: tasName
301  character(len=*), intent(in) :: text
302  logical, intent(in) :: convertFlux
303  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: nodelist
304  integer(I4B), intent(in) :: inunit
305  ! -- local
306  integer(I4B) :: i, nfiles, iloc
307  character(LINELENGTH) :: ermsg
308  type(TimeArraySeriesLinkType), pointer :: newTasLink
309  type(TimeArraySeriesType), pointer :: tasptr => null()
310  !
311  ! -- Find the time array series
312  nfiles = size(this%tasnames)
313  iloc = 0
314  do i = 1, nfiles
315  if (this%tasnames(i) == tasname) then
316  iloc = i
317  exit
318  end if
319  end do
320  if (iloc == 0) then
321  ermsg = 'Error: Time-array series "'//trim(tasname)//'" not found.'
322  call store_error(ermsg)
323  call store_error_unit(inunit)
324  end if
325  tasptr => this%taslist(iloc)
326  !
327  ! -- Construct a time-array series link
328  newtaslink => null()
329  call constructtimearrayserieslink(newtaslink, tasptr, &
330  pkgname, bndarray, iprpak, &
331  text)
332  newtaslink%ConvertFlux = convertflux
333  newtaslink%nodelist => nodelist
334  !
335  ! -- Add link to list of links
336  call this%tasmgr_add_link(newtaslink)
337  !
338  ! -- Return
339  return
Here is the call graph for this function:

◆ reset()

subroutine timearrayseriesmanagermodule::reset ( class(timearrayseriesmanagertype this,
character(len=*), intent(in)  pkgName 
)

Delete all existing links from time array series to package arrays as they will need to be created with a new BEGIN PERIOD block

Definition at line 255 of file TimeArraySeriesManager.f90.

256  ! -- dummy
257  class(TimeArraySeriesManagerType) :: this
258  character(len=*), intent(in) :: pkgName
259  ! -- local
260  integer(I4B) :: i, j, nlinks
261  type(TimeArraySeriesLinkType), pointer :: taslink
262  !
263  ! -- Reassign all linked elements to zero
264  nlinks = this%boundTasLinks%Count()
265  do i = 1, nlinks
266  taslink => gettimearrayserieslinkfromlist(this%boundTasLinks, i)
267  if (associated(taslink)) then
268  do j = 1, size(taslink%BndArray)
269  taslink%BndArray(j) = dzero
270  end do
271  end if
272  end do
273  !
274  ! -- Delete all existing time array links
275  if (associated(this%boundTasLinks)) then
276  ! Deallocate and remove all links belonging to package
277  nlinks = this%boundTasLinks%Count()
278  do i = nlinks, 1, -1
279  taslink => gettimearrayserieslinkfromlist(this%boundTasLinks, i)
280  if (associated(taslink)) then
281  call taslink%da()
282  call this%boundTasLinks%RemoveNode(i, .true.)
283  end if
284  end do
285  end if
286  !
287  ! -- Return
288  return
Here is the call graph for this function:

◆ tasmanager_cr()

subroutine, public timearrayseriesmanagermodule::tasmanager_cr ( type(timearrayseriesmanagertype this,
class(disbasetype), optional, pointer  dis,
character(len=*), intent(in)  modelname,
integer(i4b), intent(in)  iout 
)

Definition at line 57 of file TimeArraySeriesManager.f90.

58  ! -- dummy
59  type(TimeArraySeriesManagerType) :: this
60  class(DisBaseType), pointer, optional :: dis
61  character(len=*), intent(in) :: modelname
62  integer(I4B), intent(in) :: iout
63  !
64  if (present(dis)) then
65  this%dis => dis
66  end if
67  !
68  this%modelname = modelname
69  this%iout = iout
70  allocate (this%boundTasLinks)
71  allocate (this%tasfiles(0))
72  !
73  ! -- Return
74  return
Here is the caller graph for this function:

◆ tasmanager_df()

subroutine timearrayseriesmanagermodule::tasmanager_df ( class(timearrayseriesmanagertype this)
private

Definition at line 79 of file TimeArraySeriesManager.f90.

80  ! -- dummy
81  class(TimeArraySeriesManagerType) :: this
82  ! -- local
83  type(TimeArraySeriesType), pointer :: tasptr => null()
84  integer(I4B) :: nfiles
85  integer(I4B) :: i
86  !
87  ! -- determine how many tasfiles. This is the number of time array series
88  ! so allocate arrays to store them
89  nfiles = size(this%tasfiles)
90  allocate (this%taslist(nfiles))
91  allocate (this%tasnames(nfiles))
92  !
93  ! -- Setup a time array series for each file specified
94  do i = 1, nfiles
95  tasptr => this%taslist(i)
96  call tasptr%tas_init(this%tasfiles(i), this%modelname, &
97  this%iout, this%tasnames(i))
98  end do
99  !
100  ! -- Return
101  return

◆ tasmgr_ad()

subroutine timearrayseriesmanagermodule::tasmgr_ad ( class(timearrayseriesmanagertype this)
private

Call this each time step or subtime step.

Definition at line 108 of file TimeArraySeriesManager.f90.

109  ! -- dummy
110  class(TimeArraySeriesManagerType) :: this
111  ! -- local
112  type(TimeArraySeriesLinkType), pointer :: tasLink => null()
113  type(TimeArraySeriesType), pointer :: timearrayseries => null()
114  integer(I4B) :: i, j, nlinks, nvals, isize1, isize2, inunit
115  real(DP) :: begintime, endtime
116  ! -- formats
117  character(len=*), parameter :: fmt5 = &
118  "(/,'Time-array-series controlled arrays in stress period ', &
119  &i0, ', time step ', i0, ':')"
120 10 format('"', a, '" package: ', a, ' array obtained from time-array series "', &
121  a, '"')
122  !
123  ! -- Initialize time variables
124  begintime = totimc
125  endtime = begintime + delt
126  !
127  ! -- Iterate through boundtaslinks and update specified
128  ! array with array of average values obtained from
129  ! appropriate time series.
130  if (associated(this%boundTasLinks)) then
131  nlinks = this%boundTasLinks%Count()
132  do i = 1, nlinks
133  taslink => gettimearrayserieslinkfromlist(this%boundTasLinks, i)
134  if (taslink%Iprpak == 1 .and. i == 1) then
135  write (this%iout, fmt5) kper, kstp
136  end if
137  if (taslink%UseDefaultProc) then
138  timearrayseries => taslink%timeArraySeries
139  nvals = size(taslink%BndArray)
140  !
141  ! -- Fill the package array with integrated values
142  call timearrayseries%GetAverageValues(nvals, taslink%BndArray, &
143  begintime, endtime)
144  !
145  ! -- If conversion from flux to flow is required, multiply by cell area
146  if (taslink%ConvertFlux) then
147  call this%tasmgr_convert_flux(taslink)
148  end if
149  !
150  ! -- If PRINT_INPUT is specified, write information
151  ! regarding source of time-array series data
152  if (taslink%Iprpak == 1) then
153  write (this%iout, 10) trim(taslink%PackageName), &
154  trim(taslink%Text), &
155  trim(taslink%timeArraySeries%Name)
156  end if
157  end if
158  if (i == nlinks) then
159  write (this%iout, '()')
160  end if
161  end do
162  !
163  ! -- Now that all array values have been substituted, can now multiply
164  ! an array by a multiplier array
165  do i = 1, nlinks
166  taslink => gettimearrayserieslinkfromlist(this%boundTasLinks, i)
167  if (taslink%UseDefaultProc) then
168  if (associated(taslink%RMultArray)) then
169  isize1 = size(taslink%BndArray)
170  isize2 = size(taslink%RMultArray)
171  if (isize1 == isize2 .and. isize1 == nvals) then
172  do j = 1, nvals
173  taslink%BndArray(j) = taslink%BndArray(j) * taslink%RMultArray(j)
174  end do
175  else
176  errmsg = 'Size mismatch between boundary and multiplier arrays'// &
177  ' using time-array series: '// &
178  trim(taslink%TimeArraySeries%Name)
179  call store_error(errmsg)
180  inunit = taslink%TimeArraySeries%GetInunit()
181  call store_error_unit(inunit)
182  end if
183  end if
184  end if
185  end do
186  end if
187  !
188  ! -- Return
189  return
Here is the call graph for this function:

◆ tasmgr_add_link()

subroutine timearrayseriesmanagermodule::tasmgr_add_link ( class(timearrayseriesmanagertype this,
type(timearrayserieslinktype), pointer  tasLink 
)
private

Definition at line 415 of file TimeArraySeriesManager.f90.

416  ! -- dummy
417  class(TimeArraySeriesManagerType) :: this
418  type(TimeArraySeriesLinkType), pointer :: tasLink
419  ! -- local
420  !
421  call addtimearrayserieslinktolist(this%boundTasLinks, taslink)
422  !
423  ! -- Return
424  return
Here is the call graph for this function:

◆ tasmgr_convert_flux()

subroutine timearrayseriesmanagermodule::tasmgr_convert_flux ( class(timearrayseriesmanagertype this,
type(timearrayserieslinktype), intent(inout), pointer  tasLink 
)
private

Definition at line 384 of file TimeArraySeriesManager.f90.

385  ! -- dummy
386  class(TimeArraySeriesManagerType) :: this
387  type(TimeArraySeriesLinkType), pointer, intent(inout) :: tasLink
388  ! -- local
389  integer(I4B) :: i, n, noder
390  real(DP) :: area
391  !
392  if (.not. (associated(this%dis) .and. &
393  associated(taslink%nodelist))) then
394  errmsg = 'Programming error. Cannot convert flux. Verify that '&
395  &'a valid DIS instance and nodelist were provided.'
396  call store_error(errmsg)
397  call store_error_unit(taslink%TimeArraySeries%GetInunit())
398  end if
399  !
400  n = size(taslink%BndArray)
401  do i = 1, n
402  noder = taslink%nodelist(i)
403  if (noder > 0) then
404  area = this%dis%get_area(noder)
405  taslink%BndArray(i) = taslink%BndArray(i) * area
406  end if
407  end do
408  !
409  ! -- Return
410  return
Here is the call graph for this function:

◆ tasmgr_da()

subroutine timearrayseriesmanagermodule::tasmgr_da ( class(timearrayseriesmanagertype this)
private

Definition at line 194 of file TimeArraySeriesManager.f90.

195  ! -- dummy
196  class(TimeArraySeriesManagerType) :: this
197  ! -- local
198  integer :: i, n
199  type(TimeArraySeriesLinkType), pointer :: tasLink => null()
200  !
201  ! -- Deallocate contents of each TimeArraySeriesType object in list
202  ! of time-array series links.
203  n = this%boundTasLinks%Count()
204  do i = 1, n
205  taslink => gettimearrayserieslinkfromlist(this%boundTasLinks, i)
206  call taslink%da()
207  end do
208  !
209  ! -- Go through and deallocate individual time array series
210  do i = 1, size(this%taslist)
211  call this%taslist(i)%da()
212  end do
213  !
214  ! -- Deallocate the list of time-array series links.
215  call this%boundTasLinks%Clear(.true.)
216  deallocate (this%boundTasLinks)
217  deallocate (this%tasfiles)
218  !
219  ! -- Deallocate the time array series
220  deallocate (this%taslist)
221  deallocate (this%tasnames)
222  !
223  ! -- nullify pointers
224  this%dis => null()
225  this%boundTasLinks => null()
226  !
227  ! -- Return
228  return
Here is the call graph for this function: