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

This module contains the storage package methods. More...

Data Types

type  swfstotype
 

Functions/Subroutines

subroutine, public sto_cr (stoobj, name_model, inunit, iout, cxs)
 @ brief Create a new package object More...
 
subroutine sto_ar (this, dis, ibound)
 @ brief Allocate and read method for package More...
 
subroutine sto_rp (this)
 @ brief Read and prepare method for package More...
 
subroutine sto_ad (this)
 @ brief Advance the package More...
 
subroutine sto_fc (this, kiter, stage_old, stage_new, matrix_sln, idxglo, rhs)
 @ brief Fill A and right-hand side for the package More...
 
subroutine sto_fc_dis1d (this, kiter, stage_old, stage_new, matrix_sln, idxglo, rhs)
 @ brief Fill A and right-hand side for the package More...
 
subroutine sto_fc_dis2d (this, kiter, stage_old, stage_new, matrix_sln, idxglo, rhs)
 @ brief Fill A and right-hand side for the package More...
 
subroutine sto_cq (this, flowja, stage_new, stage_old)
 @ brief Calculate flows for package More...
 
subroutine calc_storage_dis1d (this, n, stage_new, stage_old, dx, qsto, derv)
 
subroutine calc_storage_dis2d (this, n, stage_new, stage_old, qsto, derv)
 
subroutine sto_bd (this, isuppress_output, model_budget)
 @ brief Model budget calculation for package More...
 
subroutine sto_save_model_flows (this, icbcfl, icbcun)
 @ brief Save model flows for package More...
 
subroutine sto_da (this)
 @ brief Deallocate package memory More...
 
subroutine allocate_scalars (this)
 @ brief Allocate scalars More...
 
subroutine allocate_arrays (this, nodes)
 @ brief Allocate package arrays More...
 
subroutine read_options (this)
 @ brief Read options for package More...
 
subroutine read_data (this)
 @ brief Read data for package More...
 
subroutine set_dfw_pointers (this)
 Set pointers to channel properties in DFW Package. More...
 
real(dp) function, dimension(:), pointer reach_length_pointer (this)
 

Variables

character(len=lenbudtxt), dimension(1) budtxt = [' STORAGE']
 

Detailed Description

This module contains the methods used to add the effects of storage on the surface water flow equation.

Function/Subroutine Documentation

◆ allocate_arrays()

subroutine swfstomodule::allocate_arrays ( class(swfstotype), target  this,
integer(i4b), intent(in)  nodes 
)

Allocate and initialize STO package arrays.

Parameters
thisSwfStoType object
[in]nodesactive model nodes

Definition at line 605 of file swf-sto.f90.

606  ! -- modules
608  ! -- dummy variables
609  class(SwfStoType), target :: this !< SwfStoType object
610  integer(I4B), intent(in) :: nodes !< active model nodes
611  ! -- local variables
612  integer(I4B) :: n
613  !
614  ! -- Allocate arrays
615  call mem_allocate(this%qsto, nodes, 'STRGSS', this%memoryPath)
616  !
617  ! -- Initialize arrays
618  this%iss = 0
619  do n = 1, nodes
620  this%qsto(n) = dzero
621  end do
622  !
623  ! -- return
624  return

◆ allocate_scalars()

