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

This module contains the extended boundary package. More...

Data Types

type  bndexttype
 @ brief BndExtType More...
 
type  bndextfoundtype
 @ brief BndExtFoundType More...
 

Functions/Subroutines

subroutine bndext_df (this, neq, dis)
 @ brief Define boundary package options and dimensions More...
 
subroutine bndext_rp (this)
 
subroutine bndext_da (this)
 @ brief Deallocate package memory More...
 
subroutine bndext_allocate_scalars (this)
 @ brief Allocate package scalars More...
 
subroutine bndext_allocate_arrays (this, nodelist, auxvar)
 @ brief Allocate package arrays More...
 
subroutine source_options (this)
 @ brief Source package options from input context More...
 
subroutine log_options (this, found, sfacauxname)
 @ brief Log package options More...
 
subroutine source_dimensions (this)
 @ brief Source package dimensions from input context More...
 
subroutine nodelist_update (this)
 @ brief Update package nodelist More...
 
subroutine check_cellid (this, ii, cellid, mshape, ndim)
 @ brief Check for valid cellid More...
 
subroutine write_list (this)
 @ brief Log package list input More...
 
real(dp) function bound_value (this, col, row)
 @ brief Return a bound value More...
 

Detailed Description

This module contains the extended boundary type that itself should be extended by model boundary packages that have been updated to source static and dynamic input data from the input context.

Function/Subroutine Documentation

◆ bndext_allocate_arrays()

