diff --git a/src/Model/GroundWaterFlow/gwf3maw8.f90 b/src/Model/GroundWaterFlow/gwf3maw8.f90 index 63d08913f1d..216c8a76108 100644 --- a/src/Model/GroundWaterFlow/gwf3maw8.f90 +++ b/src/Model/GroundWaterFlow/gwf3maw8.f90 @@ -163,7 +163,9 @@ module MawModule real(DP), dimension(:, :), pointer, contiguous :: viscratios => null() !< viscosity ratios (1: maw vsc ratio; 2: gwf vsc ratio) ! ! -- type bound procedures + contains + procedure :: maw_allocate_scalars procedure :: maw_allocate_well_conn_arrays procedure :: maw_allocate_arrays @@ -223,15 +225,12 @@ module MawModule contains +!> @brief Create a New Multi-Aquifer Well (MAW) Package +!! +!! After creating the package object point bndobj to the new package +!< subroutine maw_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname) -! ****************************************************************************** -! maw_create -- Create a New Multi-Aquifer Well Package -! Subroutine: (1) create new-style package -! (2) point bndobj to the new package -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ + ! -- dummy class(BndType), pointer :: packobj integer(I4B), intent(in) :: id integer(I4B), intent(in) :: ibcnum @@ -240,7 +239,6 @@ subroutine maw_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname) character(len=*), intent(in) :: namemodel character(len=*), intent(in) :: pakname type(MawType), pointer :: mawobj -! ------------------------------------------------------------------------------ ! ! -- allocate the object and assign values to object variables allocate (mawobj) @@ -255,7 +253,7 @@ subroutine maw_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname) ! ! -- initialize package call packobj%pack_initialize() - + ! packobj%inunit = inunit packobj%iout = iout packobj%id = id @@ -265,22 +263,17 @@ subroutine maw_create(packobj, id, ibcnum, inunit, iout, namemodel, pakname) packobj%isadvpak = 1 packobj%ictMemPath = create_mem_path(namemodel, 'NPF') ! - ! -- return + ! -- Return return end subroutine maw_create + !> @brief Allocate scalar members + !< subroutine maw_allocate_scalars(this) -! ****************************************************************************** -! allocate_scalars -- allocate scalar members -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use MemoryManagerModule, only: mem_allocate ! -- dummy class(MawType), intent(inout) :: this -! ------------------------------------------------------------------------------ ! ! -- call standard BndType allocate scalars call this%BndType%allocate_scalars() @@ -326,17 +319,13 @@ subroutine maw_allocate_scalars(this) this%idense = 0 this%ivsc = 0 ! - ! -- return + ! -- Return return end subroutine maw_allocate_scalars + !> @brief Allocate well arrays + !< subroutine maw_allocate_well_conn_arrays(this) -! ****************************************************************************** -! maw_allocate_arrays -- allocate well arrays -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use MemoryManagerModule, only: mem_allocate ! -- dummy @@ -345,7 +334,6 @@ subroutine maw_allocate_well_conn_arrays(this) integer(I4B) :: j integer(I4B) :: n integer(I4B) :: jj -! ------------------------------------------------------------------------------ ! ! -- allocate character array for budget text call mem_allocate(this%cmawbudget, LENBUDTXT, this%bditems, 'CMAWBUDGET', & @@ -531,39 +519,29 @@ subroutine maw_allocate_well_conn_arrays(this) ! -- allocate viscratios to size 0 call mem_allocate(this%viscratios, 2, 0, 'VISCRATIOS', this%memoryPath) ! - ! -- return + ! -- Return return end subroutine maw_allocate_well_conn_arrays + !> @brief Allocate arrays + !< subroutine maw_allocate_arrays(this) -! ****************************************************************************** -! maw_allocate_arrays -- allocate arrays -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use MemoryManagerModule, only: mem_allocate ! -- dummy class(MawType), intent(inout) :: this ! -- local - !integer(I4B) :: i -! ------------------------------------------------------------------------------ ! ! -- call standard BndType allocate scalars call this%BndType%allocate_arrays() ! - ! -- return + ! -- Return return end subroutine maw_allocate_arrays + !> @brief Read the packagedata for this package + !< subroutine maw_read_wells(this) -! ****************************************************************************** -! maw_read_wells -- Read the packagedata for this package -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use ConstantsModule, only: LINELENGTH use TimeSeriesManagerModule, only: read_value_or_time_series_adv ! -- dummy @@ -601,9 +579,6 @@ subroutine maw_read_wells(this) character(len=*), parameter :: fmthdbot = & "('well head (', G0, ') must be greater than or equal to the & &BOTTOM_ELEVATION (', G0, ').')" -! ------------------------------------------------------------------------------ - ! - ! -- code ! ! -- allocate and initialize temporary variables allocate (strttext(this%nmawwells)) @@ -815,17 +790,13 @@ subroutine maw_read_wells(this) deallocate (radius) deallocate (bottom) ! - ! -- return + ! -- Return return end subroutine maw_read_wells + !> @brief Read the dimensions for this package + !< subroutine maw_read_well_connections(this) -! ****************************************************************************** -! pak1read_dimensions -- Read the dimensions for this package -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use ConstantsModule, only: LINELENGTH ! -- dummy class(MawType), intent(inout) :: this @@ -852,11 +823,6 @@ subroutine maw_read_well_connections(this) real(DP) :: botw integer(I4B), dimension(:), pointer, contiguous :: nboundchk integer(I4B), dimension(:), pointer, contiguous :: iachk - -! ------------------------------------------------------------------------------ - ! -- format - ! - ! -- code ! ! -- initialize counters ireset_scrntop = 0 @@ -1072,17 +1038,13 @@ subroutine maw_read_well_connections(this) call this%parser%StoreErrorUnit() end if ! - ! -- return + ! -- Return return end subroutine maw_read_well_connections + !> @brief Read the dimensions for this package + !< subroutine maw_read_dimensions(this) -! ****************************************************************************** -! pak1read_dimensions -- Read the dimensions for this package -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use ConstantsModule, only: LINELENGTH ! -- dummy class(MawType), intent(inout) :: this @@ -1091,7 +1053,6 @@ subroutine maw_read_dimensions(this) integer(I4B) :: ierr logical :: isfound, endOfBlock ! -- format -! ------------------------------------------------------------------------------ ! ! -- initialize dimensions to -1 this%nmawwells = -1 @@ -1153,17 +1114,13 @@ subroutine maw_read_dimensions(this) ! -- setup the head table object call this%maw_setup_tableobj() ! - ! -- return + ! -- Return return end subroutine maw_read_dimensions + !> @brief Read the initial parameters for this package + !< subroutine maw_read_initial_attr(this) -! ****************************************************************************** -! maw_read_initial_attr -- Read the initial parameters for this package -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: LINELENGTH use MemoryManagerModule, only: mem_setptr @@ -1204,7 +1161,6 @@ subroutine maw_read_initial_attr(this) &/1X,2(A10,1X),A20,7(A10,1X))" character(len=*), parameter :: fmtwellcd = & &"(1X,2(I10,1X),A20,1X,2(G10.3,1X),2(A10,1X),3(G10.3,1X))" -! ------------------------------------------------------------------------------ ! ! -- initialize xnewpak do n = 1, this%nmawwells @@ -1388,18 +1344,13 @@ subroutine maw_read_initial_attr(this) call store_error_unit(this%inunit) end if ! - ! -- return + ! -- Return return end subroutine maw_read_initial_attr + !> @brief Set a stress period attribute for mawweslls(imaw) using keywords + !< subroutine maw_set_stressperiod(this, imaw, iheadlimit_warning) -! ****************************************************************************** -! maw_set_stressperiod -- Set a stress period attribute for mawweslls(imaw) -! using keywords. -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use TimeSeriesManagerModule, only: read_value_or_time_series_adv ! -- dummy @@ -1420,7 +1371,6 @@ subroutine maw_set_stressperiod(this, imaw, iheadlimit_warning) ! -- formats character(len=*), parameter :: fmthdbot = & &"('well head (',G0,') must be >= BOTTOM_ELEVATION (',G0, ').')" -! ------------------------------------------------------------------------------ ! ! -- read remainder of variables on the line call this%parser%GetStringCaps(keyword) @@ -1529,19 +1479,13 @@ subroutine maw_set_stressperiod(this, imaw, iheadlimit_warning) end select ! - ! -- return + ! -- Return return end subroutine maw_set_stressperiod + !> @brief Issue a parameter error for mawweslls(imaw) + !< subroutine maw_set_attribute_error(this, imaw, keyword, msg) -! ****************************************************************************** -! maw_set_attribute_error -- Issue a parameter error for mawweslls(imaw) -! Subroutine: (1) read itmp -! (2) read new boundaries if itmp>0 -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use SimModule, only: store_error ! -- dummy class(MawType), intent(inout) :: this @@ -1550,7 +1494,7 @@ subroutine maw_set_attribute_error(this, imaw, keyword, msg) character(len=*), intent(in) :: msg ! -- local ! -- formats -! ------------------------------------------------------------------------------ + ! if (len(msg) == 0) then write (errmsg, '(a,1x,a,1x,i0,1x,a)') & keyword, ' for MAW well', imaw, 'has already been set.' @@ -1560,19 +1504,13 @@ subroutine maw_set_attribute_error(this, imaw, keyword, msg) end if call store_error(errmsg) ! - ! -- return + ! -- Return return end subroutine maw_set_attribute_error + !> @brief Issue parameter errors for mawwells(imaw) + !< subroutine maw_check_attributes(this) -! ****************************************************************************** -! maw_check_attributes -- Issue parameter errors for mawwells(imaw) -! Subroutine: (1) read itmp -! (2) read new boundaries if itmp>0 -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use SimModule, only: store_error ! -- dummy class(MawType), intent(inout) :: this @@ -1583,7 +1521,7 @@ subroutine maw_check_attributes(this) integer(I4B) :: j integer(I4B) :: jpos ! -- formats -! ------------------------------------------------------------------------------ + ! idx = 1 do n = 1, this%nmawwells if (this%ngwfnodes(n) < 1) then @@ -1639,17 +1577,13 @@ subroutine maw_check_attributes(this) end do ! -- reset check_attr this%check_attr = 0 - ! -- return + ! -- Return return end subroutine maw_check_attributes + !> @brief Add package connection to matrix + !< subroutine maw_ac(this, moffset, sparse) -! ****************************************************************************** -! bnd_ac -- Add package connection to matrix -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use SparseModule, only: sparsematrix ! -- dummy class(MawType), intent(inout) :: this @@ -1662,8 +1596,6 @@ subroutine maw_ac(this, moffset, sparse) integer(I4B) :: jglo integer(I4B) :: nglo ! -- format -! ------------------------------------------------------------------------------ - ! ! ! -- Add package rows to sparse do n = 1, this%nmawwells @@ -1678,17 +1610,13 @@ subroutine maw_ac(this, moffset, sparse) end do ! - ! -- return + ! -- Return return end subroutine maw_ac + !> @brief Map package connection to matrix + !< subroutine maw_mc(this, moffset, matrix_sln) -! ****************************************************************************** -! bnd_ac -- map package connection to matrix -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use SparseModule, only: sparsematrix use MemoryManagerModule, only: mem_allocate ! -- dummy @@ -1703,7 +1631,6 @@ subroutine maw_mc(this, moffset, matrix_sln) integer(I4B) :: jglo integer(I4B) :: ipos ! -- format -! ------------------------------------------------------------------------------ ! ! -- allocate connection mapping vectors call mem_allocate(this%idxlocnode, this%nmawwells, 'IDXLOCNODE', & @@ -1744,18 +1671,15 @@ subroutine maw_mc(this, moffset, matrix_sln) end do end do ! - ! -- return + ! -- Return return end subroutine maw_mc + !> @brief Set options specific to MawType. + !! + !! Overrides BndType%bnd_options + !< subroutine maw_read_options(this, option, found) -! ****************************************************************************** -! maw_read_options -- set options specific to MawType. -! Overrides BndType%bnd_options -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use ConstantsModule, only: MAXCHARLEN, DZERO, MNORMAL use OpenSpecModule, only: access, form use InputOutputModule, only: urword, getunit, openfile @@ -1775,7 +1699,6 @@ subroutine maw_read_options(this, option, found) character(len=*), parameter :: fmtmawbin = & "(4x, 'MAW ', 1x, a, 1x, ' WILL BE SAVED TO FILE: ', a, /4x, & &'OPENED ON UNIT: ', I0)" -! ------------------------------------------------------------------------------ ! ! -- Check for 'FLOWING_WELLS' and set this%iflowingwells found = .true. @@ -1869,24 +1792,19 @@ subroutine maw_read_options(this, option, found) found = .false. end select ! - ! -- return + ! -- Return return end subroutine maw_read_options + !> @brief Allocate and Read + !! + !! Create new MAW package and point bndobj to the new package + !< subroutine maw_ar(this) - ! ****************************************************************************** - ! maw_ar -- Allocate and Read - ! Subroutine: (1) create new-style package - ! (2) point bndobj to the new package - ! ****************************************************************************** - ! - ! SPECIFICATIONS: - ! ------------------------------------------------------------------------------ ! -- dummy class(MawType), intent(inout) :: this ! -- local ! -- format - ! ------------------------------------------------------------------------------ ! call this%obs%obs_ar() ! @@ -1907,19 +1825,15 @@ subroutine maw_ar(this) call this%pakmvrobj%ar(this%nmawwells, this%nmawwells, this%memoryPath) end if ! - ! -- return + ! -- Return return end subroutine maw_ar + !> @brief Read and Prepare + !! + !! Read itmp and new boundaries if itmp > 0 + !< subroutine maw_rp(this) -! ****************************************************************************** -! maw_rp -- Read and Prepare -! Subroutine: (1) read itmp -! (2) read new boundaries if itmp>0 -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use ConstantsModule, only: LINELENGTH use TdisModule, only: kper, nper ! -- dummy @@ -1946,7 +1860,6 @@ subroutine maw_rp(this) &"('Looking for BEGIN PERIOD iper. Found ', a, ' instead.')" character(len=*), parameter :: fmtlsp = & &"(1X,/1X,'REUSING ',A,'S FROM LAST STRESS PERIOD')" -! ------------------------------------------------------------------------------ ! ! -- initialize counters iheadlimit_warning = 0 @@ -2201,17 +2114,13 @@ subroutine maw_rp(this) end do end do ! - ! -- return + ! -- Return return end subroutine maw_rp + !> @brief Add package connection to matrix + !< subroutine maw_ad(this) -! ****************************************************************************** -! maw_ad -- Add package connection to matrix -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use TdisModule, only: kper, kstp ! -- dummy class(MawType) :: this @@ -2220,7 +2129,6 @@ subroutine maw_ad(this) integer(I4B) :: j integer(I4B) :: jj integer(I4B) :: ibnd -! ------------------------------------------------------------------------------ ! ! -- Advance the time series call this%TsManager%ad() @@ -2275,23 +2183,18 @@ subroutine maw_ad(this) ! "current" value. call this%obs%obs_ad() ! - ! -- return + ! -- Return return end subroutine maw_ad + !> @brief Formulate the HCOF and RHS terms + !! + !! Skip if no multi-aquifer wells, otherwise, calculate hcof and rhs + !< subroutine maw_cf(this) - ! ****************************************************************************** - ! maw_cf -- Formulate the HCOF and RHS terms - ! Subroutine: (1) skip if no multi-aquifer wells - ! (2) calculate hcof and rhs - ! ****************************************************************************** - ! - ! SPECIFICATIONS: - ! ------------------------------------------------------------------------------ ! -- dummy class(MawType) :: this ! -- local - ! ------------------------------------------------------------------------------ ! ! -- Calculate maw conductance and update package RHS and HCOF call this%maw_cfupdate() @@ -2300,13 +2203,9 @@ subroutine maw_cf(this) return end subroutine maw_cf + !> @brief Copy rhs and hcof into solution rhs and amat + !< subroutine maw_fc(this, rhs, ia, idxglo, matrix_sln) -! ****************************************************************************** -! maw_fc -- Copy rhs and hcof into solution rhs and amat -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use TdisModule, only: delt ! -- dummy @@ -2341,7 +2240,6 @@ subroutine maw_fc(this, rhs, ia, idxglo, matrix_sln) real(DP) :: rate real(DP) :: ratefw real(DP) :: flow -! -------------------------------------------------------------------------- ! ! -- pakmvrobj fc if (this%imover == 1) then @@ -2456,18 +2354,13 @@ subroutine maw_fc(this, rhs, ia, idxglo, matrix_sln) end do end do ! - ! -- return + ! -- Return return end subroutine maw_fc + !> @brief Fill newton terms + !< subroutine maw_fn(this, rhs, ia, idxglo, matrix_sln) -! ************************************************************************** -! maw_fn -- Fill newton terms -! ************************************************************************** -! -! SPECIFICATIONS: -! -------------------------------------------------------------------------- - !use TdisModule, only:delt ! -- dummy class(MawType) :: this real(DP), dimension(:), intent(inout) :: rhs @@ -2505,7 +2398,6 @@ subroutine maw_fn(this, rhs, ia, idxglo, matrix_sln) real(DP) :: flow real(DP) :: term2 real(DP) :: rhsterm -! -------------------------------------------------------------------------- ! ! -- Calculate Newton-Raphson corrections idx = 1 @@ -2627,19 +2519,14 @@ subroutine maw_fn(this, rhs, ia, idxglo, matrix_sln) end do end do ! - ! -- return + ! -- Return return end subroutine maw_fn + !> @brief Calculate under-relaxation of groundwater flow model MAW Package heads + !! for current outer iteration using the well bottom + !< subroutine maw_nur(this, neqpak, x, xtemp, dx, inewtonur, dxmax, locmax) -! ****************************************************************************** -! maw_nur -- under-relaxation -! Subroutine: (1) Under-relaxation of Groundwater Flow Model MAW Package Heads -! for current outer iteration using the well bottom -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- dummy class(MawType), intent(inout) :: this integer(I4B), intent(in) :: neqpak @@ -2654,8 +2541,6 @@ subroutine maw_nur(this, neqpak, x, xtemp, dx, inewtonur, dxmax, locmax) real(DP) :: botw real(DP) :: xx real(DP) :: dxx -! ------------------------------------------------------------------------------ - ! ! -- Newton-Raphson under-relaxation do n = 1, this%nmawwells @@ -2681,13 +2566,9 @@ subroutine maw_nur(this, neqpak, x, xtemp, dx, inewtonur, dxmax, locmax) return end subroutine maw_nur + !> @brief Calculate flows + !< subroutine maw_cq(this, x, flowja, iadv) -! ************************************************************************** -! maw_cq -- Calculate flows -! ************************************************************************** -! -! SPECIFICATIONS: -! -------------------------------------------------------------------------- ! -- modules use TdisModule, only: delt use ConstantsModule, only: LENBOUNDNAME @@ -2707,7 +2588,6 @@ subroutine maw_cq(this, x, flowja, iadv) real(DP) :: cfw ! -- for observations ! -- formats -! ------------------------------------------------------------------------------ ! ! -- recalculate package HCOF and RHS terms with latest groundwater and ! maw heads prior to calling base budget functionality @@ -2802,11 +2682,14 @@ subroutine maw_cq(this, x, flowja, iadv) ! -- fill the budget object call this%maw_fill_budobj() ! - ! -- return + ! -- Return return end subroutine maw_cq + !> @brief Write flows to binary file and/or print flows to budget + !< subroutine maw_ot_model_flows(this, icbcfl, ibudfl, icbcun, imap) + ! -- dummy class(MawType) :: this integer(I4B), intent(in) :: icbcfl integer(I4B), intent(in) :: ibudfl @@ -2817,6 +2700,8 @@ subroutine maw_ot_model_flows(this, icbcfl, ibudfl, icbcun, imap) call this%BndType%bnd_ot_model_flows(icbcfl, ibudfl, icbcun, this%imap) end subroutine maw_ot_model_flows + !> @brief Output MAW package flow terms. + !< subroutine maw_ot_package_flows(this, icbcfl, ibudfl) use TdisModule, only: kstp, kper, delt, pertim, totim class(MawType) :: this @@ -2839,9 +2724,13 @@ subroutine maw_ot_package_flows(this, icbcfl, ibudfl) if (ibudfl /= 0 .and. this%iprflow /= 0) then call this%budobj%write_flowtable(this%dis, kstp, kper) end if - + ! + ! -- Return + return end subroutine maw_ot_package_flows + !> @brief Save maw-calculated values to binary file + !< subroutine maw_ot_dv(this, idvsave, idvprint) use TdisModule, only: kstp, kper, pertim, totim use ConstantsModule, only: DHNOFLO, DHDRY @@ -2893,9 +2782,13 @@ subroutine maw_ot_dv(this, idvsave, idvprint) call this%headtab%add_term(this%xnewpak(n)) end do end if - + ! + ! -- Return + return end subroutine maw_ot_dv + !> @brief Write MAW budget to listing file + !< subroutine maw_ot_bdsummary(this, kstp, kper, iout, ibudfl) ! -- module use TdisModule, only: totim @@ -2908,24 +2801,18 @@ subroutine maw_ot_bdsummary(this, kstp, kper, iout, ibudfl) ! call this%budobj%write_budtable(kstp, kper, iout, ibudfl, totim) ! - ! -- return + ! -- Return return end subroutine maw_ot_bdsummary + !> @brief Deallocate memory + !< subroutine maw_da(this) -! ****************************************************************************** -! maw_da -- deallocate -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use MemoryManagerModule, only: mem_deallocate ! -- dummy class(MawType) :: this ! -- local - !integer(I4B) :: n -! ------------------------------------------------------------------------------ ! ! -- budobj call this%budobj%budgetobject_da() @@ -3033,20 +2920,15 @@ subroutine maw_da(this) ! -- call standard BndType deallocate call this%BndType%bnd_da() ! - ! -- return + ! -- Return return end subroutine maw_da + !> @brief Define the list heading that is written to iout when PRINT_INPUT + !! option is used. + !< subroutine define_listlabel(this) -! ****************************************************************************** -! define_listlabel -- Define the list heading that is written to iout when -! PRINT_INPUT option is used. -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ class(MawType), intent(inout) :: this -! ------------------------------------------------------------------------------ ! ! -- create the header list label this%listlabel = trim(this%filtyp)//' NO.' @@ -3065,18 +2947,14 @@ subroutine define_listlabel(this) write (this%listlabel, '(a, a16)') trim(this%listlabel), 'BOUNDARY NAME' end if ! - ! -- return + ! -- Return return end subroutine define_listlabel + !> @brief Set pointers to model arrays and variables so that a package has + !! has access to these things. + !< subroutine maw_set_pointers(this, neq, ibound, xnew, xold, flowja) -! ****************************************************************************** -! set_pointers -- Set pointers to model arrays and variables so that a package -! has access to these things. -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use MemoryManagerModule, only: mem_allocate, mem_checkin ! -- dummy @@ -3089,7 +2967,6 @@ subroutine maw_set_pointers(this, neq, ibound, xnew, xold, flowja) ! -- local integer(I4B) :: n integer(I4B) :: istart, iend -! ------------------------------------------------------------------------------ ! ! -- call base BndType set_pointers call this%BndType%set_pointers(neq, ibound, xnew, xold, flowja) @@ -3110,40 +2987,34 @@ subroutine maw_set_pointers(this, neq, ibound, xnew, xold, flowja) this%xnewpak(n) = DEP20 end do ! - ! -- return + ! -- Return + return end subroutine maw_set_pointers - ! ! -- Procedures related to observations (type-bound) + + !> @brief Return true because MAW package supports observations + !! + !! Overrides BndType%bnd_obs_supported() + !< logical function maw_obs_supported(this) - ! ****************************************************************************** - ! maw_obs_supported - ! -- Return true because MAW package supports observations. - ! -- Overrides BndType%bnd_obs_supported() - ! ****************************************************************************** - ! - ! SPECIFICATIONS: - ! ------------------------------------------------------------------------------ class(MawType) :: this - ! ------------------------------------------------------------------------------ + ! maw_obs_supported = .true. + ! + ! -- Return return end function maw_obs_supported + !> @brief Store observation type supported by MAW package + !! + !! Overrides BndType%bnd_df_obs + !< subroutine maw_df_obs(this) - ! ****************************************************************************** - ! maw_df_obs (implements bnd_df_obs) - ! -- Store observation type supported by MAW package. - ! -- Overrides BndType%bnd_df_obs - ! ****************************************************************************** - ! - ! SPECIFICATIONS: - ! ------------------------------------------------------------------------------ ! -- dummy class(MawType) :: this ! -- local integer(I4B) :: indx - ! ------------------------------------------------------------------------------ ! ! -- Store obs type and assign procedure pointer ! for head observation type. @@ -3200,18 +3071,14 @@ subroutine maw_df_obs(this) call this%obs%StoreObsType('fw-conductance', .true., indx) this%obs%obsData(indx)%ProcessIdPtr => maw_process_obsID ! + ! -- Return return end subroutine maw_df_obs + !> @brief Calculate observations this time step and call + !! ObsType%SaveOneSimval for each MawType observation. + !< subroutine maw_bd_obs(this) - ! ************************************************************************** - ! maw_bd_obs - ! -- Calculate observations this time step and call - ! ObsType%SaveOneSimval for each MawType observation. - ! ************************************************************************** - ! - ! SPECIFICATIONS: - ! -------------------------------------------------------------------------- ! -- dummy class(MawType) :: this ! -- local @@ -3226,7 +3093,6 @@ subroutine maw_bd_obs(this) real(DP) :: v real(DP) :: qfact type(ObserveType), pointer :: obsrv => null() - !--------------------------------------------------------------------------- ! ! Calculate, save, and write simulated values for all MAW observations if (this%obs%npakobs > 0) then @@ -3342,10 +3208,15 @@ subroutine maw_bd_obs(this) call this%maw_redflow_csv_write() end if ! - ! -- return + ! -- Return return end subroutine maw_bd_obs + !> @brief Process each observation + !! + !! Only done the first stress period since boundaries are fixed for the + !! simulation + !< subroutine maw_rp_obs(this) use TdisModule, only: kper ! -- dummy @@ -3360,14 +3231,10 @@ subroutine maw_rp_obs(this) character(len=LENBOUNDNAME) :: bname logical :: jfound class(ObserveType), pointer :: obsrv => null() - ! -------------------------------------------------------------------------- ! -- formats 10 format('Boundary "', a, '" for observation "', a, & '" is invalid in package "', a, '"') ! - ! -- process each package observation - ! only done the first stress period since boundaries are fixed - ! for the simulation if (kper == 1) then do i = 1, this%obs%npakobs obsrv => this%obs%pakobs(i)%obsrv @@ -3470,15 +3337,18 @@ subroutine maw_rp_obs(this) end if end if ! - ! -- return + ! -- Return return end subroutine maw_rp_obs ! ! -- Procedures related to observations (NOT type-bound) + + !> @brief This procedure is pointed to by ObsDataType%ProcesssIdPtr. It + !! processes the ID string of an observation definition for MAW package + !! observations. + !< subroutine maw_process_obsID(obsrv, dis, inunitobs, iout) - ! -- This procedure is pointed to by ObsDataType%ProcesssIdPtr. It processes - ! the ID string of an observation definition for MAW package observations. ! -- dummy type(ObserveType), intent(inout) :: obsrv class(DisBaseType), intent(in) :: dis @@ -3524,14 +3394,15 @@ subroutine maw_process_obsID(obsrv, dis, inunitobs, iout) ! -- store multi-aquifer well number (NodeNumber) obsrv%NodeNumber = nn1 ! - ! -- return + ! -- Return return end subroutine maw_process_obsID ! ! -- private MAW methods - ! + !> @brief Initialize the auto flow reduce csv output file + !< subroutine maw_redflow_csv_init(this, fname) ! -- dummy variables class(MawType), intent(inout) :: this !< MawType object @@ -3548,10 +3419,13 @@ subroutine maw_redflow_csv_init(this, fname) this%ioutredflowcsv write (this%ioutredflowcsv, '(a)') & 'time,period,step,MAWnumber,rate-requested,rate-actual,maw-reduction' + ! + ! -- Return return end subroutine maw_redflow_csv_init !> @brief MAW reduced flows only when & where they occur + !< subroutine maw_redflow_csv_write(this) ! -- modules use TdisModule, only: totim, kstp, kper @@ -3575,8 +3449,14 @@ subroutine maw_redflow_csv_write(this) totim, kper, kstp, n, this%rate(n), this%ratesim(n), v end if end do + ! + ! -- Return + return end subroutine maw_redflow_csv_write + !> @brief Calculate the appropriate saturated conductance to use based on + !! aquifer and multi-aquifer well characteristics + !< subroutine maw_calculate_satcond(this, i, j, node) ! -- dummy class(MawType), intent(inout) :: this @@ -3615,7 +3495,6 @@ subroutine maw_calculate_satcond(this, i, j, node) real(DP) :: yx4 real(DP) :: xy4 ! -- formats - ! ------------------------------------------------------------------------------ ! ! -- initialize conductance variables iTcontrastErr = 0 @@ -3739,10 +3618,12 @@ subroutine maw_calculate_satcond(this, i, j, node) ! -- set saturated conductance this%satcond(jpos) = c ! - ! -- return + ! -- Return return end subroutine maw_calculate_satcond + !> @brief Calculate the saturation between the aquifer maw well_head + !< subroutine maw_calculate_saturation(this, n, j, node, sat) ! -- dummy class(MawType), intent(inout) :: this @@ -3757,7 +3638,6 @@ subroutine maw_calculate_saturation(this, n, j, node, sat) real(DP) :: topw real(DP) :: botw ! -- formats - ! ------------------------------------------------------------------------------ ! ! -- initialize saturation sat = DZERO @@ -3800,31 +3680,24 @@ subroutine maw_calculate_saturation(this, n, j, node, sat) sat = DONE end if ! - ! -- return + ! -- Return return end subroutine maw_calculate_saturation + !> @brief 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 + !< subroutine maw_calculate_conn_terms(this, n, j, icflow, cmaw, cterm, term, & flow, term2) -! ****************************************************************************** -! maw_calculate_conn_terms-- 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 -! -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- dummy class(MawType) :: this integer(I4B), intent(in) :: n @@ -3852,7 +3725,6 @@ subroutine maw_calculate_conn_terms(this, n, j, icflow, cmaw, cterm, term, & real(DP) :: drterm real(DP) :: dhbarterm real(DP) :: vscratio -! ------------------------------------------------------------------------------ ! ! -- initialize terms cterm = DZERO @@ -3964,19 +3836,14 @@ subroutine maw_calculate_conn_terms(this, n, j, icflow, cmaw, cterm, term, & call this%maw_calculate_density_exchange(jpos, hmaw, hgwf, cmaw, & bmaw, flow, term, cterm) end if - ! - ! -- return + ! -- Return return end subroutine maw_calculate_conn_terms + !> @brief Calculate well pumping rate based on constraints + !< subroutine maw_calculate_wellq(this, n, hmaw, q) -! ************************************************************************** -! maw_calculate_wellq-- Calculate well pumping rate based on constraints -! ************************************************************************** -! -! SPECIFICATIONS: -! -------------------------------------------------------------------------- ! -- dummy class(MawType) :: this integer(I4B), intent(in) :: n @@ -3989,7 +3856,6 @@ subroutine maw_calculate_wellq(this, n, hmaw, q) real(DP) :: rate real(DP) :: weight real(DP) :: dq -! -------------------------------------------------------------------------- ! ! -- Initialize q q = DZERO @@ -4139,17 +4005,13 @@ subroutine maw_calculate_wellq(this, n, hmaw, q) end if end if ! - ! -- return + ! -- Return return end subroutine maw_calculate_wellq + !> @brief Calculate groundwater inflow to a maw well + !< subroutine maw_calculate_qpot(this, n, qnet) -! ****************************************************************************** -! maw_calculate_qpot -- Calculate groundwater inflow to a maw well -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ use TdisModule, only: delt ! -- dummy class(MawType), intent(inout) :: this @@ -4172,7 +4034,6 @@ subroutine maw_calculate_qpot(this, n, qnet) real(DP) :: hv real(DP) :: vscratio ! -- format -! ------------------------------------------------------------------------------ ! ! -- initialize qnet and htmp qnet = DZERO @@ -4233,17 +4094,13 @@ subroutine maw_calculate_qpot(this, n, qnet) qnet = qnet + cmaw * (hgwf - hv) end do ! - ! -- return + ! -- Return return end subroutine maw_calculate_qpot + !> @brief Update MAW satcond and package rhs and hcof + !< subroutine maw_cfupdate(this) - ! ****************************************************************************** - ! maw_cfupdate -- Update MAW satcond and package rhs and hcof - ! ****************************************************************************** - ! - ! SPECIFICATIONS: - ! ------------------------------------------------------------------------------ class(MawType) :: this ! -- dummy ! -- local @@ -4257,7 +4114,6 @@ subroutine maw_cfupdate(this) real(DP) :: hmaw real(DP) :: cterm real(DP) :: term -! ------------------------------------------------------------------------------ ! ! -- Return if no maw wells if (this%nbound .eq. 0) return @@ -4300,15 +4156,11 @@ subroutine maw_cfupdate(this) return end subroutine maw_cfupdate + !> @brief 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. + !< subroutine maw_setup_budobj(this) -! ****************************************************************************** -! maw_setup_budobj -- 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. -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: LENBUDTXT ! -- dummy @@ -4321,7 +4173,6 @@ subroutine maw_setup_budobj(this) integer(I4B) :: idx character(len=LENBUDTXT) :: text character(len=LENBUDTXT), dimension(1) :: auxtxt -! ------------------------------------------------------------------------------ ! ! -- Determine the number of maw budget terms. These are fixed for ! the simulation and cannot change. @@ -4465,7 +4316,7 @@ subroutine maw_setup_budobj(this) maxlist, .false., .false., & naux) ! - ! -- + ! -- flowing-well flow to mover if (this%iflowingwells > 0) then ! ! -- @@ -4483,7 +4334,7 @@ subroutine maw_setup_budobj(this) end if end if ! - ! -- + ! -- auxiliary variable naux = this%naux if (naux > 0) then ! @@ -4505,19 +4356,16 @@ subroutine maw_setup_budobj(this) call this%budobj%flowtable_df(this%iout) end if ! - ! -- return + ! -- Return return end subroutine maw_setup_budobj + !> @brief Copy flow terms into this%budobj + !! + !! terms include a combination of the following: + !! gwf rate [flowing_well] [storage] constant_flow [frommvr tomvr tomvrcf [tomvrfw]] [aux] + !< subroutine maw_fill_budobj(this) -! ****************************************************************************** -! maw_fill_budobj -- copy flow terms into this%budobj -! -! gwf rate [flowing_well] [storage] constant_flow [frommvr tomvr tomvrcf [tomvrfw]] [aux] -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules ! -- dummy class(MawType) :: this @@ -4538,7 +4386,6 @@ subroutine maw_fill_budobj(this) real(DP) :: b real(DP) :: v ! -- formats -! ----------------------------------------------------------------------------- ! ! -- initialize counter idx = 0 @@ -4723,20 +4570,16 @@ subroutine maw_fill_budobj(this) ! --Terms are filled, now accumulate them for this time step call this%budobj%accumulate_terms() ! - ! -- return + ! -- Return return end subroutine maw_fill_budobj + !> @brief Set up the table object that is used to write the maw head data + !! + !! The terms listed here must correspond in number and order to the ones + !! written to the head table in the maw_ot method. + !< subroutine maw_setup_tableobj(this) -! ****************************************************************************** -! maw_setup_tableobj -- Set up the table object that is used to write the maw -! head data. The terms listed here must correspond in -! number and order to the ones written to the head table -! in the maw_ot method. -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use ConstantsModule, only: LINELENGTH, LENBUDTXT ! -- dummy @@ -4745,7 +4588,6 @@ subroutine maw_setup_tableobj(this) integer(I4B) :: nterms character(len=LINELENGTH) :: title character(len=LINELENGTH) :: text -! ------------------------------------------------------------------------------ ! ! -- setup well head table if (this%iprhed > 0) then @@ -4778,17 +4620,13 @@ subroutine maw_setup_tableobj(this) call this%headtab%initialize_column(text, 12, alignment=TABCENTER) end if ! - ! -- return + ! -- Return return end subroutine maw_setup_tableobj + !> @brief Get position of value in connection data + !< function get_jpos(this, n, j) result(jpos) -! ****************************************************************************** -! get_jpos -- position of value in connection data. -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- return variable integer(I4B) :: jpos ! -- dummy @@ -4796,22 +4634,17 @@ function get_jpos(this, n, j) result(jpos) integer(I4B), intent(in) :: n integer(I4B), intent(in) :: j ! -- local -! ------------------------------------------------------------------------------ ! ! -- set jpos jpos = this%iaconn(n) + j - 1 ! - ! -- return + ! -- Return return end function get_jpos + !> @brief Get the gwfnode for connection + !< function get_gwfnode(this, n, j) result(igwfnode) -! ****************************************************************************** -! get_gwfnode -- get the gwfnode for connection. -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- return variable integer(I4B) :: igwfnode ! -- dummy @@ -4820,29 +4653,23 @@ function get_gwfnode(this, n, j) result(igwfnode) integer(I4B), intent(in) :: j ! -- local integer(I4B) :: jpos -! ------------------------------------------------------------------------------ ! ! -- set jpos jpos = this%get_jpos(n, j) igwfnode = this%gwfnodes(jpos) ! - ! -- return + ! -- Return return end function get_gwfnode + !> @brief Activate density terms + !< subroutine maw_activate_density(this) -! ****************************************************************************** -! maw_activate_density -- Activate addition of density terms -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- dummy class(MawType), intent(inout) :: this ! -- local integer(I4B) :: i, j ! -- formats -! ------------------------------------------------------------------------------ ! ! -- Set idense and reallocate denseterms to be of size MAXBOUND this%idense = 1 @@ -4856,14 +4683,13 @@ subroutine maw_activate_density(this) write (this%iout, '(/1x,a)') 'DENSITY TERMS HAVE BEEN ACTIVATED FOR MAW & &PACKAGE: '//trim(adjustl(this%packName)) ! - ! -- return + ! -- Return return end subroutine maw_activate_density !> @brief Activate viscosity terms - !! - !! Method to activate addition of viscosity terms for a MAW package reach. - !! + !! + !! Method to activate addition of viscosity terms for a MAW package reach. !< subroutine maw_activate_viscosity(this) ! -- modules @@ -4886,40 +4712,34 @@ subroutine maw_activate_viscosity(this) write (this%iout, '(/1x,a)') 'VISCOSITY HAS BEEN ACTIVATED FOR MAW & &PACKAGE: '//trim(adjustl(this%packName)) ! - ! -- return + ! -- Return return end subroutine maw_activate_viscosity + !> @brief Calculate the groundwater-maw density exchnage terms + !! + !! 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 + !< subroutine maw_calculate_density_exchange(this, iconn, hmaw, hgwf, cond, & bmaw, flow, hcofterm, rhsterm) -! ****************************************************************************** -! maw_calculate_density_exchange -- Calculate the groundwater-maw density -! exchange terms. -! -! -- 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 -! -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- dummy class(MawType), intent(inout) :: this integer(I4B), intent(in) :: iconn @@ -4938,7 +4758,6 @@ subroutine maw_calculate_density_exchange(this, iconn, hmaw, hgwf, cond, & real(DP) :: rdenseavg real(DP) :: elevavg ! -- formats -! ------------------------------------------------------------------------------ ! ! -- assign relative density terms, return if zero which means not avail yet rdensemaw = this%denseterms(1, iconn) @@ -4979,7 +4798,7 @@ subroutine maw_calculate_density_exchange(this, iconn, hmaw, hgwf, cond, & ! -- Flow should be zero so do nothing end if ! - ! -- return + ! -- Return return end subroutine maw_calculate_density_exchange