MODFLOW and Flopy on Linux is possible?

752 views
Skip to first unread message

Rodrigo Brust

unread,
Jul 19, 2021, 11:27:40 PM7/19/21
to MODFLOW Users Group
Hey, folks! How are you?

Well, recently  I've been shifting from Windows OS to Linux OS, and in this time, I got a new job that requires MODFLOW on my PC.

I'd like to know if there's any way to download it to Ubuntu, besides Wine. 

If not, is MODFLOW via Wine stable? The performance is resonable? 

I took a look in old questions, but there weren't very conclusive. 

I appreciate your help.

Rodrigo.

Giovanni Firmani

unread,
Jul 20, 2021, 3:34:46 AM7/20/21
to mod...@googlegroups.com
you can compile the open source MODFLOW fortran codes in linux. There is plenty of documentation on the net. One example can be this:


If you are familiar with python, you can also compile MODFLOW using the module flopy-pmake:


Hatari lab also pre-compiled some stuff here:


But I would download the latest version and recompile everything

Good luck
Gio

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/modflow/3683c13c-5e54-403b-826c-0dbaf258a3dcn%40googlegroups.com.

Joseph Hughes

unread,
Jul 21, 2021, 12:43:07 AM7/21/21
to MODFLOW Users Group
Statically linked linux executables for the many of the USGS codes (MODFLOW-2005, MODFLOW 6, MODPATH, GSFLOW, etc.) are also available at:

Scott Elliott Boyce

unread,
Jul 21, 2021, 12:43:15 AM7/21/21
to MODFLOW Users Group
For MODFLOW-OWHM I recommend using WINE when it is available on the Linux OS. I do also include an Ubuntu compiled executable binary  along with the download (I call the ubuntu executable bin/mf-owhm.nix ). 

Just an fyi, anything that runs on MODFLOW-2005 and MODFLOW-NWT will run on MODFLOW-OWHM, so if you are working in any of those archs, then it might be easiest to just pull the most recent .nix on there (and let me know if it works).

If you go to
that will have download links (scroll down past the code) for the latest executable for both windows and ubuntu linux.

It also includes a GNU makefile that can build MODFLOW for linux or windows, but requires either gfortran 10 or intel fortran. Earlier versions of gfortran dont work due to several compiler bugs that GNU fixed in v10 but has yet to backport, so right now Intel is the only compiler option (which is recommended anyways cause it tends to produce faster running executables). 

All you have to do for the makefile is open it in a text editor and answer some of the questions (just following the comments). 
When you are ready to compile you just have to type the word make at while in the directory with the makefile and everything should be handled automatically.
I've tested this makefile on several Linux OSes and Windows running MinGW GNU Make.
*Note that you only need a C compiler if you are using the GMG solver package, which I would not recommend if you do not need to use it (PGCN and NWT are better options).

#############################################################################
#############################################################################
###   Set the following Variables                                         ###
#############################################################################
#############################################################################
#
# Compilation Configuration-Optimization Scheme
#   ===> Accepted Answers: RELEASE, DEBUG
CONFIG := RELEASE
#
# Decide if you want to compile the GMG solver.
#  This is the only C code dependency. If set to No then the C compiler is not used.)
#  ===> Accepted Answers: YES, NO
USEGMG := NO
#
# Compilation Software 
#   ===> Accepted Answers: INTEL, GCC, LLVM       --> LLVM not fully-supported yet
COMPILER := INTEL
#
# Define the Fortran Compiler
#                    ===> For example: gfortran, gfortran-10, ifort
F90 := ifort
#
# Define the C Compiler
#   ===> Accepted Answers: gcc, icc
CC  := icc
#
# ----------------------IGNORE THE REST OF THE MAKEFILE--------------------------
#

Hope that helps out,

Scott

Saul Montoya

unread,
Jul 21, 2021, 1:18:26 PM7/21/21
to mod...@googlegroups.com
Hi

You can have executables compiled in Linux under some USGS repositories: 

We actually have done several models in Linux, mostly working with Flopy. You wont notice the difference between working with Linux and Windows. If you want to work with Model Muse, you can use Wine. 
If you want to fancy around with MODFLOW-OWHM Scott is a nice guy that can give you much support.

Viva el software libre!

Saul

Saul Montoya M.Sc.
Director

Dir: Caminos del Inca 288 dpto 302, Surco, Lima 33  |  Tel.: (511) 4491922  | Cel: Nuevo! (51) 984 115 861  |  Web: gidahatari.com



--
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.

Rodrigo Brust

unread,
Aug 4, 2021, 1:07:44 AM8/4/21
to MODFLOW Users Group
Hello, everyone. I really appreciate your help. 

I've already shifted my OS and installed ModelMuse via Wine. Until now, it works good. 

The only challenge I'm facing right now is the instalation of pymake and flopy. I'm struggling with this, and I think I didn't understand quite well.

You guy might help me?

Things I have already done

1 - pip install flopy


3 - already downloaded the .exe from Github (https://github.com/MODFLOW-USGS/executables) and put in Documents/Modflow/src

The thing is: I'm missing something in the installation that I can't see. 

When I run this pymake example: 

import pymake
pm = pymake.Pymake()
pm.srcdir = 'src'
pm.target = 'mf6'
pm.include_subdirs = True
pm.build()

It returns me this error

image_2021-08-03_095441.png


I also tried this Hatari Lab's tutorial (https://hatarilabs.com/ih-en/unofficial-modflow-flow-and-transport-executables-for-linux-ubuntu-tested) , but Ubunutu wont let me run the very first line .

I'm kinda lost, I'm quite new to this MODFLOW and Ubunutu world, and there aren't many tutorials. 

My settings
Ubunutu 20.04
Using Python 3.8 in Anaconda Environment

Rodrigo Brust

unread,
Aug 4, 2021, 7:49:51 AM8/4/21
to MODFLOW Users Group
I found the solution in this github issue: https://github.com/modflowpy/flopy/issues/1165#issuecomment-892233629

Joseph Hughes

unread,
Aug 4, 2021, 12:16:18 PM8/4/21
to MODFLOW Users Group
If you downloaded the executables from https://github.com/MODFLOW-USGS/executables there isn't any need to use pymake to build the executables. You do need to decide if you are going to run the executables in linux or use the windows executables with Wine and download the appropriate zip file for the OS.

To run make_mf6.py in the pymake examples directory you would type:

   python make_mf6.py

This would download the distribution and build the executable using gfortran. If you wanted to build with a compiler other than gfortran you would type:

    python make_mf6.pt -fc ifort

In both cases you would need to have the compiler installed and be able to run it from the terminal.

Reply all
Reply to author
Forward
0 new messages