MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
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')
81  !
82  ! -- return
83  return
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 195 of file gwf-api.f90.

196  ! -- dummy variables
197  class(ApiType) :: this
198  ! -- local variables
199  integer(I4B) :: indx
200  !
201  ! -- initialize observations
202  call this%obs%StoreObsType('api', .true., indx)
203  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
204  !
205  ! -- Store obs type and assign procedure pointer
206  ! for to-mvr observation type.
207  call this%obs%StoreObsType('to-mvr', .true., indx)
208  this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
209  !
210  ! -- return
211  return
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 134 of file gwf-api.f90.

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

◆ 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 179 of file gwf-api.f90.

180  ! -- dummy variables
181  class(ApiType) :: this
182  !
183  ! -- set variables
184  api_obs_supported = .true.
185  !
186  ! -- return
187  return

◆ 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 91 of file gwf-api.f90.

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

◆ 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 120 of file gwf-api.f90.

121  ! -- dummy variables
122  class(ApiType), intent(inout) :: this
123  !
124  ! -- return
125  return

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'