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

Data Types

type  mawinputtype
 input context data pointers for MAW. More...
 
type  mawtype
 

Functions/Subroutines

subroutine, public maw_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, mempath)
 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_checkin_deprecated_names (this)
 Alias deprecated MAW variable names to their current storage. More...
 
subroutine maw_source_options (this)
 Source OPTIONS block from input context. More...
 
subroutine maw_source_dimensions (this)
 Source DIMENSIONS block from input context. More...
 
subroutine maw_input_init (this, mempath, naux)
 Bind MawInputType pointers to input context arrays. More...
 
subroutine maw_input_destroy (this)
 Nullify all MawInputType pointers. More...
 
subroutine maw_source_packagedata (this)
 Source PACKAGEDATA block from input context. More...
 
subroutine maw_source_connectiondata (this)
 Source CONNECTIONDATA block from input context. More...
 
subroutine maw_source_angledata (this)
 Source ANGLEDATA block from input context for non-vertical MAW connections. More...
 
pure real(dp) function, public maw_screen_length (dz, radius, omega)
 In-cell screen length of a non-vertical well connection. More...
 
real(dp) function maw_cell_extent (this, node, estimated)
 Maximum horizontal extent of a cell. More...
 
real(dp) function maw_calc_lcorr (this, i, jpos)
 Calculate the length correction factor for a multi-aquifer well connection. More...
 
subroutine maw_read_initial_attr (this)
 Read the initial parameters for this package. More...
 
subroutine maw_set_attribute_error (this, imaw, keyword, msg)
 Issue a parameter error for mawweslls(imaw) More...
 
subroutine maw_set_period_value (this, n, imaw, setting)
 Apply a PERIOD setting value to well 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_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)
 Apply Newton under-relaxation to the MAW Package well heads. More...
 
pure real(dp) function, public maw_damp_weight (dxprop, dxold, weight, damptheta, damptol, weightmin, recover)
 Update the oscillation-damping weight for a single MAW well head. More...
 
subroutine maw_cc (this, innertot, kiter, iend, icnvgmod, cpak, ipak, dpak)
 Extra convergence check for the MAW package. 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, hwell_in)
 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 3541 of file gwf-maw.f90.

3542  class(MawType), intent(inout) :: this
3543  !
3544  ! -- create the header list label
3545  this%listlabel = trim(this%filtyp)//' NO.'
3546  if (this%dis%ndim == 3) then
3547  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
3548  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'ROW'
3549  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'COL'
3550  elseif (this%dis%ndim == 2) then
3551  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'LAYER'
3552  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'CELL2D'
3553  else
3554  write (this%listlabel, '(a, a7)') trim(this%listlabel), 'NODE'
3555  end if
3556  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'STRESS RATE'
3557  if (this%inamedbound == 1) then
3558  write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME'
3559  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 5228 of file gwf-maw.f90.

5229  ! -- return variable
5230  integer(I4B) :: igwfnode
5231  ! -- dummy
5232  class(MawType) :: this
5233  integer(I4B), intent(in) :: n
5234  integer(I4B), intent(in) :: j
5235  ! -- local
5236  integer(I4B) :: jpos
5237  !
5238  ! -- set jpos
5239  jpos = this%get_jpos(n, j)
5240  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 5213 of file gwf-maw.f90.

5214  ! -- return variable
5215  integer(I4B) :: jpos
5216  ! -- dummy
5217  class(MawType) :: this
5218  integer(I4B), intent(in) :: n
5219  integer(I4B), intent(in) :: j
5220  ! -- local
5221  !
5222  ! -- set jpos
5223  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 1985 of file gwf-maw.f90.

1986  use sparsemodule, only: sparsematrix
1987  ! -- dummy
1988  class(MawType), intent(inout) :: this
1989  integer(I4B), intent(in) :: moffset
1990  type(sparsematrix), intent(inout) :: sparse
1991  ! -- local
1992  integer(I4B) :: j
1993  integer(I4B) :: n
1994  integer(I4B) :: jj
1995  integer(I4B) :: jglo
1996  integer(I4B) :: nglo
1997  ! -- format
1998  !
1999  ! -- Add package rows to sparse
2000  do n = 1, this%nmawwells
2001  nglo = moffset + this%dis%nodes + this%ioffset + n
2002  call sparse%addconnection(nglo, nglo, 1)
2003  do j = 1, this%ngwfnodes(n)
2004  jj = this%get_gwfnode(n, j)
2005  jglo = jj + moffset
2006  call sparse%addconnection(nglo, jglo, 1)
2007  call sparse%addconnection(jglo, nglo, 1)
2008  end do
2009 
2010  end do

◆ maw_activate_density()

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

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

5246  ! -- dummy
5247  class(MawType), intent(inout) :: this
5248  ! -- local
5249  integer(I4B) :: i, j
5250  ! -- formats
5251  !
5252  ! -- Set idense and reallocate denseterms to be of size MAXBOUND
5253  this%idense = 1
5254  call mem_reallocate(this%denseterms, 3, this%MAXBOUND, 'DENSETERMS', &
5255  this%memoryPath)
5256  do i = 1, this%maxbound
5257  do j = 1, 3
5258  this%denseterms(j, i) = dzero
5259  end do
5260  end do
5261  write (this%iout, '(/1x,a)') 'DENSITY TERMS HAVE BEEN ACTIVATED FOR MAW &
5262  &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 5269 of file gwf-maw.f90.

5270  ! -- modules
5272  ! -- dummy variables
5273  class(MawType), intent(inout) :: this !< MawType object
5274  ! -- local variables
5275  integer(I4B) :: i
5276  integer(I4B) :: j
5277  !
5278  ! -- Set ivsc and reallocate viscratios to be of size MAXBOUND
5279  this%ivsc = 1
5280  call mem_reallocate(this%viscratios, 2, this%MAXBOUND, 'VISCRATIOS', &
5281  this%memoryPath)
5282  do i = 1, this%maxbound
5283  do j = 1, 2
5284  this%viscratios(j, i) = done
5285  end do
5286  end do
5287  write (this%iout, '(/1x,a)') 'VISCOSITY HAS BEEN ACTIVATED FOR MAW &
5288  &PACKAGE: '//trim(adjustl(this%packName))

◆ maw_ad()

subroutine mawmodule::maw_ad ( class(mawtype)  this)

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

2491  use constantsmodule, only: lenvarname
2492  use tdismodule, only: kper, kstp
2493  ! -- dummy
2494  class(MawType) :: this
2495  ! -- local
2496  integer(I4B) :: i
2497  integer(I4B) :: n
2498  integer(I4B) :: j
2499  integer(I4B) :: jj
2500  integer(I4B) :: ibnd
2501  integer(I4B) :: imaw
2502  character(len=LENVARNAME) :: setting
2503  !
2504  ! -- sync PACKAGEDATA AUX TS and advance observations;
2505  ! -- step auxvar period block overrides
2506  call this%BndExtType%bnd_ad()
2507  !
2508  ! -- sync PERIOD TS from input context
2509  if (this%ts_active .and. this%input%nbound > 0) then
2510  do n = 1, this%input%nbound
2511  imaw = this%input%ifno(n)
2512  if (imaw < 1 .or. imaw > this%nmawwells) cycle
2513  setting = this%input%setting(n)
2514  call this%maw_set_period_value(n, imaw, setting)
2515  end do
2516  end if
2517  !
2518  ! -- update auxiliary variables
2519  if (this%naux > 0) then
2520  ibnd = 1
2521  do n = 1, this%nmawwells
2522  do j = 1, this%ngwfnodes(n)
2523  do jj = 1, this%naux
2524  if (this%noupdateauxvar(jj) /= 0) cycle
2525  this%auxvar(jj, ibnd) = this%featureauxvar(jj, n)
2526  end do
2527  ibnd = ibnd + 1
2528  end do
2529  end do
2530  end if
2531  !
2532  ! -- copy xnew into xold; CONSTANT well heads track a PACKAGEDATA STRT
2533  ! time series until a PERIOD WELL_HEAD entry overrides it
2534  do i = 1, this%nmawwells
2535  n = this%pkg_ifno(i)
2536  this%xoldpak(n) = this%xnewpak(n)
2537  this%xoldsto(n) = this%xsto(n)
2538  if (this%iboundpak(n) < 0) then
2539  if (.not. this%well_head_set(n) .and. &
2540  this%input%strt_tslink(i) /= 0) then
2541  this%well_head(n) = this%input%strt(i)
2542  end if
2543  this%xnewpak(n) = this%well_head(n)
2544  end if
2545  !
2546  ! -- start each time step with damping turned off. Clearing the weight
2547  ! and the previous head change stops a leftover value from the last
2548  ! time step from triggering damping on the first iteration.
2549  this%nurdxold(n) = dzero
2550  this%nurweight(n) = done
2551  end do
2552  !
2553  !--use the appropriate xoldsto if initial heads are above the
2554  ! specified flowing well discharge elevation
2555  if (kper == 1 .and. kstp == 1) then
2556  do n = 1, this%nmawwells
2557  if (this%fwcond(n) > dzero) then
2558  if (this%xoldsto(n) > this%fwelev(n)) then
2559  this%xoldsto(n) = this%fwelev(n)
2560  end if
2561  end if
2562  end do
2563  end if
2564  !
2565  ! -- reset ishutoffcnt (equivalent to kiter) to zero
2566  this%ishutoffcnt = 0
2567  !
2568  ! -- pakmvrobj ad
2569  if (this%imover == 1) then
2570  call this%pakmvrobj%ad()
2571  end if
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition: Constants.f90:17
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:27
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:26

◆ maw_allocate_arrays()

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

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

597  ! -- modules
599  ! -- dummy
600  class(MawType), intent(inout) :: this
601  ! -- local
602  !
603  ! -- allocate BndType connection-level arrays
604  call this%BndExtType%allocate_arrays()
605  !
606  ! -- allocate featureauxvar PACKAGEDATA variables
607  call this%BndExtType%allocate_featureauxvar()

◆ maw_allocate_scalars()

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

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

335  ! -- modules
337  ! -- dummy
338  class(MawType), intent(inout) :: this
339  !
340  ! -- call standard BndExtType allocate scalars
341  call this%BndExtType%allocate_scalars()
342  !
343  ! -- allocate the object and assign values to object variables
344  call mem_allocate(this%correct_flow, 'CORRECT_FLOW', this%memoryPath)
345  call mem_allocate(this%iprhed, 'IPRHED', this%memoryPath)
346  call mem_allocate(this%iheadout, 'IHEADOUT', this%memoryPath)
347  call mem_allocate(this%ibudgetout, 'IBUDGETOUT', this%memoryPath)
348  call mem_allocate(this%ibudcsv, 'IBUDCSV', this%memoryPath)
349  call mem_allocate(this%iflowingwells, 'IFLOWINGWELLS', this%memoryPath)
350  call mem_allocate(this%imawiss, 'IMAWISS', this%memoryPath)
351  call mem_allocate(this%imawissopt, 'IMAWISSOPT', this%memoryPath)
352  call mem_allocate(this%nmawwells, 'NMAWWELLS', this%memoryPath)
353  call mem_allocate(this%check_attr, 'CHECK_ATTR', this%memoryPath)
354  call mem_allocate(this%ishutoffcnt, 'ISHUTOFFCNT', this%memoryPath)
355  call mem_allocate(this%ieffradopt, 'IEFFRADOPT', this%memoryPath)
356  call mem_allocate(this%inonvert, 'INONVERT', this%memoryPath)
357  call mem_allocate(this%ioutredflowcsv, 'IOUTREDFLOWCSV', this%memoryPath) !for writing reduced MAW flows to csv file
358  call mem_allocate(this%satomega, 'SATOMEGA', this%memoryPath)
359  call mem_allocate(this%bditems, 'BDITEMS', this%memoryPath)
360  call mem_allocate(this%theta, 'THETA', this%memoryPath)
361  call mem_allocate(this%kappa, 'KAPPA', this%memoryPath)
362  call mem_allocate(this%cbcauxitems, 'CBCAUXITEMS', this%memoryPath)
363  call mem_allocate(this%idense, 'IDENSE', this%memoryPath)
364  !
365  ! -- Set values
366  this%correct_flow = .false.
367  this%nmawwells = 0
368  this%iprhed = 0
369  this%iheadout = 0
370  this%ibudgetout = 0
371  this%ibudcsv = 0
372  this%iflowingwells = 0
373  this%imawiss = 0
374  this%imawissopt = 0
375  this%ieffradopt = 0
376  this%inonvert = 0
377  this%ioutredflowcsv = 0
378  this%satomega = dzero
379  this%bditems = 8
380  this%theta = dp7
381  this%kappa = dem4
382  this%cbcauxitems = 1
383  this%idense = 0
384  this%ivsc = 0

◆ maw_allocate_well_conn_arrays()

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

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

390  ! -- modules
392  ! -- dummy
393  class(MawType), intent(inout) :: this
394  ! -- local
395  integer(I4B) :: j
396  integer(I4B) :: n
397  !
398  ! -- allocate character array for budget text
399  call mem_allocate(this%cmawbudget, lenbudtxt, this%bditems, 'CMAWBUDGET', &
400  this%memoryPath)
401  !
402  !-- fill cmawbudget
403  this%cmawbudget(1) = ' GWF'
404  this%cmawbudget(2) = ' RATE'
405  this%cmawbudget(3) = ' STORAGE'
406  this%cmawbudget(4) = ' CONSTANT'
407  this%cmawbudget(5) = ' FW-RATE'
408  this%cmawbudget(6) = ' FROM-MVR'
409  this%cmawbudget(7) = ' RATE-TO-MVR'
410  this%cmawbudget(8) = ' FW-RATE-TO-MVR'
411  !
412  ! -- allocate character arrays
413  call mem_allocate(this%cmawname, lenboundname, this%nmawwells, 'CMAWNAME', &
414  this%memoryPath)
415  call mem_allocate(this%status, 8, this%nmawwells, 'STATUS', this%memoryPath)
416  !
417  ! -- allocate well data pointers in memory manager
418  call mem_allocate(this%ngwfnodes, this%nmawwells, 'NGWFNODES', &
419  this%memoryPath)
420  call mem_allocate(this%ieqn, this%nmawwells, 'IEQN', this%memoryPath)
421  call mem_allocate(this%ishutoff, this%nmawwells, 'ISHUTOFF', this%memoryPath)
422  call mem_allocate(this%ifwdischarge, this%nmawwells, 'IFWDISCHARGE', &
423  this%memoryPath)
424  call mem_allocate(this%strt, this%nmawwells, 'STRT', this%memoryPath)
425  call mem_allocate(this%radius, this%nmawwells, 'RADIUS', this%memoryPath)
426  call mem_allocate(this%area, this%nmawwells, 'AREA', this%memoryPath)
427  call mem_allocate(this%pumpelev, this%nmawwells, 'PUMPELEV', this%memoryPath)
428  call mem_allocate(this%bot, this%nmawwells, 'BOT', this%memoryPath)
429  call mem_allocate(this%ratesim, this%nmawwells, 'RATESIM', this%memoryPath)
430  call mem_allocate(this%qsim0, this%nmawwells, 'QSIM0', this%memoryPath)
431  call mem_allocate(this%reduction_length, this%nmawwells, 'REDUCTION_LENGTH', &
432  this%memoryPath)
433  call mem_allocate(this%fwelev, this%nmawwells, 'FWELEV', this%memoryPath)
434  call mem_allocate(this%fwcond, this%nmawwells, 'FWCONDS', this%memoryPath)
435  call mem_allocate(this%fwrlen, this%nmawwells, 'FWRLEN', this%memoryPath)
436  call mem_allocate(this%fwcondsim, this%nmawwells, 'FWCONDSIM', &
437  this%memoryPath)
438  call mem_allocate(this%xsto, this%nmawwells, 'XSTO', this%memoryPath)
439  call mem_allocate(this%xoldsto, this%nmawwells, 'XOLDSTO', this%memoryPath)
440  call mem_allocate(this%shutoffmin, this%nmawwells, 'SHUTOFFMIN', &
441  this%memoryPath)
442  call mem_allocate(this%shutoffmax, this%nmawwells, 'SHUTOFFMAX', &
443  this%memoryPath)
444  call mem_allocate(this%shutofflevel, this%nmawwells, 'SHUTOFFLEVEL', &
445  this%memoryPath)
446  call mem_allocate(this%shutoffweight, this%nmawwells, 'SHUTOFFWEIGHT', &
447  this%memoryPath)
448  call mem_allocate(this%shutoffdq, this%nmawwells, 'SHUTOFFDQ', &
449  this%memoryPath)
450  call mem_allocate(this%shutoffqold, this%nmawwells, 'SHUTOFFQOLD', &
451  this%memoryPath)
452  call mem_allocate(this%nurdxold, this%nmawwells, 'NURDXOLD', &
453  this%memoryPath)
454  call mem_allocate(this%nurweight, this%nmawwells, 'NURWEIGHT', &
455  this%memoryPath)
456  !
457  ! -- alias into the input context's permanent, feature-indexed arrays
458  ! (allocated and DZERO-initialized by the loader)
459  call mem_setptr(this%rate, 'RATE', this%input_mempath)
460  call mem_setptr(this%well_head, 'WELL_HEAD', this%input_mempath)
461  call mem_allocate(this%well_head_set, this%nmawwells, 'WELL_HEAD_SET', &
462  this%memoryPath)
463  this%well_head_set = .false.
464  !
465  ! -- allocate and initialize dbuff
466  if (this%iheadout > 0) then
467  call mem_allocate(this%dbuff, this%nmawwells, 'DBUFF', this%memoryPath)
468  else
469  call mem_allocate(this%dbuff, 0, 'DBUFF', this%memoryPath)
470  end if
471  !
472  ! -- allocate iaconn
473  call mem_allocate(this%iaconn, this%nmawwells + 1, 'IACONN', this%memoryPath)
474  !
475  ! -- allocate imap
476  call mem_allocate(this%imap, this%MAXBOUND, 'IMAP', this%memoryPath)
477  !
478  ! -- allocate connection data
479  call mem_allocate(this%gwfnodes, this%maxbound, 'GWFNODES', this%memoryPath)
480  call mem_allocate(this%sradius, this%maxbound, 'SRADIUS', this%memoryPath)
481  call mem_allocate(this%hk, this%maxbound, 'HK', this%memoryPath)
482  call mem_allocate(this%satcond, this%maxbound, 'SATCOND', this%memoryPath)
483  call mem_allocate(this%simcond, this%maxbound, 'SIMCOND', this%memoryPath)
484  call mem_allocate(this%topscrn, this%maxbound, 'TOPSCRN', this%memoryPath)
485  call mem_allocate(this%botscrn, this%maxbound, 'BOTSCRN', this%memoryPath)
486  call mem_allocate(this%angle, this%maxbound, 'ANGLE', this%memoryPath)
487  call mem_allocate(this%connlen, this%maxbound, 'CONNLEN', this%memoryPath)
488  call mem_allocate(this%usrtopscrn, this%maxbound, 'USRTOPSCRN', &
489  this%memoryPath)
490  call mem_allocate(this%usrbotscrn, this%maxbound, 'USRBOTSCRN', &
491  this%memoryPath)
492  !
493  ! -- allocate qleak
494  call mem_allocate(this%qleak, this%maxbound, 'QLEAK', this%memoryPath)
495  !
496  ! -- initialize well data
497  do n = 1, this%nmawwells
498  this%status(n) = 'ACTIVE'
499  this%ngwfnodes(n) = 0
500  this%ieqn(n) = 0
501  this%ishutoff(n) = 0
502  this%ifwdischarge(n) = 0
503  this%strt(n) = dep20
504  this%radius(n) = dep20
505  this%area(n) = dzero
506  this%pumpelev(n) = dep20
507  this%bot(n) = dep20
508  this%ratesim(n) = dzero
509  this%qsim0(n) = dzero
510  this%reduction_length(n) = dep20
511  this%fwelev(n) = dzero
512  this%fwcond(n) = dzero
513  this%fwrlen(n) = dzero
514  this%fwcondsim(n) = dzero
515  this%xsto(n) = dzero
516  this%xoldsto(n) = dzero
517  this%shutoffmin(n) = dzero
518  this%shutoffmax(n) = dzero
519  this%shutofflevel(n) = dep20
520  this%shutoffweight(n) = done
521  this%shutoffdq(n) = done
522  this%shutoffqold(n) = done
523  this%nurdxold(n) = dzero
524  this%nurweight(n) = done
525  !
526  ! -- timeseries aware variables
527  this%rate(n) = dzero
528  this%well_head(n) = dzero
529  !
530  ! -- dbuff
531  if (this%iheadout > 0) then
532  this%dbuff(n) = dzero
533  end if
534  end do
535  !
536  ! -- initialize iaconn
537  do n = 1, this%nmawwells + 1
538  this%iaconn(n) = 0
539  end do
540  !
541  ! -- allocate character array for budget text
542  call mem_allocate(this%cauxcbc, lenauxname, this%cbcauxitems, 'CAUXCBC', &
543  this%memoryPath)
544  !
545  ! -- allocate and initialize qauxcbc
546  call mem_allocate(this%qauxcbc, this%cbcauxitems, 'QAUXCBC', this%memoryPath)
547  do j = 1, this%cbcauxitems
548  this%qauxcbc(j) = dzero
549  end do
550  !
551  ! -- allocate flowing well data
552  if (this%iflowingwells /= 0) then
553  call mem_allocate(this%qfw, this%nmawwells, 'QFW', this%memoryPath)
554  else
555  call mem_allocate(this%qfw, 1, 'QFW', this%memoryPath)
556  end if
557  call mem_allocate(this%qout, this%nmawwells, 'QOUT', this%memoryPath)
558  call mem_allocate(this%qsto, this%nmawwells, 'QSTO', this%memoryPath)
559  call mem_allocate(this%qconst, this%nmawwells, 'QCONST', this%memoryPath)
560  !
561  ! -- initialize flowing well, storage, and constant flow terms
562  do n = 1, this%nmawwells
563  if (this%iflowingwells > 0) then
564  this%qfw(n) = dzero
565  end if
566  this%qsto(n) = dzero
567  this%qconst(n) = dzero
568  end do
569  !
570  ! -- initialize connection data
571  do j = 1, this%maxbound
572  this%imap(j) = 0
573  this%gwfnodes(j) = 0
574  this%sradius(j) = dzero
575  this%hk(j) = dzero
576  this%satcond(j) = dzero
577  this%simcond(j) = dzero
578  this%topscrn(j) = dzero
579  this%botscrn(j) = dzero
580  this%angle(j) = dzero
581  this%connlen(j) = dzero
582  this%usrtopscrn(j) = dzero
583  this%usrbotscrn(j) = dzero
584  this%qleak(j) = dzero
585  end do
586  !
587  ! -- allocate denseterms to size 0
588  call mem_allocate(this%denseterms, 3, 0, 'DENSETERMS', this%memoryPath)
589  !
590  ! -- allocate viscratios to size 0
591  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 2075 of file gwf-maw.f90.

2076  ! -- dummy
2077  class(MawType), intent(inout) :: this
2078  ! -- local
2079  ! -- format
2080  !
2081  call this%obs%obs_ar()
2082  !
2083  ! -- set omega value used for saturation calculations
2084  if (this%inewton > 0) then
2085  this%satomega = dem6
2086  end if
2087  !
2088  ! -- Allocate connection arrays in MAW and in package superclass
2089  call this%maw_allocate_arrays()
2090  !
2091  ! -- read optional initial package parameters
2092  call this%read_initial_attr()
2093  !
2094  ! -- bind persistent pointers to input context data
2095  call this%input%init(this%input_mempath, this%naux)
2096  !
2097  ! -- setup pakmvrobj
2098  if (this%imover /= 0) then
2099  allocate (this%pakmvrobj)
2100  call this%pakmvrobj%ar(this%nmawwells, this%nmawwells, this%memoryPath)
2101  end if

◆ maw_bd_obs()

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

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

