Skip to content

Commit f9f5d57

Browse files
mjrenomjreno
authored andcommitted
consolidate ghb package code
1 parent 33cb4d0 commit f9f5d57

29 files changed

+275
-731
lines changed

autotest/test_gwf_disv_uzf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
uzf_spd.update({t: spd})
110110

111111

112-
# Work up the GHB / GHBA boundary
112+
# Work up the GHB / GHBG boundary
113113
ghb_ids = [(ncol - 1) + i * ncol for i in range(nrow)]
114114
ghb_spd = []
115115
abhead = np.full((nlay, ncpl), DNODATA, dtype=float)
@@ -173,7 +173,7 @@ def get_model(ws, name, array_input=False):
173173

174174
# general-head boundary
175175
if array_input:
176-
ghb = flopy.mf6.ModflowGwfghba(
176+
ghb = flopy.mf6.ModflowGwfghbg(
177177
gwf, print_flows=True, maxbound=20, bhead=abhead, cond=acond
178178
)
179179
else:

autotest/test_gwf_sfr_inactive02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get_model(ws, name, array_input=False):
7171
cond = np.full(nlay * nrow * ncol, DNODATA, dtype=float)
7272
bhead[0] = 1.0
7373
cond[0] = 1e6
74-
flopy.mf6.ModflowGwfghba(gwf, maxbound=1, bhead=bhead, cond=cond)
74+
flopy.mf6.ModflowGwfghbg(gwf, maxbound=1, bhead=bhead, cond=cond)
7575
else:
7676
flopy.mf6.ModflowGwfghb(gwf, stress_period_data=[((0, 0, 0), 1.0, 1e6)])
7777

autotest/test_gwf_uzf01.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ def get_model(ws, name, array_input=False):
9898
transient={0: True},
9999
)
100100

