MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
apimodule Module Reference

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

Data Types

type  apitype
 

Functions/Subroutines

subroutine, public api_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname)
 @ brief Create a new package object More...
 
subroutine api_options (this, option, found)
 @ brief Read additional options for package More...
 
subroutine api_rp (this)
 @ brief Read and prepare stress period data for package More...
 
subroutine api_fc (this, rhs, ia, idxglo, matrix_sln)
 @ brief Fill A and r for the package More...
 
logical function api_obs_supported (this)
 Determine if observations are supported. More...
 
subroutine api_df_obs (this)
 Define the observation types available in the package. More...
 

Variables

character(len=lenftype) ftype = 'API'
 
character(len=lenpackagename) text = ' API'
 

Detailed Description

This module contains the overridden methods from the base model package class for the API package. The API package is designed to be used with the shared object and have period data specified using the MODFLOW API. Several methods need to be overridden since no period data are specified in the API input file. Overridden methods include:

  • bnd_rp no period data is specified
  • bnd_fc BOUND array is not filled. hcof and rhs are specified dierctly

Function/Subroutine Documentation

◆ api_create()

subroutine, public apimodule::api_create ( class(bndtype), pointer  packobj,
integer(i4b), intent(in)  id,
integer(i4b), intent(in)  ibcnum,
integer(i4b), intent(in)  inunit,
integer(i4b), intent(in)  iout,
character(len=*), intent(in)  namemodel,
character(len=*), intent(in)  pakname 
)

Create a new USR Package object

Parameters
packobjpointer to default package type
[in]idpackage id
[in]ibcnumboundary condition number
[in]inunitunit number of USR package input file
[in]ioutunit number of model listing file
[in]namemodelmodel name
[in]paknamepackage name

Definition at line 48 of file gwf-api.f90.

49  ! -- dummy variables
50  class(BndType), pointer :: packobj !< pointer to default package type
51  integer(I4B), intent(in) :: id !< package id
52  integer(I4B), intent(in) :: ibcnum !< boundary condition number
53  integer(I4B), intent(in) :: inunit !< unit number of USR package input file
54  integer(I4B), intent(in) :: iout !< unit number of model listing file
55  character(len=*), intent(in) :: namemodel !< model name
56  character(len=*), intent(in) :: pakname !< package name
57  ! -- local variables
58  type(ApiType), pointer :: apiobj
59  !
60  ! -- allocate the object and assign values to object variables
61  allocate (apiobj)
62  packobj => apiobj
63  !
64  ! -- create name and memory path
65  call packobj%set_names(ibcnum, namemodel, pakname, ftype)
66  packobj%text = text
67  !
68  ! -- allocate scalars
69  call packobj%allocate_scalars()
70  !
71  ! -- initialize package
72  call packobj%pack_initialize()
73  !
74  packobj%inunit = inunit
75  packobj%iout = iout
76  packobj%id = id
77  packobj%ibcnum = ibcnum
78  packobj%ncolbnd = 2
79  packobj%iscloc = 2
80  packobj%ictMemPath = create_mem_path(namemodel, 'NPF')
Here is the call graph for this function:
Here is the caller graph for this function:

◆ api_df_obs()

subroutine apimodule::api_df_obs ( class(apitype this)
private

Method to define the observation types available in the USR package.

Definition at line 180 of file gwf-api.f90.

181  ! -- dummy variables
182  class(ApiType) :: this
183  ! -- local variables
184  integer(I4B) :: indx
185  !
186  ! -- initialize observations
187  call this%obs%StoreObsType('api', .true., indx)
188  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
189  !
190  ! -- Store obs type and assign procedure pointer
191  ! for to-mvr observation type.
192  call this%obs%StoreObsType('to-mvr', .true., indx)
193  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
Here is the call graph for this function:

◆ api_fc()

subroutine apimodule::api_fc ( class(apitype this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)
private

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

Parameters
[in,out]rhsright-hand side vector
[in]iapointer to the rows in A matrix
[in]idxgloposition of entries in A matrix
matrix_slnA matrix for solution

Definition at line 125 of file gwf-api.f90.

126  ! -- dummy variables
127  class(ApiType) :: this
128  real(DP), dimension(:), intent(inout) :: rhs !< right-hand side vector
129  integer(I4B), dimension(:), intent(in) :: ia !< pointer to the rows in A matrix
130  integer(I4B), dimension(:), intent(in) :: idxglo !< position of entries in A matrix
131  class(MatrixBaseType), pointer :: matrix_sln !< A matrix for solution
132  ! -- local variables
133  integer(I4B) :: i
134  integer(I4B) :: n
135  integer(I4B) :: ipos
136  real(DP) :: qusr
137  !
138  ! -- pakmvrobj fc
139  if (this%imover == 1) then
140  call this%pakmvrobj%fc()
141  end if
142  !
143  ! -- Copy package rhs and hcof into solution rhs and amat
144  do i = 1, this%nbound
145  n = this%nodelist(i)
146  rhs(n) = rhs(n) + this%rhs(i)
147  ipos = ia(n)
148  call matrix_sln%add_value_pos(idxglo(ipos), this%hcof(i))
149  !
150  ! -- If mover is active and this boundary is discharging,
151  ! store available water (as positive value).
152  qusr = this%rhs(i) - this%hcof(i) * this%xnew(n)
153  if (this%imover == 1 .and. qusr > dzero) then
154  call this%pakmvrobj%accumulate_qformvr(i, qusr)
155  end if
156  end do

◆ api_obs_supported()

logical function apimodule::api_obs_supported ( class(apitype this)
private

Function to determine if observations are supported by the USR package. Observations are supported by the USR package.

Definition at line 167 of file gwf-api.f90.

168  ! -- dummy variables
169  class(ApiType) :: this
170  !
171  ! -- set variables
172  api_obs_supported = .true.

◆ api_options()

subroutine apimodule::api_options ( class(apitype), intent(inout)  this,
character(len=*), intent(inout)  option,
logical, intent(inout)  found 
)
private

Read additional options for USR package.

Definition at line 88 of file gwf-api.f90.

89  ! -- dummy variables
90  class(ApiType), intent(inout) :: this
91  character(len=*), intent(inout) :: option
92  logical, intent(inout) :: found
93  !
94  ! -- process package options
95  select case (option)
96  case ('MOVER')
97  this%imover = 1
98  write (this%iout, '(4x,A)') 'MOVER OPTION ENABLED'
99  found = .true.
100  case default
101  !
102  ! -- No options found
103  found = .false.
104  end select

◆ api_rp()

subroutine apimodule::api_rp ( class(apitype), intent(inout)  this)
private

Method reads and prepares stress period data for the USR package. This method overrides the base read and prepare method and does not read any stress period data from the USR package input file.

Definition at line 114 of file gwf-api.f90.

115  ! -- dummy variables
116  class(ApiType), intent(inout) :: this

Variable Documentation

◆ ftype

character(len=lenftype) apimodule::ftype = 'API'
private

Definition at line 28 of file gwf-api.f90.

28  character(len=LENFTYPE) :: ftype = 'API'

◆ text

character(len=lenpackagename) apimodule::text = ' API'
private

Definition at line 29 of file gwf-api.f90.

29  character(len=LENPACKAGENAME) :: text = ' API'