3681  ! -- dummy
3682  class(MawType) :: this
3683  ! -- local
3684  integer(I4B) :: i
3685  integer(I4B) :: j
3686  integer(I4B) :: jj
3687  integer(I4B) :: n
3688  integer(I4B) :: nn
3689  integer(I4B) :: jpos
3690  real(DP) :: cmaw
3691  real(DP) :: hmaw
3692  real(DP) :: v
3693  real(DP) :: qfact
3694  type(ObserveType), pointer :: obsrv => null()
3695  !
3696  ! Calculate, save, and write simulated values for all MAW observations
3697  if (this%obs%npakobs > 0) then
3698  call this%obs%obs_bd_clear()
3699  do i = 1, this%obs%npakobs
3700  obsrv => this%obs%pakobs(i)%obsrv
3701  do j = 1, obsrv%indxbnds_count
3702  v = dnodata
3703  jj = obsrv%indxbnds(j)
3704  select case (obsrv%ObsTypeId)
3705  case ('HEAD')
3706  if (this%iboundpak(jj) /= 0) then
3707  v = this%xnewpak(jj)
3708  end if
3709  case ('FROM-MVR')
3710  if (this%iboundpak(jj) /= 0) then
3711  if (this%imover == 1) then
3712  v = this%pakmvrobj%get_qfrommvr(jj)
3713  end if
3714  end if
3715  case ('MAW')
3716  n = this%imap(jj)
3717  if (this%iboundpak(n) /= 0) then
3718  v = this%qleak(jj)
3719  end if
3720  case ('RATE')
3721  if (this%iboundpak(jj) /= 0) then
3722  v = this%ratesim(jj)
3723  if (v < dzero .and. this%qout(jj) < dzero) then
3724  qfact = v / this%qout(jj)
3725  if (this%imover == 1) then
3726  v = v + this%pakmvrobj%get_qtomvr(jj) * qfact
3727  end if
3728  end if
3729  end if
3730  case ('RATE-TO-MVR')
3731  if (this%iboundpak(jj) /= 0) then
3732  if (this%imover == 1) then
3733  v = this%ratesim(jj)
3734  qfact = dzero
3735  if (v < dzero .and. this%qout(jj) < dzero) then
3736  qfact = v / this%qout(jj)
3737  end if
3738  v = this%pakmvrobj%get_qtomvr(jj) * qfact
3739  if (v > dzero) then
3740  v = -v
3741  end if
3742  end if
3743  end if
3744  case ('FW-RATE')
3745  if (this%iboundpak(jj) /= 0 .and. this%iflowingwells > 0) then
3746  hmaw = this%xnewpak(jj)
3747  cmaw = this%fwcondsim(jj)
3748  v = cmaw * (this%fwelev(jj) - hmaw)
3749  if (v < dzero .and. this%qout(jj) < dzero) then
3750  qfact = v / this%qout(jj)
3751  if (this%imover == 1) then
3752  v = v + this%pakmvrobj%get_qtomvr(jj) * qfact
3753  end if
3754  end if
3755  end if
3756  case ('FW-TO-MVR')
3757  if (this%iboundpak(jj) /= 0 .and. this%iflowingwells > 0) then
3758  if (this%imover == 1) then
3759  hmaw = this%xnewpak(jj)
3760  cmaw = this%fwcondsim(jj)
3761  v = cmaw * (this%fwelev(jj) - hmaw)
3762  qfact = dzero
3763  if (v < dzero .and. this%qout(jj) < dzero) then
3764  qfact = v / this%qout(jj)
3765  end if
3766  v = this%pakmvrobj%get_qtomvr(jj) * qfact
3767  if (v > dzero) then
3768  v = -v
3769  end if
3770  end if
3771  end if
3772  case ('STORAGE')
3773  if (this%iboundpak(jj) /= 0 .and. this%imawissopt /= 1) then
3774  v = this%qsto(jj)
3775  end if
3776  case ('CONSTANT')
3777  if (this%iboundpak(jj) /= 0) then
3778  v = this%qconst(jj)
3779  end if
3780  case ('CONDUCTANCE')
3781  n = this%imap(jj)
3782  if (this%iboundpak(n) /= 0) then
3783  nn = jj - this%iaconn(n) + 1
3784  jpos = this%get_jpos(n, nn)
3785  v = this%simcond(jpos)
3786  end if
3787  case ('FW-CONDUCTANCE')
3788  if (this%iboundpak(jj) /= 0) then
3789  v = this%fwcondsim(jj)
3790  end if
3791  case default
3792  errmsg = 'Unrecognized observation type: '//trim(obsrv%ObsTypeId)
3793  call store_error(errmsg)
3794  end select
3795  call this%obs%SaveOneSimval(obsrv, v)
3796  end do
3797  end do
3798  !
3799  ! -- write summary of error messages
3800  if (count_errors() > 0) then
3801  call store_error_filename(this%input_fname)
3802  end if
3803  end if
3804  !
3805  ! -- Write the MAW reduced flows to csv file entries for this step
3806  if (this%ioutredflowcsv > 0) then
3807  call this%maw_redflow_csv_write()
3808  end if
Here is the call graph for this function:

◆ maw_calc_lcorr()

real(dp) function mawmodule::maw_calc_lcorr ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  i,
integer(i4b), intent(in)  jpos 
)

The saturated conductance of a non-vertical (slanted) connection is scaled by the ratio of the in-cell screen length to the vertical screen thickness. The factor is 1.0 for vertical connections (angle = 0 and no connection length specified). The in-cell screen length is either specified directly (CONNLEN > 0) or derived from the screen elevations and the tilt angle, accounting for the vertical band occupied by the finite-radius borehole.

Parameters
[in]iwell number
[in]jposconnection position

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

1598  use constantsmodule, only: dzero, done, dtwo, dpio180
1599  ! -- dummy
1600  class(MawType), intent(inout) :: this
1601  integer(I4B), intent(in) :: i !< well number
1602  integer(I4B), intent(in) :: jpos !< connection position
1603  ! -- return
1604  real(DP) :: lcorr
1605  ! -- local
1606  real(DP) :: dz
1607  real(DP) :: omega
1608  real(DP) :: lw
1609  !
1610  ! -- default to no correction (vertical connection)
1611  lcorr = done
1612  if (this%angle(jpos) == dzero .and. this%connlen(jpos) <= dzero) then
1613  return
1614  end if
1615  !
1616  ! -- vertical screen thickness
1617  dz = this%topscrn(jpos) - this%botscrn(jpos)
1618  if (dz <= dzero) then
1619  return
1620  end if
1621  !
1622  ! -- in-cell screen length: specified directly or derived from the screen
1623  ! elevations and the tilt angle
1624  if (this%connlen(jpos) > dzero) then
1625  lw = this%connlen(jpos)
1626  else
1627  omega = this%angle(jpos) * dpio180
1628  lw = maw_screen_length(dz, this%radius(i), omega)
1629  end if
1630  !
1631  lcorr = lw / dz
real(dp), parameter dpio180
real constant
Definition: Constants.f90:130
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
real(dp), parameter dtwo
real constant 2
Definition: Constants.f90:79
real(dp), parameter done
real constant 1
Definition: Constants.f90:76
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 4290 of file gwf-maw.f90.

4292  ! -- dummy
4293  class(MawType) :: this
4294  integer(I4B), intent(in) :: n
4295  integer(I4B), intent(in) :: j
4296  integer(I4B), intent(inout) :: icflow
4297  real(DP), intent(inout) :: cmaw
4298  real(DP), intent(inout) :: cterm
4299  real(DP), intent(inout) :: term
4300  real(DP), intent(inout) :: flow
4301  real(DP), intent(inout), optional :: term2
4302  ! -- local
4303  logical(LGP) :: correct_flow
4304  integer(I4B) :: inewton
4305  integer(I4B) :: jpos
4306  integer(I4B) :: igwfnode
4307  real(DP) :: hmaw
4308  real(DP) :: hgwf
4309  real(DP) :: hups
4310  real(DP) :: hdowns
4311  real(DP) :: sat
4312  real(DP) :: tmaw
4313  real(DP) :: bmaw
4314  real(DP) :: en
4315  real(DP) :: hbar
4316  real(DP) :: drterm
4317  real(DP) :: dhbarterm
4318  real(DP) :: vscratio
4319  !
4320  ! -- initialize terms
4321  cterm = dzero
4322  vscratio = done
4323  icflow = 0
4324  if (present(term2)) then
4325  inewton = 1
4326  else
4327  inewton = 0
4328  end if
4329  !
4330  ! -- set common terms
4331  jpos = this%get_jpos(n, j)
4332  igwfnode = this%get_gwfnode(n, j)
4333  hgwf = this%xnew(igwfnode)
4334  hmaw = this%xnewpak(n)
4335  tmaw = this%topscrn(jpos)
4336  bmaw = this%botscrn(jpos)
4337  !
4338  ! -- if vsc active, select appropriate viscosity ratio
4339  if (this%ivsc == 1) then
4340  ! flow out of well (flow is negative)
4341  if (flow < 0) then
4342  vscratio = this%viscratios(1, n)
4343  else
4344  vscratio = this%viscratios(2, n)
4345  end if
4346  end if
4347  !
4348  ! -- calculate saturation
4349  call this%maw_calculate_saturation(n, j, igwfnode, sat)
4350  cmaw = this%satcond(jpos) * vscratio * sat
4351  !
4352  ! -- set upstream head, term, and term2 if returning newton terms
4353  if (inewton == 1) then
4354  term = dzero
4355  term2 = dzero
4356  hups = hmaw
4357  if (hgwf > hups) then
4358  hups = hgwf
4359  end if
4360  !
4361  ! -- slope of the saturation with head. In a confined (non-convertible)
4362  ! cell the saturation is always one and does not change with head, so
4363  ! this slope must be zero. Otherwise the matrix terms would not match
4364  ! the flow that is actually calculated for the well.
4365  if (this%icelltype(igwfnode) /= 0) then
4366  drterm = squadraticsaturationderivative(tmaw, bmaw, hups, this%satomega)
4367  else
4368  drterm = dzero
4369  end if
4370  else
4371  term = cmaw
4372  end if
4373  !
4374  ! -- calculate correction term if flow_correction option specified
4375  if (this%correct_flow) then
4376  !
4377  ! -- set bmaw, determine en, and set correct_flow flag
4378  en = max(bmaw, this%dis%bot(igwfnode))
4379  correct_flow = .false.
4380  if (hmaw < en) then
4381  correct_flow = .true.
4382  end if
4383  if (hgwf < en .and. this%icelltype(igwfnode) /= 0) then
4384  correct_flow = .true.
4385  end if
4386  !
4387  ! -- if flow should be corrected because hgwf or hmaw is below bottom
4388  ! then calculate correction term (cterm)
4389  if (correct_flow) then
4390  icflow = 1
4391  hdowns = min(hmaw, hgwf)
4392  hbar = squadratic0sp(hdowns, en, this%satomega)
4393  if (hgwf > hmaw) then
4394  cterm = cmaw * (hmaw - hbar)
4395  else
4396  cterm = cmaw * (hbar - hgwf)
4397  end if
4398  end if
4399  !
4400  ! -- if newton formulation then calculate newton terms
4401  if (inewton /= 0) then
4402  !
4403  ! -- maw is upstream
4404  if (hmaw > hgwf) then
4405  hbar = squadratic0sp(hgwf, en, this%satomega)
4406  term = drterm * this%satcond(jpos) * vscratio * (hbar - hmaw)
4407  dhbarterm = squadratic0spderivative(hgwf, en, this%satomega)
4408  term2 = cmaw * (dhbarterm - done)
4409  !
4410  ! -- gwf is upstream
4411  else
4412  hbar = squadratic0sp(hmaw, en, this%satomega)
4413  term = -drterm * this%satcond(jpos) * vscratio * (hgwf - hbar)
4414  dhbarterm = squadratic0spderivative(hmaw, en, this%satomega)
4415  term2 = cmaw * (done - dhbarterm)
4416  end if
4417  end if
4418  else
4419  !
4420  ! -- flow is not corrected, so calculate term for newton formulation
4421  if (inewton /= 0) then
4422  term = drterm * this%satcond(jpos) * vscratio * (hgwf - hmaw)
4423  end if
4424  end if
4425  !
4426  ! -- calculate flow relative to maw for fc and bd
4427  flow = dzero
4428  if (inewton == 0) then
4429  flow = term * (hgwf - hmaw) + cterm
4430  end if
4431  !
4432  ! -- add density part here
4433  if (this%idense /= 0 .and. inewton == 0) then
4434  call this%maw_calculate_density_exchange(jpos, hmaw, hgwf, cmaw, &
4435  bmaw, flow, term, cterm)
4436  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 5313 of file gwf-maw.f90.

5315  ! -- dummy
5316  class(MawType), intent(inout) :: this
5317  integer(I4B), intent(in) :: iconn
5318  real(DP), intent(in) :: hmaw
5319  real(DP), intent(in) :: hgwf
5320  real(DP), intent(in) :: cond
5321  real(DP), intent(in) :: bmaw
5322  real(DP), intent(inout) :: flow
5323  real(DP), intent(inout) :: hcofterm
5324  real(DP), intent(inout) :: rhsterm
5325  ! -- local
5326  real(DP) :: t
5327  real(DP) :: havg
5328  real(DP) :: rdensemaw
5329  real(DP) :: rdensegwf
5330  real(DP) :: rdenseavg
5331  real(DP) :: elevavg
5332  ! -- formats
5333  !
5334  ! -- assign relative density terms, return if zero which means not avail yet
5335  rdensemaw = this%denseterms(1, iconn)
5336  rdensegwf = this%denseterms(2, iconn)
5337  if (rdensegwf == dzero) return
5338  !
5339  ! -- update rhsterm with density contribution
5340  if (hmaw > bmaw .and. hgwf > bmaw) then
5341  !
5342  ! -- hmaw and hgwf both above bmaw
5343  rdenseavg = dhalf * (rdensemaw + rdensegwf)
5344  !
5345  ! -- update rhsterm with first density term
5346  t = cond * (rdenseavg - done) * (hgwf - hmaw)
5347  rhsterm = rhsterm + t
5348  flow = flow + t
5349  !
5350  ! -- update rhterm with second density term
5351  havg = dhalf * (hgwf + hmaw)
5352  elevavg = this%denseterms(3, iconn)
5353  t = cond * (havg - elevavg) * (rdensegwf - rdensemaw)
5354  rhsterm = rhsterm + t
5355  flow = flow + t
5356  else if (hmaw > bmaw) then
5357  !
5358  ! -- if only hmaw is above bmaw, then increase correction term by density
5359  t = (rdensemaw - done) * rhsterm
5360  rhsterm = rhsterm + t
5361  !
5362  else if (hgwf > bmaw) then
5363  !
5364  ! -- if only hgwf is above bmaw, then increase correction term by density
5365  t = (rdensegwf - done) * rhsterm
5366  rhsterm = rhsterm + t
5367  !
5368  else
5369  !
5370  ! -- Flow should be zero so do nothing
5371  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 4606 of file gwf-maw.f90.

4607  use tdismodule, only: delt
4608  ! -- dummy
4609  class(MawType), intent(inout) :: this
4610  integer(I4B), intent(in) :: n
4611  real(DP), intent(inout) :: qnet
4612  ! -- local
4613  integer(I4B) :: j
4614  integer(I4B) :: jpos
4615  integer(I4B) :: igwfnode
4616  real(DP) :: bt
4617  real(DP) :: tp
4618  real(DP) :: scale
4619  real(DP) :: cfw
4620  real(DP) :: hdterm
4621  real(DP) :: sat
4622  real(DP) :: cmaw
4623  real(DP) :: hgwf
4624  real(DP) :: bmaw
4625  real(DP) :: h_temp
4626  real(DP) :: hv
4627  real(DP) :: vscratio
4628  ! -- format
4629  !
4630  ! -- initialize qnet and h_temp
4631  qnet = dzero
4632  vscratio = done
4633  h_temp = this%shutofflevel(n)
4634  !
4635  ! -- if vsc active, select appropriate viscosity ratio
4636  if (this%ivsc == 1) then
4637  ! flow out of well (flow is negative)
4638  if (qnet < 0) then
4639  vscratio = this%viscratios(1, n)
4640  else
4641  vscratio = this%viscratios(2, n)
4642  end if
4643  end if
4644  !
4645  ! -- calculate discharge to flowing wells
4646  if (this%iflowingwells > 0) then
4647  if (this%fwcond(n) > dzero) then
4648  bt = this%fwelev(n)
4649  tp = bt + this%fwrlen(n)
4650  scale = sqsaturation(tp, bt, h_temp)
4651  cfw = scale * this%fwcond(n) * this%viscratios(2, n)
4652  this%ifwdischarge(n) = 0
4653  if (cfw > dzero) then
4654  this%ifwdischarge(n) = 1
4655  this%xsto(n) = bt
4656  end if
4657  qnet = qnet + cfw * (bt - h_temp)
4658  end if
4659  end if
4660  !
4661  ! -- calculate maw storage changes
4662  if (this%imawiss /= 1) then
4663  if (this%ifwdischarge(n) /= 1) then
4664  hdterm = this%xoldsto(n) - h_temp
4665  else
4666  hdterm = this%xoldsto(n) - this%fwelev(n)
4667  end if
4668  qnet = qnet - (this%area(n) * hdterm / delt)
4669  end if
4670  !
4671  ! -- calculate inflow from aquifer
4672  do j = 1, this%ngwfnodes(n)
4673  jpos = this%get_jpos(n, j)
4674  igwfnode = this%get_gwfnode(n, j)
4675  call this%maw_calculate_saturation(n, j, igwfnode, sat)
4676  cmaw = this%satcond(jpos) * vscratio * sat
4677  hgwf = this%xnew(igwfnode)
4678  bmaw = this%botscrn(jpos)
4679  hv = h_temp
4680  if (hv < bmaw) then
4681  hv = bmaw
4682  end if
4683  if (hgwf < bmaw) then
4684  hgwf = bmaw
4685  end if
4686  qnet = qnet + cmaw * (hgwf - hv)
4687  end do
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:32
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 4046 of file gwf-maw.f90.

4047  ! -- dummy
4048  class(MawType), intent(inout) :: this
4049  integer(I4B), intent(in) :: i
4050  integer(I4B), intent(in) :: j
4051  integer(I4B), intent(in) :: node
4052  ! -- local
4053  integer(I4B) :: iTcontrastErr
4054  integer(I4B) :: jpos
4055  real(DP) :: c
4056  real(DP) :: k11
4057  real(DP) :: k22
4058  real(DP) :: sqrtk11k22
4059  real(DP) :: hks
4060  real(DP) :: area
4061  real(DP) :: eradius
4062  real(DP) :: topw
4063  real(DP) :: botw
4064  real(DP) :: tthkw
4065  real(DP) :: tthka
4066  real(DP) :: Tcontrast
4067  real(DP) :: skin
4068  real(DP) :: ravg
4069  real(DP) :: slen
4070  real(DP) :: pavg
4071  real(DP) :: gwfsat
4072  real(DP) :: gwftop
4073  real(DP) :: gwfbot
4074  real(DP) :: lc1
4075  real(DP) :: lc2
4076  real(DP) :: dx
4077  real(DP) :: dy
4078  real(DP) :: Txx
4079  real(DP) :: Tyy
4080  real(DP) :: T2pi
4081  real(DP) :: yx4
4082  real(DP) :: xy4
4083  ! -- formats
4084  !
4085  ! -- initialize conductance variables
4086  itcontrasterr = 0
4087  lc1 = dzero
4088  lc2 = dzero
4089  !
4090  ! -- calculate connection position
4091  jpos = this%get_jpos(i, j)
4092  !
4093  ! -- set K11 and K22
4094  k11 = this%gwfk11(node)
4095  if (this%gwfik22 == 0) then
4096  k22 = this%gwfk11(node)
4097  else
4098  k22 = this%gwfk22(node)
4099  end if
4100  sqrtk11k22 = sqrt(k11 * k22)
4101  !
4102  ! -- set gwftop, gwfbot, and gwfsat
4103  gwftop = this%dis%top(node)
4104  gwfbot = this%dis%bot(node)
4105  tthka = gwftop - gwfbot
4106  gwfsat = this%gwfsat(node)
4107  !
4108  ! -- set top and bottom of well screen
4109  c = dzero
4110  topw = this%topscrn(jpos)
4111  botw = this%botscrn(jpos)
4112  tthkw = topw - botw
4113  !
4114  ! -- scale screen thickness using gwfsat (for NPF Package THICKSTRT)
4115  if (gwftop == topw .and. gwfbot == botw) then
4116  if (this%icelltype(node) == 0) then
4117  tthkw = tthkw * gwfsat
4118  tthka = tthka * gwfsat
4119  end if
4120  end if
4121  !
4122  ! -- calculate the aquifer transmissivity (T2pi)
4123  t2pi = dtwopi * tthka * sqrtk11k22
4124  !
4125  ! -- calculate effective radius
4126  if (this%dis%ndim == 3 .and. this%ieffradopt /= 0) then
4127  txx = k11 * tthka
4128  tyy = k22 * tthka
4129  dx = sqrt(this%dis%area(node))
4130  dy = dx
4131  yx4 = (tyy / txx)**dquarter
4132  xy4 = (txx / tyy)**dquarter
4133  eradius = 0.28_dp * ((yx4 * dx)**dtwo + &
4134  (xy4 * dy)**dtwo)**dhalf / (yx4 + xy4)
4135  else
4136  area = this%dis%area(node)
4137  eradius = sqrt(area / (deight * dpi))
4138  end if
4139  !
4140  ! -- conductance calculations
4141  ! -- Thiem equation (1) and cumulative Thiem and skin equations (3)
4142  if (this%ieqn(i) == 1 .or. this%ieqn(i) == 3) then
4143  lc1 = log(eradius / this%radius(i)) / t2pi
4144  end if
4145  !
4146  ! -- skin equation (2) and cumulative Thiem and skin equations (3)
4147  if (this%ieqn(i) == 2 .or. this%ieqn(i) == 3) then
4148  hks = this%hk(jpos)
4149  if (tthkw * hks > dzero) then
4150  tcontrast = (sqrtk11k22 * tthka) / (hks * tthkw)
4151  skin = (tcontrast - done) * log(this%sradius(jpos) / this%radius(i))
4152  !
4153  ! -- trap invalid transmissvity contrast if using skin equation (2).
4154  ! Not trapped for cumulative Thiem and skin equations (3)
4155  ! because the MNW2 package allowed this condition (for
4156  ! backward compatibility with the MNW2 package for
4157  ! MODFLOW-2005, MODFLOW-NWT, and MODFLOW-USG).
4158  if (tcontrast <= 1 .and. this%ieqn(i) == 2) then
4159  itcontrasterr = 1
4160  write (errmsg, '(a,g0,a,1x,i0,1x,a,1x,i0,a,4(1x,a))') &
4161  'Invalid calculated transmissivity contrast (', tcontrast, &
4162  ') for maw well', i, 'connection', j, '.', 'This happens when the', &
4163  'skin transmissivity equals or exceeds the aquifer transmissivity.', &
4164  'Consider decreasing HK_SKIN for the connection or using the', &
4165  'CUMULATIVE or MEAN conductance equations.'
4166  call store_error(errmsg)
4167  else
4168  lc2 = skin / t2pi
4169  end if
4170  end if
4171  end if
4172  ! -- conductance using screen elevations, hk, well radius,
4173  ! and screen radius
4174  if (this%ieqn(i) == 4) then
4175  hks = this%hk(jpos)
4176  ravg = dhalf * (this%radius(i) + this%sradius(jpos))
4177  slen = this%sradius(jpos) - this%radius(i)
4178  pavg = dtwopi * ravg
4179  c = hks * pavg * tthkw / slen
4180  end if
4181  !
4182  ! -- calculate final conductance for Thiem (1), Skin (2), and
4183  ! and cumulative Thiem and skin equations (3)
4184  if (this%ieqn(i) < 4) then
4185  if (lc1 + lc2 /= dzero) then
4186  c = done / (lc1 + lc2)
4187  else
4188  c = -dnodata
4189  end if
4190  end if
4191  !
4192  ! -- ensure that the conductance is not negative. Only write error message
4193  ! if error condition has not occurred for skin calculations (LC2)
4194  if (c < dzero .and. itcontrasterr == 0) then
4195  write (errmsg, '(a,g0,a,1x,i0,1x,a,1x,i0,a,4(1x,a))') &
4196  'Invalid calculated negative conductance (', c, &
4197  ') for maw well', i, 'connection', j, '.', 'this happens when the', &
4198  'skin transmissivity equals or exceeds the aquifer transmissivity.', &
4199  'consider decreasing hk_skin for the connection or using the', &
4200  'mean conductance equation.'
4201  call store_error(errmsg)
4202  end if
4203  !
4204  ! -- scale the saturated conductance by the length correction factor for
4205  ! non-vertical (slanted) connections. The factor is 1.0 for vertical
4206  ! connections, so this has no effect unless an ANGLEDATA block was read.
4207  if (this%inonvert /= 0) then
4208  c = c * this%maw_calc_lcorr(i, jpos)
4209  end if
4210  !
4211  ! -- set saturated conductance
4212  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,
real(dp), intent(in), optional  hwell_in 
)
private

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

4218  ! -- dummy
4219  class(MawType), intent(inout) :: this
4220  integer(I4B), intent(in) :: n
4221  integer(I4B), intent(in) :: j
4222  integer(I4B), intent(in) :: node
4223  real(DP), intent(inout) :: sat
4224  real(DP), intent(in), optional :: hwell_in !well head to use instead of the current well head
4225  ! -- local
4226  integer(I4B) :: jpos
4227  real(DP) :: h_temp
4228  real(DP) :: hwell
4229  real(DP) :: topw
4230  real(DP) :: botw
4231  ! -- formats
4232  !
4233  ! -- initialize saturation
4234  sat = dzero
4235  !
4236  ! -- calculate current saturation for convertible cells
4237  if (this%icelltype(node) /= 0) then
4238  !
4239  ! -- set hwell (use the caller-supplied head if provided)
4240  hwell = this%xnewpak(n)
4241  if (present(hwell_in)) then
4242  hwell = hwell_in
4243  end if
4244  !
4245  ! -- set connection position
4246  jpos = this%get_jpos(n, j)
4247  !
4248  ! -- set top and bottom of the well connection
4249  topw = this%topscrn(jpos)
4250  botw = this%botscrn(jpos)
4251  !
4252  ! -- calculate appropriate saturation
4253  if (this%inewton /= 1) then
4254  h_temp = this%xnew(node)
4255  if (h_temp < botw) then
4256  h_temp = botw
4257  end if
4258  if (hwell < botw) then
4259  hwell = botw
4260  end if
4261  h_temp = dhalf * (h_temp + hwell)
4262  else
4263  h_temp = this%xnew(node)
4264  if (hwell > h_temp) then
4265  h_temp = hwell
4266  end if
4267  if (h_temp < botw) then
4268  h_temp = botw
4269  end if
4270  end if
4271  ! -- calculate saturation
4272  sat = squadraticsaturation(topw, botw, h_temp, this%satomega)
4273  else
4274  sat = done
4275  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 4441 of file gwf-maw.f90.