subroutine bndextmodule::bndext_allocate_arrays ( class(bndexttype this,
integer(i4b), dimension(:), optional, pointer, contiguous  nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous  auxvar 
)

Allocate and initialize base boundary package arrays. This method only needs to be overridden if additional arrays are defined for a specific package.

Parameters
thisBndExtType object
nodelistpackage nodelist
auxvarpackage aux variable array

Definition at line 227 of file BoundaryPackageExt.f90.

228  ! -- modules
230  ! -- dummy variables
231  class(BndExtType) :: this !< BndExtType object
232  ! -- local variables
233  integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist !< package nodelist
234  real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar !< package aux variable array
235  !
236  ! -- allocate base BndType arrays
237  call this%BndType%allocate_arrays(nodelist, auxvar)
238  !
239  ! -- set input context pointers
240  call mem_setptr(this%cellid, 'CELLID', this%input_mempath)
241  call mem_setptr(this%boundname_cst, 'BOUNDNAME', this%input_mempath)
242  !
243  ! -- checkin input context pointers
244  call mem_checkin(this%cellid, 'CELLID', this%memoryPath, &
245  'CELLID', this%input_mempath)
246  call mem_checkin(this%boundname_cst, lenboundname, 'BOUNDNAME_IDM', &
247  this%memoryPath, 'BOUNDNAME', this%input_mempath)
248  !
249  if (present(auxvar)) then
250  ! no-op
251  else
252  ! -- set auxvar input context pointer
253  call mem_setptr(this%auxvar, 'AUXVAR', this%input_mempath)
254  !
255  ! -- checkin auxvar input context pointer
256  call mem_checkin(this%auxvar, 'AUXVAR_IDM', this%memoryPath, &
257  'AUXVAR', this%input_mempath)
258  end if
259  !
260  ! -- return
261  return

◆ bndext_allocate_scalars()

subroutine bndextmodule::bndext_allocate_scalars ( class(bndexttype this)

Allocate and initialize base boundary package scalars. This method only needs to be overridden if additional scalars are defined for a specific package.

Parameters
thisBndExtType object

Definition at line 196 of file BoundaryPackageExt.f90.

197  ! -- modules
202  ! -- dummy variables
203  class(BndExtType) :: this !< BndExtType object
204  ! -- local variables
205  character(len=LENMEMPATH) :: input_mempath
206  !
207  ! -- set memory path
208  input_mempath = create_mem_path(this%name_model, this%packName, idm_context)
209  !
210  ! -- allocate base BndType scalars
211  call this%BndType%allocate_scalars()
212  !
213  ! -- set pointers to period input data scalars
214  call mem_setptr(this%iper, 'IPER', input_mempath)
215  !
216  ! -- return
217  return
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) idm_context
Here is the call graph for this function:

◆ bndext_da()

subroutine bndextmodule::bndext_da ( class(bndexttype this)
Parameters
thisBndExtType object

Definition at line 164 of file BoundaryPackageExt.f90.

165  ! -- modules
167  ! -- dummy variables
168  class(BndExtType) :: this !< BndExtType object
169  !
170  ! -- deallocate checkin paths
171  call mem_deallocate(this%cellid, 'CELLID', this%memoryPath)
172  call mem_deallocate(this%boundname_cst, 'BOUNDNAME_IDM', this%memoryPath)
173  call mem_deallocate(this%auxvar, 'AUXVAR_IDM', this%memoryPath)
174  !
175  ! -- reassign pointers for base class _da
176  call mem_setptr(this%boundname_cst, 'BOUNDNAME_CST', this%memoryPath)
177  call mem_setptr(this%auxvar, 'AUXVAR', this%memoryPath)
178  !
179  ! -- scalars
180  nullify (this%iper)
181  !
182  ! -- deallocate
183  call this%BndType%bnd_da()
184  !
185  ! -- return
186  return

◆ bndext_df()

subroutine bndextmodule::bndext_df ( class(bndexttype), intent(inout)  this,
integer(i4b), intent(inout)  neq,
class(disbasetype), pointer  dis 
)
private

Define base boundary package options and dimensions for a model boundary package.

Parameters
[in,out]thisBndExtType object
[in,out]neqnumber of equations
disdiscretization object

Definition at line 76 of file BoundaryPackageExt.f90.

77  ! -- modules
78  use basedismodule, only: disbasetype
82  ! -- dummy variables
83  class(BndExtType), intent(inout) :: this !< BndExtType object
84  integer(I4B), intent(inout) :: neq !< number of equations
85  class(DisBaseType), pointer :: dis !< discretization object
86  !
87  ! -- set pointer to dis object for the model
88  this%dis => dis
89  !
90  ! -- Create time series managers
91  ! -- Not in use by this type but BndType uses and deallocates
92  call tsmanager_cr(this%TsManager, this%iout)
93  call tasmanager_cr(this%TasManager, dis, this%name_model, this%iout)
94  !
95  ! -- create obs package
96  call obs_cr(this%obs, this%inobspkg)
97  !
98  ! -- Write information to model list file
99  write (this%iout, 1) this%filtyp, trim(adjustl(this%text)), this%input_mempath
100 1 format(1x, /1x, a, ' -- ', a, ' PACKAGE, VERSION 8, 2/22/2014', &
101  ' INPUT READ FROM MEMPATH: ', a)
102  !
103  ! -- source options
104  call this%source_options()
105  !
106  ! -- Define time series managers
107  call this%tsmanager%tsmanager_df()
108  call this%tasmanager%tasmanager_df()
109  !
110  ! -- source dimensions
111  call this%source_dimensions()
112  !
113  ! -- update package moffset for packages that add rows
114  if (this%npakeq > 0) then
115  this%ioffset = neq - this%dis%nodes
116  end if
117  !
118  ! -- update neq
119  neq = neq + this%npakeq
120  !
121  ! -- Store information needed for observations
122  if (this%bnd_obs_supported()) then
123  call this%obs%obs_df(this%iout, this%packName, this%filtyp, this%dis)
124  call this%bnd_df_obs()
125  end if
126  !
127  ! -- return
128  return
subroutine, public tasmanager_cr(this, dis, modelname, iout)
Create the time-array series manager.
subroutine, public tsmanager_cr(this, iout, removeTsLinksOnCompletion, extendTsToEndOfSimulation)
Create the tsmanager.
Here is the call graph for this function:

◆ bndext_rp()

subroutine bndextmodule::bndext_rp ( class(bndexttype), intent(inout)  this)
Parameters
[in,out]thisBndExtType object

Definition at line 131 of file BoundaryPackageExt.f90.

132  ! -- modules
133  use tdismodule, only: kper
136  ! -- dummy variables
137  class(BndExtType), intent(inout) :: this !< BndExtType object
138  ! -- local variables
139  logical(LGP) :: found
140  integer(I4B) :: n
141  !
142  if (this%iper /= kper) return
143  !
144  ! -- copy nbound from input context
145  call mem_set_value(this%nbound, 'NBOUND', this%input_mempath, &
146  found)
147  !
148  ! -- convert cellids to node numbers
149  call this%nodelist_update()
150  !
151  ! -- update boundname string list
152  if (this%inamedbound /= 0) then
153  do n = 1, size(this%boundname_cst)
154  this%boundname(n) = this%boundname_cst(n)
155  end do
156  end if
157  !
158  ! -- return
159  return
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23

◆ bound_value()

real(dp) function bndextmodule::bound_value ( class(bndexttype), intent(inout)  this,
integer(i4b), intent(in)  col,
integer(i4b), intent(in)  row 
)

Return a bound value associated with an ncolbnd index and row. This function should be overridden in the derived package class.

Parameters
[in,out]thisBndExtType object

Definition at line 761 of file BoundaryPackageExt.f90.

762  ! -- modules
763  use constantsmodule, only: dnodata
764  ! -- dummy variables
765  class(BndExtType), intent(inout) :: this !< BndExtType object
766  integer(I4B), intent(in) :: col
767  integer(I4B), intent(in) :: row
768  ! -- result
769  real(DP) :: bndval
770  !
771  ! -- override this return value by redefining this
772  ! routine in the derived package.
773  bndval = dnodata
774  !
775  ! -- return
776  return
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dnodata
real no data constant
Definition: Constants.f90:94

◆ check_cellid()

subroutine bndextmodule::check_cellid ( class(bndexttype this,
integer(i4b), intent(in)  ii,
integer(i4b), dimension(:), intent(in)  cellid,
integer(i4b), dimension(:), intent(in)  mshape,
integer(i4b), intent(in)  ndim 
)
Parameters
thisBndExtType object
[in]mshapemodel shape
[in]ndimsize of mshape

Definition at line 530 of file BoundaryPackageExt.f90.

531  ! -- modules
532  use simvariablesmodule, only: errmsg
533  ! -- dummy
534  class(BndExtType) :: this !< BndExtType object
535  ! -- local
536  integer(I4B), intent(in) :: ii
537  integer(I4B), dimension(:), intent(in) :: cellid !< cellid
538  integer(I4B), dimension(:), intent(in) :: mshape !< model shape
539  integer(I4B), intent(in) :: ndim !< size of mshape
540  character(len=20) :: cellstr, mshstr
541  character(len=*), parameter :: fmterr = &
542  "('List entry ',i0,' contains cellid ',a,' but this cellid is invalid &
543  &for model with shape ', a)"
544  character(len=*), parameter :: fmtndim1 = &
545  "('(',i0,')')"
546  character(len=*), parameter :: fmtndim2 = &
547  "('(',i0,',',i0,')')"
548  character(len=*), parameter :: fmtndim3 = &
549  "('(',i0,',',i0,',',i0,')')"
550  select case (ndim)
551  case (1)
552  !
553  if (cellid(1) < 1 .or. cellid(1) > mshape(1)) then
554  write (cellstr, fmtndim1) cellid(1)
555  write (mshstr, fmtndim1) mshape(1)
556  write (errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
557  call store_error(errmsg)
558  end if
559  !
560  case (2)
561  !
562  if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
563  cellid(2) < 1 .or. cellid(2) > mshape(2)) then
564  write (cellstr, fmtndim2) cellid(1), cellid(2)
565  write (mshstr, fmtndim2) mshape(1), mshape(2)
566  write (errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
567  call store_error(errmsg)
568  end if
569  !
570  case (3)
571  !
572  if (cellid(1) < 1 .or. cellid(1) > mshape(1) .or. &
573  cellid(2) < 1 .or. cellid(2) > mshape(2) .or. &
574  cellid(3) < 1 .or. cellid(3) > mshape(3)) then
575  write (cellstr, fmtndim3) cellid(1), cellid(2), cellid(3)
576  write (mshstr, fmtndim3) mshape(1), mshape(2), mshape(3)
577  write (errmsg, fmterr) ii, trim(adjustl(cellstr)), trim(adjustl(mshstr))
578  call store_error(errmsg)
579  end if
580  !
581  case default
582  end select
583  !
584  ! -- return
585  return
character(len=maxcharlen) errmsg
error message string
Here is the call graph for this function:

◆ log_options()

subroutine bndextmodule::log_options ( class(bndexttype), intent(inout)  this,
type(bndextfoundtype), intent(in)  found,
character(len=*), intent(in)  sfacauxname 
)
Parameters
[in,out]thisBndExtType object

Definition at line 366 of file BoundaryPackageExt.f90.

367  ! -- modules
368  ! -- dummy variables
369  class(BndExtType), intent(inout) :: this !< BndExtType object
370  type(BndExtFoundType), intent(in) :: found
371  character(len=*), intent(in) :: sfacauxname
372  ! -- local variables
373  ! -- format
374  character(len=*), parameter :: fmtflow = &
375  &"(4x, 'FLOWS WILL BE SAVED TO BUDGET FILE SPECIFIED IN OUTPUT CONTROL')"
376  character(len=*), parameter :: fmttas = &
377  &"(4x, 'TIME-ARRAY SERIES DATA WILL BE READ FROM FILE: ', a)"
378  character(len=*), parameter :: fmtts = &
379  &"(4x, 'TIME-SERIES DATA WILL BE READ FROM FILE: ', a)"
380  character(len=*), parameter :: fmtnme = &
381  &"(a, i0, a)"
382  !
383  ! -- log found options
384  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text)) &
385  //' BASE OPTIONS'
386  !
387  if (found%ipakcb) then
388  write (this%iout, fmtflow)
389  end if
390  !
391  if (found%iprpak) then
392  write (this%iout, '(4x,a)') &
393  'LISTS OF '//trim(adjustl(this%text))//' CELLS WILL BE PRINTED.'
394  end if
395  !
396  if (found%iprflow) then
397  write (this%iout, '(4x,a)') trim(adjustl(this%text))// &
398  ' FLOWS WILL BE PRINTED TO LISTING FILE.'
399  end if
400  !
401  if (found%boundnames) then
402  write (this%iout, '(4x,a)') trim(adjustl(this%text))// &
403  ' BOUNDARIES HAVE NAMES IN LAST COLUMN.'
404  end if
405  !
406  if (found%auxmultname) then
407  write (this%iout, '(4x,a,a)') &
408  'AUXILIARY MULTIPLIER NAME: ', sfacauxname
409  end if
410  !
411  if (found%inewton) then
412  write (this%iout, '(4x,a)') &
413  'NEWTON-RAPHSON method disabled for unconfined cells'
414  end if
415  !
416  ! -- close logging block
417  write (this%iout, '(1x,a)') &
418  'END OF '//trim(adjustl(this%text))//' BASE OPTIONS'
419  !
420  ! -- return
421  return

◆ nodelist_update()

subroutine bndextmodule::nodelist_update ( class(bndexttype this)

Convert period updated cellids to node numbers.

Parameters
thisBndExtType object

Definition at line 467 of file BoundaryPackageExt.f90.

468  ! -- modules
469  use simvariablesmodule, only: errmsg
470  ! -- dummy
471  class(BndExtType) :: this !< BndExtType object
472  ! -- local
473  integer(I4B), dimension(:), pointer :: cellid
474  integer(I4B) :: n, nodeu, noder
475  character(len=LINELENGTH) :: nodestr
476  !
477  ! -- update nodelist
478  do n = 1, this%nbound
479  !
480  ! -- set cellid
481  cellid => this%cellid(:, n)
482  !
483  ! -- ensure cellid is valid, store an error otherwise
484  call this%check_cellid(n, cellid, this%dis%mshape, this%dis%ndim)
485  !
486  ! -- Determine user node number
487  if (this%dis%ndim == 1) then
488  nodeu = cellid(1)
489  elseif (this%dis%ndim == 2) then
490  nodeu = get_node(cellid(1), 1, cellid(2), &
491  this%dis%mshape(1), 1, &
492  this%dis%mshape(2))
493  else
494  nodeu = get_node(cellid(1), cellid(2), cellid(3), &
495  this%dis%mshape(1), &
496  this%dis%mshape(2), &
497  this%dis%mshape(3))
498  end if
499  !
500  ! -- update the nodelist
501  if (this%dis%nodes < this%dis%nodesuser) then
502  ! -- convert user to reduced node numbers
503  noder = this%dis%get_nodenumber(nodeu, 0)
504  if (noder <= 0) then
505  call this%dis%nodeu_to_string(nodeu, nodestr)
506  write (errmsg, *) &
507  ' Cell is outside active grid domain: '// &
508  trim(adjustl(nodestr))
509  call store_error(errmsg)
510  end if
511  this%nodelist(n) = noder
512  else
513  this%nodelist(n) = nodeu
514  end if
515  end do
516  !
517  ! -- exit if errors were found
518  if (count_errors() > 0) then
519  write (errmsg, *) count_errors(), ' errors encountered.'
520  call store_error(errmsg)
521  call store_error_filename(this%input_fname)
522  end if
523  !
524  ! -- return
525  return
Here is the call graph for this function:

◆ source_dimensions()

subroutine bndextmodule::source_dimensions ( class(bndexttype), intent(inout)  this)
private
Parameters
[in,out]thisBndExtType object

Definition at line 426 of file BoundaryPackageExt.f90.

428  ! -- dummy variables
429  class(BndExtType), intent(inout) :: this !< BndExtType object
430  ! -- local variables
431  type(BndExtFoundType) :: found
432  !
433  ! -- open dimensions logging block
434  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text))// &
435  ' BASE DIMENSIONS'
436  !
437  ! -- update defaults with idm sourced values
438  call mem_set_value(this%maxbound, 'MAXBOUND', this%input_mempath, &
439  found%maxbound)
440  !
441  write (this%iout, '(4x,a,i7)') 'MAXBOUND = ', this%maxbound
442  !
443  ! -- close logging block
444  write (this%iout, '(1x,a)') &
445  'END OF '//trim(adjustl(this%text))//' BASE DIMENSIONS'
446  !
447  ! -- verify dimensions were set
448  if (this%maxbound <= 0) then
449  write (errmsg, '(a)') 'MAXBOUND must be an integer greater than zero.'
450  call store_error(errmsg)
451  call store_error_filename(this%input_fname)
452  end if
453  !
454  ! -- Call define_listlabel to construct the list label that is written
455  ! when PRINT_INPUT option is used.
456  call this%define_listlabel()
457  !
458  ! -- return
459  return
Here is the call graph for this function:

◆ source_options()

subroutine bndextmodule::source_options ( class(bndexttype), intent(inout)  this)
Parameters
[in,out]thisBndExtType object

Definition at line 266 of file BoundaryPackageExt.f90.

267  ! -- modules
268  use memorymanagermodule, only: mem_reallocate, mem_setptr !, get_isize
273  ! -- dummy variables
274  class(BndExtType), intent(inout) :: this !< BndExtType object
275  ! -- local variables
276  type(BndExtFoundType) :: found
277  character(len=LENAUXNAME) :: sfacauxname
278  integer(I4B) :: n
279  !
280  ! -- update defaults with idm sourced values
281  call mem_set_value(this%naux, 'NAUX', this%input_mempath, found%naux)
282  call mem_set_value(this%ipakcb, 'IPAKCB', this%input_mempath, found%ipakcb)
283  call mem_set_value(this%iprpak, 'IPRPAK', this%input_mempath, found%iprpak)
284  call mem_set_value(this%iprflow, 'IPRFLOW', this%input_mempath, found%iprflow)
285  call mem_set_value(this%inamedbound, 'BOUNDNAMES', this%input_mempath, &
286  found%boundnames)
287  call mem_set_value(sfacauxname, 'AUXMULTNAME', this%input_mempath, &
288  found%auxmultname)
289  call mem_set_value(this%inewton, 'INEWTON', this%input_mempath, found%inewton)
290  !
291  ! -- log found options
292  call this%log_options(found, sfacauxname)
293  !
294  ! -- reallocate aux arrays if aux variables provided
295  if (found%naux .and. this%naux > 0) then
296  call mem_reallocate(this%auxname, lenauxname, this%naux, &
297  'AUXNAME', this%memoryPath)
298  call mem_reallocate(this%auxname_cst, lenauxname, this%naux, &
299  'AUXNAME_CST', this%memoryPath)
300  call mem_set_value(this%auxname_cst, 'AUXILIARY', this%input_mempath, &
301  found%auxiliary)
302  !
303  do n = 1, this%naux
304  this%auxname(n) = this%auxname_cst(n)
305  end do
306  end if
307  !
308  ! -- save flows option active
309  if (found%ipakcb) this%ipakcb = -1
310  !
311  ! -- auxmultname provided
312  if (found%auxmultname) this%iauxmultcol = -1
313  !
314  !
315  ! -- enforce 0 or 1 OBS6_FILENAME entries in option block
316  if (filein_fname(this%obs%inputFilename, 'OBS6_FILENAME', &
317  this%input_mempath, this%input_fname)) then
318  this%obs%active = .true.
319  this%obs%inUnitObs = getunit()
320  call openfile(this%obs%inUnitObs, this%iout, this%obs%inputFilename, 'OBS')
321  end if
322  !
323  ! -- no newton specified
324  if (found%inewton) this%inewton = 0
325  !
326  ! -- AUXMULTNAME was specified, so find column of auxvar that will be multiplier
327  if (this%iauxmultcol < 0) then
328  !
329  ! -- Error if no aux variable specified
330  if (this%naux == 0) then
331  write (errmsg, '(a,2(1x,a))') &
332  'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
333  'but no AUX variables specified.'
334  call store_error(errmsg)
335  end if
336  !
337  ! -- Assign mult column
338  this%iauxmultcol = 0
339  do n = 1, this%naux
340  if (sfacauxname == this%auxname(n)) then
341  this%iauxmultcol = n
342  exit
343  end if
344  end do
345  !
346  ! -- Error if aux variable cannot be found
347  if (this%iauxmultcol == 0) then
348  write (errmsg, '(a,2(1x,a))') &
349  'AUXMULTNAME was specified as', trim(adjustl(sfacauxname)), &
350  'but no AUX variable found with this name.'
351  call store_error(errmsg)
352  end if
353  end if
354  !
355  ! -- terminate if errors were detected
356  if (count_errors() > 0) then
357  call store_error_filename(this%input_fname)
358  end if
359  !
360  ! -- return
361  return
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Here is the call graph for this function:

◆ write_list()

subroutine bndextmodule::write_list ( class(bndexttype this)

Log period list based input. This routine requires a package specific bound_value() routine to report accurate bound values.

Parameters
thisBndExtType object

Definition at line 594 of file BoundaryPackageExt.f90.

595  ! -- modules
598  use inputoutputmodule, only: ulstlb
599  use tablemodule, only: tabletype, table_cr
600  ! -- dummy
601  class(BndExtType) :: this !< BndExtType object
602  ! -- local
603  character(len=10) :: cpos
604  character(len=LINELENGTH) :: tag
605  character(len=LINELENGTH), allocatable, dimension(:) :: words
606  integer(I4B) :: ntabrows
607  integer(I4B) :: ntabcols
608  integer(I4B) :: ipos
609  integer(I4B) :: ii, jj, i, j, k, nod
610  integer(I4B) :: ldim
611  integer(I4B) :: naux
612  type(TableType), pointer :: inputtab => null()
613  ! -- formats
614  character(len=LINELENGTH) :: fmtlstbn
615 ! ------------------------------------------------------------------------------
616  !
617  ! -- Determine sizes
618  ldim = this%ncolbnd
619  naux = size(this%auxvar, 1)
620  !
621  ! -- dimension table
622  ntabrows = this%nbound
623  !
624  ! -- start building format statement to parse this%label, which
625  ! contains the column headers (except for boundname and auxnames)
626  ipos = index(this%listlabel, 'NO.')
627  if (ipos /= 0) then
628  write (cpos, '(i10)') ipos + 3
629  fmtlstbn = '(a'//trim(adjustl(cpos))
630  else
631  fmtlstbn = '(a7'
632  end if
633  ! -- sequence number, layer, row, and column.
634  if (size(this%dis%mshape) == 3) then
635  ntabcols = 4
636  fmtlstbn = trim(fmtlstbn)//',a7,a7,a7'
637  !
638  ! -- sequence number, layer, and cell2d.
639  else if (size(this%dis%mshape) == 2) then
640  ntabcols = 3
641  fmtlstbn = trim(fmtlstbn)//',a7,a7'
642  !
643  ! -- sequence number and node.
644  else
645  ntabcols = 2
646  fmtlstbn = trim(fmtlstbn)//',a7'
647  end if
648  !
649  ! -- Add fields for non-optional real values
650  ntabcols = ntabcols + ldim
651  do i = 1, ldim
652  fmtlstbn = trim(fmtlstbn)//',a16'
653  end do
654  !
655  ! -- Add field for boundary name
656  if (this%inamedbound == 1) then
657  ntabcols = ntabcols + 1
658  fmtlstbn = trim(fmtlstbn)//',a16'
659  end if
660  !
661  ! -- Add fields for auxiliary variables
662  ntabcols = ntabcols + naux
663  do i = 1, naux
664  fmtlstbn = trim(fmtlstbn)//',a16'
665  end do
666  fmtlstbn = trim(fmtlstbn)//')'
667  !
668  ! -- allocate words
669  allocate (words(ntabcols))
670  !
671  ! -- parse this%listlabel into words
672  read (this%listlabel, fmtlstbn) (words(i), i=1, ntabcols)
673  !
674  ! -- initialize the input table object
675  call table_cr(inputtab, ' ', ' ')
676  call inputtab%table_df(ntabrows, ntabcols, this%iout)
677  !
678  ! -- add the columns
679  ipos = 1
680  call inputtab%initialize_column(words(ipos), 10, alignment=tabcenter)
681  !
682  ! -- discretization
683  do i = 1, size(this%dis%mshape)
684  ipos = ipos + 1
685  call inputtab%initialize_column(words(ipos), 7, alignment=tabcenter)
686  end do
687  !
688  ! -- non-optional variables
689  do i = 1, ldim
690  ipos = ipos + 1
691  call inputtab%initialize_column(words(ipos), 16, alignment=tabcenter)
692  end do
693  !
694  ! -- boundname
695  if (this%inamedbound == 1) then
696  ipos = ipos + 1
697  tag = 'BOUNDNAME'
698  call inputtab%initialize_column(tag, lenboundname, alignment=tableft)
699  end if
700  !
701  ! -- aux variables
702  do i = 1, naux
703  call inputtab%initialize_column(this%auxname(i), 16, alignment=tabcenter)
704  end do
705  !
706  ! -- Write the table
707  do ii = 1, this%nbound
708  call inputtab%add_term(ii)
709  !
710  ! -- discretization
711  if (size(this%dis%mshape) == 3) then
712  nod = this%nodelist(ii)
713  call get_ijk(nod, this%dis%mshape(2), this%dis%mshape(3), &
714  this%dis%mshape(1), i, j, k)
715  call inputtab%add_term(k)
716  call inputtab%add_term(i)
717  call inputtab%add_term(j)
718  else if (size(this%dis%mshape) == 2) then
719  nod = this%nodelist(ii)
720  call get_ijk(nod, 1, this%dis%mshape(2), this%dis%mshape(1), i, j, k)
721  call inputtab%add_term(k)
722  call inputtab%add_term(j)
723  else
724  nod = this%nodelist(ii)
725  call inputtab%add_term(nod)
726  end if
727  !
728  ! -- non-optional variables
729  do jj = 1, ldim
730  call inputtab%add_term(this%bound_value(jj, ii))
731  end do
732  !
733  ! -- boundname
734  if (this%inamedbound == 1) then
735  call inputtab%add_term(this%boundname(ii))
736  end if
737  !
738  ! -- aux variables
739  do jj = 1, naux
740  call inputtab%add_term(this%auxvar(jj, ii))
741  end do
742  end do
743  !
744  ! -- deallocate the local variables
745  call inputtab%table_da()
746  deallocate (inputtab)
747  nullify (inputtab)
748  deallocate (words)
749  !
750  ! -- return
751  return
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
@ tabcenter
centered table column
Definition: Constants.f90:171
@ tableft
left justified table column
Definition: Constants.f90:170
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:35
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:64
subroutine, public ulstlb(iout, label, caux, ncaux, naux)
Print a label for a list.
subroutine, public table_cr(this, name, title)
Definition: Table.f90:85
Here is the call graph for this function: