Skip to content

Commit dea7cf7

Browse files
authored
refactor: add model_reset for package movers (MODFLOW-ORG#1419)
1 parent 9705a30 commit dea7cf7

File tree

18 files changed

+61
-127
lines changed

18 files changed

+61
-127
lines changed

src/Model/GroundWaterFlow/gwf3.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ subroutine gwf_cq(this, icnvg, isuppress_output)
792792
! head solution.
793793
do ip = 1, this%bndlist%Count()
794794
packobj => GetBndFromList(this%bndlist, ip)
795-
call packobj%bnd_cf(reset_mover=.false.)
795+
call packobj%bnd_cf()
796796
if (this%inbuy > 0) call this%buy%buy_cf_bnd(packobj, this%x)
797797
call packobj%bnd_cq(this%x, this%flowja)
798798
end do

src/Model/GroundWaterFlow/gwf3drn8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ subroutine drn_ck(this)
382382
return
383383
end subroutine drn_ck
384384

385-
subroutine drn_cf(this, reset_mover)
385+
subroutine drn_cf(this)
386386
! ******************************************************************************
387387
! drn_cf -- Formulate the HCOF and RHS terms
388388
! Subroutine: (1) skip if no drains
@@ -393,26 +393,17 @@ subroutine drn_cf(this, reset_mover)
393393
! ------------------------------------------------------------------------------
394394
! -- dummy
395395
class(DrnType) :: this
396-
logical, intent(in), optional :: reset_mover
397396
! -- local
398397
integer(I4B) :: i
399398
integer(I4B) :: node
400399
real(DP) :: cdrn
401400
real(DP) :: drnbot
402401
real(DP) :: fact
403-
logical :: lrm
404402
! ------------------------------------------------------------------------------
405403
!
406404
! -- Return if no drains
407405
if (this%nbound == 0) return
408406
!
409-
! -- pakmvrobj cf
410-
lrm = .true.
411-
if (present(reset_mover)) lrm = reset_mover
412-
if (this%imover == 1 .and. lrm) then
413-
call this%pakmvrobj%cf()
414-
end if
415-
!
416407
! -- Calculate hcof and rhs for each drn entry
417408
do i = 1, this%nbound
418409
node = this%nodelist(i)

src/Model/GroundWaterFlow/gwf3evt8.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ subroutine set_nodesontop(this)
568568
return
569569
end subroutine set_nodesontop
570570

571-
subroutine evt_cf(this, reset_mover)
571+
subroutine evt_cf(this)
572572
! ******************************************************************************
573573
! evt_cf -- Formulate the HCOF and RHS terms
574574
! ******************************************************************************
@@ -577,7 +577,6 @@ subroutine evt_cf(this, reset_mover)
577577
! ------------------------------------------------------------------------------
578578
! -- dummy
579579
class(EvtType) :: this
580-
logical, intent(in), optional :: reset_mover
581580
! -- local
582581
integer(I4B) :: i, iseg, node
583582
integer(I4B) :: idxdepth, idxrate

src/Model/GroundWaterFlow/gwf3ghb8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ subroutine ghb_ck(this)
280280
return
281281
end subroutine ghb_ck
282282

283-
subroutine ghb_cf(this, reset_mover)
283+
subroutine ghb_cf(this)
284284
! ******************************************************************************
285285
! ghb_cf -- Formulate the HCOF and RHS terms
286286
! Subroutine: (1) skip if no ghbs
@@ -291,22 +291,13 @@ subroutine ghb_cf(this, reset_mover)
291291
! ------------------------------------------------------------------------------
292292
! -- dummy
293293
class(GhbType) :: this
294-
logical, intent(in), optional :: reset_mover
295294
! -- local
296295
integer(I4B) :: i, node
297-
logical :: lrm
298296
! ------------------------------------------------------------------------------
299297
!
300298
! -- Return if no ghbs
301299
if (this%nbound .eq. 0) return
302300
!
303-
! -- packmvrobj cf
304-
lrm = .true.
305-
if (present(reset_mover)) lrm = reset_mover
306-
if (this%imover == 1 .and. lrm) then
307-
call this%pakmvrobj%cf()
308-
end if
309-
!
310301
! -- Calculate hcof and rhs for each ghb entry
311302
do i = 1, this%nbound
312303
node = this%nodelist(i)

src/Model/GroundWaterFlow/gwf3lak8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3841,7 +3841,7 @@ subroutine lak_ad(this)
38413841
return
38423842
end subroutine lak_ad
38433843

3844-
subroutine lak_cf(this, reset_mover)
3844+
subroutine lak_cf(this)
38453845
! ******************************************************************************
38463846
! lak_cf -- Formulate the HCOF and RHS terms
38473847
! Subroutine: (1) skip if no lakes
@@ -3852,12 +3852,10 @@ subroutine lak_cf(this, reset_mover)
38523852
! ------------------------------------------------------------------------------
38533853
! -- dummy
38543854
class(LakType) :: this
3855-
logical(LGP), intent(in), optional :: reset_mover
38563855
! -- local
38573856
integer(I4B) :: j, n
38583857
integer(I4B) :: igwfnode
38593858
real(DP) :: hlak, blak
3860-
logical(LGP) :: lrm
38613859
! ------------------------------------------------------------------------------
38623860
!!
38633861
!! -- Calculate lak conductance and update package RHS and HCOF
@@ -3874,13 +3872,6 @@ subroutine lak_cf(this, reset_mover)
38743872
call this%lak_calculate_exchange(n, this%s0(n), this%qgwf0(n))
38753873
end do
38763874
!
3877-
! -- pakmvrobj cf
3878-
lrm = .true.
3879-
if (present(reset_mover)) lrm = reset_mover
3880-
if (this%imover == 1 .and. lrm) then
3881-
call this%pakmvrobj%cf()
3882-
end if
3883-
!
38843875
! -- find highest active cell
38853876
do n = 1, this%nlakes
38863877
do j = this%idxlakeconn(n), this%idxlakeconn(n + 1) - 1

src/Model/GroundWaterFlow/gwf3maw8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ subroutine maw_ad(this)
22792279
return
22802280
end subroutine maw_ad
22812281

2282-
subroutine maw_cf(this, reset_mover)
2282+
subroutine maw_cf(this)
22832283
! ******************************************************************************
22842284
! maw_cf -- Formulate the HCOF and RHS terms
22852285
! Subroutine: (1) skip if no multi-aquifer wells
@@ -2290,21 +2290,12 @@ subroutine maw_cf(this, reset_mover)
22902290
! ------------------------------------------------------------------------------
22912291
! -- dummy
22922292
class(MawType) :: this
2293-
logical, intent(in), optional :: reset_mover
22942293
! -- local
2295-
logical :: lrm
22962294
! ------------------------------------------------------------------------------
22972295
!
22982296
! -- Calculate maw conductance and update package RHS and HCOF
22992297
call this%maw_cfupdate()
23002298
!
2301-
! -- pakmvrobj cf
2302-
lrm = .true.
2303-
if (present(reset_mover)) lrm = reset_mover
2304-
if (this%imover == 1 .and. lrm) then
2305-
call this%pakmvrobj%cf()
2306-
end if
2307-
!
23082299
! -- Return
23092300
return
23102301
end subroutine maw_cf

src/Model/GroundWaterFlow/gwf3rch8.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ subroutine set_nodesontop(this)
369369
return
370370
end subroutine set_nodesontop
371371

372-
subroutine rch_cf(this, reset_mover)
372+
subroutine rch_cf(this)
373373
! ******************************************************************************
374374
! rch_cf -- Formulate the HCOF and RHS terms
375375
! Subroutine: (1) skip if no recharge
@@ -380,7 +380,6 @@ subroutine rch_cf(this, reset_mover)
380380
! ------------------------------------------------------------------------------
381381
! -- dummy
382382
class(rchtype) :: this
383-
logical, intent(in), optional :: reset_mover
384383
! -- local
385384
integer(I4B) :: i, node
386385
! ------------------------------------------------------------------------------

src/Model/GroundWaterFlow/gwf3riv8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ subroutine riv_ck(this)
303303
return
304304
end subroutine riv_ck
305305

306-
subroutine riv_cf(this, reset_mover)
306+
subroutine riv_cf(this)
307307
! ******************************************************************************
308308
! riv_cf -- Formulate the HCOF and RHS terms
309309
! Subroutine: (1) skip in no rivs
@@ -314,23 +314,14 @@ subroutine riv_cf(this, reset_mover)
314314
! ------------------------------------------------------------------------------
315315
! -- dummy
316316
class(RivType) :: this
317-
logical, intent(in), optional :: reset_mover
318317
! -- local
319318
integer(I4B) :: i, node
320319
real(DP) :: hriv, criv, rbot
321-
logical :: lrm
322320
! ------------------------------------------------------------------------------
323321
!
324322
! -- Return if no rivs
325323
if (this%nbound .eq. 0) return
326324
!
327-
! -- pakmvrobj cf
328-
lrm = .true.
329-
if (present(reset_mover)) lrm = reset_mover
330-
if (this%imover == 1 .and. lrm) then
331-
call this%pakmvrobj%cf()
332-
end if
333-
!
334325
! -- Calculate hcof and rhs for each riv entry
335326
do i = 1, this%nbound
336327
node = this%nodelist(i)

src/Model/GroundWaterFlow/gwf3sfr8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,14 +1955,12 @@ end subroutine sfr_ad
19551955
!! added to the coefficient matrix and right-hand side vector.
19561956
!!
19571957
!<
1958-
subroutine sfr_cf(this, reset_mover)
1958+
subroutine sfr_cf(this)
19591959
! -- dummy variables
19601960
class(SfrType) :: this !< SfrType object
1961-
logical(LGP), intent(in), optional :: reset_mover !< boolean for resetting mover
19621961
! -- local variables
19631962
integer(I4B) :: n
19641963
integer(I4B) :: igwfnode
1965-
logical(LGP) :: lrm
19661964
!
19671965
! -- return if no sfr reaches
19681966
if (this%nbound == 0) return
@@ -1979,13 +1977,6 @@ subroutine sfr_cf(this, reset_mover)
19791977
this%nodelist(n) = igwfnode
19801978
end do
19811979
!
1982-
! -- pakmvrobj cf
1983-
lrm = .true.
1984-
if (present(reset_mover)) lrm = reset_mover
1985-
if (this%imover == 1 .and. lrm) then
1986-
call this%pakmvrobj%cf()
1987-
end if
1988-
!
19891980
! -- return
19901981
return
19911982
end subroutine sfr_cf

src/Model/GroundWaterFlow/gwf3uzf8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ subroutine uzf_ad(this)
10691069
return
10701070
end subroutine uzf_ad
10711071

1072-
subroutine uzf_cf(this, reset_mover)
1072+
subroutine uzf_cf(this)
10731073
! ******************************************************************************
10741074
! uzf_cf -- Formulate the HCOF and RHS terms
10751075
! Subroutine: (1) skip if no UZF cells
@@ -1081,10 +1081,8 @@ subroutine uzf_cf(this, reset_mover)
10811081
! -- modules
10821082
! -- dummy
10831083
class(UzfType) :: this
1084-
logical, intent(in), optional :: reset_mover
10851084
! -- locals
10861085
integer(I4B) :: n
1087-
logical :: lrm
10881086
! ------------------------------------------------------------------------------
10891087
!
10901088
! -- Return if no UZF cells
@@ -1098,13 +1096,6 @@ subroutine uzf_cf(this, reset_mover)
10981096
this%gwd0(n) = this%gwd(n)
10991097
end do
11001098
!
1101-
! -- pakmvrobj cf
1102-
lrm = .true.
1103-
if (present(reset_mover)) lrm = reset_mover
1104-
if (this%imover == 1 .and. lrm) then
1105-
call this%pakmvrobj%cf()
1106-
end if
1107-
!
11081099
! -- return
11091100
return
11101101
end subroutine uzf_cf

src/Model/GroundWaterFlow/gwf3wel8.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,29 +316,20 @@ end subroutine wel_rp
316316
!! added to the coefficient matrix and right-hand side vector.
317317
!!
318318
!<
319-
subroutine wel_cf(this, reset_mover)
319+
subroutine wel_cf(this)
320320
! -- dummy variables
321321
class(WelType) :: this !< WelType object
322-
logical, intent(in), optional :: reset_mover !< boolean for resetting mover
323322
! -- local variables
324323
integer(I4B) :: i, node, ict
325324
real(DP) :: qmult
326325
real(DP) :: q
327326
real(DP) :: tp
328327
real(DP) :: bt
329328
real(DP) :: thick
330-
logical :: lrm
331329
!
332330
! -- Return if no wells
333331
if (this%nbound == 0) return
334332
!
335-
! -- pakmvrobj cf
336-
lrm = .true.
337-
if (present(reset_mover)) lrm = reset_mover
338-
if (this%imover == 1 .and. lrm) then
339-
call this%pakmvrobj%cf()
340-
end if
341-
!
342333
! -- Calculate hcof and rhs for each well entry
343334
do i = 1, this%nbound
344335
node = this%nodelist(i)

src/Model/GroundWaterTransport/gwt1.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ subroutine gwt_cq(this, icnvg, isuppress_output)
528528
! conc solution.
529529
do ip = 1, this%bndlist%Count()
530530
packobj => GetBndFromList(this%bndlist, ip)
531-
call packobj%bnd_cf(reset_mover=.false.)
531+
call packobj%bnd_cf()
532532
call packobj%bnd_cq(this%x, this%flowja)
533533
end do
534534
!

src/Model/GroundWaterTransport/gwt1apt1.f90

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ module GwtAptModule
125125
procedure :: bnd_ar => apt_ar
126126
procedure :: bnd_rp => apt_rp
127127
procedure :: bnd_ad => apt_ad
128-
procedure :: bnd_cf => apt_cf
128+
procedure :: bnd_reset => apt_reset
129129
procedure :: bnd_fc => apt_fc
130130
procedure, private :: apt_fc_expanded
131131
procedure :: pak_fc_expanded
@@ -717,32 +717,18 @@ subroutine apt_ad(this)
717717
return
718718
end subroutine apt_ad
719719

720-
!> @ brief Formulate the package hcof and rhs terms.
721-
!!
722-
!! For the APT Package, the sole purpose here is to
723-
!! reset the qmfrommvr term.
724-
!!
725-
!<
726-
subroutine apt_cf(this, reset_mover)
727-
! -- modules
720+
!> @brief Override bnd reset for custom mover logic
721+
!< TODO_MJR: check this
722+
subroutine apt_reset(this)
728723
class(GwtAptType) :: this !< GwtAptType object
729-
logical(LGP), intent(in), optional :: reset_mover !< boolean for resetting mover
730-
! -- local
724+
! local
731725
integer(I4B) :: i
732-
logical :: lrm
733-
!
734-
! -- reset qmfrommvr
735-
lrm = .true.
736-
if (present(reset_mover)) lrm = reset_mover
737-
if (lrm) then
738-
do i = 1, size(this%qmfrommvr)
739-
this%qmfrommvr(i) = DZERO
740-
end do
741-
end if
742-
!
743-
! -- return
744-
return
745-
end subroutine apt_cf
726+
727+
do i = 1, size(this%qmfrommvr)
728+
this%qmfrommvr(i) = DZERO
729+
end do
730+
731+
end subroutine apt_reset
746732

747733
subroutine apt_fc(this, rhs, ia, idxglo, matrix_sln)
748734
! ******************************************************************************

src/Model/GroundWaterTransport/gwt1src1.f90

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ subroutine src_allocate_scalars(this)
124124
return
125125
end subroutine src_allocate_scalars
126126

127-
subroutine src_cf(this, reset_mover)
127+
subroutine src_cf(this)
128128
! ******************************************************************************
129129
! src_cf -- Formulate the HCOF and RHS terms
130130
! Subroutine: (1) skip if no sources
@@ -135,23 +135,14 @@ subroutine src_cf(this, reset_mover)
135135
! ------------------------------------------------------------------------------
136136
! -- dummy
137137
class(GwtSrcType) :: this
138-
logical, intent(in), optional :: reset_mover
139138
! -- local
140139
integer(I4B) :: i, node
141140
real(DP) :: q
142-
logical :: lrm
143141
! ------------------------------------------------------------------------------
144142
!
145143
! -- Return if no sources
146144
if (this%nbound == 0) return
147145
!
148-
! -- pakmvrobj cf
149-
lrm = .true.
150-
if (present(reset_mover)) lrm = reset_mover
151-
if (this%imover == 1 .and. lrm) then
152-
call this%pakmvrobj%cf()
153-
end if
154-
!
155146
! -- Calculate hcof and rhs for each source entry
156147
do i = 1, this%nbound
157148
node = this%nodelist(i)

0 commit comments

Comments
 (0)