4442  ! -- dummy
4443  class(MawType) :: this
4444  integer(I4B), intent(in) :: n
4445  real(DP), intent(in) :: hmaw
4446  real(DP), intent(inout) :: q
4447  ! -- local
4448  real(DP) :: scale
4449  real(DP) :: tp
4450  real(DP) :: bt
4451  real(DP) :: rate
4452  real(DP) :: weight
4453  real(DP) :: dq
4454  !
4455  ! -- Initialize q
4456  q = dzero
4457  !
4458  ! -- Assign rate as the user-provided base pumping rate
4459  rate = this%rate(n)
4460  !
4461  ! -- Assign q differently depending on whether this is an extraction well
4462  ! (rate < 0) or an injection well (rate > 0).
4463  if (rate < dzero) then
4464  !
4465  ! -- If well shut off is activated, then turn off well if necessary,
4466  ! or if shut off is not activated then check to see if rate scaling
4467  ! is on.
4468  if (this%shutofflevel(n) /= dep20) then
4469  call this%maw_calculate_qpot(n, q)
4470  if (q < dzero) q = dzero
4471  if (q > -rate) q = -rate
4472 
4473  if (this%ishutoffcnt == 1) then
4474  this%shutoffweight(n) = done
4475  this%shutoffdq(n) = dzero
4476  this%shutoffqold(n) = q
4477  end if
4478 
4479  dq = q - this%shutoffqold(n)
4480  weight = this%shutoffweight(n)
4481  !
4482  ! -- for oscillating condition, decrease factor
4483  if (this%shutoffdq(n) * dq < dzero) then
4484  weight = this%theta * this%shutoffweight(n)
4485  !
4486  ! -- when change is of same sign, increase factor
4487  else
4488  weight = this%shutoffweight(n) + this%kappa
4489  end if
4490  if (weight > done) weight = done
4491 
4492  q = this%shutoffqold(n) + weight * dq
4493 
4494  this%shutoffqold(n) = q
4495  this%shutoffdq(n) = dq
4496  this%shutoffweight(n) = weight
4497  !
4498  ! -- If shutoffmin and shutoffmax are specified then apply
4499  ! additional checks for when to shut off the well.
4500  if (this%shutoffmin(n) > dzero) then
4501  if (hmaw < this%shutofflevel(n)) then
4502  !
4503  ! -- calculate adjusted well rate subject to constraints
4504  ! -- well is shutoff
4505  if (this%ishutoff(n) /= 0) then
4506  q = dzero
4507  !
4508  ! --- well is not shut off
4509  else
4510  ! -- turn off well if q is less than the minimum rate and
4511  ! reset the ishutoff flag if at least on iteration 3
4512  if (q < this%shutoffmin(n)) then
4513  if (this%ishutoffcnt > 2) then
4514  this%ishutoff(n) = 1
4515  end if
4516  q = dzero
4517  !
4518  ! -- leave well on and use the specified rate
4519  ! or the potential rate
4520  end if
4521  end if
4522  !
4523  ! -- try to use the specified rate or the potential rate
4524  else
4525  if (q > this%shutoffmax(n)) then
4526  if (this%ishutoffcnt <= 2) then
4527  this%ishutoff(n) = 0
4528  end if
4529  end if
4530  if (this%ishutoff(n) /= 0) then
4531  q = dzero
4532  end if
4533  end if
4534  end if
4535 
4536  if (q /= dzero) q = -q
4537 
4538  else
4539  scale = done
4540  !
4541  ! -- Apply rate scaling by reducing pumpage when hmaw is less than the
4542  ! sum of maw pump elevation (pumpelev) and the specified reduction
4543  ! length. The rate will go to zero as hmaw drops to the pump
4544  ! elevation.
4545  if (this%reduction_length(n) /= dep20) then
4546  bt = this%pumpelev(n)
4547  tp = bt + this%reduction_length(n)
4548  scale = sqsaturation(tp, bt, hmaw)
4549  end if
4550  q = scale * rate
4551  end if
4552  !
4553  else
4554  !
4555  ! -- Handle the injection case (rate > 0) differently than extraction.
4556  q = rate
4557  if (this%shutofflevel(n) /= dep20) then
4558  call this%maw_calculate_qpot(n, q)
4559  q = -q
4560  if (q < dzero) q = dzero
4561  if (q > rate) q = rate
4562 
4563  if (this%ishutoffcnt == 1) then
4564  this%shutoffweight(n) = done
4565  this%shutoffdq(n) = dzero
4566  this%shutoffqold(n) = q
4567  end if
4568 
4569  dq = q - this%shutoffqold(n)
4570  weight = this%shutoffweight(n)
4571  !
4572  ! -- for oscillating condition, decrease factor
4573  if (this%shutoffdq(n) * dq < dzero) then
4574  weight = this%theta * this%shutoffweight(n)
4575  !
4576  ! -- when change is of same sign, increase factor
4577  else
4578  weight = this%shutoffweight(n) + this%kappa
4579  end if
4580  if (weight > done) weight = done
4581 
4582  q = this%shutoffqold(n) + weight * dq
4583 
4584  this%shutoffqold(n) = q
4585  this%shutoffdq(n) = dq
4586  this%shutoffweight(n) = weight
4587 
4588  else
4589  scale = done
4590  !
4591  ! -- Apply rate scaling for an injection well by reducing the
4592  ! injection rate as hmaw rises above the pump elevation. The rate
4593  ! will approach zero as hmaw approaches pumpelev + reduction_length.
4594  if (this%reduction_length(n) /= dep20) then
4595  bt = this%pumpelev(n)
4596  tp = bt + this%reduction_length(n)
4597  scale = done - sqsaturation(tp, bt, hmaw)
4598  end if
4599  q = scale * rate
4600  end if
4601  end if
Here is the call graph for this function:

◆ maw_cc()

subroutine mawmodule::maw_cc ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  innertot,
integer(i4b), intent(in)  kiter,
integer(i4b), intent(in)  iend,
integer(i4b), intent(in)  icnvgmod,
character(len=lenpakloc), intent(inout)  cpak,
integer(i4b), intent(inout)  ipak,
real(dp), intent(inout)  dpak 
)
private

This does two things:

  1. While a well is being damped by Newton under-relaxation, it keeps the model from converging until the well rate has also stopped changing (reported through dpak). Wells that are not being damped, and models that do not use Newton under-relaxation, are not affected.
  2. When the model fails to converge, it warns about any pumping well that is asking for more water than the aquifer can supply, a likely reason for the failure.

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

3047  ! -- modules
3048  use tdismodule, only: delt
3049  ! -- dummy
3050  class(MawType), intent(inout) :: this
3051  integer(I4B), intent(in) :: innertot
3052  integer(I4B), intent(in) :: kiter
3053  integer(I4B), intent(in) :: iend
3054  integer(I4B), intent(in) :: icnvgmod
3055  character(len=LENPAKLOC), intent(inout) :: cpak
3056  integer(I4B), intent(inout) :: ipak
3057  real(DP), intent(inout) :: dpak
3058  ! -- local
3059  integer(I4B) :: n
3060  integer(I4B) :: j
3061  integer(I4B) :: jpos
3062  integer(I4B) :: igwfnode
3063  integer(I4B) :: locdpak
3064  real(DP) :: botw
3065  real(DP) :: bmaw
3066  real(DP) :: hgwf
3067  real(DP) :: hv
3068  real(DP) :: sat
3069  real(DP) :: cmaw
3070  real(DP) :: qmax
3071  real(DP) :: qreq
3072  real(DP) :: qtolfact
3073  real(DP) :: dq
3074  real(DP) :: dpakmax
3075  character(len=LENPAKLOC) :: cloc
3076  ! -- parameters
3077  real(DP), parameter :: qtol = 1.001_dp !the request must exceed supply by this factor to warn
3078  ! -- formats
3079  character(len=*), parameter :: fmtwarn = &
3080  "('MAW well ', a, ' requests an extraction rate (', g0.5, &
3081  &') larger than the maximum rate (', g0.5, ') the aquifer can supply &
3082  &with the well head at its bottom. This may be preventing convergence. &
3083  &Consider reducing the requested rate, applying or widening RATE_SCALING, &
3084  &or reviewing the connection conductance (e.g. aquifer K).')"
3085  !
3086  ! -- rate convergence check. While a well is being damped (nurweight < 1)
3087  ! its head barely moves, so also require the well rate to stop changing
3088  ! before the model is allowed to converge. The rate change is turned
3089  ! into an equivalent head change (using the well area and time step) so
3090  ! it can be compared with the solver tolerance, and is passed back in
3091  ! dpak. Wells that are not being damped are left unchanged.
3092  dpakmax = dzero
3093  locdpak = 0
3094  do n = 1, this%nmawwells
3095  if (this%iboundpak(n) < 1) cycle
3096  if (this%nurweight(n) >= done) cycle
3097  if (this%area(n) > dzero) then
3098  qtolfact = delt / this%area(n)
3099  else
3100  qtolfact = dzero
3101  end if
3102  ! -- qsim0 and ratesim both come from maw_fc (before the solve), so dq is
3103  ! the rate change from the previous outer iteration -- one step behind
3104  ! the newest heads. That is fine here: a lagged rate can only delay
3105  ! convergence, never accept a bad answer, because the solver already
3106  ! checks the heads and steady heads mean a steady rate. The up-to-date
3107  ! rate is not used because recomputing it would change the well's
3108  ! shutoff and RATE_SCALING state.
3109  dq = (this%qsim0(n) - this%ratesim(n)) * qtolfact
3110  if (abs(dq) > abs(dpakmax)) then
3111  dpakmax = dq
3112  locdpak = n
3113  end if
3114  end do
3115  if (locdpak > 0 .and. abs(dpakmax) > abs(dpak)) then
3116  ipak = locdpak
3117  dpak = dpakmax
3118  write (cloc, "(a,'-',a)") trim(this%packName), 'rate'
3119  cpak = trim(cloc)
3120  end if
3121  !
3122  ! -- the over-demand warning is only written on the last outer iteration of
3123  ! a model that did not converge
3124  if (iend == 0) return
3125  if (icnvgmod /= 0) return
3126  !
3127  ! -- look at each active pumping (extraction) well
3128  do n = 1, this%nmawwells
3129  if (this%iboundpak(n) < 1) cycle
3130  if (this%rate(n) >= dzero) cycle
3131  botw = this%bot(n)
3132  !
3133  ! -- largest rate the aquifer could supply if the well head dropped all
3134  ! the way to the bottom of the well
3135  qmax = dzero
3136  do j = 1, this%ngwfnodes(n)
3137  jpos = this%get_jpos(n, j)
3138  igwfnode = this%get_gwfnode(n, j)
3139  hgwf = this%xnew(igwfnode)
3140  bmaw = this%botscrn(jpos)
3141  hv = max(botw, bmaw)
3142  !
3143  ! -- connection saturation evaluated with the well head at the bottom of
3144  ! the well (hv), consistent with this maximum-supply estimate, rather
3145  ! than at the current well head
3146  call this%maw_calculate_saturation(n, j, igwfnode, sat, hv)
3147  cmaw = this%satcond(jpos) * sat
3148  !
3149  ! -- only count connections that can supply water. A connection whose
3150  ! aquifer head is below the well bottom would take water in, so skip
3151  ! it instead of letting it lower the maximum supply.
3152  qmax = qmax + cmaw * max(hgwf - hv, dzero)
3153  end do
3154  !
3155  ! -- warn if the well is asking for more than the aquifer can supply
3156  qreq = -this%rate(n)
3157  if (qmax >= dzero .and. qreq > qtol * qmax) then
3158  write (cloc, '(a, a, a, a, i0, a, i0, a)') trim(this%name_model), '-(', &
3159  trim(this%filtyp), '_', this%ibcnum, '-', n, ')'
3160  write (warnmsg, fmtwarn) trim(cloc), qreq, qmax
3161  call store_warning(warnmsg)
3162  end if
3163  end do
Here is the call graph for this function:

◆ maw_cell_extent()

real(dp) function mawmodule::maw_cell_extent ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  node,
logical(lgp), intent(out)  estimated 
)
private

The extent is the largest distance between two cell vertices where they are defined, and is estimated as the diagonal of a square with the same area where they are not.

Parameters
[in]nodereduced node number of the connected cell
[out]estimatedextent is estimated from the cell area

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

1557  use constantsmodule, only: dis, disv, disu, dtwo
1558  use geomutilmodule, only: polygon_extent
1559  ! -- dummy
1560  class(MawType), intent(inout) :: this
1561  integer(I4B), intent(in) :: node !< reduced node number of the connected cell
1562  logical(LGP), intent(out) :: estimated !< extent is estimated from the cell area
1563  ! -- return
1564  real(DP) :: extent
1565  ! -- local
1566  real(DP), allocatable, dimension(:, :) :: polyverts
1567  integer(I4B) :: nverts
1568  !
1569  ! -- the vertices are optional for a disu grid and are not defined for
1570  ! grids that have no cell polygons
1571  nverts = 0
1572  select case (this%dis%get_dis_enum())
1573  case (dis, disv, disu)
1574  nverts = this%dis%get_npolyverts(node)
1575  end select
1576  !
1577  estimated = nverts == 0
1578  if (estimated) then
1579  extent = sqrt(dtwo * this%dis%area(node))
1580  else
1581  call this%dis%get_polyverts(node, polyverts)
1582  extent = polygon_extent(polyverts(1, :), polyverts(2, :))
1583  deallocate (polyverts)
1584  end if
@ disu
DISV6 discretization.
Definition: Constants.f90:158
@ dis
DIS6 discretization.
Definition: Constants.f90:156
@ disv
DISU6 discretization.
Definition: Constants.f90:157
pure real(dp) function, public polygon_extent(xv, yv)
Calculate the maximum distance between two polygon vertices.
Definition: GeomUtil.f90:388
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 2578 of file gwf-maw.f90.

2579  ! -- dummy
2580  class(MawType) :: this
2581  ! -- local
2582  !
2583  ! -- Calculate maw conductance and update package RHS and HCOF
2584  call this%maw_cfupdate()

◆ maw_cfupdate()

subroutine mawmodule::maw_cfupdate ( class(mawtype)  this)

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

4693  class(MawType) :: this
4694  ! -- dummy
4695  ! -- local
4696  integer(I4B) :: j
4697  integer(I4B) :: n
4698  integer(I4B) :: jpos
4699  integer(I4B) :: icflow
4700  integer(I4B) :: ibnd
4701  real(DP) :: flow
4702  real(DP) :: cmaw
4703  real(DP) :: hmaw
4704  real(DP) :: cterm
4705  real(DP) :: term
4706  !
4707  ! -- Return if no maw wells
4708  if (this%nbound .eq. 0) return
4709  !
4710  ! -- Update shutoff count
4711  this%ishutoffcnt = this%ishutoffcnt + 1
4712  !
4713  ! -- Calculate hcof and rhs for each maw entry
4714  ibnd = 1
4715  do n = 1, this%nmawwells
4716  hmaw = this%xnewpak(n)
4717  do j = 1, this%ngwfnodes(n)
4718  jpos = this%get_jpos(n, j)
4719  this%hcof(ibnd) = dzero
4720  this%rhs(ibnd) = dzero
4721  !
4722  ! -- set bound, hcof, and rhs components
4723  !
4724  ! -- use connection method so the gwf-maw budget flows
4725  ! are consistent with the maw-gwf budget flows
4726  if (this%iboundpak(n) == 0) then
4727  cmaw = dzero
4728  term = dzero
4729  cterm = dzero
4730  else
4731  call this%maw_calculate_conn_terms(n, j, icflow, cmaw, cterm, &
4732  term, flow)
4733  end if
4734  this%simcond(jpos) = cmaw
4735  this%bound(2, ibnd) = cmaw
4736  this%hcof(ibnd) = -term
4737  this%rhs(ibnd) = -term * hmaw + cterm
4738  !
4739  ! -- increment boundary number
4740  ibnd = ibnd + 1
4741  end do
4742  end do

◆ maw_check_attributes()

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

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

1915  use simmodule, only: store_error
1916  ! -- dummy
1917  class(MawType), intent(inout) :: this
1918  ! -- local
1919  character(len=LINELENGTH) :: cgwfnode
1920  integer(I4B) :: idx
1921  integer(I4B) :: n
1922  integer(I4B) :: j
1923  integer(I4B) :: jpos
1924  ! -- formats
1925  !
1926  idx = 1
1927  do n = 1, this%nmawwells
1928  if (this%ngwfnodes(n) < 1) then
1929  call this%maw_set_attribute_error(n, 'NGWFNODES', 'must be greater '// &
1930  'than 0.')
1931  end if
1932  if (this%radius(n) == dep20) then
1933  call this%maw_set_attribute_error(n, 'RADIUS', 'has not been specified.')
1934  end if
1935  if (this%shutoffmin(n) > dzero) then
1936  if (this%shutoffmin(n) >= this%shutoffmax(n)) then
1937  call this%maw_set_attribute_error(n, 'SHUT_OFF', 'shutoffmax must '// &
1938  'be greater than shutoffmin.')
1939  end if
1940  end if
1941  do j = 1, this%ngwfnodes(n)
1942  !
1943  ! -- calculate jpos
1944  jpos = this%get_jpos(n, j)
1945  !
1946  ! -- write gwfnode number
1947  write (cgwfnode, '(a,i0,a)') 'gwfnode(', j, ')'
1948  !
1949  ! -- connection screen data
1950  if (this%botscrn(jpos) >= this%topscrn(jpos)) then
1951  call this%maw_set_attribute_error(n, 'SCREEN_TOP', 'screen bottom '// &
1952  'must be less than screen top. '// &
1953  trim(cgwfnode))
1954  end if
1955  !
1956  ! -- connection skin hydraulic conductivity
1957  if (this%ieqn(n) == 2 .OR. this%ieqn(n) == 3 .OR. &
1958  this%ieqn(n) == 4) then
1959  if (this%hk(jpos) <= dzero) then
1960  call this%maw_set_attribute_error(n, 'HK_SKIN', 'skin hyraulic '// &
1961  'conductivity must be greater '// &
1962  'than zero. '//trim(cgwfnode))
1963  end if
1964  else if (this%ieqn(n) == 0) then
1965  !
1966  ! -- saturated conductance
1967  if (this%satcond(jpos) < dzero) then
1968  call this%maw_set_attribute_error(n, 'HK_SKIN', &
1969  'skin hyraulic conductivity '// &
1970  'must be greater than or '// &
1971  'equal to zero when using '// &
1972  'SPECIFIED condeqn. '// &
1973  trim(cgwfnode))
1974  end if
1975  end if
1976  idx = idx + 1
1977  end do
1978  end do
1979  ! -- reset check_attr
1980  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_checkin_deprecated_names()

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

IDM integration moved several well variables into the input context, renaming some. These aliases share memory with the relocated variables so that programs addressing them through the API by their old package-path names continue to resolve; each use is reported as deprecated.

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

618  ! -- modules
621  ! -- dummy
622  class(MawType), intent(inout) :: this
623  ! -- local
624  real(DP), dimension(:, :), pointer, contiguous :: aux => null()
625  integer(I4B) :: isize
626  ! -- code
627  !
628  call mem_alias_deprecated(this%rate, 'RATE', this%memoryPath, &
629  'RATE', this%input_mempath, '6.8.2')
630  call mem_alias_deprecated(this%well_head, 'WELL_HEAD', this%memoryPath, &
631  'WELL_HEAD', this%input_mempath, '6.8.2')
632  !
633  ! -- well auxiliary values, present (possibly empty) in the input context;
634  ! without auxiliary variables MAUXVAR is empty, where 6.8.1 allocated
635  ! one row of zeros
636  call get_isize('AUX', this%input_mempath, isize)
637  if (isize >= 0) then
638  call mem_setptr(aux, 'AUX', this%input_mempath)
639  call mem_alias_deprecated(aux, 'MAUXVAR', this%memoryPath, &
640  'AUX', this%input_mempath, '6.8.2')
641  end if
Previous variable names checked in as deprecated aliases.
Definition: MemoryAlias.f90:7
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
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 
)

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

3169  ! -- modules
3170  use tdismodule, only: delt
3171  use constantsmodule, only: lenboundname
3172  use budgetmodule, only: budgettype
3173  ! -- dummy
3174  class(MawType), intent(inout) :: this
3175  real(DP), dimension(:), intent(in) :: x
3176  real(DP), dimension(:), contiguous, intent(inout) :: flowja
3177  integer(I4B), optional, intent(in) :: iadv
3178  ! -- local
3179  real(DP) :: rrate
3180  real(DP) :: ss
3181  real(DP) :: ssold
3182  ! -- for budget
3183  integer(I4B) :: j
3184  integer(I4B) :: n
3185  integer(I4B) :: ibnd
3186  real(DP) :: hmaw
3187  real(DP) :: cfw
3188  ! -- for observations
3189  ! -- formats
3190  !
3191  ! -- recalculate package HCOF and RHS terms with latest groundwater and
3192  ! maw heads prior to calling base budget functionality
3193  call this%maw_cfupdate()
3194  !
3195  ! -- call base functionality in bnd_cq. This will calculate maw-gwf flows
3196  ! and put them into this%simvals
3197  call this%BndType%bnd_cq(x, flowja, iadv=1)
3198  !
3199  ! -- calculate maw budget flow and storage terms
3200  do n = 1, this%nmawwells
3201  this%qout(n) = dzero
3202  this%qsto(n) = dzero
3203  if (this%iflowingwells > 0) then
3204  this%qfw(n) = dzero
3205  end if
3206  if (this%iboundpak(n) == 0) then
3207  cycle
3208  end if
3209  !
3210  ! -- set hmaw and xsto
3211  hmaw = this%xnewpak(n)
3212  this%xsto(n) = hmaw
3213  !
3214  ! -- add pumping rate to active maw well
3215  rrate = this%ratesim(n)
3216  !
3217  ! -- If flow is out of maw set qout to rrate.
3218  if (rrate < dzero) then
3219  this%qout(n) = rrate
3220  end if
3221  !
3222  ! -- add flowing well
3223  if (this%iflowingwells > 0) then
3224  if (this%fwcond(n) > dzero) then
3225  cfw = this%fwcondsim(n)
3226  ! -- only raise the storage level to the flowing-well elevation when
3227  ! the well is actually discharging (ifwdischarge == 1), matching
3228  ! the storage term assembled in maw_fc
3229  if (this%ifwdischarge(n) == 1) then
3230  this%xsto(n) = this%fwelev(n)
3231  end if
3232  rrate = cfw * (this%fwelev(n) - hmaw)
3233  this%qfw(n) = rrate
3234  !
3235  ! -- Subtract flowing well rrate from qout.
3236  this%qout(n) = this%qout(n) + rrate
3237  end if
3238  end if
3239  !
3240  ! -- Calculate qsto so it matches the storage term built in maw_fc. A
3241  ! flowing well that is actively discharging (ifwdischarge == 1) uses
3242  ! the flowing-well elevation (xsto = fwelev). Otherwise the storage
3243  ! water level is not allowed to drop below the bottom of the well.
3244  ! Testing ifwdischarge (not fwcond) keeps the budget in step with the
3245  ! matrix when a flowing well is at or below its discharge elevation.
3246  if (this%imawiss /= 1) then
3247  if (this%iflowingwells > 0 .and. this%ifwdischarge(n) == 1) then
3248  rrate = -this%area(n) * (this%xsto(n) - this%xoldsto(n)) / delt
3249  else
3250  ss = squadratic0sp(hmaw, this%bot(n), this%satomega)
3251  ssold = squadratic0sp(this%xoldsto(n), this%bot(n), this%satomega)
3252  rrate = -this%area(n) * (ss - ssold) / delt
3253  end if
3254  this%qsto(n) = rrate
3255  end if
3256  end do
3257  !
3258  ! -- gwf and constant flow
3259  ibnd = 1
3260  do n = 1, this%nmawwells
3261  hmaw = this%xnewpak(n)
3262  this%qconst(n) = dzero
3263  do j = 1, this%ngwfnodes(n)
3264  rrate = -this%simvals(ibnd)
3265  this%qleak(ibnd) = rrate
3266  if (this%iboundpak(n) < 0) then
3267  this%qconst(n) = this%qconst(n) - rrate
3268  !
3269  ! -- If flow is out increment qout by -rrate.
3270  if (-rrate < dzero) then
3271  this%qout(n) = this%qout(n) - rrate
3272  end if
3273  end if
3274  !
3275  ! -- increment ibnd counter
3276  ibnd = ibnd + 1
3277  end do
3278  !
3279  ! -- add additional flow terms to constant head term
3280  if (this%iboundpak(n) < 0) then
3281  !
3282  ! -- add well pumping rate
3283  this%qconst(n) = this%qconst(n) - this%ratesim(n)
3284  !
3285  ! -- add flowing well rate
3286  if (this%iflowingwells > 0) then
3287  this%qconst(n) = this%qconst(n) - this%qfw(n)
3288  end if
3289  !
3290  ! -- add storage term
3291  if (this%imawiss /= 1) then
3292  this%qconst(n) = this%qconst(n) - this%qsto(n)
3293  end if
3294  end if
3295  end do
3296  !
3297  ! -- fill the budget object
3298  call this%maw_fill_budobj()
This module contains the BudgetModule.
Definition: Budget.f90:20
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:36
Derived type for the Budget object.
Definition: Budget.f90:40
Here is the call graph for this function:

◆ 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,
character(len=*), intent(in)  mempath 
)

After creating the package object point bndobj to the new package

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

297  ! -- dummy
298  class(BndType), pointer :: packobj
299  integer(I4B), intent(in) :: id
300  integer(I4B), intent(in) :: ibcnum
301  integer(I4B), intent(in) :: inunit
302  integer(I4B), intent(in) :: iout
303  character(len=*), intent(in) :: namemodel
304  character(len=*), intent(in) :: pakname
305  character(len=*), intent(in) :: mempath
306  type(MawType), pointer :: mawobj
307  !
308  ! -- allocate the object and assign values to object variables
309  allocate (mawobj)
310  packobj => mawobj
311  !
312  ! -- create name and memory path
313  call packobj%set_names(ibcnum, namemodel, pakname, ftype, mempath)
314  packobj%text = text
315  !
316  ! -- allocate scalars
317  call mawobj%maw_allocate_scalars()
318  !
319  ! -- initialize package
320  call packobj%pack_initialize()
321  !
322  packobj%inunit = inunit
323  packobj%iout = iout
324  packobj%id = id
325  packobj%ibcnum = ibcnum
326  packobj%ncolbnd = 4
327  packobj%iscloc = 0 ! not supported
328  packobj%isadvpak = 1
329  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 3413 of file gwf-maw.f90.

3414  ! -- modules
3416  ! -- dummy
3417  class(MawType) :: this
3418  ! -- local
3419  !
3420  ! -- budobj
3421  call this%budobj%budgetobject_da()
3422  deallocate (this%budobj)
3423  nullify (this%budobj)
3424  !
3425  ! -- head table
3426  if (this%iprhed > 0) then
3427  call this%headtab%table_da()
3428  deallocate (this%headtab)
3429  nullify (this%headtab)
3430  end if
3431  !
3432  ! -- character arrays
3433  call mem_deallocate(this%cmawbudget, 'CMAWBUDGET', this%memoryPath)
3434  call mem_deallocate(this%cmawname, 'CMAWNAME', this%memoryPath)
3435  call mem_deallocate(this%status, 'STATUS', this%memoryPath)
3436  !
3437  ! -- deallocate well data pointers in memory manager
3438  call mem_deallocate(this%ngwfnodes)
3439  call mem_deallocate(this%ieqn)
3440  call mem_deallocate(this%ishutoff)
3441  call mem_deallocate(this%ifwdischarge)
3442  call mem_deallocate(this%strt)
3443  call mem_deallocate(this%radius)
3444  call mem_deallocate(this%area)
3445  call mem_deallocate(this%pumpelev)
3446  call mem_deallocate(this%bot)
3447  call mem_deallocate(this%ratesim)
3448  call mem_deallocate(this%qsim0)
3449  call mem_deallocate(this%reduction_length)
3450  call mem_deallocate(this%fwelev)
3451  call mem_deallocate(this%fwcond)
3452  call mem_deallocate(this%fwrlen)
3453  call mem_deallocate(this%fwcondsim)
3454  call mem_deallocate(this%xsto)
3455  call mem_deallocate(this%xoldsto)
3456  call mem_deallocate(this%shutoffmin)
3457  call mem_deallocate(this%shutoffmax)
3458  call mem_deallocate(this%shutofflevel)
3459  call mem_deallocate(this%shutoffweight)
3460  call mem_deallocate(this%shutoffdq)
3461  call mem_deallocate(this%shutoffqold)
3462  call mem_deallocate(this%nurdxold)
3463  call mem_deallocate(this%nurweight)
3464  !
3465  ! -- input-context-owned aliases, not package-allocated
3466  nullify (this%rate)
3467  nullify (this%well_head)
3468  call mem_deallocate(this%well_head_set)
3469  !
3470  ! -- connection data
3471  call mem_deallocate(this%iaconn)
3472  call mem_deallocate(this%gwfnodes)
3473  call mem_deallocate(this%sradius)
3474  call mem_deallocate(this%hk)
3475  call mem_deallocate(this%satcond)
3476  call mem_deallocate(this%simcond)
3477  call mem_deallocate(this%topscrn)
3478  call mem_deallocate(this%botscrn)
3479  call mem_deallocate(this%angle)
3480  call mem_deallocate(this%connlen)
3481  call mem_deallocate(this%usrtopscrn)
3482  call mem_deallocate(this%usrbotscrn)
3483  !
3484  ! -- imap vector
3485  call mem_deallocate(this%imap)
3486  call mem_deallocate(this%dbuff)
3487  call mem_deallocate(this%cauxcbc, 'CAUXCBC', this%memoryPath)
3488  call mem_deallocate(this%qauxcbc)
3489  call mem_deallocate(this%qleak)
3490  call mem_deallocate(this%qfw)
3491  call mem_deallocate(this%qout)
3492  call mem_deallocate(this%qsto)
3493  call mem_deallocate(this%qconst)
3494  call mem_deallocate(this%denseterms)
3495  call mem_deallocate(this%viscratios)
3496  call mem_deallocate(this%idxlocnode)
3497  call mem_deallocate(this%idxdglo)
3498  call mem_deallocate(this%idxoffdglo)
3499  call mem_deallocate(this%idxsymdglo)
3500  call mem_deallocate(this%idxsymoffdglo)
3501  call mem_deallocate(this%xoldpak)
3502  !
3503  ! -- nullify pointers
3504  call mem_deallocate(this%xnewpak, 'HEAD', this%memoryPath)
3505  !
3506  ! -- scalars
3507  call mem_deallocate(this%correct_flow)
3508  call mem_deallocate(this%iprhed)
3509  call mem_deallocate(this%iheadout)
3510  call mem_deallocate(this%ibudgetout)
3511  call mem_deallocate(this%ibudcsv)
3512  call mem_deallocate(this%iflowingwells)
3513  call mem_deallocate(this%imawiss)
3514  call mem_deallocate(this%imawissopt)
3515  call mem_deallocate(this%nmawwells)
3516  call mem_deallocate(this%check_attr)
3517  call mem_deallocate(this%ishutoffcnt)
3518  call mem_deallocate(this%ieffradopt)
3519  call mem_deallocate(this%inonvert)
3520  call mem_deallocate(this%ioutredflowcsv)
3521  call mem_deallocate(this%satomega)
3522  call mem_deallocate(this%bditems)
3523  call mem_deallocate(this%theta)
3524  call mem_deallocate(this%kappa)
3525  call mem_deallocate(this%cbcauxitems)
3526  call mem_deallocate(this%idense)
3527  !
3528  ! -- pointers to gwf variables
3529  nullify (this%gwfiss)
3530  !
3531  ! -- nullify MAW input context pointers
3532  call this%input%destroy()
3533  !
3534  ! -- deallocate base
3535  call this%BndExtType%bnd_da()

◆ maw_damp_weight()

pure real(dp) function, public mawmodule::maw_damp_weight ( real(dp), intent(in)  dxprop,
real(dp), intent(in)  dxold,
real(dp), intent(in)  weight,
real(dp), intent(in)  damptheta,
real(dp), intent(in)  damptol,
real(dp), intent(in)  weightmin,
real(dp), intent(in)  recover 
)

This is the decision used by maw_nur. The weight is cut back (multiplied by damptheta, but never below weightmin) only when the proposed head change reversed direction and is not already getting smaller (its size is at least damptol times the previous change). Otherwise the weight grows back toward one by recover. It is a pure function so the logic can be unit tested.

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

3017  ! -- dummy
3018  real(DP), intent(in) :: dxprop !proposed well head change this outer iteration
3019  real(DP), intent(in) :: dxold !well head change applied last outer iteration
3020  real(DP), intent(in) :: weight !current damping weight
3021  real(DP), intent(in) :: damptheta !factor the weight is cut by when oscillating
3022  real(DP), intent(in) :: damptol !smallest |dxprop|/|dxold| ratio that is damped
3023  real(DP), intent(in) :: weightmin !smallest allowed weight
3024  real(DP), intent(in) :: recover !amount the weight grows back each iteration
3025  ! -- return
3026  real(DP) :: new_weight
3027  !
3028  if (dxprop * dxold < dzero .and. abs(dxprop) > damptol * abs(dxold)) then
3029  new_weight = max(damptheta * weight, weightmin)
3030  else
3031  new_weight = min(weight + recover, done)
3032  end if
Here is the caller graph for this function:

◆ maw_df_obs()

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

Overrides BndTypebnd_df_obs

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

3616  ! -- dummy
3617  class(MawType) :: this
3618  ! -- local
3619  integer(I4B) :: indx
3620  !
3621  ! -- Store obs type and assign procedure pointer
3622  ! for head observation type.
3623  call this%obs%StoreObsType('head', .false., indx)
3624  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3625  !
3626  ! -- Store obs type and assign procedure pointer
3627  ! for frommvr observation type.
3628  call this%obs%StoreObsType('from-mvr', .false., indx)
3629  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3630  !
3631  ! -- Store obs type and assign procedure pointer
3632  ! for conn-rate observation type.
3633  call this%obs%StoreObsType('maw', .true., indx)
3634  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3635  !
3636  ! -- Store obs type and assign procedure pointer
3637  ! for rate observation type.
3638  call this%obs%StoreObsType('rate', .true., indx)
3639  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3640  !
3641  ! -- Store obs type and assign procedure pointer
3642  ! for rate-to-mvr observation type.
3643  call this%obs%StoreObsType('rate-to-mvr', .true., indx)
3644  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3645  !
3646  ! -- Store obs type and assign procedure pointer
3647  ! for fw-rate observation type.
3648  call this%obs%StoreObsType('fw-rate', .true., indx)
3649  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3650  !
3651  ! -- Store obs type and assign procedure pointer
3652  ! for rate-to-mvr observation type.
3653  call this%obs%StoreObsType('fw-to-mvr', .true., indx)
3654  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3655  !
3656  ! -- Store obs type and assign procedure pointer
3657  ! for storage observation type.
3658  call this%obs%StoreObsType('storage', .true., indx)
3659  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3660  !
3661  ! -- Store obs type and assign procedure pointer
3662  ! for constant observation type.
3663  call this%obs%StoreObsType('constant', .true., indx)
3664  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3665  !
3666  ! -- Store obs type and assign procedure pointer
3667  ! for cond observation type.
3668  call this%obs%StoreObsType('conductance', .true., indx)
3669  this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsid
3670  !
3671  ! -- Store obs type and assign procedure pointer
3672  ! for fw-conductance observation type.
3673  call this%obs%StoreObsType('fw-conductance', .true., indx)
3674  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 2589 of file gwf-maw.f90.

2590  ! -- modules
2591  use tdismodule, only: delt
2592  ! -- dummy
2593  class(MawType) :: this
2594  real(DP), dimension(:), intent(inout) :: rhs
2595  integer(I4B), dimension(:), intent(in) :: ia
2596  integer(I4B), dimension(:), intent(in) :: idxglo
2597  class(MatrixBaseType), pointer :: matrix_sln
2598  ! -- local
2599  integer(I4B) :: j
2600  integer(I4B) :: n
2601  integer(I4B) :: idx
2602  integer(I4B) :: iloc
2603  integer(I4B) :: isymloc
2604  integer(I4B) :: igwfnode
2605  integer(I4B) :: iposd
2606  integer(I4B) :: iposoffd
2607  integer(I4B) :: isymnode
2608  integer(I4B) :: ipossymd
2609  integer(I4B) :: ipossymoffd
2610  integer(I4B) :: jpos
2611  integer(I4B) :: icflow
2612  real(DP) :: hmaw
2613  real(DP) :: hgwf
2614  real(DP) :: cfw
2615  real(DP) :: cmaw
2616  real(DP) :: cterm
2617  real(DP) :: term
2618  real(DP) :: scale
2619  real(DP) :: tp
2620  real(DP) :: bt
2621  real(DP) :: rate
2622  real(DP) :: ratefw
2623  real(DP) :: flow
2624  real(DP) :: tled
2625  real(DP) :: sd
2626  real(DP) :: ss
2627  real(DP) :: ssold
2628  !
2629  ! -- pakmvrobj fc
2630  if (this%imover == 1) then
2631  call this%pakmvrobj%fc()
2632  end if
2633  !
2634  ! -- Copy package rhs and hcof into solution rhs and amat
2635  idx = 1
2636  do n = 1, this%nmawwells
2637  iloc = this%idxlocnode(n)
2638  !
2639  ! -- save the well rate from the previous outer iteration before it is
2640  ! recalculated below, for the rate convergence check in maw_cc
2641  this%qsim0(n) = this%ratesim(n)
2642  !
2643  ! -- update head value for constant head maw wells
2644  if (this%iboundpak(n) < 0) then
2645  this%xnewpak(n) = this%well_head(n)
2646  end if
2647  hmaw = this%xnewpak(n)
2648  !
2649  ! -- add pumping rate to active or constant maw well
2650  if (this%iboundpak(n) == 0) then
2651  this%ratesim(n) = dzero
2652  else
2653  call this%maw_calculate_wellq(n, hmaw, rate)
2654  this%ratesim(n) = rate
2655  rhs(iloc) = rhs(iloc) - rate
2656  !
2657  ! -- location of diagonal for maw row
2658  iposd = this%idxdglo(idx)
2659  !
2660  ! -- add flowing well
2661  this%xsto(n) = hmaw
2662  ratefw = dzero
2663  if (this%iflowingwells > 0) then
2664  if (this%fwcond(n) > dzero) then
2665  bt = this%fwelev(n)
2666  tp = bt + this%fwrlen(n)
2667  scale = sqsaturation(tp, bt, hmaw)
2668  cfw = scale * this%fwcond(n)
2669  this%ifwdischarge(n) = 0
2670  if (cfw > dzero) then
2671  this%ifwdischarge(n) = 1
2672  this%xsto(n) = bt
2673  end if
2674  this%fwcondsim(n) = cfw
2675  call matrix_sln%add_value_pos(iposd, -cfw)
2676  rhs(iloc) = rhs(iloc) - cfw * bt
2677  ratefw = cfw * (bt - hmaw)
2678  end if
2679  end if
2680  !
2681  ! -- add maw storage changes
2682  if (this%imawiss /= 1) then
2683  if (this%ifwdischarge(n) /= 1) then
2684  ! -- well storage. The storage water level is not allowed to drop
2685  ! below the bottom of the well: ss is a smooth version of
2686  ! max(hmaw, well bottom). The storage release then fades out as
2687  ! the well empties instead of drawing water from below the well
2688  ! bottom. While the head is above the bottom this is the original
2689  ! term (sd = 1, ss = hmaw, giving -area/delt).
2690  tled = this%area(n) / delt
2691  sd = squadratic0spderivative(hmaw, this%bot(n), this%satomega)
2692  ss = squadratic0sp(hmaw, this%bot(n), this%satomega)
2693  ssold = squadratic0sp(this%xoldsto(n), this%bot(n), this%satomega)
2694  call matrix_sln%add_value_pos(iposd, -tled * sd)
2695  rhs(iloc) = rhs(iloc) - tled * (sd * hmaw - ss + ssold)
2696  else
2697  cterm = this%xoldsto(n) - this%fwelev(n)
2698  rhs(iloc) = rhs(iloc) - (this%area(n) * cterm / delt)
2699  end if
2700  end if
2701  !
2702  ! -- If mover is active, add receiver water to rhs and
2703  ! store available water (as positive value)
2704  if (this%imover == 1) then
2705  rhs(iloc) = rhs(iloc) - this%pakmvrobj%get_qfrommvr(n)
2706  !
2707  ! -- add pumping rate to mover if not injection
2708  if (rate < 0) then
2709  call this%pakmvrobj%accumulate_qformvr(n, -rate) !pumped water
2710  end if
2711  !
2712  ! -- add flowing well flow to mover
2713  call this%pakmvrobj%accumulate_qformvr(n, -ratefw) !flowing water
2714  end if
2715  !
2716  end if
2717  !
2718  ! -- process each maw/gwf connection
2719  do j = 1, this%ngwfnodes(n)
2720  if (this%iboundpak(n) /= 0) then
2721  jpos = this%get_jpos(n, j)
2722  igwfnode = this%get_gwfnode(n, j)
2723  hgwf = this%xnew(igwfnode)
2724  !
2725  ! -- calculate connection terms
2726  call this%maw_calculate_conn_terms(n, j, icflow, cmaw, cterm, term, &
2727  flow)
2728  this%simcond(jpos) = cmaw
2729  !
2730  ! -- add to maw row
2731  iposd = this%idxdglo(idx)
2732  iposoffd = this%idxoffdglo(idx)
2733  call matrix_sln%add_value_pos(iposd, -term)
2734  call matrix_sln%set_value_pos(iposoffd, term)
2735  !
2736  ! -- add correction term
2737  rhs(iloc) = rhs(iloc) - cterm
2738  !
2739  ! -- add to gwf row for maw connection
2740  isymnode = this%get_gwfnode(n, j)
2741  isymloc = ia(isymnode)
2742  ipossymd = this%idxsymdglo(idx)
2743  ipossymoffd = this%idxsymoffdglo(idx)
2744  call matrix_sln%add_value_pos(ipossymd, -term)
2745  call matrix_sln%set_value_pos(ipossymoffd, term)
2746  !
2747  ! -- add correction term to gwf row
2748  rhs(isymnode) = rhs(isymnode) + cterm
2749  end if
2750  !
2751  ! -- increment maw connection counter
2752  idx = idx + 1
2753  end do
2754  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 4951 of file gwf-maw.f90.

4952  ! -- modules
4953  ! -- dummy
4954  class(MawType) :: this
4955  ! -- local
4956  integer(I4B) :: naux
4957  integer(I4B) :: j
4958  integer(I4B) :: n
4959  integer(I4B) :: n2
4960  integer(I4B) :: jpos
4961  integer(I4B) :: idx
4962  integer(I4B) :: ibnd
4963  real(DP) :: q
4964  real(DP) :: tmaw
4965  real(DP) :: bmaw
4966  real(DP) :: sat
4967  real(DP) :: qfact
4968  real(DP) :: q2
4969  real(DP) :: b
4970  real(DP) :: v
4971  ! -- formats
4972  !
4973  ! -- initialize counter
4974  idx = 0
4975  !
4976  ! -- GWF (LEAKAGE) and connection surface area (aux)
4977  idx = idx + 1
4978  call this%budobj%budterm(idx)%reset(this%maxbound)
4979  ibnd = 1
4980  do n = 1, this%nmawwells
4981  do j = 1, this%ngwfnodes(n)
4982  jpos = this%get_jpos(n, j)
4983  n2 = this%get_gwfnode(n, j)
4984  !
4985  ! -- an inactive well has no wetted area, so it exchanges no heat
4986  ! by conduction with the aquifer (MWE)
4987  if (this%iboundpak(n) == 0) then
4988  this%qauxcbc(1) = dzero
4989  else
4990  tmaw = this%topscrn(jpos)
4991  bmaw = this%botscrn(jpos)
4992  call this%maw_calculate_saturation(n, j, n2, sat)
4993  this%qauxcbc(1) = dtwo * dpi * this%radius(n) * sat * (tmaw - bmaw)
4994  end if
4995  q = this%qleak(ibnd)
4996  call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
4997  ibnd = ibnd + 1
4998  end do
4999  end do
5000  !
5001  ! -- RATE (WITHDRAWAL RATE)
5002  idx = idx + 1
5003  call this%budobj%budterm(idx)%reset(this%nmawwells)
5004  do n = 1, this%nmawwells
5005  q = this%ratesim(n)
5006  !
5007  ! -- adjust if well rate is an outflow
5008  if (this%imover == 1 .and. q < dzero) then
5009  qfact = done
5010  if (this%qout(n) < dzero) then
5011  qfact = q / this%qout(n)
5012  end if
5013  q = q + qfact * this%pakmvrobj%get_qtomvr(n)
5014  end if
5015  call this%budobj%budterm(idx)%update_term(n, n, q)
5016  end do
5017  !
5018  ! -- FLOWING WELL
5019  if (this%iflowingwells > 0) then
5020  idx = idx + 1
5021  call this%budobj%budterm(idx)%reset(this%nmawwells)
5022  do n = 1, this%nmawwells
5023  q = this%qfw(n)
5024  if (this%imover == 1) then
5025  qfact = done
5026  !
5027  ! -- adjust if well rate is an outflow
5028  if (this%qout(n) < dzero) then
5029  qfact = q / this%qout(n)
5030  end if
5031  q = q + qfact * this%pakmvrobj%get_qtomvr(n)
5032  end if
5033  call this%budobj%budterm(idx)%update_term(n, n, q)
5034  end do
5035  end if
5036  !
5037  ! -- STORAGE (AND VOLUME AS AUX)
5038  idx = idx + 1
5039  call this%budobj%budterm(idx)%reset(this%nmawwells)
5040  do n = 1, this%nmawwells
5041  b = this%xsto(n) - this%bot(n)
5042  if (b < dzero) then
5043  b = dzero
5044  end if
5045  v = this%area(n) * b
5046  if (this%imawissopt /= 1) then
5047  q = this%qsto(n)
5048  else
5049  q = dzero
5050  end if
5051  this%qauxcbc(1) = v
5052  call this%budobj%budterm(idx)%update_term(n, n, q, this%qauxcbc)
5053  end do
5054  !
5055  ! -- CONSTANT FLOW
5056  idx = idx + 1
5057  call this%budobj%budterm(idx)%reset(this%nmawwells)
5058  do n = 1, this%nmawwells
5059  q = this%qconst(n)
5060  !
5061  ! -- adjust if constant-flow rate is an outflow
5062  if (this%imover == 1 .and. q < dzero) then
5063  qfact = done
5064  if (this%qout(n) < dzero) then
5065  qfact = q / this%qout(n)
5066  end if
5067  q = q + qfact * this%pakmvrobj%get_qtomvr(n)
5068  end if
5069  call this%budobj%budterm(idx)%update_term(n, n, q)
5070  end do
5071  !
5072  ! -- MOVER
5073  if (this%imover == 1) then
5074  !
5075  ! -- FROM MOVER
5076  idx = idx + 1
5077  call this%budobj%budterm(idx)%reset(this%nmawwells)
5078  do n = 1, this%nmawwells
5079  if (this%iboundpak(n) == 0) then
5080  q = dzero
5081  else
5082  q = this%pakmvrobj%get_qfrommvr(n)
5083  end if
5084  call this%budobj%budterm(idx)%update_term(n, n, q)
5085  end do
5086  !
5087  ! -- RATE TO MOVER
5088  idx = idx + 1
5089  call this%budobj%budterm(idx)%reset(this%nmawwells)
5090  do n = 1, this%nmawwells
5091  q = this%pakmvrobj%get_qtomvr(n)
5092  if (q > dzero) then
5093  q = -q
5094  q2 = this%ratesim(n)
5095  !
5096  ! -- adjust TO MOVER if well rate is outflow
5097  if (q2 < dzero) then
5098  qfact = q2 / this%qout(n)
5099  q = q * qfact
5100  else
5101  q = dzero
5102  end if
5103  end if
5104  call this%budobj%budterm(idx)%update_term(n, n, q)
5105  end do
5106  !
5107  ! -- CONSTANT TO MOVER
5108  idx = idx + 1
5109  call this%budobj%budterm(idx)%reset(this%nmawwells)
5110  do n = 1, this%nmawwells
5111  q = this%pakmvrobj%get_qtomvr(n)
5112  if (q > dzero) then
5113  q = -q
5114  q2 = this%qconst(n)
5115  ! -- adjust TO MOVER if well rate is outflow
5116  if (q2 < dzero) then
5117  qfact = q2 / this%qout(n)
5118  q = q * qfact
5119  else
5120  q = dzero
5121  end if
5122  end if
5123  call this%budobj%budterm(idx)%update_term(n, n, q)
5124  end do
5125  !
5126  ! -- FLOWING WELL TO MOVER
5127  if (this%iflowingwells > 0) then
5128  idx = idx + 1
5129  call this%budobj%budterm(idx)%reset(this%nmawwells)
5130  do n = 1, this%nmawwells
5131  q = this%pakmvrobj%get_qtomvr(n)
5132  if (q > dzero) then
5133  q = -q
5134  q2 = this%ratesim(n)
5135  !
5136  ! -- adjust TO MOVER if well rate is outflow
5137  qfact = done
5138  if (this%qout(n) < dzero) then
5139  qfact = this%qfw(n) / this%qout(n)
5140  end if
5141  q = q * qfact
5142  end if
5143  call this%budobj%budterm(idx)%update_term(n, n, q)
5144  end do
5145  end if
5146 
5147  end if
5148  !
5149  ! -- AUXILIARY VARIABLES
5150  naux = this%naux
5151  if (naux > 0) then
5152  idx = idx + 1
5153  call this%budobj%budterm(idx)%reset(this%nmawwells)
5154  do n = 1, this%nmawwells
5155  q = dzero
5156  call this%budobj%budterm(idx)%update_term(n, n, q, this%auxvar(:, n))
5157  end do
5158  end if
5159  !
5160  ! --Terms are filled, now accumulate them for this time step
5161  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 2759 of file gwf-maw.f90.

2760  ! -- dummy
2761  class(MawType) :: this
2762  real(DP), dimension(:), intent(inout) :: rhs
2763  integer(I4B), dimension(:), intent(in) :: ia
2764  integer(I4B), dimension(:), intent(in) :: idxglo
2765  class(MatrixBaseType), pointer :: matrix_sln
2766  ! -- local
2767  integer(I4B) :: j
2768  integer(I4B) :: n
2769  integer(I4B) :: idx
2770  integer(I4B) :: iloc
2771  integer(I4B) :: isymloc
2772  integer(I4B) :: igwfnode
2773  integer(I4B) :: iposd
2774  integer(I4B) :: iposoffd
2775  integer(I4B) :: isymnode
2776  integer(I4B) :: ipossymd
2777  integer(I4B) :: ipossymoffd
2778  integer(I4B) :: jpos
2779  integer(I4B) :: icflow
2780  real(DP) :: hmaw
2781  real(DP) :: hgwf
2782  real(DP) :: scale
2783  real(DP) :: tp
2784  real(DP) :: bt
2785  real(DP) :: cfw
2786  real(DP) :: rate
2787  real(DP) :: rate2
2788  real(DP) :: rterm
2789  real(DP) :: derv
2790  real(DP) :: drterm
2791  real(DP) :: cmaw
2792  real(DP) :: cterm
2793  real(DP) :: term
2794  real(DP) :: flow
2795  real(DP) :: term2
2796  real(DP) :: rhsterm
2797  !
2798  ! -- Calculate Newton-Raphson corrections
2799  idx = 1
2800  do n = 1, this%nmawwells
2801  iloc = this%idxlocnode(n)
2802  hmaw = this%xnewpak(n)
2803  !
2804  ! -- add pumping rate to active or constant maw well
2805  if (this%iboundpak(n) /= 0) then
2806  iposd = this%idxdglo(idx)
2807  scale = done
2808  drterm = dzero
2809  rate = this%ratesim(n)
2810  !
2811  !-- calculate final derivative for pumping rate
2812  call this%maw_calculate_wellq(n, hmaw + dem4, rate2)
2813  drterm = (rate2 - rate) / dem4
2814  !
2815  !-- fill amat and rhs with newton-raphson terms
2816  call matrix_sln%add_value_pos(iposd, drterm)
2817  rhs(iloc) = rhs(iloc) + drterm * hmaw
2818  !
2819  ! -- add flowing well
2820  if (this%iflowingwells > 0) then
2821  if (this%fwcond(n) > dzero) then
2822  bt = this%fwelev(n)
2823  tp = bt + this%fwrlen(n)
2824  scale = sqsaturation(tp, bt, hmaw)
2825  cfw = scale * this%fwcond(n)
2826  this%ifwdischarge(n) = 0
2827  if (cfw > dzero) then
2828  this%ifwdischarge(n) = 1
2829  end if
2830  this%fwcondsim(n) = cfw
2831  rate = cfw * (bt - hmaw)
2832  rterm = -cfw * hmaw
2833  !
2834  ! --calculate derivative for flowing well
2835  if (hmaw < tp) then
2836  derv = sqsaturationderivative(tp, bt, hmaw)
2837  drterm = -(cfw + this%fwcond(n) * derv * (hmaw - bt))
2838  !
2839  ! -- fill amat and rhs with newton-raphson terms
2840  call matrix_sln%add_value_pos(iposd, &
2841  -this%fwcond(n) * derv * (hmaw - bt))
2842  rhs(iloc) = rhs(iloc) - rterm + drterm * hmaw
2843  end if
2844  end if
2845  end if
2846  end if
2847  !
2848  ! -- process each maw/gwf connection
2849  do j = 1, this%ngwfnodes(n)
2850  if (this%iboundpak(n) /= 0) then
2851  jpos = this%get_jpos(n, j)
2852  igwfnode = this%get_gwfnode(n, j)
2853  hgwf = this%xnew(igwfnode)
2854  !
2855  ! -- add to maw row
2856  iposd = this%idxdglo(idx)
2857  iposoffd = this%idxoffdglo(idx)
2858  !
2859  ! -- add to gwf row for maw connection
2860  isymnode = this%get_gwfnode(n, j)
2861  isymloc = ia(isymnode)
2862  ipossymd = this%idxsymdglo(idx)
2863  ipossymoffd = this%idxsymoffdglo(idx)
2864  !
2865  ! -- calculate newton terms
2866  call this%maw_calculate_conn_terms(n, j, icflow, cmaw, cterm, term, &
2867  flow, term2)
2868  !
2869  ! -- maw is upstream
2870  if (hmaw > hgwf) then
2871  if (icflow /= 0) then
2872  rhsterm = term2 * hgwf + term * hmaw
2873  rhs(iloc) = rhs(iloc) + rhsterm
2874  rhs(isymnode) = rhs(isymnode) - rhsterm
2875  if (this%iboundpak(n) > 0) then
2876  call matrix_sln%add_value_pos(iposd, term)
2877  call matrix_sln%add_value_pos(iposoffd, term2)
2878  end if
2879  call matrix_sln%add_value_pos(ipossymd, -term2)
2880  call matrix_sln%add_value_pos(ipossymoffd, -term)
2881  else
2882  rhs(iloc) = rhs(iloc) + term * hmaw
2883  rhs(isymnode) = rhs(isymnode) - term * hmaw
2884  call matrix_sln%add_value_pos(iposd, term)
2885  if (this%ibound(igwfnode) > 0) then
2886  call matrix_sln%add_value_pos(ipossymoffd, -term)
2887  end if
2888  end if
2889  !
2890  ! -- gwf is upstream
2891  else
2892  if (icflow /= 0) then
2893  rhsterm = term2 * hmaw + term * hgwf
2894  rhs(iloc) = rhs(iloc) + rhsterm
2895  rhs(isymnode) = rhs(isymnode) - rhsterm
2896  if (this%iboundpak(n) > 0) then
2897  call matrix_sln%add_value_pos(iposd, term2)
2898  call matrix_sln%add_value_pos(iposoffd, term)
2899  end if
2900  call matrix_sln%add_value_pos(ipossymd, -term)
2901  call matrix_sln%add_value_pos(ipossymoffd, -term2)
2902  else
2903  rhs(iloc) = rhs(iloc) + term * hgwf
2904  rhs(isymnode) = rhs(isymnode) - term * hgwf
2905  if (this%iboundpak(n) > 0) then
2906  call matrix_sln%add_value_pos(iposoffd, term)
2907  end if
2908  call matrix_sln%add_value_pos(ipossymd, -term)
2909  end if
2910  end if
2911  end if
2912  !
2913  ! -- increment maw connection counter
2914  idx = idx + 1
2915  end do
2916  end do
Here is the call graph for this function:

◆ maw_input_destroy()

subroutine mawmodule::maw_input_destroy ( class(mawinputtype), intent(inout)  this)
private

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

864  class(MawInputType), intent(inout) :: this
865  nullify (this%strt)
866  nullify (this%strt_tslink)
867  nullify (this%nbound)
868  nullify (this%ifno)
869  nullify (this%setting)
870  nullify (this%status)
871  nullify (this%head_limit)
872  nullify (this%fwelev)
873  nullify (this%fwcond)
874  nullify (this%fwrlen)
875  nullify (this%minrate)
876  nullify (this%maxrate)
877  nullify (this%pump_elevation)
878  nullify (this%scaling_length)
879  nullify (this%auxname)
880  nullify (this%auxval)

◆ maw_input_init()

subroutine mawmodule::maw_input_init ( class(mawinputtype), intent(inout)  this,
character(len=*), intent(in)  mempath,
integer(i4b), intent(in)  naux 
)
private

Values are updated from the input context each stress period including integrated timeseries for supported arrays.

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

840  class(MawInputType), intent(inout) :: this
841  character(len=*), intent(in) :: mempath
842  integer(I4B), intent(in) :: naux
843  call mem_setptr(this%nbound, 'NBOUND', mempath)
844  call mem_setptr(this%ifno, 'IFNO', mempath)
845  call mem_setptr(this%setting, 'SETTING', mempath)
846  call mem_setptr(this%status, 'STATUS', mempath)
847  call mem_setptr(this%head_limit, 'HEAD_LIMIT', mempath)
848  call mem_setptr(this%fwelev, 'FWELEV', mempath)
849  call mem_setptr(this%fwcond, 'FWCOND', mempath)
850  call mem_setptr(this%fwrlen, 'FWRLEN', mempath)
851  call mem_setptr(this%minrate, 'MINRATE', mempath)
852  call mem_setptr(this%maxrate, 'MAXRATE', mempath)
853  call mem_setptr(this%pump_elevation, 'PUMP_ELEVATION', mempath)
854  call mem_setptr(this%scaling_length, 'SCALING_LENGTH', mempath)
855  if (naux > 0) then
856  call mem_setptr(this%auxname, 'AUXNAME', mempath)
857  call mem_setptr(this%auxval, 'AUXVAL', mempath)
858  end if

◆ maw_mc()

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

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

2016  use sparsemodule, only: sparsematrix
2018  ! -- dummy
2019  class(MawType), intent(inout) :: this
2020  integer(I4B), intent(in) :: moffset
2021  class(MatrixBaseType), pointer :: matrix_sln
2022  ! -- local
2023  integer(I4B) :: n
2024  integer(I4B) :: j
2025  integer(I4B) :: ii
2026  integer(I4B) :: iglo
2027  integer(I4B) :: jglo
2028  integer(I4B) :: ipos
2029  ! -- format
2030  !
2031  ! -- allocate connection mapping vectors
2032  call mem_allocate(this%idxlocnode, this%nmawwells, 'IDXLOCNODE', &
2033  this%memoryPath)
2034  call mem_allocate(this%idxdglo, this%maxbound, 'IDXDGLO', this%memoryPath)
2035  call mem_allocate(this%idxoffdglo, this%maxbound, 'IDXOFFDGLO', &
2036  this%memoryPath)
2037  call mem_allocate(this%idxsymdglo, this%maxbound, 'IDXSYMDGLO', &
2038  this%memoryPath)
2039  call mem_allocate(this%idxsymoffdglo, this%maxbound, 'IDXSYMOFFDGLO', &
2040  this%memoryPath)
2041  !
2042  ! -- Find the position of each connection in the global ia, ja structure
2043  ! and store them in idxglo. idxglo allows this model to insert or
2044  ! retrieve values into or from the global A matrix
2045  ! -- maw rows
2046  ipos = 1
2047  do n = 1, this%nmawwells
2048  iglo = moffset + this%dis%nodes + this%ioffset + n
2049  this%idxlocnode(n) = this%dis%nodes + this%ioffset + n
2050  do ii = 1, this%ngwfnodes(n)
2051  j = this%get_gwfnode(n, ii)
2052  jglo = j + moffset
2053  this%idxdglo(ipos) = matrix_sln%get_position_diag(iglo)
2054  this%idxoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
2055  ipos = ipos + 1
2056  end do
2057  end do
2058  ! -- maw contributions gwf portion of global matrix
2059  ipos = 1
2060  do n = 1, this%nmawwells
2061  do ii = 1, this%ngwfnodes(n)
2062  iglo = this%get_gwfnode(n, ii) + moffset
2063  jglo = moffset + this%dis%nodes + this%ioffset + n
2064  this%idxsymdglo(ipos) = matrix_sln%get_position_diag(iglo)
2065  this%idxsymoffdglo(ipos) = matrix_sln%get_position(iglo, jglo)
2066  ipos = ipos + 1
2067  end do
2068  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

Two corrections are applied to each well head, in order:

  1. Oscillation damping. If the well head change reverses direction and is not getting smaller, it is cut back by a per-well weight. The weight shrinks while the head oscillates and grows back when the head moves steadily in one direction. This settles poorly connected wells (for example a low-K cell or a single connection) whose full Newton step is too large.
  2. Bottom limit. If the head is still below the well bottom, it is moved back up toward the well bottom (the original behavior).

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

2932  ! -- dummy
2933  class(MawType), intent(inout) :: this
2934  integer(I4B), intent(in) :: neqpak
2935  real(DP), dimension(neqpak), intent(inout) :: x
2936  real(DP), dimension(neqpak), intent(in) :: xtemp
2937  real(DP), dimension(neqpak), intent(inout) :: dx
2938  integer(I4B), intent(inout) :: inewtonur
2939  real(DP), intent(inout) :: dxmax
2940  integer(I4B), intent(inout) :: locmax
2941  ! -- local
2942  integer(I4B) :: n
2943  real(DP) :: botw
2944  real(DP) :: xx
2945  real(DP) :: dxx
2946  real(DP) :: dxprop
2947  real(DP) :: weight
2948  ! -- parameters
2949  real(DP), parameter :: damptheta = dp7 !factor the weight is cut by when the head oscillates
2950  real(DP), parameter :: damptol = dhalf !only damp if the change is at least this fraction of the last one
2951  real(DP), parameter :: weightmin = dem2 !smallest allowed weight
2952  real(DP), parameter :: recover = 0.2_dp !amount the weight grows back each iteration
2953  !
2954  ! -- Newton-Raphson under-relaxation
2955  do n = 1, this%nmawwells
2956  if (this%iboundpak(n) < 1) cycle
2957  botw = this%bot(n)
2958  !
2959  ! -- full Newton head change proposed for this outer iteration
2960  dxprop = x(n) - xtemp(n)
2961  !
2962  ! -- oscillation damping. Cut the weight only when the head change flips
2963  ! direction and is not already shrinking on its own (it is still at
2964  ! least damptol times the previous change). Otherwise let the weight
2965  ! grow back toward one, so a normal, converging well is not slowed
2966  ! down. This catches oscillations above the well bottom, which the
2967  ! bottom limit below cannot.
2968  weight = maw_damp_weight(dxprop, this%nurdxold(n), this%nurweight(n), &
2969  damptheta, damptol, weightmin, recover)
2970  this%nurweight(n) = weight
2971  !
2972  ! -- apply the reduced step when damping is turned on
2973  if (weight < done) then
2974  inewtonur = 1
2975  xx = xtemp(n) + weight * dxprop
2976  dxx = x(n) - xx
2977  if (abs(dxx) > abs(dxmax)) then
2978  locmax = n
2979  dxmax = dxx
2980  end if
2981  x(n) = xx
2982  dx(n) = weight * dxprop
2983  end if
2984  !
2985  ! -- bottom limit: if the (reduced) head is still below the bottom of the
2986  ! well, move it back up toward the well bottom
2987  if (x(n) < botw) then
2988  inewtonur = 1
2989  xx = xtemp(n) * (done - dp9) + botw * dp9
2990  dxx = x(n) - xx
2991  if (abs(dxx) > abs(dxmax)) then
2992  locmax = n
2993  dxmax = dxx
2994  end if
2995  x(n) = xx
2996  dx(n) = dzero
2997  end if
2998  !
2999  ! -- save the head change actually applied this iteration (after damping
3000  ! and the bottom limit). Saving it after the bottom limit lets the
3001  ! next iteration see the downward push from the limit, so the upward
3002  ! swing that follows can be damped.
3003  this%nurdxold(n) = x(n) - xtemp(n)
3004  end do
Here is the call graph for this function:

◆ maw_obs_supported()

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

Overrides BndTypebnd_obs_supported()

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

3606  class(MawType) :: this
3607  !
3608  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 3398 of file gwf-maw.f90.

3399  ! -- module
3400  use tdismodule, only: totim, delt
3401  ! -- dummy
3402  class(MawType) :: this !< MawType object
3403  integer(I4B), intent(in) :: kstp !< time step number
3404  integer(I4B), intent(in) :: kper !< period number
3405  integer(I4B), intent(in) :: iout !< flag and unit number for the model listing file
3406  integer(I4B), intent(in) :: ibudfl !< flag indicating budget should be written
3407  !
3408  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:35

◆ maw_ot_dv()

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

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

3344  use tdismodule, only: kstp, kper, pertim, totim
3345  use constantsmodule, only: dhnoflo, dhdry
3346  use inputoutputmodule, only: ulasav
3347  class(MawType) :: this
3348  integer(I4B), intent(in) :: idvsave
3349  integer(I4B), intent(in) :: idvprint
3350  integer(I4B) :: ibinun
3351  integer(I4B) :: n
3352  real(DP) :: v
3353  real(DP) :: d
3354  !
3355  ! -- set unit number for binary dependent variable output
3356  ibinun = 0
3357  if (this%iheadout /= 0) then
3358  ibinun = this%iheadout
3359  end if
3360  if (idvsave == 0) ibinun = 0
3361  !
3362  ! -- write maw binary output
3363  if (ibinun > 0) then
3364  do n = 1, this%nmawwells
3365  v = this%xnewpak(n)
3366  d = v - this%bot(n)
3367  if (this%iboundpak(n) == 0) then
3368  v = dhnoflo
3369  else if (d <= dzero) then
3370  v = dhdry
3371  end if
3372  this%dbuff(n) = v
3373  end do
3374  call ulasav(this%dbuff, ' HEAD', &
3375  kstp, kper, pertim, totim, &
3376  this%nmawwells, 1, 1, ibinun)
3377  end if
3378  !
3379  ! -- write maw head table
3380  if (idvprint /= 0 .and. this%iprhed /= 0) then
3381  !
3382  ! -- set table kstp and kper
3383  call this%headtab%set_kstpkper(kstp, kper)
3384  !
3385  ! -- fill stage data
3386  do n = 1, this%nmawwells
3387  if (this%inamedbound == 1) then
3388  call this%headtab%add_term(this%cmawname(n))
3389  end if
3390  call this%headtab%add_term(n)
3391  call this%headtab%add_term(this%xnewpak(n))
3392  end do
3393  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:33
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 3303 of file gwf-maw.f90.

3304  ! -- dummy
3305  class(MawType) :: this
3306  integer(I4B), intent(in) :: icbcfl
3307  integer(I4B), intent(in) :: ibudfl
3308  integer(I4B), intent(in) :: icbcun
3309  integer(I4B), dimension(:), optional, intent(in) :: imap
3310  !
3311  ! -- write the flows from the budobj
3312  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 3317 of file gwf-maw.f90.

3318  use tdismodule, only: kstp, kper, delt, pertim, totim
3319  class(MawType) :: this
3320  integer(I4B), intent(in) :: icbcfl
3321  integer(I4B), intent(in) :: ibudfl
3322  integer(I4B) :: ibinun
3323  !
3324  ! -- write the flows from the budobj
3325  ibinun = 0
3326  if (this%ibudgetout /= 0) then
3327  ibinun = this%ibudgetout
3328  end if
3329  if (icbcfl == 0) ibinun = 0
3330  if (ibinun > 0) then
3331  call this%budobj%save_flows(this%dis, ibinun, kstp, kper, delt, &
3332  pertim, totim, this%iout)
3333  end if
3334  !
3335  ! -- Print maw flows table
3336  if (ibudfl /= 0 .and. this%iprflow /= 0) then
3337  call this%budobj%write_flowtable(this%dis, kstp, kper)
3338  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 3946 of file gwf-maw.f90.

3947  ! -- dummy
3948  type(ObserveType), intent(inout) :: obsrv
3949  class(DisBaseType), intent(in) :: dis
3950  integer(I4B), intent(in) :: inunitobs
3951  integer(I4B), intent(in) :: iout
3952  ! -- local
3953  integer(I4B) :: nn1, nn2
3954  integer(I4B) :: icol, istart, istop
3955  character(len=LINELENGTH) :: string
3956  character(len=LENBOUNDNAME) :: bndname
3957  ! formats
3958  !
3959  string = obsrv%IDstring
3960  ! -- Extract multi-aquifer well number from string and store it.
3961  ! If 1st item is not an integer(I4B), it should be a
3962  ! maw name--deal with it.
3963  icol = 1
3964  ! -- get multi-aquifer well number or boundary name
3965  call extract_idnum_or_bndname(string, icol, istart, istop, nn1, bndname)
3966  if (nn1 == namedboundflag) then
3967  obsrv%FeatureName = bndname
3968  else
3969  if (obsrv%ObsTypeId == 'MAW' .or. &
3970  obsrv%ObsTypeId == 'CONDUCTANCE') then
3971  call extract_idnum_or_bndname(string, icol, istart, istop, nn2, bndname)
3972  if (len_trim(bndname) < 1 .and. nn2 < 0) then
3973  write (errmsg, '(a,1x,a,a,1x,a,1x,a)') &
3974  'For observation type', trim(adjustl(obsrv%ObsTypeId)), &
3975  ', ID given as an integer and not as boundname,', &
3976  'but ID2 (icon) is missing. Either change ID to valid', &
3977  'boundname or supply valid entry for ID2.'
3978  call store_error(errmsg)
3979  end if
3980  if (nn2 == namedboundflag) then
3981  obsrv%FeatureName = bndname
3982  ! -- reset nn1
3983  nn1 = nn2
3984  else
3985  obsrv%NodeNumber2 = nn2
3986  end if
3987  end if
3988  end if
3989  ! -- store multi-aquifer well number (NodeNumber)
3990  obsrv%NodeNumber = nn1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ maw_read_initial_attr()

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

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