subroutine swfstomodule::allocate_scalars ( class(swfstotype this)

Allocate and initialize scalars for the STO package. The base numerical package allocate scalars method is also called.

Parameters
thisSwfStoType object

Definition at line 581 of file swf-sto.f90.

582  ! -- modules
584  ! -- dummy variables
585  class(SwfStoType) :: this !< SwfStoType object
586  !
587  ! -- allocate scalars in NumericalPackageType
588  call this%NumericalPackageType%allocate_scalars()
589  !
590  ! -- allocate scalars
591  !call mem_allocate(this%xxx, 'XXX', this%memoryPath)
592  !
593  ! -- initialize scalars
594  !this%xxx = 0
595  !
596  ! -- return
597  return

◆ calc_storage_dis1d()

subroutine swfstomodule::calc_storage_dis1d ( class(swfstotype this,
integer(i4b), intent(in)  n,
real(dp), intent(in)  stage_new,
real(dp), intent(in)  stage_old,
real(dp), intent(in)  dx,
real(dp), intent(inout)  qsto,
real(dp), intent(inout), optional  derv 
)

Definition at line 410 of file swf-sto.f90.

411  ! module
412  use tdismodule, only: delt
414  ! dummy
415  class(SwfStoType) :: this
416  integer(I4B), intent(in) :: n
417  real(DP), intent(in) :: stage_new
418  real(DP), intent(in) :: stage_old
419  real(DP), intent(in) :: dx
420  real(DP), intent(inout) :: qsto
421  real(DP), intent(inout), optional :: derv
422  ! local
423  real(DP) :: depth_new
424  real(DP) :: depth_old
425  real(DP) :: width_n
426  real(DP) :: width_m
427  real(DP) :: cxs_area_new
428  real(DP) :: cxs_area_old
429  real(DP) :: cxs_area_eps
430  real(DP) :: eps
431 
432  call this%dis%get_flow_width(n, n, 0, width_n, width_m)
433  depth_new = stage_new - this%dis%bot(n)
434  depth_old = stage_old - this%dis%bot(n)
435  cxs_area_new = this%cxs%get_area(this%idcxs(n), width_n, depth_new)
436  cxs_area_old = this%cxs%get_area(this%idcxs(n), width_n, depth_old)
437  qsto = (cxs_area_new - cxs_area_old) * dx / delt
438  if (present(derv)) then
439  eps = get_perturbation(depth_new)
440  cxs_area_eps = this%cxs%get_area(this%idcxs(n), width_n, depth_new + eps)
441  derv = (cxs_area_eps - cxs_area_new) * dx / delt / eps
442  end if
443 
real(dp) function, public get_perturbation(x)
Calculate a numerical perturbation given the value of x.
Definition: MathUtil.f90:446
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:29
Here is the call graph for this function:

◆ calc_storage_dis2d()

subroutine swfstomodule::calc_storage_dis2d ( class(swfstotype this,
integer(i4b), intent(in)  n,
real(dp), intent(in)  stage_new,
real(dp), intent(in)  stage_old,
real(dp), intent(inout)  qsto,
real(dp), intent(inout), optional  derv 
)

Definition at line 446 of file swf-sto.f90.

447  ! module
448  use tdismodule, only: delt
450  ! dummy
451  class(SwfStoType) :: this
452  integer(I4B), intent(in) :: n
453  real(DP), intent(in) :: stage_new
454  real(DP), intent(in) :: stage_old
455  real(DP), intent(inout) :: qsto
456  real(DP), intent(inout), optional :: derv
457  ! local
458  real(DP) :: area
459  real(DP) :: depth_new
460  real(DP) :: depth_old
461  real(DP) :: depth_eps
462  real(DP) :: volume_new
463  real(DP) :: volume_old
464  real(DP) :: eps
465 
466  area = this%dis%get_area(n)
467  depth_new = stage_new - this%dis%bot(n)
468  depth_old = stage_old - this%dis%bot(n)
469  volume_new = area * depth_new
470  volume_old = area * depth_old
471  qsto = (volume_new - volume_old) / delt
472 
473  if (present(derv)) then
474  eps = get_perturbation(depth_new)
475  depth_eps = depth_new + eps
476  derv = (depth_eps - depth_new) * area / delt / eps
477  end if
478 
Here is the call graph for this function:

◆ reach_length_pointer()

real(dp) function, dimension(:), pointer swfstomodule::reach_length_pointer ( class(swfstotype this)
Parameters
thisthis instance

Definition at line 745 of file swf-sto.f90.

746  ! dummy
747  class(SwfStoType) :: this !< this instance
748  ! return
749  real(DP), dimension(:), pointer :: ptr
750  ! local
751  class(DisBaseType), pointer :: dis
752 
753  ptr => null()
754  dis => this%dis
755  select type (dis)
756  type is (disv1dtype)
757  ptr => dis%length
758  end select
759 

◆ read_data()

subroutine swfstomodule::read_data ( class(swfstotype this)

Read griddata block for STO package.

Parameters
thisSwfStoType object

Definition at line 680 of file swf-sto.f90.

681  ! -- modules
682  ! -- dummy variables
683  class(SwfStotype) :: this !< SwfStoType object
684  ! -- local variables
685  character(len=LINELENGTH) :: keyword
686  character(len=:), allocatable :: line
687  integer(I4B) :: lloc, ierr
688  logical :: isfound, endOfBlock
689  character(len=24), dimension(1) :: aname
690  ! -- formats
691  !data
692  data aname(1)/' XXX'/
693  !
694  ! -- initialize
695  isfound = .false.
696  !
697  ! -- get stodata block
698  call this%parser%GetBlock('GRIDDATA', isfound, ierr)
699  if (isfound) then
700  write (this%iout, '(1x,a)') 'PROCESSING GRIDDATA'
701  do
702  call this%parser%GetNextLine(endofblock)
703  if (endofblock) exit
704  call this%parser%GetStringCaps(keyword)
705  call this%parser%GetRemainingLine(line)
706  lloc = 1
707  select case (keyword)
708  case default
709  write (errmsg, '(a,a)') 'Unknown GRIDDATA tag: ', &
710  trim(keyword)
711  call store_error(errmsg)
712  call this%parser%StoreErrorUnit()
713  end select
714  end do
715  write (this%iout, '(1x,a)') 'END PROCESSING GRIDDATA'
716  else
717  write (errmsg, '(a)') 'Required GRIDDATA block not found.'
718  call store_error(errmsg)
719  call this%parser%StoreErrorUnit()
720  end if
721  !
722  if (count_errors() > 0) then
723  call this%parser%StoreErrorUnit()
724  end if
725  !
726  ! -- return
727  return
Here is the call graph for this function:

◆ read_options()

subroutine swfstomodule::read_options ( class(swfstotype this)

Read options block for STO package.

Parameters
thisSwfStoType object

Definition at line 632 of file swf-sto.f90.

633  ! -- modules
634  ! -- dummy variables
635  class(SwfStoType) :: this !< SwfStoType object
636  ! -- local variables
637  character(len=LINELENGTH) :: keyword
638  integer(I4B) :: ierr
639  logical :: isfound, endOfBlock
640  ! -- formats
641  character(len=*), parameter :: fmtisvflow = &
642  "(4x,'CELL-BY-CELL FLOW INFORMATION WILL BE SAVED TO BINARY FILE &
643  &WHENEVER ICBCFL IS NOT ZERO.')"
644  character(len=*), parameter :: fmtflow = &
645  &"(4x, 'FLOWS WILL BE SAVED TO FILE: ', a, /4x, 'OPENED ON UNIT: ', I7)"
646  !
647  ! -- get options block
648  call this%parser%GetBlock('OPTIONS', isfound, ierr, &
649  supportopenclose=.true., blockrequired=.false.)
650  !
651  ! -- parse options block if detected
652  if (isfound) then
653  write (this%iout, '(1x,a)') 'PROCESSING STORAGE OPTIONS'
654  do
655  call this%parser%GetNextLine(endofblock)
656  if (endofblock) exit
657  call this%parser%GetStringCaps(keyword)
658  select case (keyword)
659  case ('SAVE_FLOWS')
660  this%ipakcb = -1
661  write (this%iout, fmtisvflow)
662  case default
663  write (errmsg, '(a,a)') 'Unknown STO option: ', &
664  trim(keyword)
665  call store_error(errmsg, terminate=.true.)
666  end select
667  end do
668  write (this%iout, '(1x,a)') 'END OF STORAGE OPTIONS'
669  end if
670  !
671  ! -- return
672  return
Here is the call graph for this function:

◆ set_dfw_pointers()

subroutine swfstomodule::set_dfw_pointers ( class(swfstotype this)
Parameters
thisthis instance

Definition at line 732 of file swf-sto.f90.

733  ! -- modules
735  ! -- dummy
736  class(SwfStoType) :: this !< this instance
737  ! -- local
738  character(len=LENMEMPATH) :: dfw_mem_path
739 
740  dfw_mem_path = create_mem_path(this%name_model, 'DFW')
741  call mem_setptr(this%idcxs, 'IDCXS', dfw_mem_path)
742 
Here is the call graph for this function:

◆ sto_ad()

subroutine swfstomodule::sto_ad ( class(swfstotype this)

Advance data in the STO package.

Parameters
thisSwfStoType object

Definition at line 230 of file swf-sto.f90.

231  ! -- modules
232  ! -- dummy variables
233  class(SwfStoType) :: this !< SwfStoType object
234  !
235  ! -- return
236  return

◆ sto_ar()

subroutine swfstomodule::sto_ar ( class(swfstotype this,
class(disbasetype), intent(in), pointer  dis,
integer(i4b), dimension(:), pointer, contiguous  ibound 
)

Method to allocate and read static data for the STO package.

Parameters
thisSwfStoType object
[in]dismodel discretization object
iboundmodel ibound array

Definition at line 103 of file swf-sto.f90.

104  ! -- modules
107  ! -- dummy variables
108  class(SwfStoType) :: this !< SwfStoType object
109  class(DisBaseType), pointer, intent(in) :: dis !< model discretization object
110  integer(I4B), dimension(:), pointer, contiguous :: ibound !< model ibound array
111  ! -- local variables
112  ! -- formats
113  character(len=*), parameter :: fmtsto = &
114  "(1x,/1x,'STO -- STORAGE PACKAGE, VERSION 1, 10/27/2023', &
115  &' INPUT READ FROM UNIT ', i0, //)"
116  !
117  ! --print a message identifying the storage package.
118  write (this%iout, fmtsto) this%inunit
119 
120  ! -- set pointers to data in dfw package
121  call this%set_dfw_pointers()
122 
123  !
124  ! -- store pointers to arguments that were passed in
125  this%dis => dis
126  this%ibound => ibound
127  !
128  ! -- set pointer to model iss
129  call mem_setptr(this%iss, 'ISS', create_mem_path(this%name_model))
130  !
131  ! -- Allocate arrays
132  call this%allocate_arrays(dis%nodes)
133  !
134  ! -- Read storage options
135  call this%read_options()
136  !
137  ! -- read the data block
138  ! no griddata at the moment for SWF Storage Package
139  ! call this%read_data()
140  !
141  ! -- return
142  return
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
Here is the call graph for this function:

◆ sto_bd()

subroutine swfstomodule::sto_bd ( class(swfstotype this,
integer(i4b), intent(in)  isuppress_output,
type(budgettype), intent(inout)  model_budget 
)

Budget calculation for the STO package components. Components include specific storage and specific yield storage.

Parameters
thisSwfStoType object
[in]isuppress_outputflag to suppress model output
[in,out]model_budgetmodel budget object

Definition at line 487 of file swf-sto.f90.

488  ! -- modules
489  use tdismodule, only: delt
491  ! -- dummy variables
492  class(SwfStoType) :: this !< SwfStoType object
493  integer(I4B), intent(in) :: isuppress_output !< flag to suppress model output
494  type(BudgetType), intent(inout) :: model_budget !< model budget object
495  ! -- local variables
496  real(DP) :: rin
497  real(DP) :: rout
498  !
499  ! -- Add storage rates to model budget
500  call rate_accumulator(this%qsto, rin, rout)
501  call model_budget%addentry(rin, rout, delt, ' STO', &
502  isuppress_output, ' STORAGE')
503  !
504  ! -- return
505  return
This module contains the BudgetModule.
Definition: Budget.f90:20
subroutine, public rate_accumulator(flow, rin, rout)
@ brief Rate accumulator subroutine
Definition: Budget.f90:664
Derived type for the Budget object.
Definition: Budget.f90:39
Here is the call graph for this function:

◆ sto_cq()

subroutine swfstomodule::sto_cq ( class(swfstotype this,
real(dp), dimension(:), intent(inout)  flowja,
real(dp), dimension(:), intent(inout)  stage_new,
real(dp), dimension(:), intent(inout)  stage_old 
)

Definition at line 367 of file swf-sto.f90.

368  ! -- dummy
369  class(SwfStoType) :: this
370  real(DP), intent(inout), dimension(:) :: flowja
371  real(DP), intent(inout), dimension(:) :: stage_new
372  real(DP), intent(inout), dimension(:) :: stage_old
373  ! -- local
374  real(DP), dimension(:), pointer :: reach_length
375  integer(I4B) :: n
376  integer(I4B) :: idiag
377  real(DP) :: dx
378  real(DP) :: q
379 
380  ! -- test if steady-state stress period
381  if (this%iss /= 0) return
382 
383  ! Set pointer to reach_length for 1d
384  reach_length => this%reach_length_pointer()
385 
386  ! -- Calculate storage term
387  do n = 1, this%dis%nodes
388  !
389  ! -- skip if constant stage
390  if (this%ibound(n) < 0) cycle
391 
392  ! Calculate storage for either the DIS1D or DIS2D cases and
393  ! add to flowja
394  if (associated(reach_length)) then
395  dx = reach_length(n)
396  call this%calc_storage_dis1d(n, stage_new(n), stage_old(n), dx, q)
397  else
398  call this%calc_storage_dis2d(n, stage_new(n), stage_old(n), q)
399  end if
400  this%qsto(n) = -q
401  idiag = this%dis%con%ia(n)
402  flowja(idiag) = flowja(idiag) + this%qsto(n)
403 
404  end do
405  !
406  ! -- Return
407  return

◆ sto_cr()

subroutine, public swfstomodule::sto_cr ( type(swfstotype), pointer  stoobj,
character(len=*), intent(in)  name_model,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
type(swfcxstype), intent(in), pointer  cxs 
)

Create a new storage (STO) object

Parameters
stoobjSwfStoType object
[in]name_modelname of model
[in]inunitpackage input file unit
[in]ioutmodel listing file unit
[in]cxsthe pointer to the cxs package

Definition at line 69 of file swf-sto.f90.

70  ! -- dummy variables
71  type(SwfStoType), pointer :: stoobj !< SwfStoType object
72  character(len=*), intent(in) :: name_model !< name of model
73  integer(I4B), intent(in) :: inunit !< package input file unit
74  integer(I4B), intent(in) :: iout !< model listing file unit
75  type(SwfCxsType), pointer, intent(in) :: cxs !< the pointer to the cxs package
76  !
77  ! -- Create the object
78  allocate (stoobj)
79  !
80  ! -- create name and memory path
81  call stoobj%set_names(1, name_model, 'STO', 'STO')
82  !
83  ! -- Allocate scalars
84  call stoobj%allocate_scalars()
85  !
86  ! -- Set variables
87  stoobj%inunit = inunit
88  stoobj%iout = iout
89 
90  ! -- store pointers
91  stoobj%cxs => cxs
92 
93  ! -- Initialize block parser
94  call stoobj%parser%Initialize(stoobj%inunit, stoobj%iout)
95 
Here is the caller graph for this function:

◆ sto_da()

subroutine swfstomodule::sto_da ( class(swfstotype this)

Deallocate STO package scalars and arrays.

Parameters
thisSwfStoType object

Definition at line 554 of file swf-sto.f90.

555  ! -- modules
557  ! -- dummy variables
558  class(SwfStoType) :: this !< SwfStoType object
559  !
560  ! -- Deallocate arrays if package is active
561  if (this%inunit > 0) then
562  call mem_deallocate(this%qsto)
563  nullify (this%idcxs)
564  end if
565  !
566  ! -- Deallocate scalars
567  !
568  ! -- deallocate parent
569  call this%NumericalPackageType%da()
570  !
571  ! -- return
572  return

◆ sto_fc()

subroutine swfstomodule::sto_fc ( class(swfstotype this,
integer(i4b)  kiter,
real(dp), dimension(:), intent(inout)  stage_old,
real(dp), dimension(:), intent(inout)  stage_new,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(:), intent(in)  idxglo,
real(dp), dimension(:), intent(inout)  rhs 
)

Fill the coefficient matrix and right-hand side with the STO package terms.

Definition at line 244 of file swf-sto.f90.

245  ! -- modules
246  use tdismodule, only: delt
247  ! -- dummy
248  class(SwfStoType) :: this
249  integer(I4B) :: kiter
250  real(DP), intent(inout), dimension(:) :: stage_old
251  real(DP), intent(inout), dimension(:) :: stage_new
252  class(MatrixBaseType), pointer :: matrix_sln
253  integer(I4B), intent(in), dimension(:) :: idxglo
254  real(DP), intent(inout), dimension(:) :: rhs
255  ! -- local
256  character(len=LINELENGTH) :: distype = ''
257  ! -- formats
258  character(len=*), parameter :: fmtsperror = &
259  &"('Detected time step length of zero. SWF Storage Package cannot be ', &
260  &'used unless delt is non-zero.')"
261  !
262  ! -- test if steady-state stress period
263  if (this%iss /= 0) return
264  !
265  ! -- Ensure time step length is not zero
266  if (delt == dzero) then
267  write (errmsg, fmtsperror)
268  call store_error(errmsg, terminate=.true.)
269  end if
270 
271  call this%dis%get_dis_type(distype)
272  if (distype == 'DISV1D') then
273  call this%sto_fc_dis1d(kiter, stage_old, stage_new, matrix_sln, idxglo, rhs)
274  else
275  call this%sto_fc_dis2d(kiter, stage_old, stage_new, matrix_sln, idxglo, rhs)
276  end if
277 
Here is the call graph for this function:

◆ sto_fc_dis1d()

subroutine swfstomodule::sto_fc_dis1d ( class(swfstotype this,
integer(i4b)  kiter,
real(dp), dimension(:), intent(inout)  stage_old,
real(dp), dimension(:), intent(inout)  stage_new,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(:), intent(in)  idxglo,
real(dp), dimension(:), intent(inout)  rhs 
)

Fill the coefficient matrix and right-hand side with the STO package terms.

Definition at line 285 of file swf-sto.f90.

287  ! -- modules
288  ! -- dummy
289  class(SwfStoType) :: this
290  integer(I4B) :: kiter
291  real(DP), intent(inout), dimension(:) :: stage_old
292  real(DP), intent(inout), dimension(:) :: stage_new
293  class(MatrixBaseType), pointer :: matrix_sln
294  integer(I4B), intent(in), dimension(:) :: idxglo
295  real(DP), intent(inout), dimension(:) :: rhs
296  ! -- local
297  integer(I4B) :: n, idiag
298  real(DP) :: derv
299  real(DP) :: qsto
300  real(DP), dimension(:), pointer :: reach_length
301 
302  ! Set pointer to reach_length for 1d
303  reach_length => this%reach_length_pointer()
304 
305  ! -- Calculate coefficients and put into amat
306  do n = 1, this%dis%nodes
307 
308  ! -- skip if constant stage
309  if (this%ibound(n) < 0) cycle
310 
311  call this%calc_storage_dis1d(n, stage_new(n), stage_old(n), &
312  reach_length(n), qsto, derv)
313 
314  ! -- Fill amat and rhs
315  idiag = this%dis%con%ia(n)
316  call matrix_sln%add_value_pos(idxglo(idiag), -derv)
317  rhs(n) = rhs(n) + qsto - derv * stage_new(n)
318 
319  end do
320  !
321  ! -- Return
322  return

◆ sto_fc_dis2d()

subroutine swfstomodule::sto_fc_dis2d ( class(swfstotype this,
integer(i4b)  kiter,
real(dp), dimension(:), intent(inout)  stage_old,
real(dp), dimension(:), intent(inout)  stage_new,
class(matrixbasetype), pointer  matrix_sln,
integer(i4b), dimension(:), intent(in)  idxglo,
real(dp), dimension(:), intent(inout)  rhs 
)

Fill the coefficient matrix and right-hand side with the STO package terms.

Definition at line 330 of file swf-sto.f90.

332  ! -- modules
333  ! -- dummy
334  class(SwfStoType) :: this
335  integer(I4B) :: kiter
336  real(DP), intent(inout), dimension(:) :: stage_old
337  real(DP), intent(inout), dimension(:) :: stage_new
338  class(MatrixBaseType), pointer :: matrix_sln
339  integer(I4B), intent(in), dimension(:) :: idxglo
340  real(DP), intent(inout), dimension(:) :: rhs
341  ! -- local
342  integer(I4B) :: n, idiag
343  real(DP) :: derv
344  real(DP) :: qsto
345 
346  ! -- Calculate coefficients and put into amat
347  do n = 1, this%dis%nodes
348  !
349  ! -- skip if constant stage
350  if (this%ibound(n) < 0) cycle
351 
352  ! Calculate storage and derivative term
353  call this%calc_storage_dis2d(n, stage_new(n), stage_old(n), &
354  qsto, derv)
355 
356  ! -- Fill amat and rhs
357  idiag = this%dis%con%ia(n)
358  call matrix_sln%add_value_pos(idxglo(idiag), -derv)
359  rhs(n) = rhs(n) + qsto - derv * stage_new(n)
360 
361  end do
362 

◆ sto_rp()

subroutine swfstomodule::sto_rp ( class(swfstotype this)

Method to read and prepare stress period data for the STO package.

Parameters
thisSwfStoType object

Definition at line 150 of file swf-sto.f90.

151  ! -- modules
152  use tdismodule, only: kper, nper
153  implicit none
154  ! -- dummy variables
155  class(SwfStoType) :: this !< SwfStoType object
156  ! -- local variables
157  integer(I4B) :: ierr
158  logical :: isfound, endOfBlock
159  character(len=16) :: css(0:1)
160  character(len=LINELENGTH) :: line, keyword
161  ! -- formats
162  character(len=*), parameter :: fmtlsp = &
163  &"(1X,/1X,'REUSING ',A,' FROM LAST STRESS PERIOD')"
164  character(len=*), parameter :: fmtblkerr = &
165  &"('Error. Looking for BEGIN PERIOD iper. Found ', a, ' instead.')"
166  ! -- data
167  data css(0)/' TRANSIENT'/
168  data css(1)/' STEADY-STATE'/
169  !
170  ! -- get stress period data
171  if (this%ionper < kper) then
172  !
173  ! -- get period block
174  call this%parser%GetBlock('PERIOD', isfound, ierr, &
175  supportopenclose=.true., &
176  blockrequired=.false.)
177  if (isfound) then
178  !
179  ! -- read ionper and check for increasing period numbers
180  call this%read_check_ionper()
181  else
182  !
183  ! -- PERIOD block not found
184  if (ierr < 0) then
185  ! -- End of file found; data applies for remainder of simulation.
186  this%ionper = nper + 1
187  else
188  ! -- Found invalid block
189  call this%parser%GetCurrentLine(line)
190  write (errmsg, fmtblkerr) adjustl(trim(line))
191  call store_error(errmsg)
192  call this%parser%StoreErrorUnit()
193  end if
194  end if
195  end if
196 
197  if (this%ionper == kper) then
198  write (this%iout, '(//,1x,a)') 'PROCESSING STORAGE PERIOD DATA'
199  do
200  call this%parser%GetNextLine(endofblock)
201  if (endofblock) exit
202  call this%parser%GetStringCaps(keyword)
203  select case (keyword)
204  case ('STEADY-STATE')
205  this%iss = 1
206  case ('TRANSIENT')
207  this%iss = 0
208  case default
209  write (errmsg, '(a,a)') 'Unknown STORAGE data tag: ', &
210  trim(keyword)
211  call store_error(errmsg)
212  call this%parser%StoreErrorUnit()
213  end select
214  end do
215  write (this%iout, '(1x,a)') 'END PROCESSING STORAGE PERIOD DATA'
216  end if
217 
218  write (this%iout, '(//1X,A,I0,A,A,/)') &
219  'STRESS PERIOD ', kper, ' IS ', trim(adjustl(css(this%iss)))
220  !
221  ! -- return
222  return
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23
integer(i4b), pointer, public nper
number of stress period
Definition: tdis.f90:21
Here is the call graph for this function:

◆ sto_save_model_flows()

subroutine swfstomodule::sto_save_model_flows ( class(swfstotype this,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  icbcun 
)

Save cell-by-cell budget terms for the STO package.

Parameters
thisSwfStoType object
[in]icbcflflag to output budget data
[in]icbcuncell-by-cell file unit number

Definition at line 513 of file swf-sto.f90.

514  ! -- dummy variables
515  class(SwfStoType) :: this !< SwfStoType object
516  integer(I4B), intent(in) :: icbcfl !< flag to output budget data
517  integer(I4B), intent(in) :: icbcun !< cell-by-cell file unit number
518  ! -- local variables
519  integer(I4B) :: ibinun
520  integer(I4B) :: iprint, nvaluesp, nwidthp
521  character(len=1) :: cdatafmp = ' ', editdesc = ' '
522  real(DP) :: dinact
523  !
524  ! -- Set unit number for binary output
525  if (this%ipakcb < 0) then
526  ibinun = icbcun
527  elseif (this%ipakcb == 0) then
528  ibinun = 0
529  else
530  ibinun = this%ipakcb
531  end if
532  if (icbcfl == 0) ibinun = 0
533  !
534  ! -- Record the storage rates if requested
535  if (ibinun /= 0) then
536  iprint = 0
537  dinact = dzero
538  !
539  ! -- qsto
540  call this%dis%record_array(this%qsto, this%iout, iprint, -ibinun, &
541  budtxt(1), cdatafmp, nvaluesp, &
542  nwidthp, editdesc, dinact)
543  end if
544  !
545  ! -- return
546  return

Variable Documentation

◆ budtxt

character(len=lenbudtxt), dimension(1) swfstomodule::budtxt = [' STORAGE']

Definition at line 26 of file swf-sto.f90.

26  character(len=LENBUDTXT), dimension(1) :: budtxt = & !< text labels for budget terms
27  &[' STORAGE']