Simulation Error

95 views
Skip to first unread message

Omowumi Erukubami

unread,
Oct 6, 2023, 11:42:49 PM10/6/23
to MODFLOW Users Group
"Hi everyone,

I am creating a modflow model in FloPy. This model has two rivers as some of its boundary conditions. I have intersected the BCs with the model grids appropriately as seen when I visualize them (i.e., they look correct when I plot them). However, whenever I try to run the simulation, I get the attached error about "file already open". I interpreted this as FloPy being unable to open the the river package a second time (for the second river BC). I have tried to resolve this error using a method I found in FloPy documentation by appending one of the packages to the other ("MfList.append"). However, I discovered that this method is for mf2005 and doesn't work with mf6. 

Does anyone have suggestions for how I can use two different rivers for BCs in mf6 without getting this error?

Thank you!
Omowumi

Mart Dayniel

unread,
Oct 7, 2023, 9:54:09 AM10/7/23
to MODFLOW Users Group
Hi Omowumi,

It's a bit difficult to diagnose this with certainty without seeing the code, and/or the list file. But my first guess is that perhaps you should not append to the first flopy.mf6.ModflowGwfriv object, but instead you should create another one. So something like this:
 import flopy as fp
 riv1 = fp.mf6.ModflowGwfriv(gwf, **riv1_properties)
 riv2 = fp.mf6.ModflowGwfriv(gwf, **riv2_properties)


Regards,
Mart

Omowumi Erukubami

unread,
Oct 9, 2023, 10:23:17 PM10/9/23
to MODFLOW Users Group
Hi Mart,

Thank you for your response! That is exactly what I did and got the aforementioned error.

I have attached a copy of my code to this response. I look forward to hearing from you.

Thanks!
Omowumi

Bow_flopy.ipynb

Mart Dayniel

unread,
Oct 10, 2023, 6:25:35 AM10/10/23
to MODFLOW Users Group
Can you try specifying a unique filename for each riv object?

riv_sjr = f.mf6.ModflowGwfriv(gwf, stress_period_data=riv_spd, filename="riv_sjr.riv")
riv_mkr = f.mf6.ModflowGwfriv(gwf, stress_period_data=riv_spd, filename="riv_mkr.riv")

Omowumi Erukubami

unread,
Oct 11, 2023, 8:16:13 AM10/11/23
to MODFLOW Users Group
Hi Mart,

I am still getting the same error message. 

My idea of combining both BCs came from an example I found in Mf2005 documentation (attached below). I am stuck at this point. If you have any more insights, please let me know.

Thanks!
Omowumi
Screenshot 2023-10-11 at 7.10.03 AM.png
Reply all
Reply to author
Forward
0 new messages