1637  ! -- modules
1638  use constantsmodule, only: linelength
1639  use memorymanagermodule, only: mem_setptr
1640  ! -- dummy
1641  class(MawType), intent(inout) :: this
1642  ! -- local
1643  character(len=LINELENGTH) :: title
1644  character(len=LINELENGTH) :: text
1645  integer(I4B) :: ntabcols
1646  integer(I4B) :: j
1647  integer(I4B) :: n
1648  integer(I4B) :: nn
1649  integer(I4B) :: jpos
1650  integer(I4B) :: inode
1651  integer(I4B) :: idx
1652  real(DP) :: k11
1653  real(DP) :: k22
1654  character(len=10), dimension(0:4) :: ccond
1655  character(len=30) :: nodestr
1656  ! -- data
1657  data ccond(0)/'SPECIFIED '/
1658  data ccond(1)/'THIEM '/
1659  data ccond(2)/'SKIN '/
1660  data ccond(3)/'CUMULATIVE'/
1661  data ccond(4)/'MEAN '/
1662  ! -- format
1663  character(len=*), parameter :: fmtwelln = &
1664  "(1X,//43X,'MULTI-AQUIFER WELL DATA'&
1665  &/1X,109('-'),&
1666  &/1X,7(A10,1X),A16)"
1667  character(len=*), parameter :: fmtwelld = &
1668  &"(1X,I10,1X,4(G10.3,1X),I10,1X,A10,1X,A16)"
1669  character(len=*), parameter :: fmtline = &
1670  &"(1X,119('-'),//)"
1671  character(len=*), parameter :: fmtwellcn = &
1672  "(1X,//37X,'MULTI-AQUIFER WELL CONNECTION DATA'&
1673  &/1X,119('-'),&
1674  &/1X,2(A10,1X),A20,7(A10,1X))"
1675  character(len=*), parameter :: fmtwellcd = &
1676  &"(1X,2(I10,1X),A20,1X,2(G10.3,1X),2(A10,1X),3(G10.3,1X))"
1677  !
1678  ! -- initialize xnewpak
1679  do n = 1, this%nmawwells
1680  this%xnewpak(n) = this%strt(n)
1681  this%xsto(n) = this%strt(n)
1682  end do
1683  !
1684  ! -- initialize status (iboundpak) of maw wells to active
1685  do n = 1, this%nmawwells
1686  select case (this%status(n))
1687  case ('CONSTANT')
1688  this%iboundpak(n) = -1
1689  case ('INACTIVE')
1690  this%iboundpak(n) = 0
1691  case ('ACTIVE')
1692  this%iboundpak(n) = 1
1693  end select
1694  end do
1695  !
1696  ! -- set imap and boundname for each connection
1697  if (this%inamedbound /= 0) then
1698  idx = 0
1699  do n = 1, this%nmawwells
1700  do j = 1, this%ngwfnodes(n)
1701  idx = idx + 1
1702  this%boundname(idx) = this%cmawname(n)
1703  this%imap(idx) = n
1704  end do
1705  end do
1706  else
1707  do n = 1, this%nmawwells
1708  this%cmawname(n) = ''
1709  end do
1710  end if
1711  !
1712  ! -- copy boundname into boundname_cst
1713  call this%copy_boundname()
1714  !
1715  ! -- set pointer to gwf iss and gwf hk
1716  call mem_setptr(this%gwfiss, 'ISS', create_mem_path(this%name_model))
1717  call mem_setptr(this%gwfk11, 'K11', create_mem_path(this%name_model, 'NPF'))
1718  call mem_setptr(this%gwfk22, 'K22', create_mem_path(this%name_model, 'NPF'))
1719  call mem_setptr(this%gwfik22, 'IK22', create_mem_path(this%name_model, 'NPF'))
1720  call mem_setptr(this%gwfsat, 'SAT', create_mem_path(this%name_model, 'NPF'))
1721  !
1722  ! -- qa data
1723  call this%maw_check_attributes()
1724  !
1725  ! -- Calculate the saturated conductance
1726  do n = 1, this%nmawwells
1727  !
1728  ! -- calculate saturated conductance only if CONDUCTANCE was not
1729  ! specified for each maw-gwf connection (CONDUCTANCE keyword).
1730  do j = 1, this%ngwfnodes(n)
1731  if (this%ieqn(n) /= 0) then
1732  inode = this%get_gwfnode(n, j)
1733  call this%maw_calculate_satcond(n, j, inode)
1734  end if
1735  end do
1736  end do
1737  !
1738  ! -- write summary of static well data
1739  ! -- write well data
1740  if (this%iprpak /= 0) then
1741  ntabcols = 7
1742  if (this%inamedbound /= 0) then
1743  ntabcols = ntabcols + 1
1744  end if
1745  title = trim(adjustl(this%text))//' PACKAGE ('// &
1746  trim(adjustl(this%packName))//') STATIC WELL DATA'
1747  call table_cr(this%inputtab, this%packName, title)
1748  call this%inputtab%table_df(this%nmawwells, ntabcols, this%iout)
1749  text = 'NUMBER'
1750  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1751  text = 'RADIUS'
1752  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1753  text = 'AREA'
1754  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1755  text = 'WELL BOTTOM'
1756  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1757  text = 'STARTING HEAD'
1758  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1759  text = 'NUMBER OF GWF NODES'
1760  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1761  text = 'CONDUCT. EQUATION'
1762  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1763  if (this%inamedbound /= 0) then
1764  text = 'NAME'
1765  call this%inputtab%initialize_column(text, 20, alignment=tableft)
1766  end if
1767  do n = 1, this%nmawwells
1768  call this%inputtab%add_term(n)
1769  call this%inputtab%add_term(this%radius(n))
1770  call this%inputtab%add_term(this%area(n))
1771  call this%inputtab%add_term(this%bot(n))
1772  call this%inputtab%add_term(this%strt(n))
1773  call this%inputtab%add_term(this%ngwfnodes(n))
1774  call this%inputtab%add_term(ccond(this%ieqn(n)))
1775  if (this%inamedbound /= 0) then
1776  call this%inputtab%add_term(this%cmawname(n))
1777  end if
1778  end do
1779  end if
1780  !
1781  ! -- write well connection data
1782  if (this%iprpak /= 0) then
1783  ntabcols = 10
1784  if (this%inonvert /= 0) then
1785  ntabcols = ntabcols + 1
1786  end if
1787  title = trim(adjustl(this%text))//' PACKAGE ('// &
1788  trim(adjustl(this%packName))//') STATIC WELL CONNECTION DATA'
1789  call table_cr(this%inputtab, this%packName, title)
1790  call this%inputtab%table_df(this%maxbound, ntabcols, this%iout)
1791  text = 'NUMBER'
1792  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1793  text = 'WELL CONNECTION'
1794  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1795  text = 'CELLID'
1796  call this%inputtab%initialize_column(text, 20, alignment=tableft)
1797  text = 'TOP OF SCREEN'
1798  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1799  text = 'BOTTOM OF SCREEN'
1800  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1801  text = 'SKIN RADIUS'
1802  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1803  text = 'SKIN K'
1804  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1805  text = 'K11'
1806  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1807  text = 'K22'
1808  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1809  text = 'SATURATED WELL CONDUCT.'
1810  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1811  if (this%inonvert /= 0) then
1812  text = 'ANGLE (DEG)'
1813  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
1814  end if
1815  !
1816  ! -- write the data to the table
1817  do n = 1, this%nmawwells
1818  do j = 1, this%ngwfnodes(n)
1819  call this%inputtab%add_term(n)
1820  call this%inputtab%add_term(j)
1821  jpos = this%get_jpos(n, j)
1822  nn = this%get_gwfnode(n, j)
1823  call this%dis%noder_to_string(nn, nodestr)
1824  call this%inputtab%add_term(nodestr)
1825  call this%inputtab%add_term(this%topscrn(jpos))
1826  call this%inputtab%add_term(this%botscrn(jpos))
1827  if (this%ieqn(n) == 2 .or. &
1828  this%ieqn(n) == 3 .or. &
1829  this%ieqn(n) == 4) then
1830  call this%inputtab%add_term(this%sradius(jpos))
1831  call this%inputtab%add_term(this%hk(jpos))
1832  else
1833  call this%inputtab%add_term(' ')
1834  call this%inputtab%add_term(' ')
1835  end if
1836  if (this%ieqn(n) == 1 .or. &
1837  this%ieqn(n) == 2 .or. &
1838  this%ieqn(n) == 3) then
1839  k11 = this%gwfk11(nn)
1840  if (this%gwfik22 == 0) then
1841  k22 = this%gwfk11(nn)
1842  else
1843  k22 = this%gwfk22(nn)
1844  end if
1845  call this%inputtab%add_term(k11)
1846  call this%inputtab%add_term(k22)
1847  else
1848  call this%inputtab%add_term(' ')
1849  call this%inputtab%add_term(' ')
1850  end if
1851  call this%inputtab%add_term(this%satcond(jpos))
1852  if (this%inonvert /= 0) then
1853  call this%inputtab%add_term(this%angle(jpos))
1854  end if
1855  end do
1856  end do
1857  end if
1858  !
1859  ! -- finished with pointer to gwf hydraulic conductivity
1860  this%gwfk11 => null()
1861  this%gwfk22 => null()
1862  this%gwfik22 => null()
1863  this%gwfsat => null()
1864  !
1865  ! -- check for any error conditions
1866  if (count_errors() > 0) then
1867  call store_error_filename(this%input_fname)
1868  end if
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
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 3998 of file gwf-maw.f90.

3999  ! -- dummy variables
4000  class(MawType), intent(inout) :: this !< MawType object
4001  character(len=*), intent(in) :: fname
4002  ! -- format
4003  character(len=*), parameter :: fmtredflowcsv = &
4004  "(4x, 'MAW REDUCED FLOW INFORMATION WILL BE SAVED TO FILE: ', a, /4x, &
4005  &'OPENED ON UNIT: ', I0)"
4006 
4007  this%ioutredflowcsv = getunit()
4008  call openfile(this%ioutredflowcsv, this%iout, fname, 'CSV', &
4009  filstat_opt='REPLACE')
4010  write (this%iout, fmtredflowcsv) trim(adjustl(fname)), &
4011  this%ioutredflowcsv
4012  write (this%ioutredflowcsv, '(a)') &
4013  '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 4018 of file gwf-maw.f90.

4019  ! -- modules
4020  use tdismodule, only: totim, kstp, kper
4021  ! -- dummy variables
4022  class(MawType), intent(inout) :: this !< MawType object
4023  ! -- local
4024  integer(I4B) :: n
4025  !integer(I4B) :: nodereduced
4026  !integer(I4B) :: nodeuser
4027  real(DP) :: v
4028  ! -- format
4029  do n = 1, this%nmawwells
4030  !
4031  ! -- test if node is constant or inactive
4032  if (this%status(n) .ne. 'ACTIVE') then
4033  cycle
4034  end if
4035  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
4036  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
4037  write (this%ioutredflowcsv, '(*(G0,:,","))') &
4038  totim, kper, kstp, n, this%rate(n), this%ratesim(n), v
4039  end if
4040  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 2108 of file gwf-maw.f90.

2109  use constantsmodule, only: lenvarname
2110  use tdismodule, only: kper
2111  use memorymanagermodule, only: mem_setptr
2113  use simmodule, only: store_error_filename
2114  ! -- dummy
2115  class(MawType), intent(inout) :: this
2116  ! -- local
2117  character(len=LINELENGTH) :: title
2118  character(len=LINELENGTH) :: text
2119  character(len=LINELENGTH) :: csteady
2120  character(len=LINELENGTH) :: str
2121  real(DP) :: auxvaldbl
2122  character(len=LENVARNAME) :: setting
2123  character(len=LINELENGTH) :: cstr
2124  character(len=LINELENGTH) :: errmsgr
2125  integer(I4B) :: node
2126  integer(I4B) :: n
2127  integer(I4B) :: ntabcols
2128  integer(I4B) :: ntabrows
2129  integer(I4B) :: imaw
2130  integer(I4B) :: ibnd
2131  integer(I4B) :: j
2132  integer(I4B) :: jpos
2133  integer(I4B) :: jj
2134  integer(I4B) :: istat
2135  integer(I4B) :: iheadlimit_warning
2136  ! -- formats
2137  character(len=*), parameter :: fmtlsp = &
2138  &"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')"
2139  character(len=*), parameter :: fmthdbot = &
2140  &"('well head (',G0,') must be >= BOTTOM_ELEVATION (',G0, ').')"
2141  !
2142  ! -- initialize counters
2143  iheadlimit_warning = 0
2144  !
2145  ! -- set steady-state flag based on gwfiss
2146  this%imawiss = this%gwfiss
2147  !
2148  ! -- reset maw steady flag if 'STEADY-STATE' specified in the OPTIONS block
2149  if (this%imawissopt == 1) then
2150  this%imawiss = 1
2151  end if
2152  !
2153  ! -- set nbound to maxbound
2154  this%nbound = this%maxbound
2155  !
2156  ! -- check if input context has been updated for this stress period
2157  if (this%iper == kper) then
2158  !
2159  ! -- setup table to echo period data
2160  if (this%iprpak /= 0) then
2161  title = trim(adjustl(this%text))//' PACKAGE ('// &
2162  trim(adjustl(this%packName))//') DATA FOR PERIOD'
2163  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
2164  call table_cr(this%inputtab, this%packName, title)
2165  call this%inputtab%table_df(1, 5, this%iout, finalize=.false.)
2166  text = 'NUMBER'
2167  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
2168  text = 'KEYWORD'
2169  call this%inputtab%initialize_column(text, 20, alignment=tableft)
2170  do jj = 1, 3
2171  write (text, '(a,1x,i6)') 'VALUE', jj
2172  call this%inputtab%initialize_column(text, 15, alignment=tabcenter)
2173  end do
2174  end if
2175  !
2176  ! -- set flag to check attributes
2177  this%check_attr = 1
2178  do n = 1, this%input%nbound
2179  imaw = this%input%ifno(n)
2180  if (imaw < 1 .or. imaw > this%nmawwells) then
2181  write (errmsg, '(2(a,1x),i0,a)') &
2182  'IMAW must be greater than 0 and', &
2183  'less than or equal to ', this%nmawwells, '.'
2184  call store_error(errmsg)
2185  cycle
2186  end if
2187  !
2188  ! -- dispatch key for this row
2189  setting = this%input%setting(n)
2190  !
2191  ! -- STATUS
2192  if (trim(setting) == 'STATUS') then
2193  str = this%input%status(n)
2194  this%status(imaw) = str(1:8)
2195  select case (trim(str))
2196  case ('CONSTANT')
2197  this%iboundpak(imaw) = -1
2198  case ('INACTIVE')
2199  this%iboundpak(imaw) = 0
2200  case ('ACTIVE')
2201  this%iboundpak(imaw) = 1
2202  case default
2203  write (errmsg, '(2a)') &
2204  'Unknown '//trim(this%text)//" maw status keyword: '", &
2205  trim(str)//"'."
2206  call store_error(errmsg)
2207  end select
2208  end if
2209  !
2210  ! -- RATE / WELL_HEAD
2211  call this%maw_set_period_value(n, imaw, setting)
2212  if (trim(setting) == 'WELL_HEAD') then
2213  if (this%well_head(imaw) < this%bot(imaw)) then
2214  write (cstr, fmthdbot) this%well_head(imaw), this%bot(imaw)
2215  call this%maw_set_attribute_error(imaw, 'WELL HEAD', trim(cstr))
2216  end if
2217  end if
2218  !
2219  ! -- HEAD_LIMIT
2220  if (trim(setting) == 'HEAD_LIMIT') then
2221  str = this%input%head_limit(n)
2222  if (trim(str) == 'OFF') then
2223  this%shutofflevel(imaw) = dep20
2224  else
2225  read (str, *, iostat=istat, iomsg=errmsgr) &
2226  this%shutofflevel(imaw)
2227  if (istat /= 0) then
2228  errmsg = 'Could not read HEAD_LIMIT value. '//trim(errmsgr)
2229  call store_error(errmsg)
2230  end if
2231  if (this%shutofflevel(imaw) <= this%bot(imaw)) then
2232  iheadlimit_warning = iheadlimit_warning + 1
2233  end if
2234  end if
2235  end if
2236  !
2237  ! -- FLOWING_WELL (compound group)
2238  if (trim(setting) == 'FLOWING_WELL') then
2239  this%fwelev(imaw) = this%input%fwelev(n)
2240  this%fwcond(imaw) = this%input%fwcond(n)
2241  this%fwrlen(imaw) = this%input%fwrlen(n)
2242  if (this%iflowingwells == 0) then
2243  this%iflowingwells = -1
2244  text = 'Flowing well data is specified in the '// &
2245  trim(this%packName)//' package but FLOWING_WELL was'// &
2246  ' not specified in the OPTIONS block.'
2247  call store_warning(text)
2248  end if
2249  end if
2250  !
2251  ! -- SHUT_OFF (compound group)
2252  if (trim(setting) == 'SHUT_OFF') then
2253  this%shutoffmin(imaw) = this%input%minrate(n)
2254  this%shutoffmax(imaw) = this%input%maxrate(n)
2255  end if
2256  !
2257  ! -- RATE_SCALING (compound group)
2258  if (trim(setting) == 'RATE_SCALING') then
2259  this%pumpelev(imaw) = this%input%pump_elevation(n)
2260  this%reduction_length(imaw) = this%input%scaling_length(n)
2261  if (this%reduction_length(imaw) < dzero) then
2262  call this%maw_set_attribute_error(imaw, 'RATE_SCALING', &
2263  &'must be greater than or equal to 0.')
2264  end if
2265  end if
2266  !
2267  ! -- AUXILIARY (compound group); the current value is already set --
2268  ! -- only extract auxname here for echoing this period's row below
2269  if (this%naux > 0) then
2270  if (trim(setting) == 'PERIOD_AUXILIARY') then
2271  str = this%input%auxname(n)
2272  auxvaldbl = this%input%auxval(n)
2273  end if
2274  end if
2275  !
2276  ! -- echo row to period data table
2277  if (this%iprpak /= 0) then
2278  call this%inputtab%add_term(imaw)
2279  if (trim(setting) == 'PERIOD_AUXILIARY') then
2280  call this%inputtab%add_term('AUXILIARY')
2281  else
2282  call this%inputtab%add_term(trim(setting))
2283  end if
2284  select case (trim(setting))
2285  case ('STATUS')
2286  call this%inputtab%add_term(trim(str))
2287  call this%inputtab%add_term(' ')
2288  call this%inputtab%add_term(' ')
2289  case ('RATE')
2290  call this%inputtab%add_term(this%rate(imaw))
2291  call this%inputtab%add_term(' ')
2292  call this%inputtab%add_term(' ')
2293  case ('WELL_HEAD')
2294  call this%inputtab%add_term(this%well_head(imaw))
2295  call this%inputtab%add_term(' ')
2296  call this%inputtab%add_term(' ')
2297  case ('HEAD_LIMIT')
2298  call this%inputtab%add_term(trim(str))
2299  call this%inputtab%add_term(' ')
2300  call this%inputtab%add_term(' ')
2301  case ('FLOWING_WELL')
2302  call this%inputtab%add_term(this%fwelev(imaw))
2303  call this%inputtab%add_term(this%fwcond(imaw))
2304  call this%inputtab%add_term(this%fwrlen(imaw))
2305  case ('SHUT_OFF')
2306  call this%inputtab%add_term(this%shutoffmin(imaw))
2307  call this%inputtab%add_term(this%shutoffmax(imaw))
2308  call this%inputtab%add_term(' ')
2309  case ('RATE_SCALING')
2310  call this%inputtab%add_term(this%pumpelev(imaw))
2311  call this%inputtab%add_term(this%reduction_length(imaw))
2312  call this%inputtab%add_term(' ')
2313  case ('PERIOD_AUXILIARY')
2314  call this%inputtab%add_term(trim(str))
2315  call this%inputtab%add_term(auxvaldbl)
2316  call this%inputtab%add_term(' ')
2317  case default
2318  call this%inputtab%add_term(' ')
2319  call this%inputtab%add_term(' ')
2320  call this%inputtab%add_term(' ')
2321  end select
2322  end if
2323  end do
2324  if (this%iprpak /= 0) then
2325  call this%inputtab%finalize_table()
2326  end if
2327  !
2328  ! -- using data from the last stress period
2329  else
2330  write (this%iout, fmtlsp) trim(this%filtyp)
2331  end if
2332  !
2333  ! -- issue warning messages
2334  if (iheadlimit_warning > 0) then
2335  write (warnmsg, '(a,a,a,1x,a,1x,a)') &
2336  "HEAD_LIMIT in '", trim(this%packName), "' was below the well bottom", &
2337  "for one or more multi-aquifer well(s). This may result in", &
2338  "convergence failures for some models."
2339  call store_warning(warnmsg, substring=warnmsg(:50))
2340  end if
2341  !
2342  ! -- write summary of maw well stress period error messages
2343  if (count_errors() > 0) then
2344  call store_error_filename(this%input_fname)
2345  end if
2346  !
2347  ! -- qa data if necessary
2348  if (this%check_attr /= 0) then
2349  call this%maw_check_attributes()
2350 
2351  ! -- write summary of stress period data for MAW
2352  if (this%iprpak == 1) then
2353  if (this%imawiss /= 0) then
2354  csteady = 'STEADY-STATE '
2355  else
2356  csteady = 'TRANSIENT '
2357  end if
2358  !
2359  ! -- reset the input table object for rate data
2360  title = trim(adjustl(this%text))//' PACKAGE ('// &
2361  trim(adjustl(this%packName))//') '//trim(adjustl(csteady))// &
2362  ' RATE DATA FOR PERIOD'
2363  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
2364  ntabcols = 6
2365  call table_cr(this%inputtab, this%packName, title)
2366  call this%inputtab%table_df(this%nmawwells, ntabcols, this%iout)
2367  text = 'NUMBER'
2368  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
2369  text = 'STATUS'
2370  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2371  text = 'RATE'
2372  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2373  text = 'SPECIFIED HEAD'
2374  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2375  text = 'PUMP ELEVATION'
2376  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2377  text = 'REDUCTION LENGTH'
2378  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2379  do n = 1, this%nmawwells
2380  call this%inputtab%add_term(n)
2381  call this%inputtab%add_term(this%status(n))
2382  call this%inputtab%add_term(this%rate(n))
2383  if (this%iboundpak(n) < 0) then
2384  call this%inputtab%add_term(this%well_head(n))
2385  else
2386  call this%inputtab%add_term(' ')
2387  end if
2388  call this%inputtab%add_term(this%pumpelev(n))
2389  if (this%reduction_length(n) /= dep20) then
2390  call this%inputtab%add_term(this%reduction_length(n))
2391  else
2392  call this%inputtab%add_term(' ')
2393  end if
2394  end do
2395  !
2396  ! -- flowing wells
2397  if (this%iflowingwells > 0) then
2398  !
2399  ! -- reset the input table object for flowing well data
2400  title = trim(adjustl(this%text))//' PACKAGE ('// &
2401  trim(adjustl(this%packName))//') '//trim(adjustl(csteady))// &
2402  ' FLOWING WELL DATA FOR PERIOD'
2403  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
2404  ntabcols = 4
2405  ntabrows = 0
2406  do n = 1, this%nmawwells
2407  if (this%fwcond(n) > dzero) then
2408  ntabrows = ntabrows + 1
2409  end if
2410  end do
2411  if (ntabrows > 0) then
2412  call table_cr(this%inputtab, this%packName, title)
2413  call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
2414  text = 'NUMBER'
2415  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
2416  text = 'ELEVATION'
2417  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2418  text = 'CONDUCT.'
2419  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2420  text = 'REDUCTION LENGTH'
2421  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2422  do n = 1, this%nmawwells
2423  if (this%fwcond(n) > dzero) then
2424  call this%inputtab%add_term(n)
2425  call this%inputtab%add_term(this%fwelev(n))
2426  call this%inputtab%add_term(this%fwcond(n))
2427  call this%inputtab%add_term(this%fwrlen(n))
2428  end if
2429  end do
2430  end if
2431  end if
2432  !
2433  ! -- reset the input table object for shutoff data
2434  title = trim(adjustl(this%text))//' PACKAGE ('// &
2435  trim(adjustl(this%packName))//') '//trim(adjustl(csteady))// &
2436  ' WELL SHUTOFF DATA FOR PERIOD'
2437  write (title, '(a,1x,i6)') trim(adjustl(title)), kper
2438  ntabcols = 4
2439  ntabrows = 0
2440  do n = 1, this%nmawwells
2441  if (this%shutofflevel(n) /= dep20) then
2442  ntabrows = ntabrows + 1
2443  end if
2444  end do
2445  if (ntabrows > 0) then
2446  call table_cr(this%inputtab, this%packName, title)
2447  call this%inputtab%table_df(ntabrows, ntabcols, this%iout)
2448  text = 'NUMBER'
2449  call this%inputtab%initialize_column(text, 10, alignment=tabcenter)
2450  text = 'ELEVATION'
2451  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2452  text = 'MINIMUM. Q'
2453  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2454  text = 'MAXIMUM Q'
2455  call this%inputtab%initialize_column(text, 12, alignment=tabcenter)
2456  do n = 1, this%nmawwells
2457  if (this%shutofflevel(n) /= dep20) then
2458  call this%inputtab%add_term(n)
2459  call this%inputtab%add_term(this%shutofflevel(n))
2460  call this%inputtab%add_term(this%shutoffmin(n))
2461  call this%inputtab%add_term(this%shutoffmax(n))
2462  end if
2463  end do
2464  end if
2465  end if
2466  end if
2467  !
2468  ! -- fill arrays
2469  ibnd = 1
2470  do n = 1, this%nmawwells
2471  do j = 1, this%ngwfnodes(n)
2472  jpos = this%get_jpos(n, j)
2473  node = this%get_gwfnode(n, j)
2474  this%nodelist(ibnd) = node
2475  this%bound(1, ibnd) = this%xnewpak(n)
2476  this%bound(2, ibnd) = this%satcond(jpos)
2477  this%bound(3, ibnd) = this%botscrn(jpos)
2478  if (this%iboundpak(n) > 0) then
2479  this%bound(4, ibnd) = this%rate(n)
2480  else
2481  this%bound(4, ibnd) = dzero
2482  end if
2483  ibnd = ibnd + 1
2484  end do
2485  end do
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition: Sim.f90:204
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Here is the call graph for this function:

◆ 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 3816 of file gwf-maw.f90.

3817  use tdismodule, only: kper
3818  ! -- dummy
3819  class(MawType), intent(inout) :: this
3820  ! -- local
3821  integer(I4B) :: i
3822  integer(I4B) :: j
3823  integer(I4B) :: n
3824  integer(I4B) :: nn1
3825  integer(I4B) :: nn2
3826  integer(I4B) :: jj
3827  character(len=LENBOUNDNAME) :: bname
3828  logical :: jfound
3829  class(ObserveType), pointer :: obsrv => null()
3830  ! -- formats
3831 10 format('Boundary "', a, '" for observation "', a, &
3832  '" is invalid in package "', a, '"')
3833  !
3834  if (kper == 1) then
3835  do i = 1, this%obs%npakobs
3836  obsrv => this%obs%pakobs(i)%obsrv
3837  !
3838  ! -- get node number 1
3839  nn1 = obsrv%NodeNumber
3840  if (nn1 == namedboundflag) then
3841  bname = obsrv%FeatureName
3842  if (bname /= '') then
3843  ! -- Observation maw is based on a boundary name.
3844  ! Iterate through all multi-aquifer wells to identify and store
3845  ! corresponding index in bound array.
3846  jfound = .false.
3847  if (obsrv%ObsTypeId == 'MAW' .or. &
3848  obsrv%ObsTypeId == 'CONDUCTANCE') then
3849  if (this%inamedbound /= 0) then
3850  do j = 1, this%nmawwells
3851  do jj = this%iaconn(j), this%iaconn(j + 1) - 1
3852  if (this%boundname(jj) == bname) then
3853  jfound = .true.
3854  call obsrv%AddObsIndex(jj)
3855  end if
3856  end do
3857  end do
3858  end if
3859  else
3860  do j = 1, this%nmawwells
3861  if (this%cmawname(j) == bname) then
3862  jfound = .true.
3863  call obsrv%AddObsIndex(j)
3864  end if
3865  end do
3866  end if
3867  if (.not. jfound) then
3868  write (errmsg, 10) &
3869  trim(bname), trim(obsrv%Name), trim(this%packName)
3870  call store_error(errmsg)
3871  end if
3872  end if
3873  else
3874  if (obsrv%indxbnds_count == 0) then
3875  if (obsrv%ObsTypeId == 'MAW' .or. &
3876  obsrv%ObsTypeId == 'CONDUCTANCE') then
3877  nn2 = obsrv%NodeNumber2
3878  j = this%iaconn(nn1) + nn2 - 1
3879  call obsrv%AddObsIndex(j)
3880  else
3881  call obsrv%AddObsIndex(nn1)
3882  end if
3883  else
3884  errmsg = 'Programming error in maw_rp_obs'
3885  call store_error(errmsg)
3886  end if
3887  end if
3888  !
3889  ! -- catch non-cumulative observation assigned to observation defined
3890  ! by a boundname that is assigned to more than one element
3891  if (obsrv%ObsTypeId == 'HEAD') then
3892  if (obsrv%indxbnds_count > 1) then
3893  write (errmsg, '(a,3(1x,a))') &
3894  trim(adjustl(obsrv%ObsTypeId)), &
3895  'for observation', trim(adjustl(obsrv%Name)), &
3896  'must be assigned to a multi-aquifer well with a unique boundname.'
3897  call store_error(errmsg)
3898  end if
3899  end if
3900  !
3901  ! -- check that index values are valid
3902  if (obsrv%ObsTypeId == 'MAW' .or. &
3903  obsrv%ObsTypeId == 'CONDUCTANCE') then
3904  do j = 1, obsrv%indxbnds_count
3905  nn1 = obsrv%indxbnds(j)
3906  n = this%imap(nn1)
3907  nn2 = nn1 - this%iaconn(n) + 1
3908  jj = this%iaconn(n + 1) - this%iaconn(n)
3909  if (nn1 < 1 .or. nn1 > this%maxbound) then
3910  write (errmsg, '(3(a,1x),i0,1x,a,i0,a)') &
3911  trim(adjustl(obsrv%ObsTypeId)), &
3912  'multi-aquifer well connection number must be greater than 0', &
3913  'and less than', jj, '(specified value is ', nn2, ').'
3914  call store_error(errmsg)
3915  end if
3916  end do
3917  else
3918  do j = 1, obsrv%indxbnds_count
3919  nn1 = obsrv%indxbnds(j)
3920  if (nn1 < 1 .or. nn1 > this%nmawwells) then
3921  write (errmsg, '(3(a,1x),i0,1x,a,i0,a)') &
3922  trim(adjustl(obsrv%ObsTypeId)), &
3923  'multi-aquifer well must be greater than 0 ', &
3924  'and less than or equal to', this%nmawwells, &
3925  '(specified value is ', nn1, ').'
3926  call store_error(errmsg)
3927  end if
3928  end do
3929  end if
3930  end do
3931  !
3932  ! -- evaluate if there are any observation errors
3933  if (count_errors() > 0) then
3934  call store_error_filename(this%input_fname)
3935  end if
3936  end if
Here is the call graph for this function:

◆ maw_screen_length()

pure real(dp) function, public mawmodule::maw_screen_length ( real(dp), intent(in)  dz,
real(dp), intent(in)  radius,
real(dp), intent(in)  omega 
)

The length is derived from the vertical screen extent, the well radius, and the tilt angle, and grows without bound as the connection approaches horizontal.

Parameters
[in]dzvertical screen extent
[in]radiuswell radius
[in]omegatilt angle from vertical, in radians

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

1540  ! -- dummy
1541  real(DP), intent(in) :: dz !< vertical screen extent
1542  real(DP), intent(in) :: radius !< well radius
1543  real(DP), intent(in) :: omega !< tilt angle from vertical, in radians
1544  ! -- return
1545  real(DP) :: lw
1546  !
1547  lw = (dz - dtwo * radius * sin(omega)) / cos(omega)
Here is the caller 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 1873 of file gwf-maw.f90.

1874  use simmodule, only: store_error
1875  ! -- dummy
1876  class(MawType), intent(inout) :: this
1877  integer(I4B), intent(in) :: imaw
1878  character(len=*), intent(in) :: keyword
1879  character(len=*), intent(in) :: msg
1880  ! -- local
1881  ! -- formats
1882  !
1883  if (len(msg) == 0) then
1884  write (errmsg, '(a,1x,a,1x,i0,1x,a)') &
1885  keyword, ' for MAW well', imaw, 'has already been set.'
1886  else
1887  write (errmsg, '(a,1x,a,1x,i0,1x,a)') &
1888  keyword, ' for MAW well', imaw, msg
1889  end if
1890  call store_error(errmsg)
Here is the call graph for this function:

◆ maw_set_period_value()

subroutine mawmodule::maw_set_period_value ( class(mawtype), intent(inout)  this,
integer(i4b), intent(in)  n,
integer(i4b), intent(in)  imaw,
character(len=*), intent(in)  setting 
)

Shared by maw_rp (once per period) and maw_ad (per-timestep resync of TS-linked settings); validation stays with the caller.

Parameters
[in]nrow index into input context arrays
[in]imawwell number
[in]settinguppercase tagname dispatch key

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

1899  ! -- dummy
1900  class(MawType), intent(inout) :: this
1901  integer(I4B), intent(in) :: n !< row index into input context arrays
1902  integer(I4B), intent(in) :: imaw !< well number
1903  character(len=*), intent(in) :: setting !< uppercase tagname dispatch key
1904  !
1905  select case (trim(setting))
1906  case ('WELL_HEAD')
1907  this%well_head_set(imaw) = .true.
1908  this%xnewpak(imaw) = this%well_head(imaw)
1909  end select

◆ 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 3565 of file gwf-maw.f90.

3566  ! -- modules
3568  ! -- dummy
3569  class(MawType) :: this
3570  integer(I4B), pointer :: neq
3571  integer(I4B), dimension(:), pointer, contiguous :: ibound
3572  real(DP), dimension(:), pointer, contiguous :: xnew
3573  real(DP), dimension(:), pointer, contiguous :: xold
3574  real(DP), dimension(:), pointer, contiguous :: flowja
3575  ! -- local
3576  integer(I4B) :: n
3577  integer(I4B) :: istart, iend
3578  !
3579  ! -- call base BndType set_pointers
3580  call this%BndType%set_pointers(neq, ibound, xnew, xold, flowja)
3581  !
3582  ! -- Set the MAW pointers
3583  !
3584  ! -- set package pointers
3585  istart = this%dis%nodes + this%ioffset + 1
3586  iend = istart + this%nmawwells - 1
3587  this%iboundpak => this%ibound(istart:iend)
3588  this%xnewpak => this%xnew(istart:iend)
3589  call mem_checkin(this%xnewpak, 'HEAD', this%memoryPath, 'X', &
3590  this%memoryPathModel)
3591  call mem_allocate(this%xoldpak, this%nmawwells, 'XOLDPAK', this%memoryPath)
3592  !
3593  ! -- initialize xnewpak
3594  do n = 1, this%nmawwells
3595  this%xnewpak(n) = dep20
3596  end do

◆ maw_setup_budobj()

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

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

4750  ! -- modules
4751  use constantsmodule, only: lenbudtxt
4752  ! -- dummy
4753  class(MawType) :: this
4754  ! -- local
4755  integer(I4B) :: nbudterm
4756  integer(I4B) :: n, j, n2
4757  real(DP) :: q
4758  integer(I4B) :: maxlist, naux
4759  integer(I4B) :: idx
4760  character(len=LENBUDTXT) :: text
4761  character(len=LENBUDTXT), dimension(1) :: auxtxt
4762  !
4763  ! -- Determine the number of maw budget terms. These are fixed for
4764  ! the simulation and cannot change.
4765  ! gwf rate [flowing_well] storage constant_flow [frommvr tomvr tomvrcf [tomvrfw]] [aux]
4766  nbudterm = 4
4767  if (this%iflowingwells > 0) then
4768  nbudterm = nbudterm + 1
4769  end if
4770  if (this%imover == 1) then
4771  nbudterm = nbudterm + 3
4772  if (this%iflowingwells > 0) then
4773  nbudterm = nbudterm + 1
4774  end if
4775  end if
4776  if (this%naux > 0) nbudterm = nbudterm + 1
4777  !
4778  ! -- set up budobj
4779  call budgetobject_cr(this%budobj, this%packName)
4780  call this%budobj%budgetobject_df(this%nmawwells, nbudterm, 0, 0, &
4781  ibudcsv=this%ibudcsv)
4782  idx = 0
4783  !
4784  ! -- Go through and set up each budget term
4785  !
4786  ! --
4787  text = ' GWF'
4788  idx = idx + 1
4789  maxlist = this%maxbound
4790  naux = 1
4791  auxtxt(1) = ' FLOW-AREA'
4792  call this%budobj%budterm(idx)%initialize(text, &
4793  this%name_model, &
4794  this%packName, &
4795  this%name_model, &
4796  this%name_model, &
4797  maxlist, .false., .true., &
4798  naux, auxtxt)
4799  call this%budobj%budterm(idx)%reset(this%maxbound)
4800  q = dzero
4801  do n = 1, this%nmawwells
4802  do j = 1, this%ngwfnodes(n)
4803  n2 = this%get_gwfnode(n, j)
4804  call this%budobj%budterm(idx)%update_term(n, n2, q)
4805  end do
4806  end do
4807  !
4808  ! --
4809  text = ' RATE'
4810  idx = idx + 1
4811  maxlist = this%nmawwells
4812  naux = 0
4813  call this%budobj%budterm(idx)%initialize(text, &
4814  this%name_model, &
4815  this%packName, &
4816  this%name_model, &
4817  this%packName, &
4818  maxlist, .false., .false., &
4819  naux)
4820  !
4821  ! --
4822  if (this%iflowingwells > 0) then
4823  text = ' FW-RATE'
4824  idx = idx + 1
4825  maxlist = this%nmawwells
4826  naux = 0
4827  call this%budobj%budterm(idx)%initialize(text, &
4828  this%name_model, &
4829  this%packName, &
4830  this%name_model, &
4831  this%packName, &
4832  maxlist, .false., .false., &
4833  naux)
4834  end if
4835  !
4836  ! --
4837  text = ' STORAGE'
4838  idx = idx + 1
4839  maxlist = this%nmawwells
4840  naux = 1
4841  auxtxt(1) = ' VOLUME'
4842  call this%budobj%budterm(idx)%initialize(text, &
4843  this%name_model, &
4844  this%packName, &
4845  this%name_model, &
4846  this%name_model, &
4847  maxlist, .false., .true., &
4848  naux, auxtxt)
4849  !
4850  ! --
4851  text = ' CONSTANT'
4852  idx = idx + 1
4853  maxlist = this%nmawwells
4854  naux = 0
4855  call this%budobj%budterm(idx)%initialize(text, &
4856  this%name_model, &
4857  this%packName, &
4858  this%name_model, &
4859  this%packName, &
4860  maxlist, .false., .false., &
4861  naux)
4862  !
4863  ! --
4864  if (this%imover == 1) then
4865  !
4866  ! --
4867  text = ' FROM-MVR'
4868  idx = idx + 1
4869  maxlist = this%nmawwells
4870  naux = 0
4871  call this%budobj%budterm(idx)%initialize(text, &
4872  this%name_model, &
4873  this%packName, &
4874  this%name_model, &
4875  this%packName, &
4876  maxlist, .false., .false., &
4877  naux)
4878  !
4879  ! --
4880  text = ' RATE-TO-MVR'
4881  idx = idx + 1
4882  maxlist = this%nmawwells
4883  naux = 0
4884  call this%budobj%budterm(idx)%initialize(text, &
4885  this%name_model, &
4886  this%packName, &
4887  this%name_model, &
4888  this%packName, &
4889  maxlist, .false., .false., &
4890  naux)
4891  !
4892  ! -- constant-head flow to mover
4893  text = ' CONSTANT-TO-MVR'
4894  idx = idx + 1
4895  maxlist = this%nmawwells
4896  naux = 0
4897  call this%budobj%budterm(idx)%initialize(text, &
4898  this%name_model, &
4899  this%packName, &
4900  this%name_model, &
4901  this%packName, &
4902  maxlist, .false., .false., &
4903  naux)
4904  !
4905  ! -- flowing-well flow to mover
4906  if (this%iflowingwells > 0) then
4907  !
4908  ! --
4909  text = ' FW-RATE-TO-MVR'
4910  idx = idx + 1
4911  maxlist = this%nmawwells
4912  naux = 0
4913  call this%budobj%budterm(idx)%initialize(text, &
4914  this%name_model, &
4915  this%packName, &
4916  this%name_model, &
4917  this%packName, &
4918  maxlist, .false., .false., &
4919  naux)
4920  end if
4921  end if
4922  !
4923  ! -- auxiliary variable
4924  naux = this%naux
4925  if (naux > 0) then
4926  !
4927  ! --
4928  text = ' AUXILIARY'
4929  idx = idx + 1
4930  maxlist = this%maxbound
4931  call this%budobj%budterm(idx)%initialize(text, &
4932  this%name_model, &
4933  this%packName, &
4934  this%name_model, &
4935  this%packName, &
4936  maxlist, .false., .false., &
4937  naux, this%auxname)
4938  end if
4939  !
4940  ! -- if maw flow for each reach are written to the listing file
4941  if (this%iprflow /= 0) then
4942  call this%budobj%flowtable_df(this%iout)
4943  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 5169 of file gwf-maw.f90.

5170  ! -- modules
5172  ! -- dummy
5173  class(MawType) :: this
5174  ! -- local
5175  integer(I4B) :: nterms
5176  character(len=LINELENGTH) :: title
5177  character(len=LINELENGTH) :: text
5178  !
5179  ! -- setup well head table
5180  if (this%iprhed > 0) then
5181  !
5182  ! -- Determine the number of head table columns
5183  nterms = 2
5184  if (this%inamedbound == 1) nterms = nterms + 1
5185  !
5186  ! -- set up table title
5187  title = trim(adjustl(this%text))//' PACKAGE ('// &
5188  trim(adjustl(this%packName))//') HEADS FOR EACH CONTROL VOLUME'
5189  !
5190  ! -- set up head tableobj
5191  call table_cr(this%headtab, this%packName, title)
5192  call this%headtab%table_df(this%nmawwells, nterms, this%iout, &
5193  transient=.true.)
5194  !
5195  ! -- Go through and set up table budget term
5196  if (this%inamedbound == 1) then
5197  text = 'NAME'
5198  call this%headtab%initialize_column(text, 20, alignment=tableft)
5199  end if
5200  !
5201  ! -- reach number
5202  text = 'NUMBER'
5203  call this%headtab%initialize_column(text, 10, alignment=tabcenter)
5204  !
5205  ! -- reach stage
5206  text = 'HEAD'
5207  call this%headtab%initialize_column(text, 12, alignment=tabcenter)
5208  end if
Here is the call graph for this function:

◆ maw_source_angledata()

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

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

1284  use constantsmodule, only: dzero, dem6, dtwo, dpio180, dnodata
1285  use mathutilmodule, only: is_close
1287  ! -- dummy
1288  class(MawType), intent(inout) :: this
1289  ! -- local
1290  integer(I4B) :: n, imaw, iconn, jpos, ichk, nangle, node
1291  real(DP) :: angle, dz, omega, lw, topexp
1292  real(DP) :: hlen
1293  real(DP) :: extent
1294  character(len=LINELENGTH) :: cndmsg
1295  character(len=LINELENGTH) :: extmsg
1296  logical(LGP) :: estimated
1297  integer(I4B), dimension(:), pointer, contiguous :: angledata_ifno => null()
1298  integer(I4B), dimension(:), pointer, contiguous :: angledata_icon => null()
1299  real(DP), dimension(:), pointer, contiguous :: angle_arr => null()
1300  real(DP), dimension(:), pointer, contiguous :: connlen_arr => null()
1301  integer(I4B), allocatable :: iachk(:)
1302  integer(I4B), allocatable :: nboundchk(:)
1303  real(DP), parameter :: coszero = dem6
1304  real(DP), parameter :: dninety = 9.0d1
1305  !
1306  call get_isize('ANGLEDATA_IFNO', this%input_mempath, nangle)
1307  !
1308  if (nangle > 0) then
1309  !
1310  if (this%inonvert == 0) then
1311  call store_error('An ANGLEDATA block was specified but the '// &
1312  'NON_VERTICAL_WELLS option was not specified in the '// &
1313  'OPTIONS block.')
1314  call store_error_filename(this%input_fname)
1315  end if
1316  !
1317  call mem_setptr(angledata_ifno, 'ANGLEDATA_IFNO', this%input_mempath)
1318  call mem_setptr(angledata_icon, 'ANGLEDATA_ICON', this%input_mempath)
1319  call mem_setptr(angle_arr, 'ANGLE', this%input_mempath)
1320  call mem_setptr(connlen_arr, 'CONNLEN', this%input_mempath)
1321  !
1322  allocate (iachk(this%nmawwells + 1))
1323  iachk(1) = 1
1324  do n = 1, this%nmawwells
1325  iachk(n + 1) = iachk(n) + this%ngwfnodes(n)
1326  end do
1327  allocate (nboundchk(this%maxbound))
1328  nboundchk = 0
1329  !
1330  write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%text))// &
1331  ' ANGLEDATA'
1332  !
1333  do n = 1, nangle
1334  imaw = angledata_ifno(n)
1335  if (imaw < 1 .or. imaw > this%nmawwells) then
1336  write (errmsg, '(a,1x,i0,a)') &
1337  'IFNO must be greater than 0 and less than or equal to ', &
1338  this%nmawwells, '.'
1339  call store_error(errmsg)
1340  cycle
1341  end if
1342  !
1343  iconn = angledata_icon(n)
1344  if (iconn < 1 .or. iconn > this%ngwfnodes(imaw)) then
1345  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
1346  'ICON for well ', imaw, &
1347  'must be greater than 0 and less than or equal to ', &
1348  this%ngwfnodes(imaw), '.'
1349  call store_error(errmsg)
1350  cycle
1351  end if
1352  jpos = this%get_jpos(imaw, iconn)
1353  !
1354  ichk = iachk(imaw) + iconn - 1
1355  nboundchk(ichk) = nboundchk(ichk) + 1
1356  if (nboundchk(ichk) > 1) then
1357  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a)') &
1358  'ANGLEDATA for maw well', imaw, 'connection', iconn, &
1359  'is specified more than once.'
1360  call store_error(errmsg)
1361  end if
1362  !
1363  angle = angle_arr(n)
1364  this%angle(jpos) = angle
1365  if (connlen_arr(n) /= dnodata) then
1366  this%connlen(jpos) = max(connlen_arr(n), dzero)
1367  end if
1368  !
1369  if (angle < dzero .or. angle > dninety) then
1370  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a)') &
1371  'ANGLE for maw well', imaw, 'connection', iconn, '(', angle, &
1372  ') must be greater than or equal to 0.0 and less than or '// &
1373  'equal to 90.0 degrees.'
1374  call store_error(errmsg)
1375  cycle
1376  end if
1377  !
1378  node = this%get_gwfnode(imaw, iconn)
1379  !
1380  ! -- a SPECIFIED connection provides the saturated conductance directly,
1381  ! so the length correction is not applied; the user-specified screen
1382  ! elevations (which are otherwise reset to the cell top and bottom)
1383  ! are restored here, clamped to the cell, so the connection
1384  ! saturation is calculated over the correct interval. It is the
1385  ! user's responsibility to calculate the correct conductance.
1386  if (this%ieqn(imaw) == 0) then
1387  this%topscrn(jpos) = min(this%usrtopscrn(jpos), this%dis%top(node))
1388  this%botscrn(jpos) = max(this%usrbotscrn(jpos), this%dis%bot(node))
1389  end if
1390  !
1391  dz = this%topscrn(jpos) - this%botscrn(jpos)
1392  if (dz <= dzero) then
1393  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a)') &
1394  'The screen top must be greater than the screen bottom for maw '// &
1395  'well', imaw, 'connection', iconn, 'listed in the ANGLEDATA block.'
1396  call store_error(errmsg)
1397  cycle
1398  end if
1399  !
1400  omega = angle * dpio180
1401  !
1402  ! -- the in-cell screen length is specified directly or derived from
1403  ! the screen elevations, well radius, and tilt angle; it cannot be
1404  ! derived for a (near) horizontal connection
1405  if (this%connlen(jpos) > dzero) then
1406  lw = this%connlen(jpos)
1407  else if (cos(omega) > coszero) then
1408  lw = maw_screen_length(dz, this%radius(imaw), omega)
1409  else
1410  lw = dzero
1411  end if
1412  !
1413  ! -- the in-cell screen length is used only by the conductance
1414  ! equations calculated by the program (it is not used by the
1415  ! SPECIFIED equation). For those equations a (near) horizontal
1416  ! connection requires a connection length, because the length cannot
1417  ! be derived from the screen elevations, and the calculated length
1418  ! must be positive.
1419  if (this%ieqn(imaw) /= 0) then
1420  if (cos(omega) <= coszero .and. this%connlen(jpos) <= dzero) then
1421  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a)') &
1422  'A connection length must be specified for the (near) '// &
1423  'horizontal maw well', imaw, 'connection', iconn, &
1424  'listed in the ANGLEDATA block.'
1425  call store_error(errmsg)
1426  cycle
1427  end if
1428  if (lw <= dzero) then
1429  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a)') &
1430  'The calculated in-cell screen length for maw well', imaw, &
1431  'connection', iconn, '(', lw, &
1432  ') is not greater than zero. Specify a connection length in '// &
1433  'the ANGLEDATA block.'
1434  call store_error(errmsg)
1435  cycle
1436  end if
1437  end if
1438  !
1439  ! -- a connection spans a horizontal distance of lw * sin(omega), which
1440  ! cannot exceed the horizontal extent of the connected cell
1441  if (lw > dzero) then
1442  hlen = lw * sin(omega)
1443  extent = this%maw_cell_extent(node, estimated)
1444  if (hlen > extent) then
1445  !
1446  ! -- the extent is estimated from the cell area where the cell
1447  ! vertices are not defined
1448  if (estimated) then
1449  extmsg = 'estimated maximum horizontal extent'
1450  else
1451  extmsg = 'maximum horizontal extent'
1452  end if
1453  !
1454  ! -- the length correction is not applied to a SPECIFIED
1455  ! connection, so the conductance of one is not the program's
1456  ! to describe as too large
1457  if (this%ieqn(imaw) == 0) then
1458  cndmsg = 'The specified saturated conductance is applied to a '// &
1459  'screen that is longer than the cell.'
1460  else
1461  cndmsg = 'The calculated saturated conductance is '// &
1462  'correspondingly too large.'
1463  end if
1464  write (warnmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a,g0,a)') &
1465  'The horizontal distance spanned by maw well', imaw, &
1466  'connection', iconn, '(', hlen, &
1467  ') is greater than the '//trim(extmsg)//' of the '// &
1468  'connected cell (', extent, &
1469  '), so the screen extends beyond the cell it is connected '// &
1470  'to. '//trim(cndmsg)//' Reduce ANGLE or CONN_LENGTH, or '// &
1471  'specify a separate connection to each cell the connection '// &
1472  'passes through.'
1473  call store_warning(warnmsg)
1474  end if
1475  end if
1476  !
1477  ! -- the radial (THIEM, SKIN, and CUMULATIVE) conductance equations use
1478  ! the horizontal-plane flow geometry, so a (near) horizontal
1479  ! connection is an approximation; recommend the MEAN equation
1480  if (cos(omega) <= coszero .and. &
1481  this%ieqn(imaw) /= 4 .and. this%ieqn(imaw) /= 0) then
1482  write (warnmsg, '(a,1x,i0,1x,a,1x,i0,1x,a)') &
1483  'The (near) horizontal maw well', imaw, 'connection', iconn, &
1484  'uses a radial conductance equation (THIEM, SKIN, or '// &
1485  'CUMULATIVE). The calculated conductance is an approximation '// &
1486  'for horizontal connections; the MEAN conductance equation is '// &
1487  'recommended for horizontal connections.'
1488  call store_warning(warnmsg)
1489  end if
1490  !
1491  if (cos(omega) <= coszero .and. &
1492  (this%ieqn(imaw) == 4 .or. this%ieqn(imaw) == 0)) then
1493  topexp = this%botscrn(jpos) + dtwo * this%radius(imaw)
1494  if (is_close(this%topscrn(jpos), topexp)) then
1495  this%topscrn(jpos) = topexp
1496  else
1497  write (warnmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a)') &
1498  'The vertical screen extent (SCRN_TOP - SCRN_BOT) for the '// &
1499  '(near) horizontal maw well', imaw, 'connection', iconn, &
1500  'is not equal to the well diameter (2 * RADIUS = ', &
1501  dtwo * this%radius(imaw), &
1502  '). The vertical screen extent is used to determine the '// &
1503  'saturation of a connection and should equal the well '// &
1504  'diameter for a horizontal connection.'
1505  call store_warning(warnmsg)
1506  end if
1507  end if
1508  end do
1509  !
1510  write (this%iout, '(1x,a)') &
1511  'END OF '//trim(adjustl(this%text))//' ANGLEDATA'
1512  !
1513  deallocate (iachk)
1514  deallocate (nboundchk)
1515  !
1516  call memorystore_release('ANGLEDATA_IFNO', this%input_mempath)
1517  call memorystore_release('ANGLEDATA_ICON', this%input_mempath)
1518  call memorystore_release('ANGLE', this%input_mempath)
1519  call memorystore_release('CONNLEN', this%input_mempath)
1520  else
1521  if (this%inonvert /= 0) then
1522  write (warnmsg, '(a)') &
1523  'The NON_VERTICAL_WELLS option was specified but an ANGLEDATA '// &
1524  'block was not found. All multi-aquifer well connections will be '// &
1525  'treated as vertical.'
1526  call store_warning(warnmsg)
1527  end if
1528  end if
1529  !
1530  if (count_errors() > 0) call store_error_filename(this%input_fname)
real(dp), parameter dnodata
real no data constant
Definition: Constants.f90:95
real(dp), parameter dem6
real constant 1e-6
Definition: Constants.f90:109
pure logical function, public is_close(a, b, rtol, atol, symmetric)
Check if a real value is approximately equal to another.
Definition: MathUtil.f90:46
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
Here is the call graph for this function:

◆ maw_source_connectiondata()

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

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

