Running a model set up in Visual MODFLOW in flopy - "UNIT IS ALREADY BEING USED" error

446 views
Skip to first unread message

JHaas

unread,
Sep 22, 2016, 10:12:54 PM9/22/16
to MODFLOW Users Group
I am working with visual MODFLOW, but I would like to have the possibility to run/visualize my models on my linux system.

Seems like flopy would fit the bill, especially since I am using python anyways. I do understand that I cannot export every feature of visual modflow, but the "core" of the model are the standard modflow files (.LST, .BAS, .WEL, etc.) with only the name file being called "myproject.modflow.in", instead of the standard "myproject.NAM", correct?

So I should be able to simply run it, after correcting the hardcoded paths in the name file.

However, when trying to run it in flopy, I get a "CANNOT OPEN airport.LST ON UNIT   6 BECAUSE UNIT IS ALREADY BEING USED" error.

What could be the reason for this? It is only assigned once in the name file. Are there any specific procedures for exporting visual modflow to flopy/basic modflow?

Richard Winston

unread,
Sep 23, 2016, 6:12:15 AM9/23/16
to mod...@googlegroups.com
Your Linux version of MODFLOW is probably using unit 6 for output to the screen.  Just use a different unit number. 
--
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modflow.
For more options, visit https://groups.google.com/d/optout.

ashutosh singh

unread,
Sep 23, 2016, 11:38:50 AM9/23/16
to mod...@googlegroups.com
Hi!

Visual modflow might use different kind of formats. The nam file might look the same as does the other lpf files etc. but the fact is that there are differences. You cannot use ordinary modflow executable to run visual modflow models. I have encountered a lot of problems in running visual modflow models using ordinary modflow executables.The differences are small and difficult to be detected. Like a different way of writing hydraulic conductivities.
Instead the solution is to use modelmuse or pmwin because they produce files for modflow executables which can be directly used in Linux systems.
I have used it this way during my thesis work.



On Fri, Sep 23, 2016 at 11:48 AM, Richard Winston <rbwi...@mindspring.com> wrote:
Your Linux version of MODFLOW is probably using unit 6 for output to the screen.  Just use a different unit number. 


-------- Original message --------
From: 'JHaas' via MODFLOW Users Group
Date:09/22/2016 3:03 PM (GMT-05:00)
To: MODFLOW Users Group
Subject: [MODFLOW] Running a model set up in Visual MODFLOW in flopy - "UNIT IS ALREADY BEING USED" error

I am working with visual MODFLOW, but I would like to have the possibility to run/visualize my models on my linux system.

Seems like flopy would fit the bill, especially since I am using python anyways. I do understand that I cannot export every feature of visual modflow, but the "core" of the model are the standard modflow files (.LST, .BAS, .WEL, etc.) with only the name file being called "myproject.modflow.in", instead of the standard "myproject.NAM", correct?

So I should be able to simply run it, after correcting the hardcoded paths in the name file.

However, when trying to run it in flopy, I get a "CANNOT OPEN airport.LST ON UNIT   6 BECAUSE UNIT IS ALREADY BEING USED" error.

What could be the reason for this? It is only assigned once in the name file. Are there any specific procedures for exporting visual modflow to flopy/basic modflow?

--
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+unsubscribe@googlegroups.com.

To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modflow.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+unsubscribe@googlegroups.com.

JHaas

unread,
Sep 24, 2016, 12:04:47 AM9/24/16
to MODFLOW Users Group
Thanks Richard, that worked. I just assigned LST to some random number in my name file, and now it proceeded…

…to the next error.

" *** ERROR OPENING FILE "airport.PCG" ON UNIT    23
       SPECIFIED FILE STATUS: OLD   
       SPECIFIED FILE FORMAT: FORMATTED          
       SPECIFIED FILE ACCESS: SEQUENTIAL         
       SPECIFIED FILE ACTION: READ               
  -- STOP EXECUTION (SGWF2BAS7OPEN)"

I suppose that has to to with how the modflow executable is compiled (SEQUENTIAL vs STREAM, see e.g. here: https://github.com/modflowpy/flopy/issues/11), but if I check a PCG file from one of the flopy examples, it appears to be the same as my visual modflow file, only that there are multiple spaces between the inputs in visual modflow. but when I manually change those, I still get the same error, so I am afraid hpc is right.

Do you know any documentation about that? Problem is, everyone here is using visual modflow, but I absolutely hate it, when I get locked to some vendor.

Richard Winston

unread,
Sep 24, 2016, 9:40:24 AM9/24/16
to mod...@googlegroups.com
I take that back about the free format option. That can't be the problem because the error occurs when opening the file. File names are case sensitive on Linux. Maybe that is related.


-------- Original message --------
From: 'JHaas' via MODFLOW Users Group
Date:09/23/2016 12:34 PM (GMT-05:00)
To: MODFLOW Users Group
--
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+u...@googlegroups.com.

Richard Winston

unread,
Sep 24, 2016, 9:40:38 AM9/24/16
to mod...@googlegroups.com
Maybe you didn't specify the free format option in the basic package input file.

Chang Liao

unread,
Oct 1, 2016, 11:27:16 PM10/1/16
to MODFLOW Users Group
I haven't really used Visual Modflow, but according to my experiences based on Modelmuse and MODFLOW (Windows and Linux versions), the UNIT is explicitly defined using the NAM file.

The unit is the file ID of each input/output file used in MODFLOW, so I suggest you double check the NAM file before you run it under Linux.
As Richard suggest, some UNIT is system reserved, so I usually avoid using UNIT less than 10.
And there can be quite a few UNITs if you have a lot of packages in your model, you can actually design a little strategy so you can easily add new files in the future. 

To run the MODFLOW under Linux, you need to compile the source code following the instruction in the downloaded archive. Most of the time you will use FRER format. You also need to modify one file (I don't remember the name now) which specify the binary format under Linux.

Richard Winston

unread,
Oct 2, 2016, 1:13:55 AM10/2/16
to mod...@googlegroups.com
The file you would modify before compiling on Linux is "openspec.inc". The comments in the file tell you how to modify it.


-------- Original message --------
From: Chang Liao
Date:10/01/2016 8:37 PM (GMT-05:00)
To: MODFLOW Users Group
Reply all
Reply to author
Forward
0 new messages