Replies: 1 comment 6 replies
-
When you construct your sim = flopy.mf6.MFSimulation()
gwf = flopy.mf6.ModflowGwf(sim, modelname="my model", save_flows=True) you can also get a list of the unique record names in your budget file by calling cbc = gwf.output.budget()
rec_names = cbc.get_unique_record_names() |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
Following a previous discussion (#1704), I added a river object to the model. The river model is built as:
#adding river
riv_row = [0,1,1,2,3,3,4,5,6,6,7,8,9]
riv_col = [4,4,5,5,5,6,6,6,6,7,7,7,7]
riv_len = delr #river length
riv_wdt = delc #river width
riv_bdp = 10. #river bed depth
riv_bk = 5e-5 #hydraulic conductivity of river bed
riv_rbot = 4 #river bottom
riv_cond = riv_bk*riv_len*riv_wdt/riv_bdp #conductance of the riverbed material
#stress period 1
riv_sp1 = []
stage_sp1 = 10 #river head at stress period 1
for inum in range(len(riv_row)):
riv_sp1.append([0, riv_row[inum], riv_col[inum], stage_sp1, riv_cond, riv_rbot])
print("Adding ", len(riv_sp1), "Stages for stress period 1.")
#stress period 2
riv_sp2 = []
stage_sp2 = 12 #river head at stress period 1
for inum in range(len(riv_row)):
riv_sp2.append([0, riv_row[inum], riv_col[inum], stage_sp2, riv_cond, riv_rbot])
print("Adding ", len(riv_sp2), "Stages for stress period 2.")
stress_period_data = {0: riv_sp1, 1: riv_sp2}
#create river obj
riv = fp.modflow.ModflowRiv(sim,
ipackcb = 1,
stress_period_data = stress_period_data)
The model is run successfully but I tried to extract the river leakage and flow lower face from the budget file, they cannot be found by the code I use (see below). I wonder is this because the river model was not added to the simulation, or some other reason (wrong post-processing code for example)?
The processing code I use is:
cbbobj = fp.utils.CellBudgetFile("./toy_tvar_mf05/modflowtest.cbc")
times = cbbobj.get_times()
leak = cbbobj.get_data(text = "RIVER LEAKAGE", totim = times[-1])[0]
face_lower = cbbobj.get_data(text = "flow lower face", totim = times[-1])[0]
The error information is:
Cell In[328], line 3
1 cbbobj = fp.utils.CellBudgetFile("./toy_tvar_mf05/modflowtest.cbc")
2 times = cbbobj.get_times()
----> 3 leak = cbbobj.get_data(text = "RIVER LEAKAGE", totim = times[-1])[0]
4 #cbbobj.list_records()
5 #face_lower = cbbobj.get_data(text = "flow lower face", totim = times[-1])[0]
File /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flopy/utils/binaryfile.py:1271, in
CellBudgetFile.get_data(self, idx, kstpkper, totim, text, paknam, full3D)
1269 text16 = None
1270 if text is not None:
-> 1271 text16 = self._find_text(text)
1272 paknam16 = None
1273 if paknam is not None:
File /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/flopy/utils/binaryfile.py:1020, in
CellBudgetFile._find_text(self, text)
1018 if text16 is None:
1019 errmsg = "The specified text string is not in the budget file."
-> 1020 raise Exception(errmsg)
1021 return text16
Exception: The specified text string is not in the budget file.
I'm very new to MODFLOW so do forgive me for my massive postings recently (and many of them are very basic things...) I'm very much appreciated for your kind help!
Beta Was this translation helpful? Give feedback.
All reactions