1049  ! -- dummy
1050  class(MawType), intent(inout) :: this
1051  ! -- local
1052  integer(I4B) :: n, nconn, imaw, iconn, ipos, jpos, j, jj
1053  integer(I4B) :: nn, nn2
1054  integer(I4B) :: ireset_scrntop, ireset_scrnbot, ireset_wellbot
1055  real(DP) :: rval, topnn, botnn, botw
1056  character(len=LINELENGTH) :: cellid_str
1057  character(len=30) :: nodestr
1058  integer(I4B), dimension(:), pointer, contiguous :: ifno => null()
1059  integer(I4B), dimension(:), pointer, contiguous :: icon => null()
1060  integer(I4B), dimension(:, :), pointer, contiguous :: cellid => null()
1061  real(DP), dimension(:), pointer, contiguous :: scrn_top => null()
1062  real(DP), dimension(:), pointer, contiguous :: scrn_bot => null()
1063  real(DP), dimension(:), pointer, contiguous :: hk_skin => null()
1064  real(DP), dimension(:), pointer, contiguous :: radius_skin => null()
1065  integer(I4B), allocatable :: iachk(:)
1066  integer(I4B), allocatable :: nboundchk(:)
1067  !
1068  ireset_scrntop = 0
1069  ireset_scrnbot = 0
1070  ireset_wellbot = 0
1071  !
1072  write (this%iout, '(/1x,a)') &
1073  'PROCESSING '//trim(adjustl(this%text))//' CONNECTIONDATA'
1074  !
1075  ! -- get input context CONNECTIONDATA columns
1076  call mem_setptr(ifno, 'CONNDATA_IFNO', this%input_mempath)
1077  call mem_setptr(icon, 'ICON', this%input_mempath)
1078  call mem_setptr(cellid, 'CELLID', this%input_mempath)
1079  call mem_setptr(scrn_top, 'SCRN_TOP', this%input_mempath)
1080  call mem_setptr(scrn_bot, 'SCRN_BOT', this%input_mempath)
1081  call mem_setptr(hk_skin, 'HK_SKIN', this%input_mempath)
1082  call mem_setptr(radius_skin, 'RADIUS_SKIN', this%input_mempath)
1083  !
1084  nconn = size(ifno)
1085  !
1086  ! -- allocate check arrays
1087  allocate (iachk(this%nmawwells + 1))
1088  iachk(1) = 1
1089  do n = 1, this%nmawwells
1090  iachk(n + 1) = iachk(n) + this%ngwfnodes(n)
1091  end do
1092  allocate (nboundchk(this%maxbound))
1093  nboundchk = 0
1094  !
1095  do n = 1, nconn
1096  imaw = ifno(n)
1097  iconn = icon(n)
1098  !
1099  ! -- check for error condition
1100  if (imaw < 1 .or. imaw > this%nmawwells) then
1101  write (errmsg, '(a,1x,i0,a)') &
1102  'IMAW must be greater than 0 and less than or equal to ', &
1103  this%nmawwells, '.'
1104  call store_error(errmsg)
1105  cycle
1106  end if
1107  if (iconn < 1 .or. iconn > this%ngwfnodes(imaw)) then
1108  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
1109  'JCONN for well ', imaw, &
1110  'must be greater than 1 and less than or equal to ', &
1111  this%ngwfnodes(imaw), '.'
1112  call store_error(errmsg)
1113  cycle
1114  end if
1115  !
1116  ipos = iachk(imaw) + iconn - 1
1117  nboundchk(ipos) = nboundchk(ipos) + 1
1118  j = iconn
1119  jpos = this%get_jpos(imaw, iconn)
1120  !
1121  ! -- convert cellid integer array to string and get node number
1122  write (cellid_str, '(10(i0,1x))') cellid(1:this%dis%ndim, n)
1123  nn = this%dis%noder_from_cellid(cellid_str, this%inunit, this%iout)
1124  topnn = this%dis%top(nn)
1125  botnn = this%dis%bot(nn)
1126  botw = this%bot(imaw)
1127  !
1128  ! -- set gwf node number for connection
1129  this%gwfnodes(jpos) = nn
1130  !
1131  ! -- top of screen; retain user value before clipping for non-vertical SPECIFIED connections
1132  this%usrtopscrn(jpos) = scrn_top(n)
1133  rval = scrn_top(n)
1134  if (this%ieqn(imaw) /= 4) then
1135  rval = topnn
1136  else
1137  if (rval > topnn) then
1138  ireset_scrntop = ireset_scrntop + 1
1139  rval = topnn
1140  end if
1141  end if
1142  this%topscrn(jpos) = rval
1143  !
1144  ! -- bottom of screen; retain user value before clipping for non-vertical SPECIFIED connections
1145  this%usrbotscrn(jpos) = scrn_bot(n)
1146  rval = scrn_bot(n)
1147  if (this%ieqn(imaw) /= 4) then
1148  rval = botnn
1149  else
1150  if (rval < botnn) then
1151  ireset_scrnbot = ireset_scrnbot + 1
1152  rval = botnn
1153  end if
1154  end if
1155  this%botscrn(jpos) = rval
1156  !
1157  ! -- adjust the bottom of the well for all conductance approaches
1158  ! except for "mean"
1159  if (rval < botw) then
1160  if (this%ieqn(imaw) /= 4) then
1161  ireset_wellbot = ireset_wellbot + 1
1162  botw = rval
1163  this%bot(imaw) = rval
1164  else
1165  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a,g0,a)') &
1166  'Screen bottom for maw well', imaw, 'connection', j, '(', &
1167  this%botscrn(jpos), ') is less than the well bottom (', &
1168  this%bot(imaw), ').'
1169  call store_error(errmsg)
1170  end if
1171  end if
1172  !
1173  ! -- hydraulic conductivity or conductance
1174  rval = hk_skin(n)
1175  if (this%ieqn(imaw) == 0) then
1176  this%satcond(jpos) = rval
1177  else if (this%ieqn(imaw) == 2 .OR. this%ieqn(imaw) == 3 .OR. &
1178  this%ieqn(imaw) == 4) then
1179  this%hk(jpos) = rval
1180  end if
1181  !
1182  ! -- skin radius
1183  rval = radius_skin(n)
1184  if (this%ieqn(imaw) == 2 .OR. this%ieqn(imaw) == 3 .OR. &
1185  this%ieqn(imaw) == 4) then
1186  this%sradius(jpos) = rval
1187  if (this%sradius(jpos) <= this%radius(imaw)) then
1188  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,g0,a,g0,a)') &
1189  'Screen radius for maw well', imaw, 'connection', j, '(', &
1190  this%sradius(jpos), &
1191  ') is less than or equal to the well radius (', &
1192  this%radius(imaw), ').'
1193  call store_error(errmsg)
1194  end if
1195  end if
1196  end do
1197  !
1198  write (this%iout, '(1x,a)') &
1199  'END OF '//trim(adjustl(this%text))//' CONNECTIONDATA'
1200  !
1201  ! -- check for missing or duplicate connections
1202  ipos = 0
1203  do n = 1, this%nmawwells
1204  do j = 1, this%ngwfnodes(n)
1205  ipos = ipos + 1
1206  if (nboundchk(ipos) == 0) then
1207  write (errmsg, '(a,1x,i0,1x,a,1x,i0,a)') &
1208  'No data specified for maw well', n, 'connection', j, '.'
1209  call store_error(errmsg)
1210  else if (nboundchk(ipos) > 1) then
1211  write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a,1x,i0,1x,a)') &
1212  'Data for maw well', n, 'connection', j, &
1213  'specified', nboundchk(ipos), 'times.'
1214  call store_error(errmsg)
1215  end if
1216  end do
1217  end do
1218  !
1219  ! -- make sure that more than one connection per cell is only specified
1220  ! for wells using the mean conductance type
1221  do n = 1, this%nmawwells
1222  if (this%ieqn(n) /= 4) then
1223  do j = 1, this%ngwfnodes(n)
1224  nn = this%get_gwfnode(n, j)
1225  do jj = 1, this%ngwfnodes(n)
1226  if (jj == j) cycle
1227  nn2 = this%get_gwfnode(n, jj)
1228  if (nn2 == nn) then
1229  call this%dis%noder_to_string(nn, nodestr)
1230  write (errmsg, '(a,1x,i0,1x,a,1x,i0,3(1x,a))') &
1231  'Only one connection can be specified for maw well', &
1232  n, 'connection', j, 'to gwf cell', trim(adjustl(nodestr)), &
1233  'unless the mean condeqn is specified.'
1234  call store_error(errmsg)
1235  end if
1236  end do
1237  end do
1238  end if
1239  end do
1240  !
1241  ! -- deallocate local storage
1242  deallocate (iachk)
1243  deallocate (nboundchk)
1244  !
1245  ! -- add warning messages
1246  if (ireset_scrntop > 0) then
1247  write (warnmsg, '(a,1x,a,1x,a,1x,i0,1x,a)') &
1248  'The screen tops in multi-aquifer well package', trim(this%packName), &
1249  'were reset to the top of the connected cell', ireset_scrntop, 'times.'
1250  call store_warning(warnmsg)
1251  end if
1252  if (ireset_scrnbot > 0) then
1253  write (warnmsg, '(a,1x,a,1x,a,1x,i0,1x,a)') &
1254  'The screen bottoms in multi-aquifer well package', trim(this%packName), &
1255  'were reset to the bottom of the connected cell', ireset_scrnbot, &
1256  'times.'
1257  call store_warning(warnmsg)
1258  end if
1259  if (ireset_wellbot > 0) then
1260  write (warnmsg, '(a,1x,a,1x,a,1x,i0,1x,a)') &
1261  'The well bottoms in multi-aquifer well package', trim(this%packName), &
1262  'were reset to the bottom of the connected cell', ireset_wellbot, &
1263  'times.'
1264  call store_warning(warnmsg)
1265  end if
1266  !
1267  if (count_errors() > 0) then
1268  call store_error_filename(this%input_fname)
1269  end if
1270  !
1271  ! -- release input context connectiondata memory
1272  call memorystore_release('CONNDATA_IFNO', this%input_mempath)
1273  call memorystore_release('ICON', this%input_mempath)
1274  call memorystore_release('CELLID', this%input_mempath)
1275  call memorystore_release('SCRN_TOP', this%input_mempath)
1276  call memorystore_release('SCRN_BOT', this%input_mempath)
1277  call memorystore_release('HK_SKIN', this%input_mempath)
1278  call memorystore_release('RADIUS_SKIN', this%input_mempath)
Here is the call graph for this function:

◆ maw_source_dimensions()

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

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

780  ! -- dummy
781  class(MawType), intent(inout) :: this
782  ! -- local
783  type(GwfMawParamFoundType) :: found
784  !
785  ! -- initialize dimensions
786  this%nmawwells = -1
787  this%maxbound = -1
788  !
789  write (this%iout, '(/1x,a)') &
790  'PROCESSING '//trim(adjustl(this%text))//' DIMENSIONS'
791  !
792  ! -- read NMAWWELLS
793  call mem_set_value(this%nmawwells, 'MAXBOUND', this%input_mempath, &
794  found%maxbound, release=.false.)
795  if (found%maxbound) then
796  write (this%iout, '(4x,a,i0)') 'NMAWWELLS = ', this%nmawwells
797  end if
798  !
799  write (this%iout, '(1x,a)') &
800  'END OF '//trim(adjustl(this%text))//' DIMENSIONS'
801  !
802  if (this%nmawwells < 0) then
803  write (errmsg, '(a)') &
804  'NMAWWELLS was not specified or was specified incorrectly.'
805  call store_error(errmsg)
806  call store_error_filename(this%input_fname)
807  end if
808  !
809  ! -- set npakeq to nmawwells
810  this%npakeq = this%nmawwells
811  !
812  ! -- read PACKAGEDATA
813  call this%maw_source_packagedata()
814  !
815  ! -- read CONNECTIONDATA
816  call this%maw_source_connectiondata()
817  !
818  ! -- read optional ANGLEDATA (non-vertical well connections)
819  call this%maw_source_angledata()
820  !
821  ! -- alias deprecated variable names
822  call this%maw_checkin_deprecated_names()
823  !
824  ! -- Call define_listlabel
825  call this%define_listlabel()
826  !
827  ! -- setup the budget object
828  call this%maw_setup_budobj()
829  !
830  ! -- setup the head table object
831  call this%maw_setup_tableobj()
Here is the call graph for this function:

◆ maw_source_options()

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

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

647  ! -- dummy
648  class(MawType), intent(inout) :: this
649  ! -- local
650  type(GwfMawParamFoundType) :: found
651  integer(I4B) :: isize
652  character(len=LINELENGTH) :: fname
653  ! -- formats
654  character(len=*), parameter :: fmtflowingwells = &
655  &"(4x, 'FLOWING WELLS WILL BE SIMULATED.')"
656  character(len=*), parameter :: fmtshutdown = &
657  &"(4x, 'SHUTDOWN ', a, ' VALUE (',g15.7,') SPECIFIED.')"
658  character(len=*), parameter :: fmtnostoragewells = &
659  &"(4x, 'WELL STORAGE WILL NOT BE SIMULATED.')"
660  character(len=*), parameter :: fmtmawbin = &
661  "(4x, 'MAW ', 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, /4x, &
662  &'OPENED ON UNIT: ', I0)"
663  !
664  ! -- call base class to handle AUXILIARY/NAUX, BOUNDNAMES, PRINT_INPUT,
665  ! PRINT_FLOWS, SAVE_FLOWS, OBS6_FILENAME, AUXMULTNAME
666  call this%BndExtType%source_options()
667  !
668  write (this%iout, '(1x,a)') &
669  'PROCESSING '//trim(adjustl(this%text))//' OPTIONS'
670  !
671  ! -- PRINT_HEAD
672  call get_isize('PRINT_HEAD', this%input_mempath, isize)
673  if (isize > 0) then
674  this%iprhed = 1
675  write (this%iout, '(4x,a)') &
676  trim(adjustl(this%text))//' heads will be printed to listing file.'
677  end if
678  !
679  ! -- HEAD FILEOUT
680  call mem_set_value(fname, 'HEADFILE', this%input_mempath, found%headfile)
681  if (found%headfile) then
682  call assign_iounit(this%iheadout, this%inunit, "HEAD fileout")
683  call openfile(this%iheadout, this%iout, fname, 'DATA(BINARY)', &
684  form, access, 'REPLACE', mode_opt=mnormal)
685  write (this%iout, fmtmawbin) 'HEAD', trim(adjustl(fname)), this%iheadout
686  end if
687  !
688  ! -- BUDGET FILEOUT
689  call mem_set_value(fname, 'BUDGETFILE', this%input_mempath, found%budgetfile)
690  if (found%budgetfile) then
691  call assign_iounit(this%ibudgetout, this%inunit, "BUDGET fileout")
692  call openfile(this%ibudgetout, this%iout, fname, 'DATA(BINARY)', &
693  form, access, 'REPLACE', mode_opt=mnormal)
694  write (this%iout, fmtmawbin) 'BUDGET', trim(adjustl(fname)), this%ibudgetout
695  end if
696  !
697  ! -- BUDGETCSV FILEOUT
698  call mem_set_value(fname, 'BUDGETCSVFILE', this%input_mempath, &
699  found%budgetcsvfile)
700  if (found%budgetcsvfile) then
701  call assign_iounit(this%ibudcsv, this%inunit, "BUDGETCSV fileout")
702  call openfile(this%ibudcsv, this%iout, fname, 'CSV', filstat_opt='REPLACE')
703  write (this%iout, fmtmawbin) &
704  'BUDGET CSV', trim(adjustl(fname)), this%ibudcsv
705  end if
706  !
707  ! -- NO_WELL_STORAGE
708  call get_isize('NO_WELL_STORAGE', this%input_mempath, isize)
709  if (isize > 0) then
710  this%imawissopt = 1
711  write (this%iout, fmtnostoragewells)
712  end if
713  !
714  ! -- FLOW_CORRECTION
715  call get_isize('FLOW_CORRECTION', this%input_mempath, isize)
716  if (isize > 0) then
717  this%correct_flow = .true.
718  write (this%iout, '(4x,a,/,4x,a)') &
719  'MAW-GWF FLOW CORRECTIONS WILL BE APPLIED WHEN MAW HEADS ARE BELOW', &
720  'OR GWF HEADS IN CONNECTED CELLS ARE BELOW THE CELL BOTTOM.'
721  end if
722  !
723  ! -- FLOWING_WELLS
724  call get_isize('FLOWING_WELLS', this%input_mempath, isize)
725  if (isize > 0) then
726  this%iflowingwells = 1
727  write (this%iout, fmtflowingwells)
728  end if
729  !
730  ! -- SHUTDOWN_THETA
731  call mem_set_value(this%theta, 'SHUTDOWN_THETA', this%input_mempath, &
732  found%shutdown_theta)
733  if (found%shutdown_theta) then
734  write (this%iout, fmtshutdown) 'THETA', this%theta
735  end if
736  !
737  ! -- SHUTDOWN_KAPPA
738  call mem_set_value(this%kappa, 'SHUTDOWN_KAPPA', this%input_mempath, &
739  found%shutdown_kappa)
740  if (found%shutdown_kappa) then
741  write (this%iout, fmtshutdown) 'KAPPA', this%kappa
742  end if
743  !
744  ! -- MAW_FLOW_REDUCE_CSV FILEOUT
745  call mem_set_value(fname, 'MFRCSVFILE', this%input_mempath, found%mfrcsvfile)
746  if (found%mfrcsvfile) then
747  call this%maw_redflow_csv_init(fname)
748  end if
749  !
750  ! -- MOVER
751  call get_isize('MOVER', this%input_mempath, isize)
752  if (isize > 0) then
753  this%imover = 1
754  write (this%iout, '(4x,A)') 'MOVER OPTION ENABLED'
755  end if
756  !
757  ! -- DEV_PEACEMAN_EFFECTIVE_RADIUS
758  call get_isize('IEFFRADOPT', this%input_mempath, isize)
759  if (isize > 0) then
760  this%ieffradopt = 1
761  write (this%iout, '(4x,a)') &
762  'EFFECTIVE RADIUS FOR STRUCTURED GRIDS WILL BE CALCULATED &
763  &USING PEACEMAN 1983'
764  end if
765  !
766  ! -- NON_VERTICAL_WELLS
767  call get_isize('INONVERT', this%input_mempath, isize)
768  if (isize > 0) then
769  this%inonvert = 1
770  write (this%iout, '(4x,a)') &
771  'NON-VERTICAL (SLANTED) WELL CONNECTIONS ENABLED'
772  end if
773  !
774  write (this%iout, '(1x,a)') 'END OF '//trim(adjustl(this%text))//' OPTIONS'
Here is the call graph for this function:

◆ maw_source_packagedata()

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

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

886  ! -- dummy
887  class(MawType), intent(inout) :: this
888  ! -- local
889  integer(I4B) :: n, jj, idx, imaw
890  character(len=9) :: cno9
891  character(len=LINELENGTH) :: keyword
892  real(DP) :: rval
893  integer(I4B), dimension(:), pointer, contiguous :: ifno => null()
894  real(DP), dimension(:), pointer, contiguous :: radius => null()
895  real(DP), dimension(:), pointer, contiguous :: bottom => null()
896  type(CharacterStringType), dimension(:), pointer, &
897  contiguous :: condeqn => null()
898  integer(I4B), dimension(:), pointer, contiguous :: ngwfnodes => null()
899  type(CharacterStringType), dimension(:), pointer, &
900  contiguous :: boundname => null()
901  integer(I4B), dimension(:, :), pointer, contiguous :: tslink => null()
902  type(CharacterStringType), dimension(:), pointer, &
903  contiguous :: tslinkvars => null()
904  integer(I4B), allocatable :: nboundchk(:)
905  ! -- formats
906  character(len=*), parameter :: fmthdbot = &
907  "('well head (', G0, ') must be greater than or equal to the &
908  &BOTTOM_ELEVATION (', G0, ').')"
909  !
910  write (this%iout, '(/1x,a)') &
911  'PROCESSING '//trim(adjustl(this%text))//' PACKAGEDATA'
912  !
913  ! -- get input context PACKAGEDATA column arrays
914  call mem_setptr(ifno, 'PACKAGEDATA_IFNO', this%input_mempath)
915  call mem_setptr(radius, 'RADIUS', this%input_mempath)
916  call mem_setptr(bottom, 'BOTTOM', this%input_mempath)
917  call mem_setptr(this%input%strt, 'STRT', this%input_mempath)
918  call mem_setptr(tslink, 'TSLINK_PD', this%input_mempath)
919  call mem_setptr(tslinkvars, 'TSLINKVARS_PD', this%input_mempath)
920  do n = 1, size(tslinkvars)
921  if (tslinkvars(n) == 'STRT') this%input%strt_tslink => tslink(n, :)
922  end do
923  if (.not. associated(this%input%strt_tslink)) then
924  call store_error('Time series links for STRT not found in input.')
925  call store_error_filename(this%input_fname)
926  end if
927  call mem_setptr(condeqn, 'CONDEQN', this%input_mempath)
928  call mem_setptr(ngwfnodes, 'NGWFNODES', this%input_mempath)
929  if (this%inamedbound /= 0) then
930  call mem_setptr(boundname, 'BOUNDNAME', this%input_mempath)
931  end if
932  !
933  ! -- total GWF connections is the sum of per-well node counts;
934  ! -- allocate well and connection arrays before filling them
935  this%maxbound = sum(ngwfnodes)
936  write (this%iout, '(//4x,a,i7)') 'MAXBOUND = ', this%maxbound
937  call this%maw_allocate_well_conn_arrays()
938  !
939  ! -- validate and fill allocated arrays in feature-number order
940  allocate (nboundchk(this%nmawwells))
941  nboundchk = 0
942  do n = 1, this%nmawwells
943  imaw = this%validate_ifno(ifno(n), this%nmawwells, nboundchk, &
944  'IMAW', 'PACKAGEDATA')
945  if (imaw == 0) cycle
946  !
947  ! -- radius
948  rval = radius(n)
949  if (rval <= dzero) then
950  write (errmsg, '(a,1x,i0,1x,a)') &
951  'Radius for well', imaw, 'must be greater than zero.'
952  call store_error(errmsg)
953  end if
954  this%radius(imaw) = rval
955  this%area(imaw) = dpi * rval**dtwo
956  !
957  ! -- well bottom
958  this%bot(imaw) = bottom(n)
959  !
960  ! -- conductance equation
961  keyword = condeqn(n)
962  select case (trim(keyword))
963  case ('SPECIFIED')
964  this%ieqn(imaw) = 0
965  case ('THIEM')
966  this%ieqn(imaw) = 1
967  case ('THEIM') ! # codespell:ignore
968  this%ieqn(imaw) = 1
969  write (warnmsg, '(a,a,a,a,a,a)') &
970  "CONDEQN in '", trim(this%packName), "' should be ", &
971  "corrected from '", trim(keyword), "' to 'THIEM'."
972  call store_warning(warnmsg)
973  case ('SKIN')
974  this%ieqn(imaw) = 2
975  case ('CUMULATIVE')
976  this%ieqn(imaw) = 3
977  case ('MEAN')
978  this%ieqn(imaw) = 4
979  case default
980  write (errmsg, '(a,1x,i0,1x,a)') &
981  'CONDEQN for well', imaw, &
982  "must be 'CUMULATIVE', 'THIEM', 'MEAN', or 'SKIN'."
983  call store_error(errmsg)
984  this%ieqn(imaw) = 0
985  end select
986  !
987  ! -- ngwfnodes
988  if (ngwfnodes(n) < 1) then
989  write (errmsg, '(a,1x,i0,1x,a)') &
990  'NGWFNODES for well', imaw, 'must be greater than zero.'
991  call store_error(errmsg)
992  end if
993  this%ngwfnodes(imaw) = ngwfnodes(n)
994  !
995  ! -- read the TS integrated numeric value directly
996  this%well_head(imaw) = this%input%strt(n)
997  this%strt(imaw) = this%input%strt(n)
998  if (this%strt(imaw) < this%bot(imaw)) then
999  write (keyword, fmthdbot) this%strt(imaw), this%bot(imaw)
1000  call this%maw_set_attribute_error(imaw, 'STRT', trim(keyword))
1001  end if
1002  !
1003  ! -- well name / boundname
1004  write (cno9, '(i9.9)') imaw
1005  this%cmawname(imaw) = 'MAWWELL'//cno9
1006  if (this%inamedbound /= 0) then
1007  text = boundname(n)
1008  if (trim(text) /= '') then
1009  this%cmawname(imaw) = trim(text)
1010  end if
1011  end if
1012  end do
1013  !
1014  ! -- check for duplicate or missing wells
1015  call this%report_ifno_coverage(nboundchk, this%nmawwells, 'well', &
1016  'PACKAGEDATA')
1017  deallocate (nboundchk)
1018  !
1019  write (this%iout, '(1x,a)') &
1020  'END OF '//trim(adjustl(this%text))//' PACKAGEDATA'
1021  !
1022  if (count_errors() > 0) then
1023  call store_error_filename(this%input_fname)
1024  end if
1025  !
1026  ! -- set iaconn and imap for each connection
1027  idx = 0
1028  this%iaconn(1) = 1
1029  do n = 1, this%nmawwells
1030  do jj = 1, this%ngwfnodes(n)
1031  idx = idx + 1
1032  this%imap(idx) = n
1033  end do
1034  this%iaconn(n + 1) = idx + 1
1035  end do
1036  !
1037  ! -- release input context packagedata memory;
1038  ! exclude STRT and PACKAGEDATA_IFNO
1039  call memorystore_release('RADIUS', this%input_mempath)
1040  call memorystore_release('BOTTOM', this%input_mempath)
1041  call memorystore_release('CONDEQN', this%input_mempath)
1042  call memorystore_release('NGWFNODES', this%input_mempath)
1043  call memorystore_release('BOUNDNAME', this%input_mempath)
Here is the call graph for this function:

Variable Documentation

◆ ftype

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

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

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

◆ text

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

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

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