MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
mawmodule Module Reference

Data Types

type  mawtype
 

Functions/Subroutines

subroutine, public maw_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname)
 Create a New Multi-Aquifer Well (MAW) Package. More...
 
subroutine maw_allocate_scalars (this)
 Allocate scalar members. More...
 
subroutine maw_allocate_well_conn_arrays (this)
 Allocate well arrays. More...
 
subroutine maw_allocate_arrays (this)
 Allocate arrays. More...
 
subroutine maw_read_wells (this)
 Read the packagedata for this package. More...
 
subroutine maw_read_well_connections (this)
 Read the dimensions for this package. More...
 
subroutine maw_read_dimensions (this)
 Read the dimensions for this package. More...
 
subroutine maw_read_initial_attr (this)
 Read the initial parameters for this package. More...
 
subroutine maw_set_stressperiod (this, imaw, iheadlimit_warning)
 Set a stress period attribute for mawweslls(imaw) using keywords. More...
 
subroutine maw_set_attribute_error (this, imaw, keyword, msg)
 Issue a parameter error for mawweslls(imaw) More...
 
subroutine maw_check_attributes (this)
 Issue parameter errors for mawwells(imaw) More...
 
subroutine maw_ac (this, moffset, sparse)
 Add package connection to matrix. More...
 
subroutine maw_mc (this, moffset, matrix_sln)
 Map package connection to matrix. More...
 
subroutine maw_read_options (this, option, found)
 Set options specific to MawType. More...
 
subroutine maw_ar (this)
 Allocate and Read. More...
 
subroutine maw_rp (this)
 Read and Prepare. More...
 
subroutine maw_ad (this)
 Add package connection to matrix. More...
 
subroutine maw_cf (this)
 Formulate the HCOF and RHS terms. More...
 
subroutine maw_fc (this, rhs, ia, idxglo, matrix_sln)
 Copy rhs and hcof into solution rhs and amat. More...
 
subroutine maw_fn (this, rhs, ia, idxglo, matrix_sln)
 Fill newton terms. More...
 
subroutine maw_nur (this, neqpak, x, xtemp, dx, inewtonur, dxmax, locmax)
 Calculate under-relaxation of groundwater flow model MAW Package heads for current outer iteration using the well bottom. More...
 
subroutine maw_cq (this, x, flowja, iadv)
 Calculate flows. More...
 
subroutine maw_ot_model_flows (this, icbcfl, ibudfl, icbcun, imap)
 Write flows to binary file and/or print flows to budget. More...
 
subroutine maw_ot_package_flows (this, icbcfl, ibudfl)
 Output MAW package flow terms. More...
 
subroutine maw_ot_dv (this, idvsave, idvprint)
 Save maw-calculated values to binary file. More...
 
subroutine maw_ot_bdsummary (this, kstp, kper, iout, ibudfl)
 Write MAW budget to listing file. More...
 
subroutine maw_da (this)
 Deallocate memory. More...
 
subroutine define_listlabel (this)
 Define the list heading that is written to iout when PRINT_INPUT option is used. More...
 
subroutine maw_set_pointers (this, neq, ibound, xnew, xold, flowja)
 Set pointers to model arrays and variables so that a package has has access to these things. More...
 
logical function maw_obs_supported (this)
 Return true because MAW package supports observations. More...
 
subroutine maw_df_obs (this)
 Store observation type supported by MAW package. More...
 
subroutine maw_bd_obs (this)
 Calculate observations this time step and call ObsTypeSaveOneSimval for each MawType observation. More...
 
subroutine maw_rp_obs (this)
 Process each observation. More...
 
subroutine maw_process_obsid (obsrv, dis, inunitobs, iout)
 This procedure is pointed to by ObsDataTypeProcesssIdPtr. It processes the ID string of an observation definition for MAW package observations. More...
 
subroutine maw_redflow_csv_init (this, fname)
 Initialize the auto flow reduce csv output file. More...
 
subroutine maw_redflow_csv_write (this)
 MAW reduced flows only when & where they occur. More...
 
subroutine maw_calculate_satcond (this, i, j, node)
 Calculate the appropriate saturated conductance to use based on aquifer and multi-aquifer well characteristics. More...
 
subroutine maw_calculate_saturation (this, n, j, node, sat)
 Calculate the saturation between the aquifer maw well_head. More...
 
subroutine maw_calculate_conn_terms (this, n, j, icflow, cmaw, cterm, term, flow, term2)
 Calculate matrix terms for a multi-aquifer well connection. Terms for fc and fn methods are calculated based on whether term2 is passed Arguments are as follows: n : maw well number j : connection number for well n icflow : flag indicating that flow should be corrected cmaw : maw-gwf conducance cterm : correction term for flow to dry cell term : xxx flow : calculated flow for this connection, positive into well term2 : xxx. More...
 
subroutine maw_calculate_wellq (this, n, hmaw, q)
 Calculate well pumping rate based on constraints. More...
 
subroutine maw_calculate_qpot (this, n, qnet)
 Calculate groundwater inflow to a maw well. More...
 
subroutine maw_cfupdate (this)
 Update MAW satcond and package rhs and hcof. More...
 
subroutine maw_setup_budobj (this)
 Set up the budget object that stores all the maw flows The terms listed here must correspond in number and order to the ones listed in the maw_fill_budobj routine. More...
 
subroutine maw_fill_budobj (this)
 Copy flow terms into thisbudobj. More...
 
subroutine maw_setup_tableobj (this)
 Set up the table object that is used to write the maw head data. More...
 
integer(i4b) function get_jpos (this, n, j)
 Get position of value in connection data. More...
 
integer(i4b) function get_gwfnode (this, n, j)
 Get the gwfnode for connection. More...
 
subroutine maw_activate_density (this)
 Activate density terms. More...
 
subroutine maw_activate_viscosity (this)
 Activate viscosity terms. More...
 
subroutine maw_calculate_density_exchange (this, iconn, hmaw, hgwf, cond, bmaw, flow, hcofterm, rhsterm)
 Calculate the groundwater-maw density exchange terms. More...
 

Variables

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

Function/Subroutine Documentation

◆ define_listlabel()

subroutine mawmodule::define_listlabel ( class(mawtype), intent(inout)  this)

Definition at line 2860 of file gwf-maw.f90.

2861  class(MawType), intent(inout) :: this
2862  !
2863  ! -- create the header list label
2864  this%listlabel = trim(this%filtyp)//' NO.'
2865  if (this%dis%ndim == 3) then
2866  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
2867  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
2868  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
2869  elseif (this%dis%ndim == 2) then
2870  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
2871  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
2872  else
2873  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
2874  end if
2875  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'STRESS RATE'
2876  if (this%inamedbound == 1) then
2877  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
2878  end if

◆ get_gwfnode()

