Skip to content

Commit

Permalink
merge from develop (#282)
Browse files Browse the repository at this point in the history
* fix(uzf): fix indexing error in UZF (#274)

* Error introduced as part of recent UZF refactoring
* Closes #273

* fix(memory): some variables not deallocated (#278)

Implemented new check in develop mode so code bombs with error if memory manager variable not deallocated

* refactor(budobj): new budget object for advanced packages (#279)

* single code base for writing binary budget files for advanced packages
* single code base for creating and writing budget tables to list file for advanced packages
* implemented for MAW, UZF, LAK, SFR, and MVR
* closes #277
* update mf6exes from 2.0 to 3.0
* will allow generalized transport calculations for advanced packages

* refactor(advanced packages): read static data as part of df() (#281)

* refactor(advanced packages): modify advanced packages to read all static data as part of df()
* modify setup_budobj to include the connectivity so that it is available to other models
  • Loading branch information
langevin-usgs committed Jan 6, 2020
1 parent 80bfe52 commit 55c44f6
Show file tree
Hide file tree
Showing 6 changed files with 375 additions and 141 deletions.
31 changes: 26 additions & 5 deletions src/Model/GroundWaterFlow/gwf3lak8.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,9 @@ subroutine lak_read_dimensions(this)
! when PRINT_INPUT option is used.
call this%define_listlabel()
!
! -- setup the budget object
call this%lak_setup_budobj()
!
! -- return
return
end subroutine lak_read_dimensions
Expand Down Expand Up @@ -3402,9 +3405,6 @@ subroutine lak_ar(this)
call this%pakmvrobj%ar(this%noutlets, this%nlakes, this%origin)
endif
!
! -- setup the budget object
call this%lak_setup_budobj()
!
! -- return
return
end subroutine lak_ar
Expand Down Expand Up @@ -5755,9 +5755,10 @@ subroutine lak_setup_budobj(this)
! -- local
integer(I4B) :: nbudterm
integer(I4B) :: nlen
integer(I4B) :: n
integer(I4B) :: j, n, n1, n2
integer(I4B) :: maxlist, naux
integer(I4B) :: idx
real(DP) :: q
character(len=LENBUDTXT) :: text
character(len=LENBUDTXT), dimension(1) :: auxtxt
! ------------------------------------------------------------------------------
Expand Down Expand Up @@ -5793,6 +5794,18 @@ subroutine lak_setup_budobj(this)
this%name, &
maxlist, .false., .false., &
naux)
!
! -- store connectivity
call this%budobj%budterm(idx)%reset(2 * nlen)
q = DZERO
do n = 1, this%noutlets
n1 = this%lakein(n)
n2 = this%lakeout(n)
if (n1 > 0 .and. n2 > 0) then
call this%budobj%budterm(idx)%update_term(n1, n2, q)
call this%budobj%budterm(idx)%update_term(n2, n1, -q)
end if
end do
end if
!
! --
Expand All @@ -5808,6 +5821,14 @@ subroutine lak_setup_budobj(this)
this%name_model, &
maxlist, .false., .true., &
naux, auxtxt)
call this%budobj%budterm(idx)%reset(this%maxbound)
q = DZERO
do n = 1, this%nlakes
do j = this%idxlakeconn(n), this%idxlakeconn(n + 1) - 1
n2 = this%cellid(j)
call this%budobj%budterm(idx)%update_term(n, n2, q)
end do
end do
!
! --
text = ' RAINFALL'
Expand Down Expand Up @@ -6027,7 +6048,7 @@ subroutine lak_fill_budobj(this)
hgwf = this%xnew(n2)
call this%lak_calculate_conn_warea(n, j, hlak, hgwf, this%qauxcbc(1))
q = this%qleak(j)
call this%budobj%budterm(idx)%update_term(n1, n2, q, this%qauxcbc)
call this%budobj%budterm(idx)%update_term(n, n2, q, this%qauxcbc)
end do
end do

Expand Down
16 changes: 13 additions & 3 deletions src/Model/GroundWaterFlow/gwf3maw8.f90
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,9 @@ subroutine maw_read_dimensions(this)
! when PRINT_INPUT option is used.
call this%define_listlabel()
!
! -- setup the budget object
call this%maw_setup_budobj()
!
! -- return
return
end subroutine maw_read_dimensions
Expand Down Expand Up @@ -1589,9 +1592,6 @@ subroutine maw_ar(this)
call this%pakmvrobj%ar(this%nmawwells, this%nmawwells, this%origin)
endif
!
! -- setup the budget object
call this%maw_setup_budobj()
!
! -- return
return
end subroutine maw_ar
Expand Down Expand Up @@ -3924,6 +3924,8 @@ subroutine maw_setup_budobj(this)
class(MawType) :: this
! -- local
integer(I4B) :: nbudterm
integer(I4B) :: n, j, n2
real(DP) :: q
integer(I4B) :: maxlist, naux
integer(I4B) :: idx
character(len=LENBUDTXT) :: text
Expand Down Expand Up @@ -3962,6 +3964,14 @@ subroutine maw_setup_budobj(this)
this%name_model, &
maxlist, .false., .true., &
naux, auxtxt)
call this%budobj%budterm(idx)%reset(this%maxbound)
q = DZERO
do n = 1, this%nmawwells
do j = 1, this%mawwells(n)%ngwfnodes
n2 = this%mawwells(n)%gwfnodes(j)
call this%budobj%budterm(idx)%update_term(n, n2, q)
end do
end do
!
! --
text = ' RATE'
Expand Down
Loading

0 comments on commit 55c44f6

Please sign in to comment.