Skip to content

Commit

Permalink
fix(par): exchange mover budgets should be written only once in paral…
Browse files Browse the repository at this point in the history
…lel (#2028)

* -exchange mover budgets should be written only once in parallel

* - add to release notes

* - oops...

* - ruff

* - ruffer

* - fix comment (to trigger build...)
  • Loading branch information
mjr-deltares authored Oct 9, 2024
1 parent e2d9eaa commit 933eba4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
9 changes: 9 additions & 0 deletions autotest/test_gwf_exgmvr01.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import flopy
import numpy as np
import pandas as pd
import pytest
from framework import TestFramework

Expand Down Expand Up @@ -257,6 +258,7 @@ def build_exchanges(sim):
modelnames=True,
maxmvr=maxmvr,
print_flows=True,
budgetcsv_filerecord="left-right.mvr.bud.csv",
maxpackages=maxpackages,
packages=mvrpack_sim,
perioddata=mvrspd,
Expand Down Expand Up @@ -293,6 +295,13 @@ def check_output(idx, test):

assert np.allclose(single_stage, stage), "sfr stages are not equal"

# check mover CSV output
fpth = ws / "left-right.mvr.bud.csv"
df = pd.read_csv(fpth)

for diff in df["PERCENT_DIFFERENCE"].iloc:
assert abs(diff) < 1e-05, "no mass balance on the exchange mover"


@pytest.mark.parametrize("idx, name", enumerate(cases))
def test_mf6model(idx, name, function_tmpdir, targets):
Expand Down
10 changes: 4 additions & 6 deletions doc/ReleaseNotes/develop.tex
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@
% \item xxx
%\end{itemize}

%\underline{PARALLEL}
%\begin{itemize}
% \item xxx
% \item xxx
% \item xxx
%\end{itemize}
\underline{PARALLEL}
\begin{itemize}
\item Writing budget files for a MVR package in the GWF-GWF Exchange gave an error when running in parallel but this is fixed with this change.
\end{itemize}

1 change: 1 addition & 0 deletions src/Exchange/exg-gwfgwf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ subroutine read_mvr(this, iout)
call exg_mvr_cr(this%mvr, this%name, this%inmvr, iout, dis)
this%mvr%model1 => this%v_model1
this%mvr%model2 => this%v_model2
this%mvr%suppress_fileout = this%is_datacopy
!
! -- Return
return
Expand Down
3 changes: 3 additions & 0 deletions src/Model/GroundWaterFlow/gwf-mvr.f90
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ module GwfMvrModule
!
! -- table objects
type(TableType), pointer :: outputtab => null()
logical(LGP) :: suppress_fileout = .false. !< flag to disable output file (budget, budget csv)

contains
procedure :: mvr_init
Expand Down Expand Up @@ -749,6 +750,7 @@ subroutine read_options(this)
call this%parser%GetStringCaps(keyword)
select case (keyword)
case ('BUDGET')
if (this%suppress_fileout) cycle
call this%parser%GetStringCaps(keyword)
if (keyword == 'FILEOUT') then
call this%parser%GetString(fname)
Expand All @@ -762,6 +764,7 @@ subroutine read_options(this)
&BE FOLLOWED BY FILEOUT')
end if
case ('BUDGETCSV')
if (this%suppress_fileout) cycle
call this%parser%GetStringCaps(keyword)
if (keyword == 'FILEOUT') then
call this%parser%GetString(fname)
Expand Down

0 comments on commit 933eba4

Please sign in to comment.