101-
# ghb / ghba
101+
# ghb / ghbg
102102
if array_input:
103-
ghb_obs = {f"{name}.ghb.obs.csv": [("100_1_1", "GHBA", (99, 0, 0))]}
103+
ghb_obs = {f"{name}.ghb.obs.csv": [("100_1_1", "GHB", (99, 0, 0))]}
104104
bhead = np.full(nlay * nrow * ncol, DNODATA, dtype=float)
105105
cond = np.full(nlay * nrow * ncol, DNODATA, dtype=float)
106106
bhead[nlay - 1] = 1.5
107107
cond[nlay - 1] = 1.0
108-
ghb = flopy.mf6.ModflowGwfghba(
108+
ghb = flopy.mf6.ModflowGwfghbg(
109109
gwf,
110110
print_input=True,
111111
print_flows=True,

autotest/test_gwf_vsc01.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_model(idx, ws, array_input=False):
143143
bhead[0][0, i, ncol - 1] = top
144144
cond[0][0, i, ncol - 1] = ghbcond
145145
temp[0][0, i, ncol - 1] = initial_temperature
146-
flopy.mf6.ModflowGwfghba(
146+
flopy.mf6.ModflowGwfghbg(
147147
gwf,
148148
maxbound=nrow,
149149
pname="GHB-1",
@@ -269,10 +269,7 @@ def check_output(idx, ws, array_input=False):
269269
fname = os.path.join(ws, fname)
270270
assert os.path.isfile(fname)
271271
budobj = flopy.utils.CellBudgetFile(fname, precision="double")
272-
if array_input:
273-
outbud = budobj.get_data(text=" GHBA")
274-
else:
275-
outbud = budobj.get_data(text=" GHB")
272+
outbud = budobj.get_data(text=" GHB")
276273

277274
# Establish known answer:
278275
stored_ans = -151.63446156218242

autotest/test_gwt_henry_nr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ def get_model(ws, name, array_input=False):
219219
auxiliary="CONCENTRATION",
220220
)
221221

222-
# ghb / ghba
222+
# ghb / ghbg
223223
if array_input:
224-
ghb1 = flopy.mf6.ModflowGwfghba(
224+
ghb1 = flopy.mf6.ModflowGwfghbg(
225225
gwf,
226226
print_input=True,
227227
print_flows=True,

autotest/test_netcdf_gwf_disv_uzf.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
NetCDF test version of test_gwf_disv_uzf. The primary aim is to test
3-
that GHBA package NetCDF array input (bhead and cond) gives the same
4-
results as test_gwf_disv_uzf list based (GHB) and array based (GHBA)
3+
that GHBG package NetCDF array input (bhead and cond) gives the same
4+
results as test_gwf_disv_uzf list based (GHB) and array based (GHBG)
55
ascii input runs. This test compares heads in the the NetCDF file to
66
those in the FloPy binary output head file.
77
"""
@@ -35,7 +35,7 @@ def build_models(idx, test):
3535

3636
sim, mc = build(idx, test)
3737
gwf = mc.gwf[0]
38-
gwf.get_package("GHBA_0").export_array_netcdf = True
38+
gwf.get_package("GHBG_0").export_array_netcdf = True
3939

4040
name = cases[idx]
4141

@@ -50,7 +50,7 @@ def check_output(idx, test):
5050
name = test.name
5151
ws = Path(test.workspace / "mf6")
5252

53-
# check outputs of GHB / GHBA ascii input runs
53+
# check outputs of GHB / GHBG ascii input runs
5454
check(test.workspace, name)
5555
check(ws, name)
5656

@@ -77,14 +77,15 @@ def check_output(idx, test):
7777
f.write(f" IC6 {name}.ic ic\n")
7878
f.write(f" NPF6 {name}.npf npf\n")
7979
f.write(f" STO6 {name}.sto sto\n")
80-
f.write(f" GHBA6 {name}.ghba ghba_0\n")
80+
f.write(f" GHB6 {name}.ghbg ghbg_0\n")
8181
f.write(f" UZF6 {name}.uzf uzf_0\n")
8282
f.write(f" OC6 {name}.oc oc\n")
8383
f.write(f" OBS6 {name}.obs head_obs\n")
8484
f.write("END packages\n")
8585

86-
with open(ws / f"{name}.ghba", "w") as f:
86+
with open(ws / f"{name}.ghbg", "w") as f:
8787
f.write("BEGIN options\n")
88+
f.write(" READARRAYGRID\n")
8889
f.write(" PRINT_INPUT\n")
8990
f.write(" PRINT_FLOWS\n")
9091
f.write("END options\n\n")

autotest/test_netcdf_gwf_uzf01.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
NetCDF test version of test_gwf_uzf01. The primary aim is to test
3-
that GHBA package NetCDF array input (bhead and cond) gives the same
4-
results as test_gwf_uzf01 list based (GHB) and array based (GHBA)
3+
that GHBG package NetCDF array input (bhead and cond) gives the same
4+
results as test_gwf_uzf01 list based (GHB) and array based (GHBG)
55
ascii input runs. This test compares heads in the the NetCDF file
66
to those in the FloPy binary output head file.
77
"""
@@ -37,8 +37,8 @@ def build_models(idx, test, export):
3737

3838
sim, mc = build(idx, test)
3939
gwf = mc.gwf[0]
40-
ghba = gwf.get_package("GHBA_0")
41-
ghba.export_array_netcdf = True
40+
ghbg = gwf.get_package("GHBG_0")
41+
ghbg.export_array_netcdf = True
4242

4343
if export == "ugrid":
4444
gwf.name_file.nc_mesh2d_filerecord = f"{name}.nc"
@@ -54,7 +54,7 @@ def check_output(idx, test, export):
5454
name = test.name
5555
ws = Path(test.workspace / "mf6")
5656

57-
# check outputs of GHB / GHBA ascii input runs
57+
# check outputs of GHB / GHBG ascii input runs
5858
check(test.workspace, name)
5959
check(ws, name)
6060

@@ -84,14 +84,15 @@ def check_output(idx, test, export):
8484
f.write(f" IC6 {name}.ic ic\n")
8585
f.write(f" NPF6 {name}.npf npf\n")
8686
f.write(f" STO6 {name}.sto sto\n")
87-
f.write(f" GHBA6 {name}.ghba ghba_0\n")
87+
f.write(f" GHB6 {name}.ghbg ghbg_0\n")
8888
f.write(f" UZF6 {name}.uzf uzf_0\n")
8989
f.write(f" OC6 {name}.oc oc\n")
9090
f.write(f" OBS6 {name}.obs head_obs\n")
9191
f.write("END packages\n")
9292

93-
with open(ws / f"{name}.ghba", "w") as f:
93+
with open(ws / f"{name}.ghbg", "w") as f:
9494
f.write("BEGIN options\n")
95+
f.write(" READARRAYGRID\n")
9596
f.write(" PRINT_INPUT\n")
9697
f.write(" PRINT_FLOWS\n")
9798
f.write(" OBS6 FILEIN gwf_uzf01a.ghb.obs\n")

autotest/test_netcdf_gwf_vsc01.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
22
NetCDF test version of test_gwf_vsc01. The primary aim is to test
3-
that GHBA package NetCDF array input (bhead, cond, and temperature
3+
that GHBG package NetCDF array input (bhead, cond, and temperature
44
auxiliary arrays) gives the same results as test_gwf_vsc01 list based
5-
(GHB) and array based (GHBA) ascii input runs. This test compares
5+
(GHB) and array based (GHBG) ascii input runs. This test compares
66
heads in the the NetCDF file to those in the FloPy binary output
77
head file.
88
"""
@@ -55,7 +55,7 @@ def check_output(idx, test, export):
5555
name = "gwf-" + test.name
5656
ws = Path(test.workspace / "mf6")
5757

58-
# check outputs of GHB / GHBA ascii input runs
58+
# check outputs of GHB / GHBG ascii input runs
5959
check(idx, test.workspace, array_input=False)
6060
check(idx, ws, array_input=True)
6161

@@ -85,13 +85,14 @@ def check_output(idx, test, export):
8585
f.write(f" IC6 {name}.ic ic\n")
8686
if viscosity_on[idx]:
8787
f.write(f" VSC6 {name}.vsc vsc\n")
88-
f.write(f" GHBA6 {name}.ghba ghb-1\n")
88+
f.write(f" GHB6 {name}.ghbg ghb-1\n")
8989
f.write(f" CHD6 {name}.chd chd-1\n")
9090
f.write(f" OC6 {name}.oc oc\n")
9191
f.write("END packages\n")
9292

93-
with open(ws / f"{name}.ghba", "w") as f:
93+
with open(ws / f"{name}.ghbg", "w") as f:
9494
f.write("BEGIN options\n")
95+
f.write(" READARRAYGRID\n")
9596
f.write(" auxiliary TEMPERATURE\n")
9697
f.write("END options\n\n")
9798
f.write("BEGIN dimensions\n")

autotest/test_netcdf_gwt_henry_nr.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
22
NetCDF test version of test_gwt_henry_nr. The primary aim is to test
3-
that GHBA package NetCDF array input (bhead, cond, concentration and
3+
that GHBG package NetCDF array input (bhead, cond, concentration and
44
density auxiliary arrays) gives the same results as test_gwt_henry_nr
5-
list based (GHB) and array based (GHBA) ascii input runs. This test
5+
list based (GHB) and array based (GHBG) ascii input runs. This test
66
compares heads in the the NetCDF file to those in the FloPy binary
77
output head file.
88
"""
@@ -54,14 +54,14 @@ def check_output(idx, test, export):
5454
from test_gwt_henry_nr import check_output as check
5555

5656
name = "gwf_" + test.name
57-
ghba_ws = Path(test.workspace / "mf6")
57+
ghbg_ws = Path(test.workspace / "mf6")
5858
ws = Path(test.workspace / "mf6" / "netcdf")
59-
shutil.copytree(ghba_ws, ws)
59+
shutil.copytree(ghbg_ws, ws)
6060

61-
# check outputs of GHB / GHBA ascii input runs
61+
# check outputs of GHB / GHBG ascii input runs
6262
check(test.workspace, test.name, test.sims[0])
6363
# check(ws, test.name, test.sims[0])
64-
check(ghba_ws, test.name, test.sims[0])
64+
check(ghbg_ws, test.name, test.sims[0])
6565

6666
# verify format of generated netcdf file
6767
with nc.Dataset(ws / f"{name}.nc") as ds:
@@ -90,13 +90,14 @@ def check_output(idx, test, export):
9090
f.write(f" STO6 {name}.sto sto\n")
9191
f.write(f" BUY6 {name}.buy buy\n")
9292
f.write(f" DRN6 {name}.drn drn-1\n")
93-
f.write(f" GHBA6 {name}.ghba ghb-1\n")
93+
f.write(f" GHB6 {name}.ghbg ghb-1\n")
9494
f.write(f" WEL6 {name}.wel wel-1\n")
9595
f.write(f" OC6 {name}.oc oc\n")
9696
f.write("END packages\n")
9797

98-
with open(ws / f"{name}.ghba", "w") as f:
98+
with open(ws / f"{name}.ghbg", "w") as f:
9999
f.write("BEGIN options\n")
100+
f.write(" READARRAYGRID\n")
100101
f.write(" auxiliary CONCENTRATION DENSITY\n")
101102
f.write(" PRINT_INPUT\n")
102103
f.write(" PRINT_FLOWS\n")
@@ -132,7 +133,7 @@ def check_output(idx, test, export):
132133
names = [name, "gwt_" + test.name]
133134
for i, e in enumerate(ext):
134135
fpth1 = os.path.join(
135-
ghba_ws,
136+
ghbg_ws,
136137
f"{names[i]}.{e}",
137138
)
138139
fpth2 = os.path.join(ws, f"{names[i]}.{e}")

doc/mf6io/mf6ivar/dfn/gwf-ghba.dfn renamed to doc/mf6io/mf6ivar/dfn/gwf-ghbg.dfn

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
# --------------------- gwf ghba options ---------------------
1+
# --------------------- gwf ghbg options ---------------------
22
# flopy multi-package
33
# package-type stress-package
44

5+
block options
6+
name readarraygrid
7+
type keyword
8+
reader urword
9+
optional false
10+
longname use array-based grid input
11+
description indicates that array-based grid input will be used for the general-head boundary package. This keyword must be specified to use array-based grid input. When READARRAYGRID is specified, values must be provided for every cell within a model grid, even those cells that have an IDOMAIN value less than one. Values assigned to cells with IDOMAIN values less than one are not used and have no effect on simulation results. No data cells should contain the value DNODATA (3.0E+30).
12+
default_value True
13+
514
block options
615
name auxiliary
716
type string
@@ -43,7 +52,7 @@ name save_flows
4352
type keyword
4453
reader urword
4554
optional true
46-
longname save GHBA flows to budget file
55+
longname save GHBG flows to budget file
4756
description REPLACE save_flows {'{#1}': 'general-head boundary'}
4857
mf6internal ipakcb
4958

@@ -109,7 +118,7 @@ longname export array variables to netcdf output files.
109118
description keyword that specifies input griddata arrays should be written to the model output netcdf file.
110119
extended true
111120

112-
# --------------------- gwf ghba dimensions ---------------------
121+
# --------------------- gwf ghbg dimensions ---------------------
113122

114123
block dimensions
115124
name maxbound
@@ -119,7 +128,7 @@ optional false
119128
longname maximum number of general-head boundaries in any stress period
120129
description REPLACE maxbound {'{#1}': 'general-head boundary'}
121130

122-
# --------------------- gwf ghba period ---------------------
131+
# --------------------- gwf ghbg period ---------------------
123132

124133
block period
125134
name iper

0 commit comments

Comments
 (0)