integer(i4b) function mawmodule::get_gwfnode ( class(mawtype this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  j 
)
private

Definition at line 4520 of file gwf-maw.f90.

4521  ! -- return variable
4522  integer(I4B) :: igwfnode
4523  ! -- dummy
4524  class(MawType) :: this
4525  integer(I4B), intent(in) :: n
4526  integer(I4B), intent(in) :: j
4527  ! -- local
4528  integer(I4B) :: jpos
4529  !
4530  ! -- set jpos
4531  jpos = this%get_jpos(n, j)
4532  igwfnode = this%gwfnodes(jpos)

◆ get_jpos()

integer(i4b) function mawmodule::get_jpos ( class(mawtype this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  j 
)

Definition at line 4505 of file gwf-maw.f90.

4506  ! -- return variable
4507  integer(I4B) :: jpos
4508  ! -- dummy
4509  class(MawType) :: this
4510  integer(I4B), intent(in) :: n
4511  integer(I4B), intent(in) :: j
4512  ! -- local
4513  !
4514  ! -- set jpos
4515  jpos = this%iaconn(n) + j - 1

◆ maw_ac()

subroutine mawmodule::maw_ac ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  moffset,
type(sparsematrix), intent(inout)  sparse 
)

Definition at line 1561 of file gwf-maw.f90.

1562  use sparsemodule, only: sparsematrix
1563  ! -- dummy
1564  class(MawType), intent(inout) :: this
1565  integer(I4B), intent(in) :: moffset
1566  type(sparsematrix), intent(inout) :: sparse
1567  ! -- local
1568  integer(I4B) :: j
1569  integer(I4B) :: n
1570  integer(I4B) :: jj
1571  integer(I4B) :: jglo
1572  integer(I4B) :: nglo
1573  ! -- format
1574  !
1575  ! -- Add package rows to sparse
1576  do n = 1, this%nmawwells
1577  nglo = moffset + this%dis%nodes + this%ioffset + n
1578  call sparse%addconnection(nglo, nglo, 1)
1579  do j = 1, this%ngwfnodes(n)
1580  jj = this%get_gwfnode(n, j)
1581  jglo = jj + moffset
1582  call sparse%addconnection(nglo, jglo, 1)
1583  call sparse%addconnection(jglo, nglo, 1)
1584  end do
1585 
1586  end do

◆ maw_activate_density()

subroutine mawmodule::maw_activate_density ( class(mawtype), intent(inout)  this)
private

Definition at line 4537 of file gwf-maw.f90.

4538  ! -- dummy
4539  class(MawType), intent(inout) :: this
4540  ! -- local
4541  integer(I4B) :: i, j
4542  ! -- formats
4543  !
4544  ! -- Set idense and reallocate denseterms to be of size MAXBOUND
4545  this%idense = 1
4546  call mem_reallocate(this%denseterms, 3, this%MAXBOUND, 'DENSETERMS', &
4547  this%memoryPath)
4548  do i = 1, this%maxbound
4549  do j = 1, 3
4550  this%denseterms(j, i) = dzero
4551  end do
4552  end do
4553  write (this%iout, '(/1x,a)') 'DENSITY TERMS HAVE BEEN ACTIVATED FOR MAW &
4554  &PACKAGE: '//trim(adjustl(this%packName))

◆ maw_activate_viscosity()

subroutine mawmodule::maw_activate_viscosity ( class(mawtype), intent(inout)  this)
private

Method to activate addition of viscosity terms for a MAW package reach.

Parameters
[in,out]thisMawType object

Definition at line 4561 of file gwf-maw.f90.

4562  ! -- modules
4564  ! -- dummy variables
4565  class(MawType), intent(inout) :: this !< MawType object
4566  ! -- local variables
4567  integer(I4B) :: i
4568  integer(I4B) :: j
4569  !
4570  ! -- Set ivsc and reallocate viscratios to be of size MAXBOUND
4571  this%ivsc = 1
4572  call mem_reallocate(this%viscratios, 2, this%MAXBOUND, 'VISCRATIOS', &
4573  this%memoryPath)
4574  do i = 1, this%maxbound
4575  do j = 1, 2
4576  this%viscratios(j, i) = done
4577  end do
4578  end do
4579  write (this%iout, '(/1x,a)') 'VISCOSITY HAS BEEN ACTIVATED FOR MAW &
4580  &PACKAGE: '//trim(adjustl(this%packName))

◆ maw_ad()

subroutine mawmodule::maw_ad ( class(mawtype this)

Definition at line 2083 of file gwf-maw.f90.

2084  use tdismodule, only: kper, kstp
2085  ! -- dummy
2086  class(MawType) :: this
2087  ! -- local
2088  integer(I4B) :: n
2089  integer(I4B) :: j
2090  integer(I4B) :: jj
2091  integer(I4B) :: ibnd
2092  !
2093  ! -- Advance the time series
2094  call this%TsManager%ad()
2095  !
2096  ! -- update auxiliary variables by copying from the derived-type time
2097  ! series variable into the bndpackage auxvar variable so that this
2098  ! information is properly written to the GWF budget file
2099  if (this%naux > 0) then
2100  ibnd = 1
2101  do n = 1, this%nmawwells
2102  do j = 1, this%ngwfnodes(n)
2103  do jj = 1, this%naux
2104  if (this%noupdateauxvar(jj) /= 0) cycle
2105  this%auxvar(jj, ibnd) = this%mauxvar(jj, n)
2106  end do
2107  ibnd = ibnd + 1
2108  end do
2109  end do
2110  end if
2111  !
2112  ! -- copy xnew into xold
2113  do n = 1, this%nmawwells
2114  this%xoldpak(n) = this%xnewpak(n)
2115  this%xoldsto(n) = this%xsto(n)
2116  if (this%iboundpak(n) < 0) then
2117  this%xnewpak(n) = this%well_head(n)
2118  end if
2119  end do
2120  !
2121  !--use the appropriate xoldsto if initial heads are above the
2122  ! specified flowing well discharge elevation
2123  if (kper == 1 .and. kstp == 1) then
2124  do n = 1, this%nmawwells
2125  if (this%fwcond(n) > dzero) then
2126  if (this%xoldsto(n) > this%fwelev(n)) then
2127  this%xoldsto(n) = this%fwelev(n)
2128  end if
2129  end if
2130  end do
2131  end if
2132  !
2133  ! -- reset ishutoffcnt (equivalent to kiter) to zero
2134  this%ishutoffcnt = 0
2135  !
2136  ! -- pakmvrobj ad
2137  if (this%imover == 1) then
2138  call this%pakmvrobj%ad()
2139  end if
2140  !
2141  ! -- For each observation, push simulated value and corresponding
2142  ! simulation time from "current" to "preceding" and reset
2143  ! "current" value.
2144  call this%obs%obs_ad()
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:24
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23

◆ maw_allocate_arrays()

subroutine mawmodule::maw_allocate_arrays ( class(mawtype), intent(inout)  this)

Definition at line 520 of file gwf-maw.f90.

521  ! -- modules
523  ! -- dummy
524  class(MawType), intent(inout) :: this
525  ! -- local
526  !
527  ! -- call standard BndType allocate scalars
528  call this%BndType%allocate_arrays()

◆ maw_allocate_scalars()

subroutine mawmodule::maw_allocate_scalars ( class(mawtype), intent(inout)  this)
private

Definition at line 270 of file gwf-maw.f90.

271  ! -- modules
273  ! -- dummy
274  class(MawType), intent(inout) :: this
275  !
276  ! -- call standard BndType allocate scalars
277  call this%BndType%allocate_scalars()
278  !
279  ! -- allocate the object and assign values to object variables
280  call mem_allocate(this%correct_flow, 'CORRECT_FLOW', this%memoryPath)
281  call mem_allocate(this%iprhed, 'IPRHED', this%memoryPath)
282  call mem_allocate(this%iheadout, 'IHEADOUT', this%memoryPath)
283  call mem_allocate(this%ibudgetout, 'IBUDGETOUT', this%memoryPath)
284  call mem_allocate(this%ibudcsv, 'IBUDCSV', this%memoryPath)
285  call mem_allocate(this%iflowingwells, 'IFLOWINGWELLS', this%memoryPath)
286  call mem_allocate(this%imawiss, 'IMAWISS', this%memoryPath)
287  call mem_allocate(this%imawissopt, 'IMAWISSOPT', this%memoryPath)
288  call mem_allocate(this%nmawwells, 'NMAWWELLS', this%memoryPath)
289  call mem_allocate(this%check_attr, 'CHECK_ATTR', this%memoryPath)
290  call mem_allocate(this%ishutoffcnt, 'ISHUTOFFCNT', this%memoryPath)
291  call mem_allocate(this%ieffradopt, 'IEFFRADOPT', this%memoryPath)
292  call mem_allocate(this%ioutredflowcsv, 'IOUTREDFLOWCSV', this%memoryPath) !for writing reduced MAW flows to csv file
293  call mem_allocate(this%satomega, 'SATOMEGA', this%memoryPath)
294  call mem_allocate(this%bditems, 'BDITEMS', this%memoryPath)
295  call mem_allocate(this%theta, 'THETA', this%memoryPath)
296  call mem_allocate(this%kappa, 'KAPPA', this%memoryPath)
297  call mem_allocate(this%cbcauxitems, 'CBCAUXITEMS', this%memoryPath)
298  call mem_allocate(this%idense, 'IDENSE', this%memoryPath)
299  !
300  ! -- Set values
301  this%correct_flow = .false.
302  this%nmawwells = 0
303  this%iprhed = 0
304  this%iheadout = 0
305  this%ibudgetout = 0
306  this%ibudcsv = 0
307  this%iflowingwells = 0
308  this%imawiss = 0
309  this%imawissopt = 0
310  this%ieffradopt = 0
311  this%ioutredflowcsv = 0
312  this%satomega = dzero
313  this%bditems = 8
314  this%theta = dp7
315  this%kappa = dem4
316  this%cbcauxitems = 1
317  this%idense = 0
318  this%ivsc = 0

◆ maw_allocate_well_conn_arrays()

subroutine mawmodule::maw_allocate_well_conn_arrays ( class(mawtype), intent(inout)  this)

Definition at line 323 of file gwf-maw.f90.

324  ! -- modules
326  ! -- dummy
327  class(MawType), intent(inout) :: this
328  ! -- local
329  integer(I4B) :: j
330  integer(I4B) :: n
331  integer(I4B) :: jj
332  !
333  ! -- allocate character array for budget text
334  call mem_allocate(this%cmawbudget, lenbudtxt, this%bditems, 'CMAWBUDGET', &
335  this%memoryPath)
336  !
337  !-- fill cmawbudget
338  this%cmawbudget(1) = ' GWF'
339  this%cmawbudget(2) = ' RATE'
340  this%cmawbudget(3) = ' STORAGE'
341  this%cmawbudget(4) = ' CONSTANT'
342  this%cmawbudget(5) = ' FW-RATE'
343  this%cmawbudget(6) = ' FROM-MVR'
344  this%cmawbudget(7) = ' RATE-TO-MVR'
345  this%cmawbudget(8) = ' FW-RATE-TO-MVR'
346  !
347  ! -- allocate character arrays
348  call mem_allocate(this%cmawname, lenboundname, this%nmawwells, 'CMAWNAME', &
349  this%memoryPath)
350  call mem_allocate(this%status, 8, this%nmawwells, 'STATUS', this%memoryPath)
351  !
352  ! -- allocate well data pointers in memory manager
353  call mem_allocate(this%ngwfnodes, this%nmawwells, 'NGWFNODES', &
354  this%memoryPath)
355  call mem_allocate(this%ieqn, this%nmawwells, 'IEQN', this%memoryPath)
356  call mem_allocate(this%ishutoff, this%nmawwells, 'ISHUTOFF', this%memoryPath)
357  call mem_allocate(this%ifwdischarge, this%nmawwells, 'IFWDISCHARGE', &
358  this%memoryPath)
359  call mem_allocate(this%strt, this%nmawwells, 'STRT', this%memoryPath)
360  call mem_allocate(this%radius, this%nmawwells, 'RADIUS', this%memoryPath)
361  call mem_allocate(this%area, this%nmawwells, 'AREA', this%memoryPath)
362  call mem_allocate(this%pumpelev, this%nmawwells, 'PUMPELEV', this%memoryPath)
363  call mem_allocate(this%bot, this%nmawwells, 'BOT', this%memoryPath)
364  call mem_allocate(this%ratesim, this%nmawwells, 'RATESIM', this%memoryPath)
365  call mem_allocate(this%reduction_length, this%nmawwells, 'REDUCTION_LENGTH', &
366  this%memoryPath)
367  call mem_allocate(this%fwelev, this%nmawwells, 'FWELEV', this%memoryPath)
368  call mem_allocate(this%fwcond, this%nmawwells, 'FWCONDS', this%memoryPath)
369  call mem_allocate(this%fwrlen, this%nmawwells, 'FWRLEN', this%memoryPath)
370  call mem_allocate(this%fwcondsim, this%nmawwells, 'FWCONDSIM', &
371  this%memoryPath)
372  call mem_allocate(this%xsto, this%nmawwells, 'XSTO', this%memoryPath)
373  call mem_allocate(this%xoldsto, this%nmawwells, 'XOLDSTO', this%memoryPath)
374  call mem_allocate(this%shutoffmin, this%nmawwells, 'SHUTOFFMIN', &
375  this%memoryPath)
376  call mem_allocate(this%shutoffmax, this%nmawwells, 'SHUTOFFMAX', &
377  this%memoryPath)
378  call mem_allocate(this%shutofflevel, this%nmawwells, 'SHUTOFFLEVEL', &
379  this%memoryPath)
380  call mem_allocate(this%shutoffweight, this%nmawwells, 'SHUTOFFWEIGHT', &
381  this%memoryPath)
382  call mem_allocate(this%shutoffdq, this%nmawwells, 'SHUTOFFDQ', &
383  this%memoryPath)
384  call mem_allocate(this%shutoffqold, this%nmawwells, 'SHUTOFFQOLD', &
385  this%memoryPath)
386  !
387  ! -- timeseries aware variables
388  call mem_allocate(this%rate, this%nmawwells, 'RATE', this%memoryPath)
389  call mem_allocate(this%well_head, this%nmawwells, 'WELL_HEAD', &
390  this%memoryPath)
391  if (this%naux > 0) then
392  jj = this%naux
393  else
394  jj = 1
395  end if
396  call mem_allocate(this%mauxvar, jj, this%nmawwells, 'MAUXVAR', &
397  this%memoryPath)
398  !
399  ! -- allocate and initialize dbuff
400  if (this%iheadout > 0) then
401  call mem_allocate(this%dbuff, this%nmawwells, 'DBUFF', this%memoryPath)
402  else
403  call mem_allocate(this%dbuff, 0, 'DBUFF', this%memoryPath)
404  end if
405  !
406  ! -- allocate iaconn
407  call mem_allocate(this%iaconn, this%nmawwells + 1, 'IACONN', this%memoryPath)
408  !
409  ! -- allocate imap
410  call mem_allocate(this%imap, this%MAXBOUND, 'IMAP', this%memoryPath)
411  !
412  ! -- allocate connection data
413  call mem_allocate(this%gwfnodes, this%maxbound, 'GWFNODES', this%memoryPath)
414  call mem_allocate(this%sradius, this%maxbound, 'SRADIUS', this%memoryPath)
415  call mem_allocate(this%hk, this%maxbound, 'HK', this%memoryPath)
416  call mem_allocate(this%satcond, this%maxbound, 'SATCOND', this%memoryPath)
417  call mem_allocate(this%simcond, this%maxbound, 'SIMCOND', this%memoryPath)
418  call mem_allocate(this%topscrn, this%maxbound, 'TOPSCRN', this%memoryPath)
419  call mem_allocate(this%botscrn, this%maxbound, 'BOTSCRN', this%memoryPath)
420  !
421  ! -- allocate qleak
422  call mem_allocate(this%qleak, this%maxbound, 'QLEAK', this%memoryPath)
423  !
424  ! -- initialize well data
425  do n = 1, this%nmawwells
426  this%status(n) = 'ACTIVE'
427  this%ngwfnodes(n) = 0
428  this%ieqn(n) = 0
429  this%ishutoff(n) = 0
430  this%ifwdischarge(n) = 0
431  this%strt(n) = dep20
432  this%radius(n) = dep20
433  this%area(n) = dzero
434  this%pumpelev(n) = dep20
435  this%bot(n) = dep20
436  this%ratesim(n) = dzero
437  this%reduction_length(n) = dep20
438  this%fwelev(n) = dzero
439  this%fwcond(n) = dzero
440  this%fwrlen(n) = dzero
441  this%fwcondsim(n) = dzero
442  this%xsto(n) = dzero
443  this%xoldsto(n) = dzero
444  this%shutoffmin(n) = dzero
445  this%shutoffmax(n) = dzero
446  this%shutofflevel(n) = dep20
447  this%shutoffweight(n) = done
448  this%shutoffdq(n) = done
449  this%shutoffqold(n) = done
450  !
451  ! -- timeseries aware variables
452  this%rate(n) = dzero
453  this%well_head(n) = dzero
454  do jj = 1, max(1, this%naux)
455  this%mauxvar(jj, n) = dzero
456  end do
457  !
458  ! -- dbuff
459  if (this%iheadout > 0) then
460  this%dbuff(n) = dzero
461  end if
462  end do
463  !
464  ! -- initialize iaconn
465  do n = 1, this%nmawwells + 1
466  this%iaconn(n) = 0
467  end do
468  !
469  ! -- allocate character array for budget text
470  call mem_allocate(this%cauxcbc, lenauxname, this%cbcauxitems, 'CAUXCBC', &
471  this%memoryPath)
472  !
473  ! -- allocate and initialize qauxcbc
474  call mem_allocate(this%qauxcbc, this%cbcauxitems, 'QAUXCBC', this%memoryPath)
475  do j = 1, this%cbcauxitems
476  this%qauxcbc(j) = dzero
477  end do
478  !
479  ! -- allocate flowing well data
480  if (this%iflowingwells /= 0) then
481  call mem_allocate(this%qfw, this%nmawwells, 'QFW', this%memoryPath)
482  else
483  call mem_allocate(this%qfw, 1, 'QFW', this%memoryPath)
484  end if
485  call mem_allocate(this%qout, this%nmawwells, 'QOUT', this%memoryPath)
486  call mem_allocate(this%qsto, this%nmawwells, 'QSTO', this%memoryPath)
487  call mem_allocate(this%qconst, this%nmawwells, 'QCONST', this%memoryPath)
488  !
489  ! -- initialize flowing well, storage, and constant flow terms
490  do n = 1, this%nmawwells
491  if (this%iflowingwells > 0) then
492  this%qfw(n) = dzero
493  end if
494  this%qsto(n) = dzero
495  this%qconst(n) = dzero
496  end do
497  !
498  ! -- initialize connection data
499  do j = 1, this%maxbound
500  this%imap(j) = 0
501  this%gwfnodes(j) = 0
502  this%sradius(j) = dzero
503  this%hk(j) = dzero
504  this%satcond(j) = dzero
505  this%simcond(j) = dzero
506  this%topscrn(j) = dzero
507  this%botscrn(j) = dzero
508  this%qleak(j) = dzero
509  end do
510  !
511  ! -- allocate denseterms to size 0
512  call mem_allocate(this%denseterms, 3, 0, 'DENSETERMS', this%memoryPath)
513  !
514  ! -- allocate viscratios to size 0
515  call mem_allocate(this%viscratios, 2, 0, 'VISCRATIOS', this%memoryPath)

◆ maw_ar()

subroutine mawmodule::maw_ar ( class(mawtype), intent(inout)  this)

Create new MAW package and point bndobj to the new package

Definition at line 1769 of file gwf-maw.f90.

1770  ! -- dummy
1771  class(MawType), intent(inout) :: this
1772  ! -- local
1773  ! -- format
1774  !
1775  call this%obs%obs_ar()
1776  !
1777  ! -- set omega value used for saturation calculations
1778  if (this%inewton > 0) then
1779  this%satomega = dem6
1780  end if
1781  !
1782  ! -- Allocate connection arrays in MAW and in package superclass
1783  call this%maw_allocate_arrays()
1784  !
1785  ! -- read optional initial package parameters
1786  call this%read_initial_attr()
1787  !
1788  ! -- setup pakmvrobj
1789  if (this%imover /= 0) then
1790  allocate (this%pakmvrobj)
1791  call this%pakmvrobj%ar(this%nmawwells, this%nmawwells, this%memoryPath)
1792  end if

◆ maw_bd_obs()

subroutine mawmodule::maw_bd_obs ( class(mawtype this)
private

Definition at line 2999 of file gwf-maw.f90.

3000  ! -- dummy
3001  class(MawType) :: this
3002  ! -- local
3003  integer(I4B) :: i
3004  integer(I4B) :: j
3005  integer(I4B) :: jj
3006  integer(I4B) :: n
3007  integer(I4B) :: nn
3008  integer(I4B) :: jpos
3009  real(DP) :: cmaw
3010  real(DP) :: hmaw
3011  real(DP) :: v
3012  real(DP) :: qfact
3013  type(ObserveType), pointer :: obsrv => null()
3014  !
3015  ! Calculate, save, and write simulated values for all MAW observations
3016  if (this%obs%npakobs > 0) then
3017  call this%obs%obs_bd_clear()
3018  do i = 1, this%obs%npakobs
3019  obsrv => this%obs%pakobs(i)%obsrv
3020  do j = 1, obsrv%indxbnds_count
3021  v = dnodata
3022  jj = obsrv%indxbnds(j)
3023  select case (obsrv%ObsTypeId)
3024  case ('HEAD')
3025  if (this%iboundpak(jj) /= 0) then
3026  v = this%xnewpak(jj)
3027  end if
3028  case ('FROM-MVR')
3029  if (this%iboundpak(jj) /= 0) then
3030  if (this%imover == 1) then
3031  v = this%pakmvrobj%get_qfrommvr(jj)
3032  end if
3033  end if
3034  case ('MAW')
3035  n = this%imap(jj)
3036  if (this%iboundpak(n) /= 0) then
3037  v = this%qleak(jj)
3038  end if
3039  case ('RATE')
3040  if (this%iboundpak(jj) /= 0) then
3041  v = this%ratesim(jj)
3042  if (v < dzero .and. this%qout(jj) < dzero) then
3043  qfact = v / this%qout(jj)
3044  if (this%imover == 1) then
3045  v = v + this%pakmvrobj%get_qtomvr(jj) * qfact
3046  end if
3047  end if
3048  end if
3049  case ('RATE-TO-MVR')
3050  if (this%iboundpak(jj) /= 0) then
3051  if (this%imover == 1) then
3052  v = this%ratesim(jj)
3053  qfact = dzero
3054  if (v < dzero .and. this%qout(jj) < dzero) then
3055  qfact = v / this%qout(jj)
3056  end if
3057  v = this%pakmvrobj%get_qtomvr(jj) * qfact
3058  if (v > dzero) then
3059  v = -v
3060  end if
3061  end if
3062  end if
3063  case ('FW-RATE')
3064  if (this%iboundpak(jj) /= 0 .and. this%iflowingwells > 0) then
3065  hmaw = this%xnewpak(jj)
3066  cmaw = this%fwcondsim(jj)
3067  v = cmaw * (this%fwelev(jj) - hmaw)
3068  if (v < dzero .and. this%qout(jj) < dzero) then
3069  qfact = v / this%qout(jj)
3070  if (this%imover == 1) then
3071  v = v + this%pakmvrobj%get_qtomvr(jj) * qfact
3072  end if
3073  end if
3074  end if
3075  case ('FW-TO-MVR')
3076  if (this%iboundpak(jj) /= 0 .and. this%iflowingwells > 0) then
3077  if (this%imover == 1) then
3078  hmaw = this%xnewpak(jj)
3079  cmaw = this%fwcondsim(jj)
3080  v = cmaw * (this%fwelev(jj) - hmaw)
3081  qfact = dzero
3082  if (v < dzero .and. this%qout(jj) < dzero) then
3083  qfact = v / this%qout(jj)
3084  end if
3085  v = this%pakmvrobj%get_qtomvr(jj) * qfact
3086  if (v > dzero) then
3087  v = -v
3088  end if
3089  end if
3090  end if
3091  case ('STORAGE')
3092  if (this%iboundpak(jj) /= 0 .and. this%imawissopt /= 1) then
3093  v = this%qsto(jj)
3094  end if
3095  case ('CONSTANT')
3096  if (this%iboundpak(jj) /= 0) then
3097  v = this%qconst(jj)
3098  end if
3099  case ('CONDUCTANCE')
3100  n = this%imap(jj)
3101  if (this%iboundpak(n) /= 0) then
3102  nn = jj - this%iaconn(n) + 1
3103  jpos = this%get_jpos(n, nn)
3104  v = this%simcond(jpos)
3105  end if
3106  case ('FW-CONDUCTANCE')
3107  if (this%iboundpak(jj) /= 0) then
3108  v = this%fwcondsim(jj)
3109  end if
3110  case default
3111  errmsg = 'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
3112  call store_error(errmsg)
3113  end select
3114  call this%obs%SaveOneSimval(obsrv, v)
3115  end do
3116  end do
3117  !
3118  ! -- write summary of error messages
3119  if (count_errors() > 0) then
3120  call store_error_unit(this%inunit)
3121  end if
3122  end if
3123  !
3124  ! -- Write the MAW reduced flows to csv file entries for this step
3125  if (this%ioutredflowcsv > 0) then
3126  call this%maw_redflow_csv_write()
3127  end if
Here is the call graph for this function:

◆ maw_calculate_conn_terms()

subroutine mawmodule::maw_calculate_conn_terms ( class(mawtype this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  j,
integer(i4b), intent(inout)  icflow,
real(dp), intent(inout)  cmaw,
real(dp), intent(inout)  cterm,
real(dp), intent(inout)  term,
real(dp), intent(inout)  flow,
real(dp), intent(inout), optional  term2 
)
private

Definition at line 3596 of file gwf-maw.f90.

3598  ! -- dummy
3599  class(MawType) :: this
3600  integer(I4B), intent(in) :: n
3601  integer(I4B), intent(in) :: j
3602  integer(I4B), intent(inout) :: icflow
3603  real(DP), intent(inout) :: cmaw
3604  real(DP), intent(inout) :: cterm
3605  real(DP), intent(inout) :: term
3606  real(DP), intent(inout) :: flow
3607  real(DP), intent(inout), optional :: term2
3608  ! -- local
3609  logical(LGP) :: correct_flow
3610  integer(I4B) :: inewton
3611  integer(I4B) :: jpos
3612  integer(I4B) :: igwfnode
3613  real(DP) :: hmaw
3614  real(DP) :: hgwf
3615  real(DP) :: hups
3616  real(DP) :: hdowns
3617  real(DP) :: sat
3618  real(DP) :: tmaw
3619  real(DP) :: bmaw
3620  real(DP) :: en
3621  real(DP) :: hbar
3622  real(DP) :: drterm
3623  real(DP) :: dhbarterm
3624  real(DP) :: vscratio
3625  !
3626  ! -- initialize terms
3627  cterm = dzero
3628  vscratio = done
3629  icflow = 0
3630  if (present(term2)) then
3631  inewton = 1
3632  else
3633  inewton = 0
3634  end if
3635  !
3636  ! -- set common terms
3637  jpos = this%get_jpos(n, j)
3638  igwfnode = this%get_gwfnode(n, j)
3639  hgwf = this%xnew(igwfnode)
3640  hmaw = this%xnewpak(n)
3641  tmaw = this%topscrn(jpos)
3642  bmaw = this%botscrn(jpos)
3643  !
3644  ! -- if vsc active, select appropriate viscosity ratio
3645  if (this%ivsc == 1) then
3646  ! flow out of well (flow is negative)
3647  if (flow < 0) then
3648  vscratio = this%viscratios(1, igwfnode)
3649  else
3650  vscratio = this%viscratios(2, igwfnode)
3651  end if
3652  end if
3653  !
3654  ! -- calculate saturation
3655  call this%maw_calculate_saturation(n, j, igwfnode, sat)
3656  cmaw = this%satcond(jpos) * vscratio * sat
3657  !
3658  ! -- set upstream head, term, and term2 if returning newton terms
3659  if (inewton == 1) then
3660  term = dzero
3661  term2 = dzero
3662  hups = hmaw
3663  if (hgwf > hups) then
3664  hups = hgwf
3665  end if
3666  !
3667  ! -- calculate the derivative of saturation
3668  drterm = squadraticsaturationderivative(tmaw, bmaw, hups, this%satomega)
3669  else
3670  term = cmaw
3671  end if
3672  !
3673  ! -- calculate correction term if flow_correction option specified
3674  if (this%correct_flow) then
3675  !
3676  ! -- set bmaw, determine en, and set correct_flow flag
3677  en = max(bmaw, this%dis%bot(igwfnode))
3678  correct_flow = .false.
3679  if (hmaw < en) then
3680  correct_flow = .true.
3681  end if
3682  if (hgwf < en .and. this%icelltype(igwfnode) /= 0) then
3683  correct_flow = .true.
3684  end if
3685  !
3686  ! -- if flow should be corrected because hgwf or hmaw is below bottom
3687  ! then calculate correction term (cterm)
3688  if (correct_flow) then
3689  icflow = 1
3690  hdowns = min(hmaw, hgwf)
3691  hbar = squadratic0sp(hdowns, en, this%satomega)
3692  if (hgwf > hmaw) then
3693  cterm = cmaw * (hmaw - hbar)
3694  else
3695  cterm = cmaw * (hbar - hgwf)
3696  end if
3697  end if
3698  !
3699  ! -- if newton formulation then calculate newton terms
3700  if (inewton /= 0) then
3701  !
3702  ! -- maw is upstream
3703  if (hmaw > hgwf) then
3704  hbar = squadratic0sp(hgwf, en, this%satomega)
3705  term = drterm * this%satcond(jpos) * vscratio * (hbar - hmaw)
3706  dhbarterm = squadratic0spderivative(hgwf, en, this%satomega)
3707  term2 = cmaw * (dhbarterm - done)
3708  !
3709  ! -- gwf is upstream
3710  else
3711  hbar = squadratic0sp(hmaw, en, this%satomega)
3712  term = -drterm * this%satcond(jpos) * vscratio * (hgwf - hbar)
3713  dhbarterm = squadratic0spderivative(hmaw, en, this%satomega)
3714  term2 = cmaw * (done - dhbarterm)
3715  end if
3716  end if
3717  else
3718  !
3719  ! -- flow is not corrected, so calculate term for newton formulation
3720  if (inewton /= 0) then
3721  term = drterm * this%satcond(jpos) * vscratio * (hgwf - hmaw)
3722  end if
3723  end if
3724  !
3725  ! -- calculate flow relative to maw for fc and bd
3726  flow = dzero
3727  if (inewton == 0) then
3728  flow = term * (hgwf - hmaw) + cterm
3729  end if
3730  !
3731  ! -- add density part here
3732  if (this%idense /= 0 .and. inewton == 0) then
3733  call this%maw_calculate_density_exchange(jpos, hmaw, hgwf, cmaw, &
3734  bmaw, flow, term, cterm)
3735  end if
Here is the call graph for this function:

◆ maw_calculate_density_exchange()

subroutine mawmodule::maw_calculate_density_exchange ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  iconn,
real(dp), intent(in)  hmaw,
real(dp), intent(in)  hgwf,
real(dp), intent(in)  cond,
real(dp), intent(in)  bmaw,
real(dp), intent(inout)  flow,
real(dp), intent(inout)  hcofterm,
real(dp), intent(inout)  rhsterm 
)

Arguments are as follows: iconn : maw-gwf connection number hmaw : maw head hgwf : gwf head cond : conductance bmaw : bottom elevation of this connection flow : calculated flow, updated here with density terms, + into maw hcofterm : head coefficient term rhsterm : right-hand-side value, updated here with density terms

Member variable used here denseterms : shape (3, MAXBOUND), filled by buoyancy package col 1 is relative density of maw (densemaw / denseref) col 2 is relative density of gwf cell (densegwf / denseref) col 3 is elevation of gwf cell

Upon return, amat and rhs for maw row should be updated as: amat(idiag) = amat(idiag) - hcofterm rhs(n) = rhs(n) + rhsterm

Definition at line 4605 of file gwf-maw.f90.

4607  ! -- dummy
4608  class(MawType), intent(inout) :: this
4609  integer(I4B), intent(in) :: iconn
4610  real(DP), intent(in) :: hmaw
4611  real(DP), intent(in) :: hgwf
4612  real(DP), intent(in) :: cond
4613  real(DP), intent(in) :: bmaw
4614  real(DP), intent(inout) :: flow
4615  real(DP), intent(inout) :: hcofterm
4616  real(DP), intent(inout) :: rhsterm
4617  ! -- local
4618  real(DP) :: t
4619  real(DP) :: havg
4620  real(DP) :: rdensemaw
4621  real(DP) :: rdensegwf
4622  real(DP) :: rdenseavg
4623  real(DP) :: elevavg
4624  ! -- formats
4625  !
4626  ! -- assign relative density terms, return if zero which means not avail yet
4627  rdensemaw = this%denseterms(1, iconn)
4628  rdensegwf = this%denseterms(2, iconn)
4629  if (rdensegwf == dzero) return
4630  !
4631  ! -- update rhsterm with density contribution
4632  if (hmaw > bmaw .and. hgwf > bmaw) then
4633  !
4634  ! -- hmaw and hgwf both above bmaw
4635  rdenseavg = dhalf * (rdensemaw + rdensegwf)
4636  !
4637  ! -- update rhsterm with first density term
4638  t = cond * (rdenseavg - done) * (hgwf - hmaw)
4639  rhsterm = rhsterm + t
4640  flow = flow + t
4641  !
4642  ! -- update rhterm with second density term
4643  havg = dhalf * (hgwf + hmaw)
4644  elevavg = this%denseterms(3, iconn)
4645  t = cond * (havg - elevavg) * (rdensegwf - rdensemaw)
4646  rhsterm = rhsterm + t
4647  flow = flow + t
4648  else if (hmaw > bmaw) then
4649  !
4650  ! -- if only hmaw is above bmaw, then increase correction term by density
4651  t = (rdensemaw - done) * rhsterm
4652  rhsterm = rhsterm + t
4653  !
4654  else if (hgwf > bmaw) then
4655  !
4656  ! -- if only hgwf is above bmaw, then increase correction term by density
4657  t = (rdensegwf - done) * rhsterm
4658  rhsterm = rhsterm + t
4659  !
4660  else
4661  !
4662  ! -- Flow should be zero so do nothing
4663  end if

◆ maw_calculate_qpot()

subroutine mawmodule::maw_calculate_qpot ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  n,
real(dp), intent(inout)  qnet 
)
private

Definition at line 3905 of file gwf-maw.f90.

3906  use tdismodule, only: delt
3907  ! -- dummy
3908  class(MawType), intent(inout) :: this
3909  integer(I4B), intent(in) :: n
3910  real(DP), intent(inout) :: qnet
3911  ! -- local
3912  integer(I4B) :: j
3913  integer(I4B) :: jpos
3914  integer(I4B) :: igwfnode
3915  real(DP) :: bt
3916  real(DP) :: tp
3917  real(DP) :: scale
3918  real(DP) :: cfw
3919  real(DP) :: hdterm
3920  real(DP) :: sat
3921  real(DP) :: cmaw
3922  real(DP) :: hgwf
3923  real(DP) :: bmaw
3924  real(DP) :: h_temp
3925  real(DP) :: hv
3926  real(DP) :: vscratio
3927  ! -- format
3928  !
3929  ! -- initialize qnet and h_temp
3930  qnet = dzero
3931  vscratio = done
3932  h_temp = this%shutofflevel(n)
3933  !
3934  ! -- if vsc active, select appropriate viscosity ratio
3935  if (this%ivsc == 1) then
3936  ! flow out of well (flow is negative)
3937  if (qnet < 0) then
3938  vscratio = this%viscratios(1, igwfnode)
3939  else
3940  vscratio = this%viscratios(2, igwfnode)
3941  end if
3942  end if
3943  !
3944  ! -- calculate discharge to flowing wells
3945  if (this%iflowingwells > 0) then
3946  if (this%fwcond(n) > dzero) then
3947  bt = this%fwelev(n)
3948  tp = bt + this%fwrlen(n)
3949  scale = sqsaturation(tp, bt, h_temp)
3950  cfw = scale * this%fwcond(n) * this%viscratios(2, n)
3951  this%ifwdischarge(n) = 0
3952  if (cfw > dzero) then
3953  this%ifwdischarge(n) = 1
3954  this%xsto(n) = bt
3955  end if
3956  qnet = qnet + cfw * (bt - h_temp)
3957  end if
3958  end if
3959  !
3960  ! -- calculate maw storage changes
3961  if (this%imawiss /= 1) then
3962  if (this%ifwdischarge(n) /= 1) then
3963  hdterm = this%xoldsto(n) - h_temp
3964  else
3965  hdterm = this%xoldsto(n) - this%fwelev(n)
3966  end if
3967  qnet = qnet - (this%area(n) * hdterm / delt)
3968  end if
3969  !
3970  ! -- calculate inflow from aquifer
3971  do j = 1, this%ngwfnodes(n)
3972  jpos = this%get_jpos(n, j)
3973  igwfnode = this%get_gwfnode(n, j)
3974  call this%maw_calculate_saturation(n, j, igwfnode, sat)
3975  cmaw = this%satcond(jpos) * vscratio * sat
3976  hgwf = this%xnew(igwfnode)
3977  bmaw = this%botscrn(jpos)
3978  hv = h_temp
3979  if (hv < bmaw) then
3980  hv = bmaw
3981  end if
3982  if (hgwf < bmaw) then
3983  hgwf = bmaw
3984  end if
3985  qnet = qnet + cmaw * (hgwf - hv)
3986  end do
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:29
Here is the call graph for this function:

◆ maw_calculate_satcond()

subroutine mawmodule::maw_calculate_satcond ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  i,
integer(i4b), intent(in)  j,
integer(i4b), intent(in)  node 
)

Definition at line 3363 of file gwf-maw.f90.

3364  ! -- dummy
3365  class(MawType), intent(inout) :: this
3366  integer(I4B), intent(in) :: i
3367  integer(I4B), intent(in) :: j
3368  integer(I4B), intent(in) :: node
3369  ! -- local
3370  integer(I4B) :: iTcontrastErr
3371  integer(I4B) :: jpos
3372  real(DP) :: c
3373  real(DP) :: k11
3374  real(DP) :: k22
3375  real(DP) :: sqrtk11k22
3376  real(DP) :: hks
3377  real(DP) :: area
3378  real(DP) :: eradius
3379  real(DP) :: topw
3380  real(DP) :: botw
3381  real(DP) :: tthkw
3382  real(DP) :: tthka
3383  real(DP) :: Tcontrast
3384  real(DP) :: skin
3385  real(DP) :: ravg
3386  real(DP) :: slen
3387  real(DP) :: pavg
3388  real(DP) :: gwfsat
3389  real(DP) :: gwftop
3390  real(DP) :: gwfbot
3391  real(DP) :: lc1
3392  real(DP) :: lc2
3393  real(DP) :: dx
3394  real(DP) :: dy
3395  real(DP) :: Txx
3396  real(DP) :: Tyy
3397  real(DP) :: T2pi
3398  real(DP) :: yx4
3399  real(DP) :: xy4
3400  ! -- formats
3401  !
3402  ! -- initialize conductance variables
3403  itcontrasterr = 0
3404  lc1 = dzero
3405  lc2 = dzero
3406  !
3407  ! -- calculate connection position
3408  jpos = this%get_jpos(i, j)
3409  !
3410  ! -- set K11 and K22
3411  k11 = this%gwfk11(node)
3412  if (this%gwfik22 == 0) then
3413  k22 = this%gwfk11(node)
3414  else
3415  k22 = this%gwfk22(node)
3416  end if
3417  sqrtk11k22 = sqrt(k11 * k22)
3418  !
3419  ! -- set gwftop, gwfbot, and gwfsat
3420  gwftop = this%dis%top(node)
3421  gwfbot = this%dis%bot(node)
3422  tthka = gwftop - gwfbot
3423  gwfsat = this%gwfsat(node)
3424  !
3425  ! -- set top and bottom of well screen
3426  c = dzero
3427  topw = this%topscrn(jpos)
3428  botw = this%botscrn(jpos)
3429  tthkw = topw - botw
3430  !
3431  ! -- scale screen thickness using gwfsat (for NPF Package THICKSTRT)
3432  if (gwftop == topw .and. gwfbot == botw) then
3433  if (this%icelltype(node) == 0) then
3434  tthkw = tthkw * gwfsat
3435  tthka = tthka * gwfsat
3436  end if
3437  end if
3438  !
3439  ! -- calculate the aquifer transmissivity (T2pi)
3440  t2pi = dtwopi * tthka * sqrtk11k22
3441  !
3442  ! -- calculate effective radius
3443  if (this%dis%ndim == 3 .and. this%ieffradopt /= 0) then
3444  txx = k11 * tthka
3445  tyy = k22 * tthka
3446  dx = sqrt(this%dis%area(node))
3447  dy = dx
3448  yx4 = (tyy / txx)**dquarter
3449  xy4 = (txx / tyy)**dquarter
3450  eradius = 0.28_dp * ((yx4 * dx)**dtwo + &
3451  (xy4 * dy)**dtwo)**dhalf / (yx4 + xy4)
3452  else
3453  area = this%dis%area(node)
3454  eradius = sqrt(area / (deight * dpi))
3455  end if
3456  !
3457  ! -- conductance calculations
3458  ! -- Thiem equation (1) and cumulative Thiem and skin equations (3)
3459  if (this%ieqn(i) == 1 .or. this%ieqn(i) == 3) then
3460  lc1 = log(eradius / this%radius(i)) / t2pi
3461  end if
3462  !
3463  ! -- skin equation (2) and cumulative Thiem and skin equations (3)
3464  if (this%ieqn(i) == 2 .or. this%ieqn(i) == 3) then
3465  hks = this%hk(jpos)
3466  if (tthkw * hks > dzero) then
3467  tcontrast = (sqrtk11k22 * tthka) / (hks * tthkw)
3468  skin = (tcontrast - done) * log(this%sradius(jpos) / this%radius(i))
3469  !
3470  ! -- trap invalid transmissvity contrast if using skin equation (2).
3471  ! Not trapped for cumulative Thiem and skin equations (3)
3472  ! because the MNW2 package allowed this condition (for
3473  ! backward compatibility with the MNW2 package for
3474  ! MODFLOW-2005, MODFLOW-NWT, and MODFLOW-USG).
3475  if (tcontrast <= 1 .and. this%ieqn(i) == 2) then
3476  itcontrasterr = 1
3477  write (errmsg, '(a,g0,a,1x,i0,1x,a,1x,i0,a,4(1x,a))') &
3478  'Invalid calculated transmissivity contrast (', tcontrast, &
3479  ') for maw well', i, 'connection', j, '.', 'This happens when the', &
3480  'skin transmissivity equals or exceeds the aquifer transmissivity.', &
3481  'Consider decreasing HK_SKIN for the connection or using the', &
3482  'CUMULATIVE or MEAN conductance equations.'
3483  call store_error(errmsg)
3484  else
3485  lc2 = skin / t2pi
3486  end if
3487  end if
3488  end if
3489  ! -- conductance using screen elevations, hk, well radius,
3490  ! and screen radius
3491  if (this%ieqn(i) == 4) then
3492  hks = this%hk(jpos)
3493  ravg = dhalf * (this%radius(i) + this%sradius(jpos))
3494  slen = this%sradius(jpos) - this%radius(i)
3495  pavg = dtwopi * ravg
3496  c = hks * pavg * tthkw / slen
3497  end if
3498  !
3499  ! -- calculate final conductance for Thiem (1), Skin (2), and
3500  ! and cumulative Thiem and skin equations (3)
3501  if (this%ieqn(i) < 4) then
3502  if (lc1 + lc2 /= dzero) then
3503  c = done / (lc1 + lc2)
3504  else
3505  c = -dnodata
3506  end if
3507  end if
3508  !
3509  ! -- ensure that the conductance is not negative. Only write error message
3510  ! if error condition has not occurred for skin calculations (LC2)
3511  if (c < dzero .and. itcontrasterr == 0) then
3512  write (errmsg, '(a,g0,a,1x,i0,1x,a,1x,i0,a,4(1x,a))') &
3513  'Invalid calculated negative conductance (', c, &
3514  ') for maw well', i, 'connection', j, '.', 'this happens when the', &
3515  'skin transmissivity equals or exceeds the aquifer transmissivity.', &
3516  'consider decreasing hk_skin for the connection or using the', &
3517  'mean conductance equation.'
3518  call store_error(errmsg)
3519  end if
3520  !
3521  ! -- set saturated conductance
3522  this%satcond(jpos) = c
Here is the call graph for this function:

◆ maw_calculate_saturation()

subroutine mawmodule::maw_calculate_saturation ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  j,
integer(i4b), intent(in)  node,
real(dp), intent(inout)  sat 
)
private

