How to run SWAT in Linux

1,476 views
Skip to first unread message

Rahman Mostafaie

unread,
Jul 11, 2014, 10:21:20 AM7/11/14
to swat...@googlegroups.com
Dear friends

I want to run SWAT in Linux, I can't use ArcSWAT for some reasons, so I want to use this model in Linux.
I can't find any manual about this,
If somebody knows how to do this job, please help me.


Warm Regards

Zhiqiang Yu

unread,
Jul 11, 2014, 5:03:45 PM7/11/14
to swat...@googlegroups.com
I never try but it seems SWAT give a linux version on their website. Download that and put into the txtinout folder and run.

Rahman Mostafaie

unread,
Jul 11, 2014, 5:17:57 PM7/11/14
to swat...@googlegroups.com
Hi
Thanks alot, I'll try it.

Best,

Grey Evenson

unread,
Jul 12, 2014, 9:25:46 AM7/12/14
to Rahman Mostafaie, swat...@googlegroups.com
Hello,

Be sure to note that you cannot set up the model in linux,  The only *up-to-date* model construction software is ArcSWAT, and as I'm sure you know, you cannot run ArcGIS Desktop in linux.  They used to support a GRASS plugin but I believe that got left behind years ago.

In my opinion, an open source model construction package is a significant need for our model community.  Somebody please develop a QGIS plugin!

That said, as Zhiqiang notes, you can run the model executable (post text file construction) no-problem in linux.  The linux executable they have on the website is for an outdated model version, last I checked.  So you may want to compile the latest source code yourself.




--
You received this message because you are subscribed to the Google Groups "SWAT-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swatuser+u...@googlegroups.com.
To post to this group, send email to swat...@googlegroups.com.
Visit this group at http://groups.google.com/group/swatuser.
For more options, visit https://groups.google.com/d/optout.

Jim Almendinger

unread,
Jul 12, 2014, 6:03:48 PM7/12/14
to evenson 5, Rahman Mostafaie, swat...@googlegroups.com
There is the free MapWindows version, MWSWAT, available at waterbase.org, a project of the United Nations University.  I've never tried it, but it seems to stay current with new versions of SWAT.  
Colleagues have said great things about Q-GIS, and it would be a good option.  I know I'd like it if there were an interface with SWAT -- since I work for a non-profit that is always scraping for funds, keeping up with the latest ArcGIS software has been difficult (unless I can convince Esri to give me their non-profit discount).  But I recognize the significant investment in ArcSWAT -- it would be tough to start all over again on a new platform.  
-- Jim


From: "Grey Evenson" <greye...@gmail.com>
To: "Rahman Mostafaie" <amost...@gmail.com>
Cc: swat...@googlegroups.com
Sent: Saturday, July 12, 2014 8:25:43 AM
Subject: Re: [SWAT-user:4888] Re: How to run SWAT in Linux

NOTE: This message was trained as non-spam. If this is wrong, please correct the training as soon as possible.
Spam
Not spam
Forget previous vote



--
Dr. James E. Almendinger
St. Croix Watershed Research Station
Science Museum of Minnesota
16910 152nd St N
Marine on St. Croix, MN  55047
tel: 651-433-5953 ext 19


Grey Evenson

unread,
Jul 13, 2014, 10:25:13 AM7/13/14
to Jim Almendinger, Rahman Mostafaie, swat...@googlegroups.com
Very true, Jim.  I'm not sure what the folks in Texas have invested in the ArcGIS plugin.  I'm young-enough and low-enough in the hierarchy of things that I don't yet worry about budgets and such!  

andreasculbertson

unread,
Jul 23, 2014, 3:21:23 PM7/23/14
to swat...@googlegroups.com
I have noticed that the TAMU website provides only SWAT rev 583 for linux. The source code is also available. Does anyone have experience compiling the Fortran code in Linux? I typically work in Windows, however I would like to use a Linux super computer for my SWAT runs. The super computer website recommends using the ifort compiler. I am able to compile each fortran file (*.f) to an object file (*.o), but when I try to compile the object files, the compiler gives errors about multiple definitions. Also, I believe the source code available on the SWAT website is for the most recent revision. Is there any way to obtain the source code for rev 613?

Thanks,
Andreas

Grey Evenson

unread,
Jul 23, 2014, 3:58:40 PM7/23/14
to andreasculbertson, swat...@googlegroups.com
Zhiqiang Yu has some good blog posts on compiling in windows which is pretty much equivalent to doing it in linux.  You simply don't put the ".exe" extension when you're naming the swat file.  So look for those if this isn't clear.  Generally, you need to compile modparm.f first so:

1- comment out the include modparm.f line in the main.f file
2 - create the modparm object file (ifort -c modparm.f) 
3 - create swat (ifort -o swat *.f)

There might be a few other bugs within the code related to line extension operators...

Also, you might as well through the -fast flag in those commands.  I think it helps.


--

andreasculbertson

unread,
Jul 24, 2014, 11:05:55 AM7/24/14
to swat...@googlegroups.com, andreas.c...@gmail.com, even...@osu.edu
That worked perfectly! I just had to include the f90 files (changed step 3 to ifort -o swat *.f *.f90). Thanks!

Anil Aryal

unread,
Mar 2, 2017, 12:13:42 AM3/2/17
to SWAT-user
Reply all
Reply to author
Forward
0 new messages