Definition at line 3527 of file gwf-maw.f90.

3528  ! -- dummy
3529  class(MawType), intent(inout) :: this
3530  integer(I4B), intent(in) :: n
3531  integer(I4B), intent(in) :: j
3532  integer(I4B), intent(in) :: node
3533  real(DP), intent(inout) :: sat
3534  ! -- local
3535  integer(I4B) :: jpos
3536  real(DP) :: h_temp
3537  real(DP) :: hwell
3538  real(DP) :: topw
3539  real(DP) :: botw
3540  ! -- formats
3541  !
3542  ! -- initialize saturation
3543  sat = dzero
3544  !
3545  ! -- calculate current saturation for convertible cells
3546  if (this%icelltype(node) /= 0) then
3547  !
3548  ! -- set hwell
3549  hwell = this%xnewpak(n)
3550  !
3551  ! -- set connection position
3552  jpos = this%get_jpos(n, j)
3553  !
3554  ! -- set top and bottom of the well connection
3555  topw = this%topscrn(jpos)
3556  botw = this%botscrn(jpos)
3557  !
3558  ! -- calculate appropriate saturation
3559  if (this%inewton /= 1) then
3560  h_temp = this%xnew(node)
3561  if (h_temp < botw) then
3562  h_temp = botw
3563  end if
3564  if (hwell < botw) then
3565  hwell = botw
3566  end if
3567  h_temp = dhalf * (h_temp + hwell)
3568  else
3569  h_temp = this%xnew(node)
3570  if (hwell > h_temp) then
3571  h_temp = hwell
3572  end if
3573  if (h_temp < botw) then
3574  h_temp = botw
3575  end if
3576  end if
3577  ! -- calculate saturation
3578  sat = squadraticsaturation(topw, botw, h_temp, this%satomega)
3579  else
3580  sat = done
3581  end if
Here is the call graph for this function:

◆ maw_calculate_wellq()

subroutine mawmodule::maw_calculate_wellq ( class(mawtype this,
integer(i4b), intent(in)  n,
real(dp), intent(in)  hmaw,
real(dp), intent(inout)  q 
)
private

Definition at line 3740 of file gwf-maw.f90.

3741  ! -- dummy
3742  class(MawType) :: this
3743  integer(I4B), intent(in) :: n
3744  real(DP), intent(in) :: hmaw
3745  real(DP), intent(inout) :: q
3746  ! -- local
3747  real(DP) :: scale
3748  real(DP) :: tp
3749  real(DP) :: bt
3750  real(DP) :: rate
3751  real(DP) :: weight
3752  real(DP) :: dq
3753  !
3754  ! -- Initialize q
3755  q = dzero
3756  !
3757  ! -- Assign rate as the user-provided base pumping rate
3758  rate = this%rate(n)
3759  !
3760  ! -- Assign q differently depending on whether this is an extraction well
3761  ! (rate < 0) or an injection well (rate > 0).
3762  if (rate < dzero) then
3763  !
3764  ! -- If well shut off is activated, then turn off well if necessary,
3765  ! or if shut off is not activated then check to see if rate scaling
3766  ! is on.
3767  if (this%shutofflevel(n) /= dep20) then
3768  call this%maw_calculate_qpot(n, q)
3769  if (q < dzero) q = dzero
3770  if (q > -rate) q = -rate
3771 
3772  if (this%ishutoffcnt == 1) then
3773  this%shutoffweight(n) = done
3774  this%shutoffdq(n) = dzero
3775  this%shutoffqold(n) = q
3776  end if
3777 
3778  dq = q - this%shutoffqold(n)
3779  weight = this%shutoffweight(n)
3780  !
3781  ! -- for flip-flop condition, decrease factor
3782  if (this%shutoffdq(n) * dq < dzero) then
3783  weight = this%theta * this%shutoffweight(n)
3784  !
3785  ! -- when change is of same sign, increase factor
3786  else
3787  weight = this%shutoffweight(n) + this%kappa
3788  end if
3789  if (weight > done) weight = done
3790 
3791  q = this%shutoffqold(n) + weight * dq
3792 
3793  this%shutoffqold(n) = q
3794  this%shutoffdq(n) = dq
3795  this%shutoffweight(n) = weight
3796  !
3797  ! -- If shutoffmin and shutoffmax are specified then apply
3798  ! additional checks for when to shut off the well.
3799  if (this%shutoffmin(n) > dzero) then
3800  if (hmaw < this%shutofflevel(n)) then
3801  !
3802  ! -- calculate adjusted well rate subject to constraints
3803  ! -- well is shutoff
3804  if (this%ishutoff(n) /= 0) then
3805  q = dzero
3806  !
3807  ! --- well is not shut off
3808  else
3809  ! -- turn off well if q is less than the minimum rate and
3810  ! reset the ishutoff flag if at least on iteration 3
3811  if (q < this%shutoffmin(n)) then
3812  if (this%ishutoffcnt > 2) then
3813  this%ishutoff(n) = 1
3814  end if
3815  q = dzero
3816  !
3817  ! -- leave well on and use the specified rate
3818  ! or the potential rate
3819  end if
3820  end if
3821  !
3822  ! -- try to use the specified rate or the potential rate
3823  else
3824  if (q > this%shutoffmax(n)) then
3825  if (this%ishutoffcnt <= 2) then
3826  this%ishutoff(n) = 0
3827  end if
3828  end if
3829  if (this%ishutoff(n) /= 0) then
3830  q = dzero
3831  end if
3832  end if
3833  end if
3834 
3835  if (q /= dzero) q = -q
3836 
3837  else
3838  scale = done
3839  !
3840  ! -- Apply rate scaling by reducing pumpage when hmaw is less than the
3841  ! sum of maw pump elevation (pumpelev) and the specified reduction
3842  ! length. The rate will go to zero as hmaw drops to the pump
3843  ! elevation.
3844  if (this%reduction_length(n) /= dep20) then
3845  bt = this%pumpelev(n)
3846  tp = bt + this%reduction_length(n)
3847  scale = sqsaturation(tp, bt, hmaw)
3848  end if
3849  q = scale * rate
3850  end if
3851  !
3852  else
3853  !
3854  ! -- Handle the injection case (rate > 0) differently than extraction.
3855  q = rate
3856  if (this%shutofflevel(n) /= dep20) then
3857  call this%maw_calculate_qpot(n, q)
3858  q = -q
3859  if (q < dzero) q = dzero
3860  if (q > rate) q = rate
3861 
3862  if (this%ishutoffcnt == 1) then
3863  this%shutoffweight(n) = done
3864  this%shutoffdq(n) = dzero
3865  this%shutoffqold(n) = q
3866  end if
3867 
3868  dq = q - this%shutoffqold(n)
3869  weight = this%shutoffweight(n)
3870  !
3871  ! -- for flip-flop condition, decrease factor
3872  if (this%shutoffdq(n) * dq < dzero) then
3873  weight = this%theta * this%shutoffweight(n)
3874  !
3875  ! -- when change is of same sign, increase factor
3876  else
3877  weight = this%shutoffweight(n) + this%kappa
3878  end if
3879  if (weight > done) weight = done
3880 
3881  q = this%shutoffqold(n) + weight * dq
3882 
3883  this%shutoffqold(n) = q
3884  this%shutoffdq(n) = dq
3885  this%shutoffweight(n) = weight
3886 
3887  else
3888  scale = done
3889  !
3890  ! -- Apply rate scaling for an injection well by reducing the
3891  ! injection rate as hmaw rises above the pump elevation. The rate
3892  ! will approach zero as hmaw approaches pumpelev + reduction_length.
3893  if (this%reduction_length(n) /= dep20) then
3894  bt = this%pumpelev(n)
3895  tp = bt + this%reduction_length(n)
3896  scale = done - sqsaturation(tp, bt, hmaw)
3897  end if
3898  q = scale * rate
3899  end if
3900  end if
Here is the call graph for this function:

◆ maw_cf()

subroutine mawmodule::maw_cf ( class(mawtype this)

Skip if no multi-aquifer wells, otherwise, calculate hcof and rhs

Definition at line 2151 of file gwf-maw.f90.

2152  ! -- dummy
2153  class(MawType) :: this
2154  ! -- local
2155  !
2156  ! -- Calculate maw conductance and update package RHS and HCOF
2157  call this%maw_cfupdate()

◆ maw_cfupdate()

subroutine mawmodule::maw_cfupdate ( class(mawtype this)

Definition at line 3991 of file gwf-maw.f90.

3992  class(MawType) :: this
3993  ! -- dummy
3994  ! -- local
3995  integer(I4B) :: j
3996  integer(I4B) :: n
3997  integer(I4B) :: jpos
3998  integer(I4B) :: icflow
3999  integer(I4B) :: ibnd
4000  real(DP) :: flow
4001  real(DP) :: cmaw
4002  real(DP) :: hmaw
4003  real(DP) :: cterm
4004  real(DP) :: term
4005  !
4006  ! -- Return if no maw wells
4007  if (this%nbound .eq. 0) return
4008  !
4009  ! -- Update shutoff count
4010  this%ishutoffcnt = this%ishutoffcnt + 1
4011  !
4012  ! -- Calculate hcof and rhs for each maw entry
4013  ibnd = 1
4014  do n = 1, this%nmawwells
4015  hmaw = this%xnewpak(n)
4016  do j = 1, this%ngwfnodes(n)
4017  jpos = this%get_jpos(n, j)
4018  this%hcof(ibnd) = dzero
4019  this%rhs(ibnd) = dzero
4020  !
4021  ! -- set bound, hcof, and rhs components
4022  !
4023  ! -- use connection method so the gwf-maw budget flows
4024  ! are consistent with the maw-gwf budget flows
4025  if (this%iboundpak(n) == 0) then
4026  cmaw = dzero
4027  term = dzero
4028  cterm = dzero
4029  else
4030  call this%maw_calculate_conn_terms(n, j, icflow, cmaw, cterm, &
4031  term, flow)
4032  end if
4033  this%simcond(jpos) = cmaw
4034  this%bound(2, ibnd) = cmaw
4035  this%hcof(ibnd) = -term
4036  this%rhs(ibnd) = -term * hmaw + cterm
4037  !
4038  ! -- increment boundary number
4039  ibnd = ibnd + 1
4040  end do
4041  end do

◆ maw_check_attributes()

subroutine mawmodule::maw_check_attributes ( class(mawtype), intent(inout)  this)

Definition at line 1490 of file gwf-maw.f90.

1491  use simmodule, only: store_error
1492  ! -- dummy
1493  class(MawType), intent(inout) :: this
1494  ! -- local
1495  character(len=LINELENGTH) :: cgwfnode
1496  integer(I4B) :: idx
1497  integer(I4B) :: n
1498  integer(I4B) :: j
1499  integer(I4B) :: jpos
1500  ! -- formats
1501  !
1502  idx = 1
1503  do n = 1, this%nmawwells
1504  if (this%ngwfnodes(n) < 1) then
1505  call this%maw_set_attribute_error(n, 'NGWFNODES', 'must be greater '// &
1506  'than 0.')
1507  end if
1508  if (this%radius(n) == dep20) then
1509  call this%maw_set_attribute_error(n, 'RADIUS', 'has not been specified.')
1510  end if
1511  if (this%shutoffmin(n) > dzero) then
1512  if (this%shutoffmin(n) >= this%shutoffmax(n)) then
1513  call this%maw_set_attribute_error(n, 'SHUT_OFF', 'shutoffmax must '// &
1514  'be greater than shutoffmin.')
1515  end if
1516  end if
1517  do j = 1, this%ngwfnodes(n)
1518  !
1519  ! -- calculate jpos
1520  jpos = this%get_jpos(n, j)
1521  !
1522  ! -- write gwfnode number
1523  write (cgwfnode, '(a,i0,a)') 'gwfnode(', j, ')'
1524  !
1525  ! -- connection screen data
1526  if (this%botscrn(jpos) >= this%topscrn(jpos)) then
1527  call this%maw_set_attribute_error(n, 'SCREEN_TOP', 'screen bottom '// &
1528  'must be less than screen top. '// &
1529  trim(cgwfnode))
1530  end if
1531  !
1532  ! -- connection skin hydraulic conductivity
1533  if (this%ieqn(n) == 2 .OR. this%ieqn(n) == 3 .OR. &
1534  this%ieqn(n) == 4) then
1535  if (this%hk(jpos) <= dzero) then
1536  call this%maw_set_attribute_error(n, 'HK_SKIN', 'skin hyraulic '// &
1537  'conductivity must be greater '// &
1538  'than zero. '//trim(cgwfnode))
1539  end if
1540  else if (this%ieqn(n) == 0) then
1541  !
1542  ! -- saturated conductance
1543  if (this%satcond(jpos) < dzero) then
1544  call this%maw_set_attribute_error(n, 'HK_SKIN', &
1545  'skin hyraulic conductivity '// &
1546  'must be greater than or '// &
1547  'equal to zero when using '// &
1548  'SPECIFIED condeqn. '// &
1549  trim(cgwfnode))
1550  end if
1551  end if
1552  idx = idx + 1
1553  end do
1554  end do
1555  ! -- reset check_attr
1556  this%check_attr = 0
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
Here is the call graph for this function:

◆ maw_cq()

subroutine mawmodule::maw_cq ( class(mawtype), intent(inout)  this,
real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(inout), contiguous  flowja,
integer(i4b), intent(in), optional  iadv 
)
private

Definition at line 2516 of file gwf-maw.f90.

2517  ! -- modules
2518  use tdismodule, only: delt
2519  use constantsmodule, only: lenboundname
2520  use budgetmodule, only: budgettype
2521  ! -- dummy
2522  class(MawType), intent(inout) :: this
2523  real(DP), dimension(:), intent(in) :: x
2524  real(DP), dimension(:), contiguous, intent(inout) :: flowja
2525  integer(I4B), optional, intent(in) :: iadv
2526  ! -- local
2527  real(DP) :: rrate
2528  ! -- for budget
2529  integer(I4B) :: j
2530  integer(I4B) :: n
2531  integer(I4B) :: ibnd
2532  real(DP) :: hmaw
2533  real(DP) :: cfw
2534  ! -- for observations
2535  ! -- formats
2536  !
2537  ! -- recalculate package HCOF and RHS terms with latest groundwater and
2538  ! maw heads prior to calling base budget functionality
2539  call this%maw_cfupdate()
2540  !
2541  ! -- call base functionality in bnd_cq. This will calculate maw-gwf flows
2542  ! and put them into this%simvals
2543  call this%BndType%bnd_cq(x, flowja, iadv=1)
2544  !
2545  ! -- calculate maw budget flow and storage terms
2546  do n = 1, this%nmawwells
2547  this%qout(n) = dzero
2548  this%qsto(n) = dzero
2549  if (this%iflowingwells > 0) then
2550  this%qfw(n) = dzero
2551  end if
2552  if (this%iboundpak(n) == 0) then
2553  cycle
2554  end if
2555  !
2556  ! -- set hmaw and xsto
2557  hmaw = this%xnewpak(n)
2558  this%xsto(n) = hmaw
2559  !
2560  ! -- add pumping rate to active maw well
2561  rrate = this%ratesim(n)
2562  !
2563  ! -- If flow is out of maw set qout to rrate.
2564  if (rrate < dzero) then
2565  this%qout(n) = rrate
2566  end if
2567  !
2568  ! -- add flowing well
2569  if (this%iflowingwells > 0) then
2570  if (this%fwcond(n) > dzero) then
2571  cfw = this%fwcondsim(n)
2572  this%xsto(n) = this%fwelev(n)
2573  rrate = cfw * (this%fwelev(n) - hmaw)
2574  this%qfw(n) = rrate
2575  !
2576  ! -- Subtract flowing well rrate from qout.
2577  this%qout(n) = this%qout(n) + rrate
2578  end if
2579  end if
2580  !
2581  ! -- Calculate qsto
2582  if (this%imawiss /= 1) then
2583  rrate = -this%area(n) * (this%xsto(n) - this%xoldsto(n)) / delt
2584  this%qsto(n) = rrate
2585  end if
2586  end do
2587  !
2588  ! -- gwf and constant flow
2589  ibnd = 1
2590  do n = 1, this%nmawwells
2591  hmaw = this%xnewpak(n)
2592  this%qconst(n) = dzero
2593  do j = 1, this%ngwfnodes(n)
2594  rrate = -this%simvals(ibnd)
2595  this%qleak(ibnd) = rrate
2596  if (this%iboundpak(n) < 0) then
2597  this%qconst(n) = this%qconst(n) - rrate
2598  !
2599  ! -- If flow is out increment qout by -rrate.
2600  if (-rrate < dzero) then
2601  this%qout(n) = this%qout(n) - rrate
2602  end if
2603  end if
2604  !
2605  ! -- increment ibnd counter
2606  ibnd = ibnd + 1
2607  end do
2608  !
2609  ! -- add additional flow terms to constant head term
2610  if (this%iboundpak(n) < 0) then
2611  !
2612  ! -- add well pumping rate
2613  this%qconst(n) = this%qconst(n) - this%ratesim(n)
2614  !
2615  ! -- add flowing well rate
2616  if (this%iflowingwells > 0) then
2617  this%qconst(n) = this%qconst(n) - this%qfw(n)
2618  end if
2619  !
2620  ! -- add storage term
2621  if (this%imawiss /= 1) then
2622  this%qconst(n) = this%qconst(n) - this%qsto(n)
2623  end if
2624  end if
2625  end do
2626  !
2627  ! -- fill the budget object
2628  call this%maw_fill_budobj()
This module contains the BudgetModule.
Definition: Budget.f90:20
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:36
Derived type for the Budget object.
Definition: Budget.f90:39

◆ maw_create()

subroutine, public mawmodule::maw_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 
)

After creating the package object point bndobj to the new package

Definition at line 233 of file gwf-maw.f90.

234  ! -- dummy
235  class(BndType), pointer :: packobj
236  integer(I4B), intent(in) :: id
237  integer(I4B), intent(in) :: ibcnum
238  integer(I4B), intent(in) :: inunit
239  integer(I4B), intent(in) :: iout
240  character(len=*), intent(in) :: namemodel
241  character(len=*), intent(in) :: pakname
242  type(MawType), pointer :: mawobj
243  !
244  ! -- allocate the object and assign values to object variables
245  allocate (mawobj)
246  packobj => mawobj
247  !
248  ! -- create name and memory path
249  call packobj%set_names(ibcnum, namemodel, pakname, ftype)
250  packobj%text = text
251  !
252  ! -- allocate scalars
253  call mawobj%maw_allocate_scalars()
254  !
255  ! -- initialize package
256  call packobj%pack_initialize()
257  !
258  packobj%inunit = inunit
259  packobj%iout = iout
260  packobj%id = id
261  packobj%ibcnum = ibcnum
262  packobj%ncolbnd = 4
263  packobj%iscloc = 0 ! not supported
264  packobj%isadvpak = 1
265  packobj%ictMemPath = create_mem_path(namemodel, 'NPF')
Here is the call graph for this function:
Here is the caller graph for this function:

◆ maw_da()

subroutine mawmodule::maw_da ( class(mawtype this)

Definition at line 2743 of file gwf-maw.f90.

2744  ! -- modules
2746  ! -- dummy
2747  class(MawType) :: this
2748  ! -- local
2749  !
2750  ! -- budobj
2751  call this%budobj%budgetobject_da()
2752  deallocate (this%budobj)
2753  nullify (this%budobj)
2754  !
2755  ! -- head table
2756  if (this%iprhed > 0) then
2757  call this%headtab%table_da()
2758  deallocate (this%headtab)
2759  nullify (this%headtab)
2760  end if
2761  !
2762  ! -- character arrays
2763  call mem_deallocate(this%cmawbudget, 'CMAWBUDGET', this%memoryPath)
2764  call mem_deallocate(this%cmawname, 'CMAWNAME', this%memoryPath)
2765  call mem_deallocate(this%status, 'STATUS', this%memoryPath)
2766  !
2767  ! -- deallocate well data pointers in memory manager
2768  call mem_deallocate(this%ngwfnodes)
2769  call mem_deallocate(this%ieqn)
2770  call mem_deallocate(this%ishutoff)
2771  call mem_deallocate(this%ifwdischarge)
2772  call mem_deallocate(this%strt)
2773  call mem_deallocate(this%radius)
2774  call mem_deallocate(this%area)
2775  call mem_deallocate(this%pumpelev)
2776  call mem_deallocate(this%bot)
2777  call mem_deallocate(this%ratesim)
2778  call mem_deallocate(this%reduction_length)
2779  call mem_deallocate(this%fwelev)
2780  call mem_deallocate(this%fwcond)
2781  call mem_deallocate(this%fwrlen)
2782  call mem_deallocate(this%fwcondsim)
2783  call mem_deallocate(this%xsto)
2784  call mem_deallocate(this%xoldsto)
2785  call mem_deallocate(this%shutoffmin)
2786  call mem_deallocate(this%shutoffmax)
2787  call mem_deallocate(this%shutofflevel)
2788  call mem_deallocate(this%shutoffweight)
2789  call mem_deallocate(this%shutoffdq)
2790  call mem_deallocate(this%shutoffqold)
2791  !
2792  ! -- timeseries aware variables
2793  call mem_deallocate(this%mauxvar)
2794  call mem_deallocate(this%rate)
2795  call mem_deallocate(this%well_head)
2796  !
2797  ! -- connection data
2798  call mem_deallocate(this%iaconn)
2799  call mem_deallocate(this%gwfnodes)
2800  call mem_deallocate(this%sradius)
2801  call mem_deallocate(this%hk)
2802  call mem_deallocate(this%satcond)
2803  call mem_deallocate(this%simcond)
2804  call mem_deallocate(this%topscrn)
2805  call mem_deallocate(this%botscrn)
2806  !
2807  ! -- imap vector
2808  call mem_deallocate(this%imap)
2809  call mem_deallocate(this%dbuff)
2810  call mem_deallocate(this%cauxcbc, 'CAUXCBC', this%memoryPath)
2811  call mem_deallocate(this%qauxcbc)
2812  call mem_deallocate(this%qleak)
2813  call mem_deallocate(this%qfw)
2814  call mem_deallocate(this%qout)
2815  call mem_deallocate(this%qsto)
2816  call mem_deallocate(this%qconst)
2817  call mem_deallocate(this%denseterms)
2818  call mem_deallocate(this%viscratios)
2819  call mem_deallocate(this%idxlocnode)
2820  call mem_deallocate(this%idxdglo)
2821  call mem_deallocate(this%idxoffdglo)
2822  call mem_deallocate(this%idxsymdglo)
2823  call mem_deallocate(this%idxsymoffdglo)
2824  call mem_deallocate(this%xoldpak)
2825  !
2826  ! -- nullify pointers
2827  call mem_deallocate(this%xnewpak, 'HEAD', this%memoryPath)
2828  !
2829  ! -- scalars
2830  call mem_deallocate(this%correct_flow)
2831  call mem_deallocate(this%iprhed)
2832  call mem_deallocate(this%iheadout)
2833  call mem_deallocate(this%ibudgetout)
2834  call mem_deallocate(this%ibudcsv)
2835  call mem_deallocate(this%iflowingwells)
2836  call mem_deallocate(this%imawiss)
2837  call mem_deallocate(this%imawissopt)
2838  call mem_deallocate(this%nmawwells)
2839  call mem_deallocate(this%check_attr)
2840  call mem_deallocate(this%ishutoffcnt)
2841  call mem_deallocate(this%ieffradopt)
2842  call mem_deallocate(this%ioutredflowcsv)
2843  call mem_deallocate(this%satomega)
2844  call mem_deallocate(this%bditems)
2845  call mem_deallocate(this%theta)
2846  call mem_deallocate(this%kappa)
2847  call mem_deallocate(this%cbcauxitems)
2848  call mem_deallocate(this%idense)
2849  !
2850  ! -- pointers to gwf variables
2851  nullify (this%gwfiss)
2852  !
2853  ! -- call standard BndType deallocate
2854  call this%BndType%bnd_da()

◆ maw_df_obs()

subroutine mawmodule::maw_df_obs ( class(mawtype this)
private

Overrides BndTypebnd_df_obs

Definition at line 2934 of file gwf-maw.f90.

2935  ! -- dummy
2936  class(MawType) :: this
2937  ! -- local
2938  integer(I4B) :: indx
2939  !
2940  ! -- Store obs type and assign procedure pointer
2941  ! for head observation type.
2942  call this%obs%StoreObsType('head', .false., indx)
2943  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2944  !
2945  ! -- Store obs type and assign procedure pointer
2946  ! for frommvr observation type.
2947  call this%obs%StoreObsType('from-mvr', .false., indx)
2948  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2949  !
2950  ! -- Store obs type and assign procedure pointer
2951  ! for conn-rate observation type.
2952  call this%obs%StoreObsType('maw', .true., indx)
2953  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2954  !
2955  ! -- Store obs type and assign procedure pointer
2956  ! for rate observation type.
2957  call this%obs%StoreObsType('rate', .true., indx)
2958  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2959  !
2960  ! -- Store obs type and assign procedure pointer
2961  ! for rate-to-mvr observation type.
2962  call this%obs%StoreObsType('rate-to-mvr', .true., indx)
2963  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2964  !
2965  ! -- Store obs type and assign procedure pointer
2966  ! for fw-rate observation type.
2967  call this%obs%StoreObsType('fw-rate', .true., indx)
2968  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2969  !
2970  ! -- Store obs type and assign procedure pointer
2971  ! for rate-to-mvr observation type.
2972  call this%obs%StoreObsType('fw-to-mvr', .true., indx)
2973  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2974  !
2975  ! -- Store obs type and assign procedure pointer
2976  ! for storage observation type.
2977  call this%obs%StoreObsType('storage', .true., indx)
2978  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2979  !
2980  ! -- Store obs type and assign procedure pointer
2981  ! for constant observation type.
2982  call this%obs%StoreObsType('constant', .true., indx)
2983  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2984  !
2985  ! -- Store obs type and assign procedure pointer
2986  ! for cond observation type.
2987  call this%obs%StoreObsType('conductance', .true., indx)
2988  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
2989  !
2990  ! -- Store obs type and assign procedure pointer
2991  ! for fw-conductance observation type.
2992  call this%obs%StoreObsType('fw-conductance', .true., indx)
2993  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
Here is the call graph for this function:

◆ maw_fc()

subroutine mawmodule::maw_fc ( class(mawtype 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

Definition at line 2162 of file gwf-maw.f90.

2163  ! -- modules
2164  use tdismodule, only: delt
2165  ! -- dummy
2166  class(MawType) :: this
2167  real(DP), dimension(:), intent(inout) :: rhs
2168  integer(I4B), dimension(:), intent(in) :: ia
2169  integer(I4B), dimension(:), intent(in) :: idxglo
2170  class(MatrixBaseType), pointer :: matrix_sln
2171  ! -- local
2172  integer(I4B) :: j
2173  integer(I4B) :: n
2174  integer(I4B) :: idx
2175  integer(I4B) :: iloc
2176  integer(I4B) :: isymloc
2177  integer(I4B) :: igwfnode
2178  integer(I4B) :: iposd
2179  integer(I4B) :: iposoffd
2180  integer(I4B) :: isymnode
2181  integer(I4B) :: ipossymd
2182  integer(I4B) :: ipossymoffd
2183  integer(I4B) :: jpos
2184  integer(I4B) :: icflow
2185  real(DP) :: hmaw
2186  real(DP) :: hgwf
2187  real(DP) :: cfw
2188  real(DP) :: cmaw
2189  real(DP) :: cterm
2190  real(DP) :: term
2191  real(DP) :: scale
2192  real(DP) :: tp
2193  real(DP) :: bt
2194  real(DP) :: rate
2195  real(DP) :: ratefw
2196  real(DP) :: flow
2197  !
2198  ! -- pakmvrobj fc
2199  if (this%imover == 1) then
2200  call this%pakmvrobj%fc()
2201  end if
2202  !
2203  ! -- Copy package rhs and hcof into solution rhs and amat
2204  idx = 1
2205  do n = 1, this%nmawwells
2206  iloc = this%idxlocnode(n)
2207  !
2208  ! -- update head value for constant head maw wells
2209  if (this%iboundpak(n) < 0) then
2210  this%xnewpak(n) = this%well_head(n)
2211  end if
2212  hmaw = this%xnewpak(n)
2213  !
2214  ! -- add pumping rate to active or constant maw well
2215  if (this%iboundpak(n) == 0) then
2216  this%ratesim(n) = dzero
2217  else
2218  call this%maw_calculate_wellq(n, hmaw, rate)
2219  this%ratesim(n) = rate
2220  rhs(iloc) = rhs(iloc) - rate
2221  !
2222  ! -- location of diagonal for maw row
2223  iposd = this%idxdglo(idx)
2224  !
2225  ! -- add flowing well
2226  this%xsto(n) = hmaw
2227  ratefw = dzero
2228  if (this%iflowingwells > 0) then
2229  if (this%fwcond(n) > dzero) then
2230  bt = this%fwelev(n)
2231  tp = bt + this%fwrlen(n)
2232  scale = sqsaturation(tp, bt, hmaw)
2233  cfw = scale * this%fwcond(n)
2234  this%ifwdischarge(n) = 0
2235  if (cfw > dzero) then
2236  this%ifwdischarge(n) = 1
2237  this%xsto(n) = bt
2238  end if
2239  this%fwcondsim(n) = cfw
2240  call matrix_sln%add_value_pos(iposd, -cfw)
2241  rhs(iloc) = rhs(iloc) - cfw * bt
2242  ratefw = cfw * (bt - hmaw)
2243  end if
2244  end if
2245  !
2246  ! -- add maw storage changes
2247  if (this%imawiss /= 1) then
2248  if (this%ifwdischarge(n) /= 1) then
2249  call matrix_sln%add_value_pos(iposd, -this%area(n) / delt)
2250  rhs(iloc) = rhs(iloc) - (this%area(n) * this%xoldsto(n) / delt)
2251  else
2252  cterm = this%xoldsto(n) - this%fwelev(n)
2253  rhs(iloc) = rhs(iloc) - (this%area(n) * cterm / delt)
2254  end if
2255  end if
2256  !
2257  ! -- If mover is active, add receiver water to rhs and
2258  ! store available water (as positive value)
2259  if (this%imover == 1) then
2260  rhs(iloc) = rhs(iloc) - this%pakmvrobj%get_qfrommvr(n)
2261  !
2262  ! -- add pumping rate to mover if not injection
2263  if (rate < 0) then
2264  call this%pakmvrobj%accumulate_qformvr(n, -rate) !pumped water
2265  end if
2266  !
2267  ! -- add flowing well flow to mover
2268  call this%pakmvrobj%accumulate_qformvr(n, -ratefw) !flowing water
2269  end if
2270  !
2271  end if
2272  !
2273  ! -- process each maw/gwf connection
2274  do j = 1, this%ngwfnodes(n)
2275  if (this%iboundpak(n) /= 0) then
2276  jpos = this%get_jpos(n, j)
2277  igwfnode = this%get_gwfnode(n, j)
2278  hgwf = this%xnew(igwfnode)
2279  !
2280  ! -- calculate connection terms
2281  call this%maw_calculate_conn_terms(n, j, icflow, cmaw, cterm, term, &
2282  flow)
2283  this%simcond(jpos) = cmaw
2284  !
2285  ! -- add to maw row
2286  iposd = this%idxdglo(idx)
2287  iposoffd = this%idxoffdglo(idx)
2288  call matrix_sln%add_value_pos(iposd, -term)
2289  call matrix_sln%set_value_pos(iposoffd, term)
2290  !
2291  ! -- add correction term
2292  rhs(iloc) = rhs(iloc) - cterm
2293  !
2294  ! -- add to gwf row for maw connection
2295  isymnode = this%get_gwfnode(n, j)
2296  isymloc = ia(isymnode)
2297  ipossymd = this%idxsymdglo(idx)
2298  ipossymoffd = this%idxsymoffdglo(idx)
2299  call matrix_sln%add_value_pos(ipossymd, -term)
2300  call matrix_sln%set_value_pos(ipossymoffd, term)
2301  !
2302  ! -- add correction term to gwf row
2303  rhs(isymnode) = rhs(isymnode) + cterm
2304  end if
2305  !
2306  ! -- increment maw connection counter
2307  idx = idx + 1
2308  end do
2309  end do
Here is the call graph for this function:

◆ maw_fill_budobj()

subroutine mawmodule::maw_fill_budobj ( class(mawtype this)

terms include a combination of the following: gwf rate [flowing_well] [storage] constant_flow [frommvr tomvr tomvrcf [tomvrfw]] [aux]

Definition at line 4250 of file gwf-maw.f90.

4251  ! -- modules
4252  ! -- dummy
4253  class(MawType) :: this
4254  ! -- local
4255  integer(I4B) :: naux
4256  integer(I4B) :: j
4257  integer(I4B) :: n
4258  integer(I4B) :: n2
4259  integer(I4B) :: jpos
4260  integer(I4B) :: idx
4261  integer(I4B) :: ibnd
4262  real(DP) :: q
4263  real(DP) :: tmaw
4264  real(DP) :: bmaw
4265  real(DP) :: sat
4266  real(DP) :: qfact
4267  real(DP) :: q2
4268  real(DP) :: b
4269  real(DP) :: v
4270  ! -- formats
4271  !
4272  ! -- initialize counter
4273  idx = 0
4274  !
4275  ! -- GWF (LEAKAGE) and connection surface area (aux)
4276  idx = idx + 1
4277  call this%budobj%budterm(idx)%reset(this%maxbound)
4278  ibnd = 1
4279  do n = 1, this%nmawwells
4280  do j = 1, this%ngwfnodes(n)
4281  jpos = this%get_jpos(n, j)
4282  n2 = this%get_gwfnode(n, j)
4283  tmaw = this%topscrn(jpos)
4284  bmaw = this%botscrn(jpos)
4285  call this%maw_calculate_saturation(n, j, n2, sat)
4286  this%qauxcbc(1) = dtwo * dpi * this%radius(n) * sat * (tmaw - bmaw)
4287  q = this%qleak(ibnd)
4288  call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
4289  ibnd = ibnd + 1
4290  end do
4291  end do
4292  !
4293  ! -- RATE (WITHDRAWAL RATE)
4294  idx = idx + 1
4295  call this%budobj%budterm(idx)%reset(this%nmawwells)
4296  do n = 1, this%nmawwells
4297  q = this%ratesim(n)
4298  !
4299  ! -- adjust if well rate is an outflow
4300  if (this%imover == 1 .and. q < dzero) then
4301  qfact = done
4302  if (this%qout(n) < dzero) then
4303  qfact = q / this%qout(n)
4304  end if
4305  q = q + qfact * this%pakmvrobj%get_qtomvr(n)
4306  end if
4307  call this%budobj%budterm(idx)%update_term(n, n, q)
4308  end do
4309  !
4310  ! -- FLOWING WELL
4311  if (this%iflowingwells > 0) then
4312  idx = idx + 1
4313  call this%budobj%budterm(idx)%reset(this%nmawwells)
4314  do n = 1, this%nmawwells
4315  q = this%qfw(n)
4316  if (this%imover == 1) then
4317  qfact = done
4318  !
4319  ! -- adjust if well rate is an outflow
4320  if (this%qout(n) < dzero) then
4321  qfact = q / this%qout(n)
4322  end if
4323  q = q + qfact * this%pakmvrobj%get_qtomvr(n)
4324  end if
4325  call this%budobj%budterm(idx)%update_term(n, n, q)
4326  end do
4327  end if
4328  !
4329  ! -- STORAGE (AND VOLUME AS AUX)
4330  idx = idx + 1
4331  call this%budobj%budterm(idx)%reset(this%nmawwells)
4332  do n = 1, this%nmawwells
4333  b = this%xsto(n) - this%bot(n)
4334  if (b < dzero) then
4335  b = dzero
4336  end if
4337  v = this%area(n) * b
4338  if (this%imawissopt /= 1) then
4339  q = this%qsto(n)
4340  else
4341  q = dzero
4342  end if
4343  this%qauxcbc(1) = v
4344  call this%budobj%budterm(idx)%update_term(n, n, q, this%qauxcbc)
4345  end do
4346  !
4347  ! -- CONSTANT FLOW
4348  idx = idx + 1
4349  call this%budobj%budterm(idx)%reset(this%nmawwells)
4350  do n = 1, this%nmawwells
4351  q = this%qconst(n)
4352  !
4353  ! -- adjust if constant-flow rate is an outflow
4354  if (this%imover == 1 .and. q < dzero) then
4355  qfact = done
4356  if (this%qout(n) < dzero) then
4357  qfact = q / this%qout(n)
4358  end if
4359  q = q + qfact * this%pakmvrobj%get_qtomvr(n)
4360  end if
4361  call this%budobj%budterm(idx)%update_term(n, n, q)
4362  end do
4363  !
4364  ! -- MOVER
4365  if (this%imover == 1) then
4366  !
4367  ! -- FROM MOVER
4368  idx = idx + 1
4369  call this%budobj%budterm(idx)%reset(this%nmawwells)
4370  do n = 1, this%nmawwells
4371  if (this%iboundpak(n) == 0) then
4372  q = dzero
4373  else
4374  q = this%pakmvrobj%get_qfrommvr(n)
4375  end if
4376  call this%budobj%budterm(idx)%update_term(n, n, q)
4377  end do
4378  !
4379  ! -- RATE TO MOVER
4380  idx = idx + 1
4381  call this%budobj%budterm(idx)%reset(this%nmawwells)
4382  do n = 1, this%nmawwells
4383  q = this%pakmvrobj%get_qtomvr(n)
4384  if (q > dzero) then
4385  q = -q
4386  q2 = this%ratesim(n)
4387  !
4388  ! -- adjust TO MOVER if well rate is outflow
4389  if (q2 < dzero) then
4390  qfact = q2 / this%qout(n)
4391  q = q * qfact
4392  else
4393  q = dzero
4394  end if
4395  end if
4396  call this%budobj%budterm(idx)%update_term(n, n, q)
4397  end do
4398  !
4399  ! -- CONSTANT TO MOVER
4400  idx = idx + 1
4401  call this%budobj%budterm(idx)%reset(this%nmawwells)
4402  do n = 1, this%nmawwells
4403  q = this%pakmvrobj%get_qtomvr(n)
4404  if (q > dzero) then
4405  q = -q
4406  q2 = this%qconst(n)
4407  ! -- adjust TO MOVER if well rate is outflow
4408  if (q2 < dzero) then
4409  qfact = q2 / this%qout(n)
4410  q = q * qfact
4411  else
4412  q = dzero
4413  end if
4414  end if
4415  call this%budobj%budterm(idx)%update_term(n, n, q)
4416  end do
4417  !
4418  ! -- FLOWING WELL TO MOVER
4419  if (this%iflowingwells > 0) then
4420  idx = idx + 1
4421  call this%budobj%budterm(idx)%reset(this%nmawwells)
4422  do n = 1, this%nmawwells
4423  q = this%pakmvrobj%get_qtomvr(n)
4424  if (q > dzero) then
4425  q = -q
4426  q2 = this%ratesim(n)
4427  !
4428  ! -- adjust TO MOVER if well rate is outflow
4429  qfact = done
4430  if (this%qout(n) < dzero) then
4431  qfact = this%qfw(n) / this%qout(n)
4432  end if
4433  q = q * qfact
4434  end if
4435  call this%budobj%budterm(idx)%update_term(n, n, q)
4436  end do
4437  end if
4438 
4439  end if
4440  !
4441  ! -- AUXILIARY VARIABLES
4442  naux = this%naux
4443  if (naux > 0) then
4444  idx = idx + 1
4445  call this%budobj%budterm(idx)%reset(this%nmawwells)
4446  do n = 1, this%nmawwells
4447  q = dzero
4448  call this%budobj%budterm(idx)%update_term(n, n, q, this%auxvar(:, n))
4449  end do
4450  end if
4451  !
4452  ! --Terms are filled, now accumulate them for this time step
4453  call this%budobj%accumulate_terms()

◆ maw_fn()

subroutine mawmodule::maw_fn ( class(mawtype this,
real(dp), dimension(:), intent(inout)  rhs,
integer(i4b), dimension(:), intent(in)  ia,
integer(i4b), dimension(:), intent(in)  idxglo,
class(matrixbasetype), pointer  matrix_sln 
)

Definition at line 2314 of file gwf-maw.f90.

2315  ! -- dummy
2316  class(MawType) :: this
2317  real(DP), dimension(:), intent(inout) :: rhs
2318  integer(I4B), dimension(:), intent(in) :: ia
2319  integer(I4B), dimension(:), intent(in) :: idxglo
2320  class(MatrixBaseType), pointer :: matrix_sln
2321  ! -- local
2322  integer(I4B) :: j
2323  integer(I4B) :: n
2324  integer(I4B) :: idx
2325  integer(I4B) :: iloc
2326  integer(I4B) :: isymloc
2327  integer(I4B) :: igwfnode
2328  integer(I4B) :: iposd
2329  integer(I4B) :: iposoffd
2330  integer(I4B) :: isymnode
2331  integer(I4B) :: ipossymd
2332  integer(I4B) :: ipossymoffd
2333  integer(I4B) :: jpos
2334  integer(I4B) :: icflow
2335  real(DP) :: hmaw
2336  real(DP) :: hgwf
2337  real(DP) :: scale
2338  real(DP) :: tp
2339  real(DP) :: bt
2340  real(DP) :: cfw
2341  real(DP) :: rate
2342  real(DP) :: rate2
2343  real(DP) :: rterm
2344  real(DP) :: derv
2345  real(DP) :: drterm
2346  real(DP) :: cmaw
2347  real(DP) :: cterm
2348  real(DP) :: term
2349  real(DP) :: flow
2350  real(DP) :: term2
2351  real(DP) :: rhsterm
2352  !
2353  ! -- Calculate Newton-Raphson corrections
2354  idx = 1
2355  do n = 1, this%nmawwells
2356  iloc = this%idxlocnode(n)
2357  hmaw = this%xnewpak(n)
2358  !
2359  ! -- add pumping rate to active or constant maw well
2360  if (this%iboundpak(n) /= 0) then
2361  iposd = this%idxdglo(idx)
2362  scale = done
2363  drterm = dzero
2364  rate = this%ratesim(n)
2365  !
2366  !-- calculate final derivative for pumping rate
2367  call this%maw_calculate_wellq(n, hmaw + dem4, rate2)
2368  drterm = (rate2 - rate) / dem4
2369  !
2370  !-- fill amat and rhs with newton-raphson terms
2371  call matrix_sln%add_value_pos(iposd, drterm)
2372  rhs(iloc) = rhs(iloc) + drterm * hmaw
2373  !
2374  ! -- add flowing well
2375  if (this%iflowingwells > 0) then
2376  if (this%fwcond(n) > dzero) then
2377  bt = this%fwelev(n)
2378  tp = bt + this%fwrlen(n)
2379  scale = sqsaturation(tp, bt, hmaw)
2380  cfw = scale * this%fwcond(n)
2381  this%ifwdischarge(n) = 0
2382  if (cfw > dzero) then
2383  this%ifwdischarge(n) = 1
2384  end if
2385  this%fwcondsim(n) = cfw
2386  rate = cfw * (bt - hmaw)
2387  rterm = -cfw * hmaw
2388  !
2389  ! --calculate derivative for flowing well
2390  if (hmaw < tp) then
2391  derv = sqsaturationderivative(tp, bt, hmaw)
2392  drterm = -(cfw + this%fwcond(n) * derv * (hmaw - bt))
2393  !
2394  ! -- fill amat and rhs with newton-raphson terms
2395  call matrix_sln%add_value_pos(iposd, &
2396  -this%fwcond(n) * derv * (hmaw - bt))
2397  rhs(iloc) = rhs(iloc) - rterm + drterm * hmaw
2398  end if
2399  end if
2400  end if
2401  end if
2402  !
2403  ! -- process each maw/gwf connection
2404  do j = 1, this%ngwfnodes(n)
2405  if (this%iboundpak(n) /= 0) then
2406  jpos = this%get_jpos(n, j)
2407  igwfnode = this%get_gwfnode(n, j)
2408  hgwf = this%xnew(igwfnode)
2409  !
2410  ! -- add to maw row
2411  iposd = this%idxdglo(idx)
2412  iposoffd = this%idxoffdglo(idx)
2413  !
2414  ! -- add to gwf row for maw connection
2415  isymnode = this%get_gwfnode(n, j)
2416  isymloc = ia(isymnode)
2417  ipossymd = this%idxsymdglo(idx)
2418  ipossymoffd = this%idxsymoffdglo(idx)
2419  !
2420  ! -- calculate newton terms
2421  call this%maw_calculate_conn_terms(n, j, icflow, cmaw, cterm, term, &
2422  flow, term2)
2423  !
2424  ! -- maw is upstream
2425  if (hmaw > hgwf) then
2426  if (icflow /= 0) then
2427  rhsterm = term2 * hgwf + term * hmaw
2428  rhs(iloc) = rhs(iloc) + rhsterm
2429  rhs(isymnode) = rhs(isymnode) - rhsterm
2430  if (this%iboundpak(n) > 0) then
2431  call matrix_sln%add_value_pos(iposd, term)
2432  call matrix_sln%add_value_pos(iposoffd, term2)
2433  end if
2434  call matrix_sln%add_value_pos(ipossymd, -term2)
2435  call matrix_sln%add_value_pos(ipossymoffd, -term)
2436  else
2437  rhs(iloc) = rhs(iloc) + term * hmaw
2438  rhs(isymnode) = rhs(isymnode) - term * hmaw
2439  call matrix_sln%add_value_pos(iposd, term)
2440  if (this%ibound(igwfnode) > 0) then
2441  call matrix_sln%add_value_pos(ipossymoffd, -term)
2442  end if
2443  end if
2444  !
2445  ! -- gwf is upstream
2446  else
2447  if (icflow /= 0) then
2448  rhsterm = term2 * hmaw + term * hgwf
2449  rhs(iloc) = rhs(iloc) + rhsterm
2450  rhs(isymnode) = rhs(isymnode) - rhsterm
2451  if (this%iboundpak(n) > 0) then
2452  call matrix_sln%add_value_pos(iposd, term2)
2453  call matrix_sln%add_value_pos(iposoffd, term)
2454  end if
2455  call matrix_sln%add_value_pos(ipossymd, -term)
2456  call matrix_sln%add_value_pos(ipossymoffd, -term2)
2457  else
2458  rhs(iloc) = rhs(iloc) + term * hgwf
2459  rhs(isymnode) = rhs(isymnode) - term * hgwf
2460  if (this%iboundpak(n) > 0) then
2461  call matrix_sln%add_value_pos(iposoffd, term)
2462  end if
2463  call matrix_sln%add_value_pos(ipossymd, -term)
2464  end if
2465  end if
2466  end if
2467  !
2468  ! -- increment maw connection counter
2469  idx = idx + 1
2470  end do
2471  end do
Here is the call graph for this function:

◆ maw_mc()

subroutine mawmodule::maw_mc ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  moffset,
class(matrixbasetype), pointer  matrix_sln 
)

Definition at line 1591 of file gwf-maw.f90.

1592  use sparsemodule, only: sparsematrix
1594  ! -- dummy
1595  class(MawType), intent(inout) :: this
1596  integer(I4B), intent(in) :: moffset
1597  class(MatrixBaseType), pointer :: matrix_sln
1598  ! -- local
1599  integer(I4B) :: n
1600  integer(I4B) :: j
1601  integer(I4B) :: ii
1602  integer(I4B) :: iglo
1603  integer(I4B) :: jglo
1604  integer(I4B) :: ipos
1605  ! -- format
1606  !
1607  ! -- allocate connection mapping vectors
1608  call mem_allocate(this%idxlocnode, this%nmawwells, 'IDXLOCNODE', &
1609  this%memoryPath)
1610  call mem_allocate(this%idxdglo, this%maxbound, 'IDXDGLO', this%memoryPath)
1611  call mem_allocate(this%idxoffdglo, this%maxbound, 'IDXOFFDGLO', &
1612  this%memoryPath)
1613  call mem_allocate(this%idxsymdglo, this%maxbound, 'IDXSYMDGLO', &
1614  this%memoryPath)
1615  call mem_allocate(this%idxsymoffdglo, this%maxbound, 'IDXSYMOFFDGLO', &
1616  this%memoryPath)
1617  !
1618  ! -- Find the position of each connection in the global ia, ja structure
1619  ! and store them in idxglo. idxglo allows this model to insert or
1620  ! retrieve values into or from the global A matrix
1621  ! -- maw rows
1622  ipos = 1
1623  do n = 1, this%nmawwells
1624  iglo = moffset + this%dis%nodes + this%ioffset + n
1625  this%idxlocnode(n) = this%dis%nodes + this%ioffset + n
1626  do ii = 1, this%ngwfnodes(n)
1627  j = this%get_gwfnode(n, ii)
1628  jglo = j + moffset
1629  this%idxdglo(ipos) = matrix_sln%get_position_diag(iglo)
1630  this%idxoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
1631  ipos = ipos + 1
1632  end do
1633  end do
1634  ! -- maw contributions gwf portion of global matrix
1635  ipos = 1
1636  do n = 1, this%nmawwells
1637  do ii = 1, this%ngwfnodes(n)
1638  iglo = this%get_gwfnode(n, ii) + moffset
1639  jglo = moffset + this%dis%nodes + this%ioffset + n
1640  this%idxsymdglo(ipos) = matrix_sln%get_position_diag(iglo)
1641  this%idxsymoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
1642  ipos = ipos + 1
1643  end do
1644  end do

◆ maw_nur()

subroutine mawmodule::maw_nur ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  neqpak,
real(dp), dimension(neqpak), intent(inout)  x,
real(dp), dimension(neqpak), intent(in)  xtemp,
real(dp), dimension(neqpak), intent(inout)  dx,
integer(i4b), intent(inout)  inewtonur,
real(dp), intent(inout)  dxmax,
integer(i4b), intent(inout)  locmax 
)
private

Definition at line 2477 of file gwf-maw.f90.

2478  ! -- dummy
2479  class(MawType), intent(inout) :: this
2480  integer(I4B), intent(in) :: neqpak
2481  real(DP), dimension(neqpak), intent(inout) :: x
2482  real(DP), dimension(neqpak), intent(in) :: xtemp
2483  real(DP), dimension(neqpak), intent(inout) :: dx
2484  integer(I4B), intent(inout) :: inewtonur
2485  real(DP), intent(inout) :: dxmax
2486  integer(I4B), intent(inout) :: locmax
2487  ! -- local
2488  integer(I4B) :: n
2489  real(DP) :: botw
2490  real(DP) :: xx
2491  real(DP) :: dxx
2492  !
2493  ! -- Newton-Raphson under-relaxation
2494  do n = 1, this%nmawwells
2495  if (this%iboundpak(n) < 1) cycle
2496  botw = this%bot(n)
2497  !
2498  ! -- only apply Newton-Raphson under-relaxation if
2499  ! solution head is below the bottom of the well
2500  if (x(n) < botw) then
2501  inewtonur = 1
2502  xx = xtemp(n) * (done - dp9) + botw * dp9
2503  dxx = x(n) - xx
2504  if (abs(dxx) > abs(dxmax)) then
2505  locmax = n
2506  dxmax = dxx
2507  end if
2508  x(n) = xx
2509  dx(n) = dzero
2510  end if
2511  end do

◆ maw_obs_supported()

logical function mawmodule::maw_obs_supported ( class(mawtype this)

Overrides BndTypebnd_obs_supported()

Definition at line 2924 of file gwf-maw.f90.

2925  class(MawType) :: this
2926  !
2927  maw_obs_supported = .true.

◆ maw_ot_bdsummary()

subroutine mawmodule::maw_ot_bdsummary ( class(mawtype this,
integer(i4b), intent(in)  kstp,
integer(i4b), intent(in)  kper,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  ibudfl 
)
Parameters
thisMawType object
[in]kstptime step number
[in]kperperiod number
[in]ioutflag and unit number for the model listing file
[in]ibudflflag indicating budget should be written

Definition at line 2728 of file gwf-maw.f90.

2729  ! -- module
2730  use tdismodule, only: totim, delt
2731  ! -- dummy
2732  class(MawType) :: this !< MawType object
2733  integer(I4B), intent(in) :: kstp !< time step number
2734  integer(I4B), intent(in) :: kper !< period number
2735  integer(I4B), intent(in) :: iout !< flag and unit number for the model listing file
2736  integer(I4B), intent(in) :: ibudfl !< flag indicating budget should be written
2737  !
2738  call this%budobj%write_budtable(kstp, kper, iout, ibudfl, totim, delt)
real(dp), pointer, public totim
time relative to start of simulation
Definition: tdis.f90:32

◆ maw_ot_dv()

subroutine mawmodule::maw_ot_dv ( class(mawtype this,
integer(i4b), intent(in)  idvsave,
integer(i4b), intent(in)  idvprint 
)

Definition at line 2673 of file gwf-maw.f90.

2674  use tdismodule, only: kstp, kper, pertim, totim
2675  use constantsmodule, only: dhnoflo, dhdry
2676  use inputoutputmodule, only: ulasav
2677  class(MawType) :: this
2678  integer(I4B), intent(in) :: idvsave
2679  integer(I4B), intent(in) :: idvprint
2680  integer(I4B) :: ibinun
2681  integer(I4B) :: n
2682  real(DP) :: v
2683  real(DP) :: d
2684  !
2685  ! -- set unit number for binary dependent variable output
2686  ibinun = 0
2687  if (this%iheadout /= 0) then
2688  ibinun = this%iheadout
2689  end if
2690  if (idvsave == 0) ibinun = 0
2691  !
2692  ! -- write maw binary output
2693  if (ibinun > 0) then
2694  do n = 1, this%nmawwells
2695  v = this%xnewpak(n)
2696  d = v - this%bot(n)
2697  if (this%iboundpak(n) == 0) then
2698  v = dhnoflo
2699  else if (d <= dzero) then
2700  v = dhdry
2701  end if
2702  this%dbuff(n) = v
2703  end do
2704  call ulasav(this%dbuff, ' HEAD', &
2705  kstp, kper, pertim, totim, &
2706  this%nmawwells, 1, 1, ibinun)
2707  end if
2708  !
2709  ! -- write maw head table
2710  if (idvprint /= 0 .and. this%iprhed /= 0) then
2711  !
2712  ! -- set table kstp and kper
2713  call this%headtab%set_kstpkper(kstp, kper)
2714  !
2715  ! -- fill stage data
2716  do n = 1, this%nmawwells
2717  if (this%inamedbound == 1) then
2718  call this%headtab%add_term(this%cmawname(n))
2719  end if
2720  call this%headtab%add_term(n)
2721  call this%headtab%add_term(this%xnewpak(n))
2722  end do
2723  end if
real(dp), parameter dhdry
real dry cell constant
Definition: Constants.f90:94
real(dp), parameter dhnoflo
real no flow constant
Definition: Constants.f90:93
subroutine, public ulasav(buf, text, kstp, kper, pertim, totim, ncol, nrow, ilay, ichn)
Save 1 layer array on disk.
real(dp), pointer, public pertim
time relative to start of stress period
Definition: tdis.f90:30
Here is the call graph for this function:

◆ maw_ot_model_flows()

subroutine mawmodule::maw_ot_model_flows ( class(mawtype this,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  ibudfl,
integer(i4b), intent(in)  icbcun,
integer(i4b), dimension(:), intent(in), optional  imap 
)

Definition at line 2633 of file gwf-maw.f90.

2634  ! -- dummy
2635  class(MawType) :: this
2636  integer(I4B), intent(in) :: icbcfl
2637  integer(I4B), intent(in) :: ibudfl
2638  integer(I4B), intent(in) :: icbcun
2639  integer(I4B), dimension(:), optional, intent(in) :: imap
2640  !
2641  ! -- write the flows from the budobj
2642  call this%BndType%bnd_ot_model_flows(icbcfl, ibudfl, icbcun, this%imap)

◆ maw_ot_package_flows()

subroutine mawmodule::maw_ot_package_flows ( class(mawtype this,
integer(i4b), intent(in)  icbcfl,
integer(i4b), intent(in)  ibudfl 
)
private

Definition at line 2647 of file gwf-maw.f90.

2648  use tdismodule, only: kstp, kper, delt, pertim, totim
2649  class(MawType) :: this
2650  integer(I4B), intent(in) :: icbcfl
2651  integer(I4B), intent(in) :: ibudfl
2652  integer(I4B) :: ibinun
2653  !
2654  ! -- write the flows from the budobj
2655  ibinun = 0
2656  if (this%ibudgetout /= 0) then
2657  ibinun = this%ibudgetout
2658  end if
2659  if (icbcfl == 0) ibinun = 0
2660  if (ibinun > 0) then
2661  call this%budobj%save_flows(this%dis, ibinun, kstp, kper, delt, &
2662  pertim, totim, this%iout)
2663  end if
2664  !
2665  ! -- Print maw flows table
2666  if (ibudfl /= 0 .and. this%iprflow /= 0) then
2667  call this%budobj%write_flowtable(this%dis, kstp, kper)
2668  end if

◆ maw_process_obsid()

subroutine mawmodule::maw_process_obsid ( type(observetype), intent(inout)  obsrv,
class(disbasetype), intent(in)  dis,
integer(i4b), intent(in)  inunitobs,
integer(i4b), intent(in)  iout 
)

Definition at line 3263 of file gwf-maw.f90.

3264  ! -- dummy
3265  type(ObserveType), intent(inout) :: obsrv
3266  class(DisBaseType), intent(in) :: dis
3267  integer(I4B), intent(in) :: inunitobs
3268  integer(I4B), intent(in) :: iout
3269  ! -- local
3270  integer(I4B) :: nn1, nn2
3271  integer(I4B) :: icol, istart, istop
3272  character(len=LINELENGTH) :: string
3273  character(len=LENBOUNDNAME) :: bndname
3274  ! formats
3275  !
3276  string = obsrv%IDstring
3277  ! -- Extract multi-aquifer well number from string and store it.
3278  ! If 1st item is not an integer(I4B), it should be a
3279  ! maw name--deal with it.
3280  icol = 1
3281  ! -- get multi-aquifer well number or boundary name
3282  call extract_idnum_or_bndname(string, icol, istart, istop, nn1, bndname)
3283  if (nn1 == namedboundflag) then
3284  obsrv%FeatureName = bndname
3285  else
3286  if (obsrv%ObsTypeId == 'MAW' .or. &
3287  obsrv%ObsTypeId == 'CONDUCTANCE') then
3288  call extract_idnum_or_bndname(string, icol, istart, istop, nn2, bndname)
3289  if (len_trim(bndname) < 1 .and. nn2 < 0) then
3290  write (errmsg, '(a,1x,a,a,1x,a,1x,a)') &
3291  'For observation type', trim(adjustl(obsrv%ObsTypeId)), &
3292  ', ID given as an integer and not as boundname,', &
3293  'but ID2 (icon) is missing. Either change ID to valid', &
3294  'boundname or supply valid entry for ID2.'
3295  call store_error(errmsg)
3296  end if
3297  if (nn2 == namedboundflag) then
3298  obsrv%FeatureName = bndname
3299  ! -- reset nn1
3300  nn1 = nn2
3301  else
3302  obsrv%NodeNumber2 = nn2
3303  end if
3304  end if
3305  end if
3306  ! -- store multi-aquifer well number (NodeNumber)
3307  obsrv%NodeNumber = nn1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ maw_read_dimensions()

subroutine mawmodule::maw_read_dimensions ( class(mawtype), intent(inout)  this)

Definition at line 1036 of file gwf-maw.f90.

1037  use constantsmodule, only: linelength
1038  ! -- dummy
1039  class(MawType), intent(inout) :: this
1040  ! -- local
1041  character(len=LENBOUNDNAME) :: keyword
1042  integer(I4B) :: ierr
1043  logical :: isfound, endOfBlock
1044  ! -- format
1045  !
1046  ! -- initialize dimensions to -1
1047  this%nmawwells = -1
1048  this%maxbound = -1
1049  !
1050  ! -- get dimensions block
1051  call this%parser%GetBlock('DIMENSIONS', isfound, ierr, &
1052  supportopenclose=.true.)
1053  !
1054  ! -- parse dimensions block if detected
1055  if (isfound) then
1056  write (this%iout, '(/1x,a)') &
1057  'PROCESSING '//trim(adjustl(this%text))//' DIMENSIONS'
1058  do
1059  call this%parser%GetNextLine(endofblock)
1060  if (endofblock) exit
1061  call this%parser%GetStringCaps(keyword)
1062  select case (keyword)
1063  case ('NMAWWELLS')
1064  this%nmawwells = this%parser%GetInteger()
1065  write (this%iout, '(4x,a,i0)') 'NMAWWELLS = ', this%nmawwells
1066  case default
1067  write (errmsg, '(3a)') &
1068  'Unknown '//trim(this%text)//' dimension: ', trim(keyword), '.'
1069  call store_error(errmsg)
1070  end select
1071  end do
1072  write (this%iout, '(1x,a)') &
1073  'END OF '//trim(adjustl(this%text))//' DIMENSIONS'
1074  else
1075  call store_error('Required dimensions block not found.', terminate=.true.)
1076  end if
1077  !
1078  ! -- verify dimensions were set correctly
1079  if (this%nmawwells < 0) then
1080  write (errmsg, '(a)') &
1081  'NMAWWELLS was not specified or was specified incorrectly.'
1082  call store_error(errmsg)
1083  end if
1084  !
1085  ! -- stop if errors were encountered in the DIMENSIONS block
1086  if (count_errors() > 0) then
1087  call this%parser%StoreErrorUnit()
1088  end if
1089  !
1090  ! -- read wells block
1091  call this%maw_read_wells()
1092  !
1093  ! -- read well_connections block
1094  call this%maw_read_well_connections()
1095  !
1096  ! -- Call define_listlabel to construct the list label that is written
1097  ! when PRINT_INPUT option is used.
1098  call this%define_listlabel()
1099  !
1100  ! -- setup the budget object
1101  call this%maw_setup_budobj()
1102  !
1103  ! -- setup the head table object
1104  call this%maw_setup_tableobj()
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
Here is the call graph for this function:

◆ maw_read_initial_attr()

subroutine mawmodule::maw_read_initial_attr ( class(mawtype), intent(inout)  this)

Definition at line 1109 of file gwf-maw.f90.

1110  ! -- modules
1111  use constantsmodule, only: linelength
1112  use memorymanagermodule, only: mem_setptr
1113  ! -- dummy
1114  class(MawType), intent(inout) :: this
1115  ! -- local
1116  character(len=LINELENGTH) :: title
1117  character(len=LINELENGTH) :: text
1118  integer(I4B) :: ntabcols
1119  integer(I4B) :: j
1120  integer(I4B) :: n
1121  integer(I4B) :: nn
1122  integer(I4B) :: jpos
1123  integer(I4B) :: inode
1124  integer(I4B) :: idx
1125  real(DP) :: k11
1126  real(DP) :: k22
1127  character(len=10), dimension(0:4) :: ccond
1128  character(len=30) :: nodestr
1129  ! -- data
1130  data ccond(0)/'SPECIFIED '/
1131  data ccond(1)/'THIEM '/
1132  data ccond(2)/'SKIN '/
1133  data ccond(3)/'CUMULATIVE'/
1134  data ccond(4)/'MEAN '/
1135  ! -- format
1136  character(len=*), parameter :: fmtwelln = &
1137  "(1X,//43X,'MULTI-AQUIFER WELL DATA'&
1138  &/1X,109('-'),&
1139  &/1X,7(A10,1X),A16)"
1140  character(len=*), parameter :: fmtwelld = &
1141  &"(1X,I10,1X,4(G10.3,1X),I10,1X,A10,1X,A16)"
1142  character(len=*), parameter :: fmtline = &
1143  &"(1X,119('-'),//)"
1144  character(len=*), parameter :: fmtwellcn = &
1145  "(1X,//37X,'MULTI-AQUIFER WELL CONNECTION DATA'&
1146  &/1X,119('-'),&
1147  &/1X,2(A10,1X),A20,7(A10,1X))"
1148  character(len=*), parameter :: fmtwellcd = &
1149  &"(1X,2(I10,1X),A20,1X,2(G10.3,1X),2(A10,1X),3(G10.3,1X))"
1150  !
1151  ! -- initialize xnewpak
1152  do n = 1, this%nmawwells
1153  this%xnewpak(n) = this%strt(n)
1154  this%xsto(n) = this%strt(n)
1155  end do
1156  !
1157  ! -- initialize status (iboundpak) of maw wells to active
1158  do n = 1, this%nmawwells
1159  select case (this%status(n))
1160  case ('CONSTANT')
1161  this%iboundpak(n) = -1
1162  case ('INACTIVE')
1163  this%iboundpak(n) = 0
1164  case ('ACTIVE')
1165  this%iboundpak(n) = 1
1166  end select
1167  end do
1168  !
1169  ! -- set imap and boundname for each connection
1170  if (this%inamedbound /= 0) then
1171  idx = 0
1172  do n = 1, this%nmawwells
1173  do j = 1, this%ngwfnodes(n)
1174  idx = idx + 1
1175  this%boundname(idx) = this%cmawname(n)
1176  this%imap(idx) = n
1177  end do
1178  end do
1179  else
1180  do n = 1, this%nmawwells
1181  this%cmawname(n) = ''
1182  end do
1183  end if
1184  !
1185  ! -- copy boundname into boundname_cst
1186  call this%copy_boundname()
1187  !
1188  ! -- set pointer to gwf iss and gwf hk
1189  call mem_setptr(this%gwfiss, 'ISS', create_mem_path(this%name_model))
1190  call mem_setptr(this%gwfk11, 'K11', create_mem_path(this%name_model, 'NPF'))
1191  call mem_setptr(this%gwfk22, 'K22', create_mem_path(this%name_model, 'NPF'))
1192  call mem_setptr(this%gwfik22, 'IK22', create_mem_path(this%name_model, 'NPF'))
1193  call mem_setptr(this%gwfsat, 'SAT', create_mem_path(this%name_model, 'NPF'))
1194  !
1195  ! -- qa data
1196  call this%maw_check_attributes()
1197  !
1198  ! -- Calculate the saturated conductance
1199  do n = 1, this%nmawwells
1200  !
1201  ! -- calculate saturated conductance only if CONDUCTANCE was not
1202  ! specified for each maw-gwf connection (CONDUCTANCE keyword).
1203  do j = 1, this%ngwfnodes(n)
1204  if (this%ieqn(n) /= 0) then
1205  inode = this%get_gwfnode(n, j)
1206  call this%maw_calculate_satcond(n, j, inode)
1207  end if
1208  end do
1209  end do
1210  !
1211  ! -- write summary of static well data
1212  ! -- write well data
1213  if (this%iprpak /= 0) then
1214  ntabcols = 7
1215  if (this%inamedbound /= 0) then
1216  ntabcols = ntabcols + 1
1217  end if
1218  title = trim(adjustl(this%text))//' PACKAGE ('// &
1219  trim(adjustl(this%packName))//') STATIC WELL DATA'
1220  call table_cr(this%inputtab, this%packName, title)
1221  call this%inputtab%table_df(this%nmawwells, ntabcols, this%iout)
1222  text = 'NUMBER'
1223  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1224  text = 'RADIUS'
1225  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1226  text = 'AREA'
1227  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1228  text = 'WELL BOTTOM'
1229  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1230  text = 'STARTING HEAD'
1231  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1232  text = 'NUMBER OF GWF NODES'
1233  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1234  text = 'CONDUCT. EQUATION'
1235  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1236  if (this%inamedbound /= 0) then
1237  text = 'NAME'
1238  call this%inputtab%initialize_column(text, 20, alignment=tableft)
1239  end if
1240  do n = 1, this%nmawwells
1241  call this%inputtab%add_term(n)
1242  call this%inputtab%add_term(this%radius(n))
1243  call this%inputtab%add_term(this%area(n))
1244  call this%inputtab%add_term(this%bot(n))
1245  call this%inputtab%add_term(this%strt(n))
1246  call this%inputtab%add_term(this%ngwfnodes(n))
1247  call this%inputtab%add_term(ccond(this%ieqn(n)))
1248  if (this%inamedbound /= 0) then
1249  call this%inputtab%add_term(this%cmawname(n))
1250  end if
1251  end do
1252  end if
1253  !
1254  ! -- write well connection data
1255  if (this%iprpak /= 0) then
1256  ntabcols = 10
1257  title = trim(adjustl(this%text))//' PACKAGE ('// &
1258  trim(adjustl(this%packName))//') STATIC WELL CONNECTION DATA'
1259  call table_cr(this%inputtab, this%packName, title)
1260  call this%inputtab%table_df(this%maxbound, ntabcols, this%iout)
1261  text = 'NUMBER'
1262  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1263  text = 'WELL CONNECTION'
1264  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1265  text = 'CELLID'
1266  call this%inputtab%initialize_column(text, 20, alignment=tableft)
1267  text = 'TOP OF SCREEN'
1268  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1269  text = 'BOTTOM OF SCREEN'
1270  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1271  text = 'SKIN RADIUS'
1272  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1273  text = 'SKIN K'
1274  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1275  text = 'K11'
1276  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1277  text = 'K22'
1278  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1279  text = 'SATURATED WELL CONDUCT.'
1280  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1281  !
1282  ! -- write the data to the table
1283  do n = 1, this%nmawwells
1284  do j = 1, this%ngwfnodes(n)
1285  call this%inputtab%add_term(n)
1286  call this%inputtab%add_term(j)
1287  jpos = this%get_jpos(n, j)
1288  nn = this%get_gwfnode(n, j)
1289  call this%dis%noder_to_string(nn, nodestr)
1290  call this%inputtab%add_term(nodestr)
1291  call this%inputtab%add_term(this%topscrn(jpos))
1292  call this%inputtab%add_term(this%botscrn(jpos))
1293  if (this%ieqn(n) == 2 .or. &
1294  this%ieqn(n) == 3 .or. &
1295  this%ieqn(n) == 4) then
1296  call this%inputtab%add_term(this%sradius(jpos))
1297  call this%inputtab%add_term(this%hk(jpos))
1298  else
1299  call this%inputtab%add_term(' ')
1300  call this%inputtab%add_term(' ')
1301  end if
1302  if (this%ieqn(n) == 1 .or. &
1303  this%ieqn(n) == 2 .or. &
1304  this%ieqn(n) == 3) then
1305  k11 = this%gwfk11(nn)
1306  if (this%gwfik22 == 0) then
1307  k22 = this%gwfk11(nn)
1308  else
1309  k22 = this%gwfk22(nn)
1310  end if
1311  call this%inputtab%add_term(k11)
1312  call this%inputtab%add_term(k22)
1313  else
1314  call this%inputtab%add_term(' ')
1315  call this%inputtab%add_term(' ')
1316  end if
1317  call this%inputtab%add_term(this%satcond(jpos))
1318  end do
1319  end do
1320  end if
1321  !
1322  ! -- finished with pointer to gwf hydraulic conductivity
1323  this%gwfk11 => null()
1324  this%gwfk22 => null()
1325  this%gwfik22 => null()
1326  this%gwfsat => null()
1327  !
1328  ! -- check for any error conditions
1329  if (count_errors() > 0) then
1330  call store_error_unit(this%inunit)
1331  end if
Here is the call graph for this function:

◆ maw_read_options()

subroutine mawmodule::maw_read_options ( class(mawtype), intent(inout)  this,
character(len=*), intent(inout)  option,
logical, intent(inout)  found 
)

Overrides BndTypebnd_options

Definition at line 1651 of file gwf-maw.f90.

1653  use openspecmodule, only: access, form
1655  ! -- dummy
1656  class(MawType), intent(inout) :: this
1657  character(len=*), intent(inout) :: option
1658  logical, intent(inout) :: found
1659  ! -- local
1660  character(len=MAXCHARLEN) :: fname, keyword
1661  ! -- formats
1662  character(len=*), parameter :: fmtflowingwells = &
1663  &"(4x, 'FLOWING WELLS WILL BE SIMULATED.')"
1664  character(len=*), parameter :: fmtshutdown = &
1665  &"(4x, 'SHUTDOWN ', a, ' VALUE (',g15.7,') SPECIFIED.')"
1666  character(len=*), parameter :: fmtnostoragewells = &
1667  &"(4x, 'WELL STORAGE WILL NOT BE SIMULATED.')"
1668  character(len=*), parameter :: fmtmawbin = &
1669  "(4x, 'MAW ', 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, /4x, &
1670  &'OPENED ON UNIT: ', I0)"
1671  !
1672  ! -- Check for 'FLOWING_WELLS' and set this%iflowingwells
1673  found = .true.
1674  select case (option)
1675  case ('PRINT_HEAD')
1676  this%iprhed = 1
1677  write (this%iout, '(4x,a)') &
1678  trim(adjustl(this%text))//' heads will be printed to listing file.'
1679  case ('HEAD')
1680  call this%parser%GetStringCaps(keyword)
1681  if (keyword == 'FILEOUT') then
1682  call this%parser%GetString(fname)
1683  call assign_iounit(this%iheadout, this%inunit, "HEAD fileout")
1684  call openfile(this%iheadout, this%iout, fname, 'DATA(BINARY)', &
1685  form, access, 'REPLACE', mode_opt=mnormal)
1686  write (this%iout, fmtmawbin) 'HEAD', trim(adjustl(fname)), &
1687  this%iheadout
1688  else
1689  call store_error('Optional maw stage keyword must be '// &
1690  'followed by fileout.')
1691  end if
1692  case ('BUDGET')
1693  call this%parser%GetStringCaps(keyword)
1694  if (keyword == 'FILEOUT') then
1695  call this%parser%GetString(fname)
1696  call assign_iounit(this%ibudgetout, this%inunit, "BUDGET fileout")
1697  call openfile(this%ibudgetout, this%iout, fname, 'DATA(BINARY)', &
1698  form, access, 'REPLACE', mode_opt=mnormal)
1699  write (this%iout, fmtmawbin) 'BUDGET', trim(adjustl(fname)), &
1700  this%ibudgetout
1701  else
1702  call store_error('Optional maw budget keyword must be '// &
1703  'followed by fileout.')
1704  end if
1705  case ('BUDGETCSV')
1706  call this%parser%GetStringCaps(keyword)
1707  if (keyword == 'FILEOUT') then
1708  call this%parser%GetString(fname)
1709  call assign_iounit(this%ibudcsv, this%inunit, "BUDGETCSV fileout")
1710  call openfile(this%ibudcsv, this%iout, fname, 'CSV', &
1711  filstat_opt='REPLACE')
1712  write (this%iout, fmtmawbin) 'BUDGET CSV', trim(adjustl(fname)), &
1713  this%ibudcsv
1714  else
1715  call store_error('OPTIONAL BUDGETCSV KEYWORD MUST BE FOLLOWED BY &
1716  &FILEOUT')
1717  end if
1718  case ('FLOWING_WELLS')
1719  this%iflowingwells = 1
1720  write (this%iout, fmtflowingwells)
1721  case ('SHUTDOWN_THETA')
1722  this%theta = this%parser%GetDouble()
1723  write (this%iout, fmtshutdown) 'THETA', this%theta
1724  case ('SHUTDOWN_KAPPA')
1725  this%kappa = this%parser%GetDouble()
1726  write (this%iout, fmtshutdown) 'KAPPA', this%kappa
1727  case ('MOVER')
1728  this%imover = 1
1729  write (this%iout, '(4x,A)') 'MOVER OPTION ENABLED'
1730  case ('NO_WELL_STORAGE')
1731  this%imawissopt = 1
1732  write (this%iout, fmtnostoragewells)
1733  case ('FLOW_CORRECTION')
1734  this%correct_flow = .true.
1735  write (this%iout, '(4x,a,/,4x,a)') &
1736  'MAW-GWF FLOW CORRECTIONS WILL BE APPLIED WHEN MAW HEADS ARE BELOW', &
1737  'OR GWF HEADS IN CONNECTED CELLS ARE BELOW THE CELL BOTTOM.'
1738  case ('MAW_FLOW_REDUCE_CSV')
1739  call this%parser%GetStringCaps(keyword)
1740  if (keyword == 'FILEOUT') then
1741  call this%parser%GetString(fname)
1742  call this%maw_redflow_csv_init(fname)
1743  else
1744  call store_error('OPTIONAL MAW_FLOW_REDUCE_CSV KEYWORD MUST BE &
1745  &FOLLOWED BY FILEOUT')
1746  end if
1747  !
1748  ! -- right now these are options that are only available in the
1749  ! development version and are not included in the documentation.
1750  ! These options are only available when IDEVELOPMODE in
1751  ! constants module is set to 1
1752  case ('DEV_PEACEMAN_EFFECTIVE_RADIUS')
1753  call this%parser%DevOpt()
1754  this%ieffradopt = 1
1755  write (this%iout, '(4x,a)') &
1756  'EFFECTIVE RADIUS FOR STRUCTURED GRIDS WILL BE CALCULATED &
1757  &USING PEACEMAN 1983'
1758  case default
1759  !
1760  ! -- No options found
1761  found = .false.
1762  end select
@ mnormal
normal output mode
Definition: Constants.f90:206
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
integer(i4b), parameter maxcharlen
maximum length of char string
Definition: Constants.f90:47
subroutine, public assign_iounit(iounit, errunit, description)
@ brief assign io unit number
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
Here is the call graph for this function:

◆ maw_read_well_connections()

subroutine mawmodule::maw_read_well_connections ( class(mawtype), intent(inout)  this)

Definition at line 791 of file gwf-maw.f90.

792  use constantsmodule, only: linelength
793  ! -- dummy
794  class(MawType), intent(inout) :: this
795  ! -- local
796  character(len=LINELENGTH) :: cellid
797  character(len=30) :: nodestr
798  logical :: isfound
799  logical :: endOfBlock
800  integer(I4B) :: ierr
801  integer(I4B) :: ival
802  integer(I4B) :: j
803  integer(I4B) :: jj
804  integer(I4B) :: n
805  integer(I4B) :: nn
806  integer(I4B) :: nn2
807  integer(I4B) :: ipos
808  integer(I4B) :: jpos
809  integer(I4B) :: ireset_scrntop
810  integer(I4B) :: ireset_scrnbot
811  integer(I4B) :: ireset_wellbot
812  real(DP) :: rval
813  real(DP) :: topnn
814  real(DP) :: botnn
815  real(DP) :: botw
816  integer(I4B), dimension(:), pointer, contiguous :: nboundchk
817  integer(I4B), dimension(:), pointer, contiguous :: iachk
818  !
819  ! -- initialize counters
820  ireset_scrntop = 0
821  ireset_scrnbot = 0
822  ireset_wellbot = 0
823  !
824  ! -- allocate and initialize local storage
825  allocate (iachk(this%nmawwells + 1))
826  iachk(1) = 1
827  do n = 1, this%nmawwells
828  iachk(n + 1) = iachk(n) + this%ngwfnodes(n)
829  end do
830  allocate (nboundchk(this%maxbound))
831  do n = 1, this%maxbound
832  nboundchk(n) = 0
833  end do
834  !
835  ! -- get well_connections block
836  call this%parser%GetBlock('CONNECTIONDATA', isfound, ierr, &
837  supportopenclose=.true.)
838  !
839  ! -- parse well_connections block if detected
840  if (isfound) then
841  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text))// &
842  ' CONNECTIONDATA'
843  do
844  call this%parser%GetNextLine(endofblock)
845  if (endofblock) exit
846  !
847  ! -- well number
848  ival = this%parser%GetInteger()
849  n = ival
850  !
851  ! -- check for error condition
852  if (n < 1 .or. n > this%nmawwells) then
853  write (errmsg, '(a,1x,i0,a)') &
854  'IMAW must be greater than 0 and less than or equal to ', &
855  this%nmawwells, '.'
856  call store_error(errmsg)
857  cycle
858  end if
859  !
860  ! -- read connection number
861  ival = this%parser%GetInteger()
862  if (ival < 1 .or. ival > this%ngwfnodes(n)) then
863  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
864  'JCONN for well ', n, &
865  'must be greater than 1 and less than or equal to ', &
866  this%ngwfnodes(n), '.'
867  call store_error(errmsg)
868  cycle
869  end if
870 
871  ipos = iachk(n) + ival - 1
872  nboundchk(ipos) = nboundchk(ipos) + 1
873 
874  j = ival
875  jpos = this%get_jpos(n, ival)
876  !
877  ! -- read gwfnodes from the line
878  call this%parser%GetCellid(this%dis%ndim, cellid)
879  nn = this%dis%noder_from_cellid(cellid, this%inunit, this%iout)
880  topnn = this%dis%top(nn)
881  botnn = this%dis%bot(nn)
882  botw = this%bot(n)
883  !
884  ! -- set gwf node number for connection
885  this%gwfnodes(jpos) = nn
886  !
887  ! -- top of screen
888  rval = this%parser%GetDouble()
889  if (this%ieqn(n) /= 4) then
890  rval = topnn
891  else
892  if (rval > topnn) then
893  ireset_scrntop = ireset_scrntop + 1
894  rval = topnn
895  end if
896  end if
897  this%topscrn(jpos) = rval
898  !
899  ! -- bottom of screen
900  rval = this%parser%GetDouble()
901  if (this%ieqn(n) /= 4) then
902  rval = botnn
903  else
904  if (rval < botnn) then
905  ireset_scrnbot = ireset_scrnbot + 1
906  rval = botnn
907  end if
908  end if
909  this%botscrn(jpos) = rval
910  !
911  ! -- adjust the bottom of the well for all conductance approaches
912  ! except for "mean"
913  if (rval < botw) then
914  if (this%ieqn(n) /= 4) then
915  ireset_wellbot = ireset_wellbot + 1
916  botw = rval
917  this%bot(n) = rval
918  else
919  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a,g0,a)') &
920  'Screen bottom for maw well', n, 'connection', j, '(', &
921  this%botscrn(jpos), ') is less than the well bottom (', &
922  this%bot(n), ').'
923  call store_error(errmsg)
924  end if
925  end if
926  !
927  ! -- hydraulic conductivity or conductance
928  rval = this%parser%GetDouble()
929  if (this%ieqn(n) == 0) then
930  this%satcond(jpos) = rval
931  else if (this%ieqn(n) == 2 .OR. this%ieqn(n) == 3 .OR. &
932  this%ieqn(n) == 4) then
933  this%hk(jpos) = rval
934  end if
935  !
936  ! -- skin radius
937  rval = this%parser%GetDouble()
938  if (this%ieqn(n) == 2 .OR. this%ieqn(n) == 3 .OR. &
939  this%ieqn(n) == 4) then
940  this%sradius(jpos) = rval
941  if (this%sradius(jpos) <= this%radius(n)) then
942  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a,g0,a)') &
943  'Screen radius for maw well', n, 'connection', j, '(', &
944  this%sradius(jpos), &
945  ') is less than or equal to the well radius (', &
946  this%radius(n), ').'
947  call store_error(errmsg)
948  end if
949  end if
950  end do
951  write (this%iout, '(1x,a)') &
952  'END OF '//trim(adjustl(this%text))//' CONNECTIONDATA'
953 
954  ipos = 0
955  do n = 1, this%nmawwells
956  do j = 1, this%ngwfnodes(n)
957  ipos = ipos + 1
958  !
959  ! -- check for missing or duplicate maw well connections
960  if (nboundchk(ipos) == 0) then
961  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
962  'No data specified for maw well', n, 'connection', j, '.'
963  call store_error(errmsg)
964  else if (nboundchk(ipos) > 1) then
965  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,1x,i0,1x,a)') &
966  'Data for maw well', n, 'connection', j, &
967  'specified', nboundchk(n), 'times.'
968  call store_error(errmsg)
969  end if
970  end do
971  end do
972  !
973  ! -- make sure that more than one connection per cell is only specified
974  ! wells using the mean conducance type
975  do n = 1, this%nmawwells
976  if (this%ieqn(n) /= 4) then
977  do j = 1, this%ngwfnodes(n)
978  nn = this%get_gwfnode(n, j)
979  do jj = 1, this%ngwfnodes(n)
980  !
981  ! -- skip current maw node
982  if (jj == j) then
983  cycle
984  end if
985  nn2 = this%get_gwfnode(n, jj)
986  if (nn2 == nn) then
987  call this%dis%noder_to_string(nn, nodestr)
988  write (errmsg, '(a,1x,i0,1x,a,1x,i0,3(1x,a))') &
989  'Only one connection can be specified for maw well', &
990  n, 'connection', j, 'to gwf cell', trim(adjustl(nodestr)), &
991  'unless the mean condeqn is specified.'
992  call store_error(errmsg)
993  end if
994  end do
995  end do
996  end if
997  end do
998  else
999  call store_error('Required connectiondata block not found.')
1000  end if
1001  !
1002  ! -- deallocate local variable
1003  deallocate (iachk)
1004  deallocate (nboundchk)
1005  !
1006  ! -- add warning messages
1007  if (ireset_scrntop > 0) then
1008  write (warnmsg, '(a,1x,a,1x,a,1x,i0,1x,a)') &
1009  'The screen tops in multi-aquifer well package', trim(this%packName), &
1010  'were reset to the top of the connected cell', ireset_scrntop, 'times.'
1011  call store_warning(warnmsg)
1012  end if
1013  if (ireset_scrnbot > 0) then
1014  write (warnmsg, '(a,1x,a,1x,a,1x,i0,1x,a)') &
1015  'The screen bottoms in multi-aquifer well package', trim(this%packName), &
1016  'were reset to the bottom of the connected cell', ireset_scrnbot, &
1017  'times.'
1018  call store_warning(warnmsg)
1019  end if
1020  if (ireset_wellbot > 0) then
1021  write (warnmsg, '(a,1x,a,1x,a,1x,i0,1x,a)') &
1022  'The well bottoms in multi-aquifer well package', trim(this%packName), &
1023  'were reset to the bottom of the connected cell', ireset_wellbot, &
1024  'times.'
1025  call store_warning(warnmsg)
1026  end if
1027  !
1028  ! -- write summary of maw well_connection error messages
1029  if (count_errors() > 0) then
1030  call this%parser%StoreErrorUnit()
1031  end if
Here is the call graph for this function:

◆ maw_read_wells()

subroutine mawmodule::maw_read_wells ( class(mawtype), intent(inout)  this)

Definition at line 533 of file gwf-maw.f90.

534  use constantsmodule, only: linelength
536  ! -- dummy
537  class(MawType), intent(inout) :: this
538  ! -- local
539  character(len=LINELENGTH) :: text
540  character(len=LINELENGTH) :: keyword
541  character(len=LINELENGTH) :: cstr
542  character(len=LENBOUNDNAME) :: bndName
543  character(len=LENBOUNDNAME) :: bndNameTemp
544  character(len=9) :: cno
545  logical :: isfound
546  logical :: endOfBlock
547  integer(I4B) :: ival
548  integer(I4B) :: n
549  integer(I4B) :: j
550  integer(I4B) :: ii
551  integer(I4B) :: jj
552  integer(I4B) :: ieqn
553  integer(I4B) :: itmp
554  integer(I4B) :: ierr
555  integer(I4B) :: idx
556  real(DP) :: rval
557  real(DP), pointer :: bndElem => null()
558  ! -- local allocatable arrays
559  character(len=LINELENGTH), dimension(:), allocatable :: strttext
560  character(len=LENBOUNDNAME), dimension(:), allocatable :: nametxt
561  character(len=50), dimension(:, :), allocatable :: caux
562  integer(I4B), dimension(:), allocatable :: nboundchk
563  integer(I4B), dimension(:), allocatable :: wellieqn
564  integer(I4B), dimension(:), allocatable :: ngwfnodes
565  real(DP), dimension(:), allocatable :: radius
566  real(DP), dimension(:), allocatable :: bottom
567  ! -- format
568  character(len=*), parameter :: fmthdbot = &
569  "('well head (', G0, ') must be greater than or equal to the &
570  &BOTTOM_ELEVATION (', G0, ').')"
571  !
572  ! -- allocate and initialize temporary variables
573  allocate (strttext(this%nmawwells))
574  allocate (nametxt(this%nmawwells))
575  if (this%naux > 0) then
576  allocate (caux(this%naux, this%nmawwells))
577  end if
578  allocate (nboundchk(this%nmawwells))
579  allocate (wellieqn(this%nmawwells))
580  allocate (ngwfnodes(this%nmawwells))
581  allocate (radius(this%nmawwells))
582  allocate (bottom(this%nmawwells))
583  !
584  ! -- initialize temporary variables
585  do n = 1, this%nmawwells
586  nboundchk(n) = 0
587  end do
588  !
589  ! -- initialize itmp
590  itmp = 0
591  !
592  ! -- set npakeq to nmawwells
593  this%npakeq = this%nmawwells
594  !
595  ! -- read maw well data
596  ! -- get wells block
597  call this%parser%GetBlock('PACKAGEDATA', isfound, ierr, &
598  supportopenclose=.true.)
599  !
600  ! -- parse locations block if detected
601  if (isfound) then
602  write (this%iout, '(/1x,a)') &
603  'PROCESSING '//trim(adjustl(this%text))//' PACKAGEDATA'
604  do
605  call this%parser%GetNextLine(endofblock)
606  if (endofblock) exit
607  ival = this%parser%GetInteger()
608  n = ival
609 
610  if (n < 1 .or. n > this%nmawwells) then
611  write (errmsg, '(a,1x,i0,a)') &
612  'IMAW must be greater than 0 and less than or equal to', &
613  this%nmawwells, '.'
614  call store_error(errmsg)
615  cycle
616  end if
617  !
618  ! -- increment nboundchk
619  nboundchk(n) = nboundchk(n) + 1
620  !
621  ! -- radius
622  rval = this%parser%GetDouble()
623  if (rval <= dzero) then
624  write (errmsg, '(a,1x,i0,1x,a)') &
625  'Radius for well', n, 'must be greater than zero.'
626  call store_error(errmsg)
627  end if
628  radius(n) = rval
629  !
630  ! -- well bottom
631  bottom(n) = this%parser%GetDouble()
632  !
633  ! -- strt
634  call this%parser%GetString(strttext(n))
635  !
636  ! -- ieqn
637  call this%parser%GetStringCaps(keyword)
638  if (keyword == 'SPECIFIED') then
639  ieqn = 0
640  else if (keyword == 'THIEM') then
641  ieqn = 1
642  else if (keyword == 'THEIM') then ! # codespell:ignore
643  ieqn = 1
644  write (warnmsg, '(a,a,a,a,a,a)') &
645  "CONDEQN in '", trim(this%packName), "' should be ", &
646  "corrected from '", trim(keyword), "' to 'THIEM'."
647  call store_warning(warnmsg)
648  else if (keyword == 'SKIN') then
649  ieqn = 2
650  else if (keyword == 'CUMULATIVE') then
651  ieqn = 3
652  else if (keyword == 'MEAN') then
653  ieqn = 4
654  else
655  write (errmsg, '(a,1x,i0,1x,a)') &
656  'CONDEQN for well', n, &
657  "must be 'CUMULATIVE', 'THIEM', 'MEAN', or 'SKIN'."
658  end if
659  wellieqn(n) = ieqn
660  !
661  ! -- ngwnodes
662  ival = this%parser%GetInteger()
663  if (ival < 1) then
664  ival = 0
665  write (errmsg, '(a,1x,i0,1x,a)') &
666  'NGWFNODES for well', n, 'must be greater than zero.'
667  call store_error(errmsg)
668  end if
669 
670  if (ival > 0) then
671  ngwfnodes(n) = ival
672  end if
673  !
674  ! -- increment maxbound
675  itmp = itmp + ival
676  !
677  ! -- get aux data
678  do jj = 1, this%naux
679  call this%parser%GetString(caux(jj, n))
680  end do
681  !
682  ! -- set default bndName
683  write (cno, '(i9.9)') n
684  bndname = 'MAWWELL'//cno
685  !
686  ! -- read well name
687  if (this%inamedbound /= 0) then
688  call this%parser%GetStringCaps(bndnametemp)
689  if (bndnametemp /= '') then
690  bndname = bndnametemp
691  end if
692  end if
693  nametxt(n) = bndname
694  end do
695 
696  write (this%iout, '(1x,a)') &
697  'END OF '//trim(adjustl(this%text))//' PACKAGEDATA'
698  !
699  ! -- check for duplicate or missing wells
700  do n = 1, this%nmawwells
701  if (nboundchk(n) == 0) then
702  write (errmsg, '(a,1x,i0,a)') 'No data specified for maw well', n, '.'
703  call store_error(errmsg)
704  else if (nboundchk(n) > 1) then
705  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a)') &
706  'Data for maw well', n, 'specified', nboundchk(n), 'times.'
707  call store_error(errmsg)
708  end if
709  end do
710  else
711  call store_error('Required packagedata block not found.')
712  end if
713  !
714  ! -- terminate if any errors were detected
715  if (count_errors() > 0) then
716  call this%parser%StoreErrorUnit()
717  end if
718  !
719  ! -- set MAXBOUND
720  this%maxbound = itmp
721  write (this%iout, '(//4x,a,i7)') 'MAXBOUND = ', this%maxbound
722  !
723  ! -- allocate well and connection data
724  call this%maw_allocate_well_conn_arrays()
725  !
726  ! -- fill well data with data stored in temporary local arrays
727  do n = 1, this%nmawwells
728  rval = radius(n)
729  this%radius(n) = rval
730  this%area(n) = dpi * rval**dtwo
731  this%bot(n) = bottom(n)
732  this%ieqn(n) = wellieqn(n)
733  this%ngwfnodes(n) = ngwfnodes(n)
734  this%cmawname(n) = nametxt(n)
735  !
736  ! fill timeseries aware data
737  !
738  ! -- well_head and strt
739  jj = 1 ! For WELL_HEAD
740  bndelem => this%well_head(n)
741  call read_value_or_time_series_adv(strttext(n), n, jj, bndelem, &
742  this%packName, 'BND', this%tsManager, &
743  this%iprpak, 'WELL_HEAD')
744  !
745  ! -- set starting head value
746  this%strt(n) = this%well_head(n)
747  !
748  ! -- check for error condition
749  if (this%strt(n) < this%bot(n)) then
750  write (cstr, fmthdbot) this%strt(n), this%bot(n)
751  call this%maw_set_attribute_error(n, 'STRT', trim(cstr))
752  end if
753  !
754  ! -- fill aux data
755  do jj = 1, this%naux
756  text = caux(jj, n)
757  ii = n
758  bndelem => this%mauxvar(jj, ii)
759  call read_value_or_time_series_adv(text, ii, jj, bndelem, this%packName, &
760  'AUX', this%tsManager, this%iprpak, &
761  this%auxname(jj))
762  end do
763  end do
764  !
765  ! -- set iaconn and imap for each connection
766  idx = 0
767  this%iaconn(1) = 1
768  do n = 1, this%nmawwells
769  do j = 1, this%ngwfnodes(n)
770  idx = idx + 1
771  this%imap(idx) = n
772  end do
773  this%iaconn(n + 1) = idx + 1
774  end do
775  !
776  ! -- deallocate local storage
777  deallocate (strttext)
778  deallocate (nametxt)
779  if (this%naux > 0) then
780  deallocate (caux)
781  end if
782  deallocate (nboundchk)
783  deallocate (wellieqn)
784  deallocate (ngwfnodes)
785  deallocate (radius)
786  deallocate (bottom)
subroutine, public read_value_or_time_series_adv(textInput, ii, jj, bndElem, pkgName, auxOrBnd, tsManager, iprpak, varName)
Call this subroutine from advanced packages to define timeseries link for a variable (varName).
Here is the call graph for this function:

◆ maw_redflow_csv_init()

subroutine mawmodule::maw_redflow_csv_init ( class(mawtype), intent(inout)  this,
character(len=*), intent(in)  fname 
)
private
Parameters
[in,out]thisMawType object

Definition at line 3315 of file gwf-maw.f90.

3316  ! -- dummy variables
3317  class(MawType), intent(inout) :: this !< MawType object
3318  character(len=*), intent(in) :: fname
3319  ! -- format
3320  character(len=*), parameter :: fmtredflowcsv = &
3321  "(4x, 'MAW REDUCED FLOW INFORMATION WILL BE SAVED TO FILE: ', a, /4x, &
3322  &'OPENED ON UNIT: ', I0)"
3323 
3324  this%ioutredflowcsv = getunit()
3325  call openfile(this%ioutredflowcsv, this%iout, fname, 'CSV', &
3326  filstat_opt='REPLACE')
3327  write (this%iout, fmtredflowcsv) trim(adjustl(fname)), &
3328  this%ioutredflowcsv
3329  write (this%ioutredflowcsv, '(a)') &
3330  'time,period,step,MAWnumber,rate-requested,rate-actual,maw-reduction'
Here is the call graph for this function:

◆ maw_redflow_csv_write()

subroutine mawmodule::maw_redflow_csv_write ( class(mawtype), intent(inout)  this)
private
Parameters
[in,out]thisMawType object

Definition at line 3335 of file gwf-maw.f90.

3336  ! -- modules
3337  use tdismodule, only: totim, kstp, kper
3338  ! -- dummy variables
3339  class(MawType), intent(inout) :: this !< MawType object
3340  ! -- local
3341  integer(I4B) :: n
3342  !integer(I4B) :: nodereduced
3343  !integer(I4B) :: nodeuser
3344  real(DP) :: v
3345  ! -- format
3346  do n = 1, this%nmawwells
3347  !
3348  ! -- test if node is constant or inactive
3349  if (this%status(n) .ne. 'ACTIVE') then
3350  cycle
3351  end if
3352  v = this%rate(n) - this%ratesim(n) !reductions in extraction will be negative and reductions in injection will be positive; follows convention of WEL AUTO_FLOW_REDUCE_CSV
3353  if (abs(v) > dem9) then !need to check absolute value of difference for both extraction and injection; using 1e-9 as epsilon value but could be tweaked
3354  write (this%ioutredflowcsv, '(*(G0,:,","))') &
3355  totim, kper, kstp, n, this%rate(n), this%ratesim(n), v
3356  end if
3357  end do

◆ maw_rp()

subroutine mawmodule::maw_rp ( class(mawtype), intent(inout)  this)
private

Read itmp and new boundaries if itmp > 0

Definition at line 1799 of file gwf-maw.f90.

1800  use constantsmodule, only: linelength
1801  use tdismodule, only: kper, nper
1802  ! -- dummy
1803  class(MawType), intent(inout) :: this
1804  ! -- local
1805  character(len=LINELENGTH) :: title
1806  character(len=LINELENGTH) :: line
1807  character(len=LINELENGTH) :: text
1808  character(len=16) :: csteady
1809  logical :: isfound
1810  logical :: endOfBlock
1811  integer(I4B) :: ierr
1812  integer(I4B) :: node
1813  integer(I4B) :: n
1814  integer(I4B) :: ntabcols
1815  integer(I4B) :: ntabrows
1816  integer(I4B) :: imaw
1817  integer(I4B) :: ibnd
1818  integer(I4B) :: j
1819  integer(I4B) :: jpos
1820  integer(I4B) :: iheadlimit_warning
1821  ! -- formats
1822  character(len=*), parameter :: fmtblkerr = &
1823  &"('Looking for BEGIN PERIOD iper. Found ', a, ' instead.')"
1824  character(len=*), parameter :: fmtlsp = &
1825  &"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
1826  !
1827  ! -- initialize counters
1828  iheadlimit_warning = 0
1829  !
1830  ! -- set steady-state flag based on gwfiss
1831  this%imawiss = this%gwfiss
1832  !
1833  ! -- reset maw steady flag if 'STEADY-STATE' specified in the OPTIONS block
1834  if (this%imawissopt == 1) then
1835  this%imawiss = 1
1836  end if
1837  !
1838  ! -- set nbound to maxbound
1839  this%nbound = this%maxbound
1840  !
1841  ! -- Set ionper to the stress period number for which a new block of data
1842  ! will be read.
1843  if (this%inunit == 0) return
1844  !
1845  ! -- get stress period data
1846  if (this%ionper < kper) then
1847  !
1848  ! -- get period block
1849  call this%parser%GetBlock('PERIOD', isfound, ierr, &
1850  supportopenclose=.true., &
1851  blockrequired=.false.)
1852  if (isfound) then
1853  !
1854  ! -- read ionper and check for increasing period numbers
1855  call this%read_check_ionper()
1856  else
1857  !
1858  ! -- PERIOD block not found
1859  if (ierr < 0) then
1860  ! -- End of file found; data applies for remainder of simulation.
1861  this%ionper = nper + 1
1862  else
1863  ! -- Found invalid block
1864  call this%parser%GetCurrentLine(line)
1865  write (errmsg, fmtblkerr) adjustl(trim(line))
1866  call store_error(errmsg, terminate=.true.)
1867  end if
1868  end if
1869  end if
1870  !
1871  ! -- Read data if ionper == kper
1872  if (this%ionper == kper) then
1873  !
1874  ! -- setup table for period data
1875  if (this%iprpak /= 0) then
1876  !
1877  ! -- reset the input table object
1878  title = trim(adjustl(this%text))//' PACKAGE ('// &
1879  trim(adjustl(this%packName))//') DATA FOR PERIOD'
1880  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
1881  call table_cr(this%inputtab, this%packName, title)
1882  call this%inputtab%table_df(1, 5, this%iout, finalize=.false.)
1883  text = 'NUMBER'
1884  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1885  text = 'KEYWORD'
1886  call this%inputtab%initialize_column(text, 20, alignment=tableft)
1887  do n = 1, 3
1888  write (text, '(a,1x,i6)') 'VALUE', n
1889  call this%inputtab%initialize_column(text, 15, alignment=tabcenter)
1890  end do
1891  end if
1892  !
1893  ! -- set flag to check attributes
1894  this%check_attr = 1
1895  do
1896  call this%parser%GetNextLine(endofblock)
1897  if (endofblock) exit
1898 
1899  imaw = this%parser%GetInteger()
1900  if (imaw < 1 .or. imaw > this%nmawwells) then
1901  write (errmsg, '(2(a,1x),i0,a)') &
1902  'IMAW must be greater than 0 and', &
1903  'less than or equal to ', this%nmawwells, '.'
1904  call store_error(errmsg)
1905  cycle
1906  end if
1907  !
1908  ! -- set stress period data
1909  call this%maw_set_stressperiod(imaw, iheadlimit_warning)
1910  !
1911  ! -- write line to table
1912  if (this%iprpak /= 0) then
1913  call this%parser%GetCurrentLine(line)
1914  call this%inputtab%line_to_columns(line)
1915  end if
1916  end do
1917  if (this%iprpak /= 0) then
1918  call this%inputtab%finalize_table()
1919  end if
1920  !
1921  ! -- using data from the last stress period
1922  else
1923  write (this%iout, fmtlsp) trim(this%filtyp)
1924  end if
1925  !
1926  ! -- issue warning messages
1927  if (iheadlimit_warning > 0) then
1928  write (warnmsg, '(a,a,a,1x,a,1x,a)') &
1929  "HEAD_LIMIT in '", trim(this%packName), "' was below the well bottom", &
1930  "for one or more multi-aquifer well(s). This may result in", &
1931  "convergence failures for some models."
1932  call store_warning(warnmsg, substring=warnmsg(:50))
1933  end if
1934  !
1935  ! -- write summary of maw well stress period error messages
1936  if (count_errors() > 0) then
1937  call this%parser%StoreErrorUnit()
1938  end if
1939  !
1940  ! -- qa data if necessary
1941  if (this%check_attr /= 0) then
1942  call this%maw_check_attributes()
1943 
1944  ! -- write summary of stress period data for MAW
1945  if (this%iprpak == 1) then
1946  if (this%imawiss /= 0) then
1947  csteady = 'STEADY-STATE '
1948  else
1949  csteady = 'TRANSIENT '
1950  end if
1951  !
1952  ! -- reset the input table object for rate data
1953  title = trim(adjustl(this%text))//' PACKAGE ('// &
1954  trim(adjustl(this%packName))//') '//trim(adjustl(csteady))// &
1955  ' RATE DATA FOR PERIOD'
1956  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
1957  ntabcols = 6
1958  call table_cr(this%inputtab, this%packName, title)
1959  call this%inputtab%table_df(this%nmawwells, ntabcols, this%iout)
1960  text = 'NUMBER'
1961  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1962  text = 'STATUS'
1963  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
1964  text = 'RATE'
1965  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
1966  text = 'SPECIFIED HEAD'
1967  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
1968  text = 'PUMP ELEVATION'
1969  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
1970  text = 'REDUCTION LENGTH'
1971  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
1972  do n = 1, this%nmawwells
1973  call this%inputtab%add_term(n)
1974  call this%inputtab%add_term(this%status(n))
1975  call this%inputtab%add_term(this%rate(n))
1976  if (this%iboundpak(n) < 0) then
1977  call this%inputtab%add_term(this%well_head(n))
1978  else
1979  call this%inputtab%add_term(' ')
1980  end if
1981  call this%inputtab%add_term(this%pumpelev(n))
1982  if (this%reduction_length(n) /= dep20) then
1983  call this%inputtab%add_term(this%reduction_length(n))
1984  else
1985  call this%inputtab%add_term(' ')
1986  end if
1987  end do
1988  !
1989  ! -- flowing wells
1990  if (this%iflowingwells > 0) then
1991  !
1992  ! -- reset the input table object for flowing well data
1993  title = trim(adjustl(this%text))//' PACKAGE ('// &
1994  trim(adjustl(this%packName))//') '//trim(adjustl(csteady))// &
1995  ' FLOWING WELL DATA FOR PERIOD'
1996  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
1997  ntabcols = 4
1998  ntabrows = 0
1999  do n = 1, this%nmawwells
2000  if (this%fwcond(n) > dzero) then
2001  ntabrows = ntabrows + 1
2002  end if
2003  end do
2004  if (ntabrows > 0) then
2005  call table_cr(this%inputtab, this%packName, title)
2006  call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
2007  text = 'NUMBER'
2008  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
2009  text = 'ELEVATION'
2010  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2011  text = 'CONDUCT.'
2012  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2013  text = 'REDUCTION LENGTH'
2014  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2015  do n = 1, this%nmawwells
2016  if (this%fwcond(n) > dzero) then
2017  call this%inputtab%add_term(n)
2018  call this%inputtab%add_term(this%fwelev(n))
2019  call this%inputtab%add_term(this%fwcond(n))
2020  call this%inputtab%add_term(this%fwrlen(n))
2021  end if
2022  end do
2023  end if
2024  end if
2025  !
2026  ! -- reset the input table object for shutoff data
2027  title = trim(adjustl(this%text))//' PACKAGE ('// &
2028  trim(adjustl(this%packName))//') '//trim(adjustl(csteady))// &
2029  ' WELL SHUTOFF DATA FOR PERIOD'
2030  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
2031  ntabcols = 4
2032  ntabrows = 0
2033  do n = 1, this%nmawwells
2034  if (this%shutofflevel(n) /= dep20) then
2035  ntabrows = ntabrows + 1
2036  end if
2037  end do
2038  if (ntabrows > 0) then
2039  call table_cr(this%inputtab, this%packName, title)
2040  call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
2041  text = 'NUMBER'
2042  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
2043  text = 'ELEVATION'
2044  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2045  text = 'MINIMUM. Q'
2046  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2047  text = 'MAXIMUM Q'
2048  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2049  do n = 1, this%nmawwells
2050  if (this%shutofflevel(n) /= dep20) then
2051  call this%inputtab%add_term(n)
2052  call this%inputtab%add_term(this%shutofflevel(n))
2053  call this%inputtab%add_term(this%shutoffmin(n))
2054  call this%inputtab%add_term(this%shutoffmax(n))
2055  end if
2056  end do
2057  end if
2058  end if
2059  end if
2060  !
2061  ! -- fill arrays
2062  ibnd = 1
2063  do n = 1, this%nmawwells
2064  do j = 1, this%ngwfnodes(n)
2065  jpos = this%get_jpos(n, j)
2066  node = this%get_gwfnode(n, j)
2067  this%nodelist(ibnd) = node
2068  this%bound(1, ibnd) = this%xnewpak(n)
2069  this%bound(2, ibnd) = this%satcond(jpos)
2070  this%bound(3, ibnd) = this%botscrn(jpos)
2071  if (this%iboundpak(n) > 0) then
2072  this%bound(4, ibnd) = this%rate(n)
2073  else
2074  this%bound(4, ibnd) = dzero
2075  end if
2076  ibnd = ibnd + 1
2077  end do
2078  end do
integer(i4b), pointer, public nper
number of stress period
Definition: tdis.f90:21
Here is the call graph for this function:

◆ maw_rp_obs()

subroutine mawmodule::maw_rp_obs ( class(mawtype), intent(inout)  this)
private

Only done the first stress period since boundaries are fixed for the simulation

Definition at line 3135 of file gwf-maw.f90.

3136  use tdismodule, only: kper
3137  ! -- dummy
3138  class(MawType), intent(inout) :: this
3139  ! -- local
3140  integer(I4B) :: i
3141  integer(I4B) :: j
3142  integer(I4B) :: n
3143  integer(I4B) :: nn1
3144  integer(I4B) :: nn2
3145  integer(I4B) :: jj
3146  character(len=LENBOUNDNAME) :: bname
3147  logical :: jfound
3148  class(ObserveType), pointer :: obsrv => null()
3149  ! -- formats
3150 10 format('Boundary "', a, '" for observation "', a, &
3151  '" is invalid in package "', a, '"')
3152  !
3153  if (kper == 1) then
3154  do i = 1, this%obs%npakobs
3155  obsrv => this%obs%pakobs(i)%obsrv
3156  !
3157  ! -- get node number 1
3158  nn1 = obsrv%NodeNumber
3159  if (nn1 == namedboundflag) then
3160  bname = obsrv%FeatureName
3161  if (bname /= '') then
3162  ! -- Observation maw is based on a boundary name.
3163  ! Iterate through all multi-aquifer wells to identify and store
3164  ! corresponding index in bound array.
3165  jfound = .false.
3166  if (obsrv%ObsTypeId == 'MAW' .or. &
3167  obsrv%ObsTypeId == 'CONDUCTANCE') then
3168  do j = 1, this%nmawwells
3169  do jj = this%iaconn(j), this%iaconn(j + 1) - 1
3170  if (this%boundname(jj) == bname) then
3171  jfound = .true.
3172  call obsrv%AddObsIndex(jj)
3173  end if
3174  end do
3175  end do
3176  else
3177  do j = 1, this%nmawwells
3178  if (this%cmawname(j) == bname) then
3179  jfound = .true.
3180  call obsrv%AddObsIndex(j)
3181  end if
3182  end do
3183  end if
3184  if (.not. jfound) then
3185  write (errmsg, 10) &
3186  trim(bname), trim(obsrv%Name), trim(this%packName)
3187  call store_error(errmsg)
3188  end if
3189  end if
3190  else
3191  if (obsrv%indxbnds_count == 0) then
3192  if (obsrv%ObsTypeId == 'MAW' .or. &
3193  obsrv%ObsTypeId == 'CONDUCTANCE') then
3194  nn2 = obsrv%NodeNumber2
3195  j = this%iaconn(nn1) + nn2 - 1
3196  call obsrv%AddObsIndex(j)
3197  else
3198  call obsrv%AddObsIndex(nn1)
3199  end if
3200  else
3201  errmsg = 'Programming error in maw_rp_obs'
3202  call store_error(errmsg)
3203  end if
3204  end if
3205  !
3206  ! -- catch non-cumulative observation assigned to observation defined
3207  ! by a boundname that is assigned to more than one element
3208  if (obsrv%ObsTypeId == 'HEAD') then
3209  if (obsrv%indxbnds_count > 1) then
3210  write (errmsg, '(a,3(1x,a))') &
3211  trim(adjustl(obsrv%ObsTypeId)), &
3212  'for observation', trim(adjustl(obsrv%Name)), &
3213  'must be assigned to a multi-aquifer well with a unique boundname.'
3214  call store_error(errmsg)
3215  end if
3216  end if
3217  !
3218  ! -- check that index values are valid
3219  if (obsrv%ObsTypeId == 'MAW' .or. &
3220  obsrv%ObsTypeId == 'CONDUCTANCE') then
3221  do j = 1, obsrv%indxbnds_count
3222  nn1 = obsrv%indxbnds(j)
3223  n = this%imap(nn1)
3224  nn2 = nn1 - this%iaconn(n) + 1
3225  jj = this%iaconn(n + 1) - this%iaconn(n)
3226  if (nn1 < 1 .or. nn1 > this%maxbound) then
3227  write (errmsg, '(3(a,1x),i0,1x,a,i0,a)') &
3228  trim(adjustl(obsrv%ObsTypeId)), &
3229  'multi-aquifer well connection number must be greater than 0', &
3230  'and less than', jj, '(specified value is ', nn2, ').'
3231  call store_error(errmsg)
3232  end if
3233  end do
3234  else
3235  do j = 1, obsrv%indxbnds_count
3236  nn1 = obsrv%indxbnds(j)
3237  if (nn1 < 1 .or. nn1 > this%nmawwells) then
3238  write (errmsg, '(3(a,1x),i0,1x,a,i0,a)') &
3239  trim(adjustl(obsrv%ObsTypeId)), &
3240  'multi-aquifer well must be greater than 0 ', &
3241  'and less than or equal to', this%nmawwells, &
3242  '(specified value is ', nn1, ').'
3243  call store_error(errmsg)
3244  end if
3245  end do
3246  end if
3247  end do
3248  !
3249  ! -- evaluate if there are any observation errors
3250  if (count_errors() > 0) then
3251  call store_error_unit(this%inunit)
3252  end if
3253  end if
Here is the call graph for this function:

◆ maw_set_attribute_error()

subroutine mawmodule::maw_set_attribute_error ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  imaw,
character(len=*), intent(in)  keyword,
character(len=*), intent(in)  msg 
)

Definition at line 1468 of file gwf-maw.f90.

1469  use simmodule, only: store_error
1470  ! -- dummy
1471  class(MawType), intent(inout) :: this
1472  integer(I4B), intent(in) :: imaw
1473  character(len=*), intent(in) :: keyword
1474  character(len=*), intent(in) :: msg
1475  ! -- local
1476  ! -- formats
1477  !
1478  if (len(msg) == 0) then
1479  write (errmsg, '(a,1x,a,1x,i0,1x,a)') &
1480  keyword, ' for MAW well', imaw, 'has already been set.'
1481  else
1482  write (errmsg, '(a,1x,a,1x,i0,1x,a)') &
1483  keyword, ' for MAW well', imaw, msg
1484  end if
1485  call store_error(errmsg)
Here is the call graph for this function:

◆ maw_set_pointers()

subroutine mawmodule::maw_set_pointers ( class(mawtype this,
integer(i4b), pointer  neq,
integer(i4b), dimension(:), pointer, contiguous  ibound,
real(dp), dimension(:), pointer, contiguous  xnew,
real(dp), dimension(:), pointer, contiguous  xold,
real(dp), dimension(:), pointer, contiguous  flowja 
)
private

Definition at line 2884 of file gwf-maw.f90.

2885  ! -- modules
2887  ! -- dummy
2888  class(MawType) :: this
2889  integer(I4B), pointer :: neq
2890  integer(I4B), dimension(:), pointer, contiguous :: ibound
2891  real(DP), dimension(:), pointer, contiguous :: xnew
2892  real(DP), dimension(:), pointer, contiguous :: xold
2893  real(DP), dimension(:), pointer, contiguous :: flowja
2894  ! -- local
2895  integer(I4B) :: n
2896  integer(I4B) :: istart, iend
2897  !
2898  ! -- call base BndType set_pointers
2899  call this%BndType%set_pointers(neq, ibound, xnew, xold, flowja)
2900  !
2901  ! -- Set the MAW pointers
2902  !
2903  ! -- set package pointers
2904  istart = this%dis%nodes + this%ioffset + 1
2905  iend = istart + this%nmawwells - 1
2906  this%iboundpak => this%ibound(istart:iend)
2907  this%xnewpak => this%xnew(istart:iend)
2908  call mem_checkin(this%xnewpak, 'HEAD', this%memoryPath, 'X', &
2909  this%memoryPathModel)
2910  call mem_allocate(this%xoldpak, this%nmawwells, 'XOLDPAK', this%memoryPath)
2911  !
2912  ! -- initialize xnewpak
2913  do n = 1, this%nmawwells
2914  this%xnewpak(n) = dep20
2915  end do

◆ maw_set_stressperiod()

subroutine mawmodule::maw_set_stressperiod ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  imaw,
integer(i4b), intent(inout)  iheadlimit_warning 
)

Definition at line 1336 of file gwf-maw.f90.

1337  ! -- modules
1339  ! -- dummy
1340  class(MawType), intent(inout) :: this
1341  integer(I4B), intent(in) :: imaw
1342  integer(I4B), intent(inout) :: iheadlimit_warning
1343  ! -- local
1344  character(len=LINELENGTH) :: errmsgr
1345  character(len=LINELENGTH) :: text
1346  character(len=LINELENGTH) :: cstr
1347  character(len=LINELENGTH) :: caux
1348  character(len=LINELENGTH) :: keyword
1349  integer(I4B) :: ii
1350  integer(I4B) :: jj
1351  real(DP) :: rval
1352  real(DP), pointer :: bndElem => null()
1353  integer(I4B) :: istat
1354  ! -- formats
1355  character(len=*), parameter :: fmthdbot = &
1356  &"('well head (',G0,') must be >= BOTTOM_ELEVATION (',G0, ').')"
1357  !
1358  ! -- read remainder of variables on the line
1359  call this%parser%GetStringCaps(keyword)
1360  select case (keyword)
1361  case ('STATUS')
1362  call this%parser%GetStringCaps(text)
1363  this%status(imaw) = text(1:8)
1364  select case (text)
1365  case ('CONSTANT')
1366  this%iboundpak(imaw) = -1
1367  case ('INACTIVE')
1368  this%iboundpak(imaw) = 0
1369  case ('ACTIVE')
1370  this%iboundpak(imaw) = 1
1371  case default
1372  write (errmsg, '(2a)') &
1373  'Unknown '//trim(this%text)//" maw status keyword: '", &
1374  trim(text)//"'."
1375  call store_error(errmsg)
1376  end select
1377  case ('RATE')
1378  call this%parser%GetString(text)
1379  jj = 1 ! For RATE
1380  bndelem => this%rate(imaw)
1381  call read_value_or_time_series_adv(text, imaw, jj, bndelem, &
1382  this%packName, 'BND', this%tsManager, &
1383  this%iprpak, 'RATE')
1384  case ('WELL_HEAD')
1385  call this%parser%GetString(text)
1386  jj = 1 ! For WELL_HEAD
1387  bndelem => this%well_head(imaw)
1388  call read_value_or_time_series_adv(text, imaw, jj, bndelem, &
1389  this%packName, 'BND', this%tsManager, &
1390  this%iprpak, 'WELL_HEAD')
1391  !
1392  ! -- set xnewpak to well_head
1393  this%xnewpak(imaw) = this%well_head(imaw)
1394  !
1395  ! -- check for error condition
1396  if (this%well_head(imaw) < this%bot(imaw)) then
1397  write (cstr, fmthdbot) &
1398  this%well_head(imaw), this%bot(imaw)
1399  call this%maw_set_attribute_error(imaw, 'WELL HEAD', trim(cstr))
1400  end if
1401  case ('FLOWING_WELL')
1402  this%fwelev(imaw) = this%parser%GetDouble()
1403  this%fwcond(imaw) = this%parser%GetDouble()
1404  this%fwrlen(imaw) = this%parser%GetDouble()
1405  !
1406  ! -- test for condition where flowing well data is specified but
1407  ! flowing_wells is not specified in the options block
1408  if (this%iflowingwells == 0) then
1409  this%iflowingwells = -1
1410  text = 'Flowing well data is specified in the '//trim(this%packName)// &
1411  ' package but FLOWING_WELL was not specified in the '// &
1412  'OPTIONS block.'
1413  call store_warning(text)
1414  end if
1415  case ('RATE_SCALING')
1416  rval = this%parser%GetDouble()
1417  this%pumpelev(imaw) = rval
1418  rval = this%parser%GetDouble()
1419  this%reduction_length(imaw) = rval
1420  if (rval < dzero) then
1421  call this%maw_set_attribute_error(imaw, trim(keyword), &
1422  'must be greater than or equal to 0.')
1423  end if
1424  case ('HEAD_LIMIT')
1425  call this%parser%GetString(text)
1426  if (trim(text) == 'OFF') then
1427  this%shutofflevel(imaw) = dep20
1428  else
1429  read (text, *, iostat=istat, iomsg=errmsgr) &
1430  this%shutofflevel(imaw)
1431  if (istat /= 0) then
1432  errmsg = 'Could not read HEAD_LIMIT value. '//trim(errmsgr)
1433  call store_error(errmsg)
1434  end if
1435  if (this%shutofflevel(imaw) <= this%bot(imaw)) then
1436  iheadlimit_warning = iheadlimit_warning + 1
1437  end if
1438  end if
1439  case ('SHUT_OFF')
1440  rval = this%parser%GetDouble()
1441  this%shutoffmin(imaw) = rval
1442  rval = this%parser%GetDouble()
1443  this%shutoffmax(imaw) = rval
1444  case ('AUXILIARY')
1445  call this%parser%GetStringCaps(caux)
1446  do jj = 1, this%naux
1447  if (trim(adjustl(caux)) /= trim(adjustl(this%auxname(jj)))) cycle
1448  call this%parser%GetString(text)
1449  ii = imaw
1450  bndelem => this%mauxvar(jj, ii)
1451  call read_value_or_time_series_adv(text, ii, jj, bndelem, &
1452  this%packName, 'AUX', &
1453  this%tsManager, this%iprpak, &
1454  this%auxname(jj))
1455  exit
1456  end do
1457  case default
1458  write (errmsg, '(2a)') &
1459  'Unknown '//trim(this%text)//" maw data keyword: '", &
1460  trim(keyword)//"'."
1461  call store_error(errmsg)
1462  end select
1463 
Here is the call graph for this function:

◆ maw_setup_budobj()

subroutine mawmodule::maw_setup_budobj ( class(mawtype this)
private

Definition at line 4048 of file gwf-maw.f90.

4049  ! -- modules
4050  use constantsmodule, only: lenbudtxt
4051  ! -- dummy
4052  class(MawType) :: this
4053  ! -- local
4054  integer(I4B) :: nbudterm
4055  integer(I4B) :: n, j, n2
4056  real(DP) :: q
4057  integer(I4B) :: maxlist, naux
4058  integer(I4B) :: idx
4059  character(len=LENBUDTXT) :: text
4060  character(len=LENBUDTXT), dimension(1) :: auxtxt
4061  !
4062  ! -- Determine the number of maw budget terms. These are fixed for
4063  ! the simulation and cannot change.
4064  ! gwf rate [flowing_well] storage constant_flow [frommvr tomvr tomvrcf [tomvrfw]] [aux]
4065  nbudterm = 4
4066  if (this%iflowingwells > 0) then
4067  nbudterm = nbudterm + 1
4068  end if
4069  if (this%imover == 1) then
4070  nbudterm = nbudterm + 3
4071  if (this%iflowingwells > 0) then
4072  nbudterm = nbudterm + 1
4073  end if
4074  end if
4075  if (this%naux > 0) nbudterm = nbudterm + 1
4076  !
4077  ! -- set up budobj
4078  call budgetobject_cr(this%budobj, this%packName)
4079  call this%budobj%budgetobject_df(this%nmawwells, nbudterm, 0, 0, &
4080  ibudcsv=this%ibudcsv)
4081  idx = 0
4082  !
4083  ! -- Go through and set up each budget term
4084  !
4085  ! --
4086  text = ' GWF'
4087  idx = idx + 1
4088  maxlist = this%maxbound
4089  naux = 1
4090  auxtxt(1) = ' FLOW-AREA'
4091  call this%budobj%budterm(idx)%initialize(text, &
4092  this%name_model, &
4093  this%packName, &
4094  this%name_model, &
4095  this%name_model, &
4096  maxlist, .false., .true., &
4097  naux, auxtxt)
4098  call this%budobj%budterm(idx)%reset(this%maxbound)
4099  q = dzero
4100  do n = 1, this%nmawwells
4101  do j = 1, this%ngwfnodes(n)
4102  n2 = this%get_gwfnode(n, j)
4103  call this%budobj%budterm(idx)%update_term(n, n2, q)
4104  end do
4105  end do
4106  !
4107  ! --
4108  text = ' RATE'
4109  idx = idx + 1
4110  maxlist = this%nmawwells
4111  naux = 0
4112  call this%budobj%budterm(idx)%initialize(text, &
4113  this%name_model, &
4114  this%packName, &
4115  this%name_model, &
4116  this%packName, &
4117  maxlist, .false., .false., &
4118  naux)
4119  !
4120  ! --
4121  if (this%iflowingwells > 0) then
4122  text = ' FW-RATE'
4123  idx = idx + 1
4124  maxlist = this%nmawwells
4125  naux = 0
4126  call this%budobj%budterm(idx)%initialize(text, &
4127  this%name_model, &
4128  this%packName, &
4129  this%name_model, &
4130  this%packName, &
4131  maxlist, .false., .false., &
4132  naux)
4133  end if
4134  !
4135  ! --
4136  text = ' STORAGE'
4137  idx = idx + 1
4138  maxlist = this%nmawwells
4139  naux = 1
4140  auxtxt(1) = ' VOLUME'
4141  call this%budobj%budterm(idx)%initialize(text, &
4142  this%name_model, &
4143  this%packName, &
4144  this%name_model, &
4145  this%name_model, &
4146  maxlist, .false., .true., &
4147  naux, auxtxt)
4148  !
4149  ! --
4150  text = ' CONSTANT'
4151  idx = idx + 1
4152  maxlist = this%nmawwells
4153  naux = 0
4154  call this%budobj%budterm(idx)%initialize(text, &
4155  this%name_model, &
4156  this%packName, &
4157  this%name_model, &
4158  this%packName, &
4159  maxlist, .false., .false., &
4160  naux)
4161  !
4162  ! --
4163  if (this%imover == 1) then
4164  !
4165  ! --
4166  text = ' FROM-MVR'
4167  idx = idx + 1
4168  maxlist = this%nmawwells
4169  naux = 0
4170  call this%budobj%budterm(idx)%initialize(text, &
4171  this%name_model, &
4172  this%packName, &
4173  this%name_model, &
4174  this%packName, &
4175  maxlist, .false., .false., &
4176  naux)
4177  !
4178  ! --
4179  text = ' RATE-TO-MVR'
4180  idx = idx + 1
4181  maxlist = this%nmawwells
4182  naux = 0
4183  call this%budobj%budterm(idx)%initialize(text, &
4184  this%name_model, &
4185  this%packName, &
4186  this%name_model, &
4187  this%packName, &
4188  maxlist, .false., .false., &
4189  naux)
4190  !
4191  ! -- constant-head flow to mover
4192  text = ' CONSTANT-TO-MVR'
4193  idx = idx + 1
4194  maxlist = this%nmawwells
4195  naux = 0
4196  call this%budobj%budterm(idx)%initialize(text, &
4197  this%name_model, &
4198  this%packName, &
4199  this%name_model, &
4200  this%packName, &
4201  maxlist, .false., .false., &
4202  naux)
4203  !
4204  ! -- flowing-well flow to mover
4205  if (this%iflowingwells > 0) then
4206  !
4207  ! --
4208  text = ' FW-RATE-TO-MVR'
4209  idx = idx + 1
4210  maxlist = this%nmawwells
4211  naux = 0
4212  call this%budobj%budterm(idx)%initialize(text, &
4213  this%name_model, &
4214  this%packName, &
4215  this%name_model, &
4216  this%packName, &
4217  maxlist, .false., .false., &
4218  naux)
4219  end if
4220  end if
4221  !
4222  ! -- auxiliary variable
4223  naux = this%naux
4224  if (naux > 0) then
4225  !
4226  ! --
4227  text = ' AUXILIARY'
4228  idx = idx + 1
4229  maxlist = this%maxbound
4230  call this%budobj%budterm(idx)%initialize(text, &
4231  this%name_model, &
4232  this%packName, &
4233  this%name_model, &
4234  this%packName, &
4235  maxlist, .false., .false., &
4236  naux, this%auxname)
4237  end if
4238  !
4239  ! -- if maw flow for each reach are written to the listing file
4240  if (this%iprflow /= 0) then
4241  call this%budobj%flowtable_df(this%iout)
4242  end if
integer(i4b), parameter lenbudtxt
maximum length of a budget component names
Definition: Constants.f90:37
Here is the call graph for this function:

◆ maw_setup_tableobj()

subroutine mawmodule::maw_setup_tableobj ( class(mawtype this)
private

The terms listed here must correspond in number and order to the ones written to the head table in the maw_ot method.

Definition at line 4461 of file gwf-maw.f90.

4462  ! -- modules
4464  ! -- dummy
4465  class(MawType) :: this
4466  ! -- local
4467  integer(I4B) :: nterms
4468  character(len=LINELENGTH) :: title
4469  character(len=LINELENGTH) :: text
4470  !
4471  ! -- setup well head table
4472  if (this%iprhed > 0) then
4473  !
4474  ! -- Determine the number of head table columns
4475  nterms = 2
4476  if (this%inamedbound == 1) nterms = nterms + 1
4477  !
4478  ! -- set up table title
4479  title = trim(adjustl(this%text))//' PACKAGE ('// &
4480  trim(adjustl(this%packName))//') HEADS FOR EACH CONTROL VOLUME'
4481  !
4482  ! -- set up head tableobj
4483  call table_cr(this%headtab, this%packName, title)
4484  call this%headtab%table_df(this%nmawwells, nterms, this%iout, &
4485  transient=.true.)
4486  !
4487  ! -- Go through and set up table budget term
4488  if (this%inamedbound == 1) then
4489  text = 'NAME'
4490  call this%headtab%initialize_column(text, 20, alignment=tableft)
4491  end if
4492  !
4493  ! -- reach number
4494  text = 'NUMBER'
4495  call this%headtab%initialize_column(text, 10, alignment=tabcenter)
4496  !
4497  ! -- reach stage
4498  text = 'HEAD'
4499  call this%headtab%initialize_column(text, 12, alignment=tabcenter)
4500  end if
Here is the call graph for this function:

Variable Documentation

◆ ftype

character(len=lenftype) mawmodule::ftype = 'MAW'

Definition at line 39 of file gwf-maw.f90.

39  character(len=LENFTYPE) :: ftype = 'MAW'

◆ text

character(len=lenpackagename) mawmodule::text = ' MAW'

Definition at line 40 of file gwf-maw.f90.

40  character(len=LENPACKAGENAME) :: text = ' MAW'