https://www.myroms.org/wiki/index.php/Tutorials
This post will remain for historical reasons only.
Hi All,
I am new to ROMS... new to Linux... and trained as a biologist. For me, the path of learning ROMS has been a bit like off-roading... thrilling and exciting, but it gives me back pain (due to hours on Google). However, I decided that my first post on this forum should not be about asking questions. I prefer to start by posting a bit of what I have done so far. Hopefully this would help new(er) ROMS users!
===============================================
Disclaimer: This post was written for the very beginners. Some parts may be a bit tedious for more advanced users or people with solid Linux knowledge.
The following recipe will guide you through the steps required to download, compile and run ROMS on Windows XP or Vista.
(1)Register
The very first thing to do is to Register. After some checking, ROMS crew will give you a username and a password within a day or two. While you wait, you can prepare your PC with lots of ancillary software that you will need. See below...
(2) Install Cygwin
ROMS runs on a Unix or Linux command-line environment. So, to run ROMS on Windows, first we need to install a Linux emulator for Windows. We need to download and install Cygwin!
- * Download: Go to the Cygwin website and download the setup.exe file, by clicking on any of the cygwin-install icons. Or simply click here to start the download.
* Open the recently downloaded setup.exe file
* Select to "Install from Internet"
* Keep the selected defaults (i.e. "All Users" and "Unix / Binary")
* Choose a path where to save Cygwin, I chose: C:\Program Files\cygwin
* Select Internet Connection... likely "Direct Connection" if you have high speed internet.
* Select a download mirror-site. Choose one close to you... University sites are usually reliable.
IMPORTANT: You will need to tell cygwin to install some modules that are not installed by default.
* Install Perl: As shown in the figure below, find the Perl Category and click on "Default" until it turns into "Install".
* Install X11: Do the same in the category of X11... (I needed X11 to run applications on a remote computer... technically you don't need this to run ROMS on Windows... however, I haven't install Cygwin without X11 so I'm not sure that some modules installed under X11 may be required later... feel free to experiment and leave out X11).
* Expand the window and click on the "View" button on the upper right corner (shown below), until it toggles into "Full" view.
* Install gcc=g++: Scroll down and find "gcc-g++" (on the package column). Click on "Skip" (1st column) until it shows a version number (and a box selected with an X)...see image below.
* Install GNUmake: Similarly, scroll down and find "make" (on the package column). Click on "Skip" (1st column) until it shows a version number (and a box selected with an X). See below.
* Click next. A list of dependencies will show... install them all by making sure the tick-mark (bottom left) is on... and click "next"
* Make a cup of coffee. Sit back. The download/installation took about 30 min on my machine.
This Fortran compiler works in cygwin / Windows. In theory, you should be able to install other Fortran compilers instead, but I just didn't have luck with the others I tried. If you don't know what is compiling... read point 8 below.
- * Go to the g95-project website and download the G95 Source Code. Or simply click here to start the download.
* Save it inside the cygwin folder C:\cygwin
* Now you have to open cygwin and go to the place where you save the g95-x86-cygwin.tgz.tar file. Here you need to know that cygwing uses the folder C:\cygwin\cygdrive as a pseudo-drive. When cygwin starts, you will be able to see all your files and folders that you have in your Windows-user root (say... C:\Users\Administrator\ ), but they will appear to be in a different location (i.e. /cygwin/cygdrive/c/Users/Administrator/ ). This is just cygwin's way to emulate a Linux-type hard-drive inside Windows.
IMPORTANT to keep in mind:- * Cygwin's home directory, which is where cygwin opens by default is /cygwin/cygdrive/c/Users/Administrator/ but when in it, cygwin abbreviates it as ~
* Cygwin's HOME directory (i.e. ~) = C:\Users\Administrator\ in Windows Explorer
* Cygwin's ROOT directory (i.e. /) = C:\cygwin\ in Windows Explorer
* PASTE: To paste text in the cygwin window, right-click on the cygwin symbol on the left-upper corner of the window. Chose Edit > Paste.
* Here are some websites where you can learn more Linux commands
http://www.howtoforge.com/useful_linux_commands
http://www.tuxfiles.org/linuxhelp/cli.html
Ok back to g95... open cygwin and go to the root directory. To do this type cd / (cd = command for: 'change directory"). Now that you are in the root directory, type ls (command for: "show contents of this directory"), you should see our recently downloaded g95-x86-cygwin.tgz.tar file.
*Extract (or unzip) g95-x86-cygwin.tgz.tar by typing:*This should install g95 in /usr/local/bin and its documentation in /usr/local/doc/g95Code: Select all
tar -xvzf g95-x86-cygwin.tgz.tar
- * Cygwin's home directory, which is where cygwin opens by default is /cygwin/cygdrive/c/Users/Administrator/ but when in it, cygwin abbreviates it as ~
ROMS needs NetCDF to read input files and to write output files. NetCDF is free to download from Unidata. However, the executable file available is not good for ROMS. We need get the source code and recompile an executable file that is ROMS-friendly. Here are the step-by-step instructions:
- * Go to the Unidata website and download the NetCDF C/C++/Fortran Source Code and Documentation. Or simply click here to start the download.
* Same as before, save the file in the cygwin folder C:\cygwin
* Unpack it by typing:* Go to the location where it unpacked by typing cd netcdf-3.6.2 and start the compilation by typing the line below... It will take about 10 minutes. Enough to start a fresh batch of coffee.Code: Select all
tar -xvzf netcdf.tar.Z
* Then, type the text below... this will take just about enough the time for the coffee to brew.Code: Select all
CC=gcc FC=g95 CPPFLAGS=-DpgiFortran FFLAGS=-fno-second-underscore FCFLAGS=-fno-second-underscore ./configure
* Finally, type the text below... this is fast... just enough to mix coffee, sugar and milk.Code: Select all
make check
Well done! Have a sip!Code: Select all
make install
This is software needed to download ROMS source code... I used a GUI for subversion called Tortoise (wonderful and free)... This program is an ADD-ON for Windows Explorer.
- * First download the installer at the TortoiseSVN website. Or simply click here to start the download.
* Open the installer and follow instructions.
* Restart your computer (The Installer asks you to do so).
This section assumes that you registered and obtained your ROMS username / password as indicated in section (1).
- * In Windows Explorer, create a folder for ROMS in a place easy to find under cygwin... let say under C:\cygwin\ (I named my folder simply ROMS)
* Then, using Windows Explorer, get into the folder you just created and right-click... choose "Checkout".
* Type the URL where ROMS lives: https://www.myroms.org/svn/src ...and click Ok
* Enter your username and password... poor another cup of coffee and let the download begin! (Takes ~8 min)
NOTE: In Windows VISTA there was a problem at the end of the download. Tortoise couldn't access the .svn folder. I think this will cause problems when getting ROMS updates. However, all source code got downloaded, compiling was successful and test case ran ok. This problem DIDN'T occur in Windows XP.
(7) Modify makefile and compiler file
Now you need to modify 2 files so ROMS can works properly.
- * In windows explorer, go to the folder where you put ROMS (for me... C:\cygwin\ROMS)
* Go into the trunk directory and open the file named makefile using wordpad or your preferred text editor (except Notepad).
* Scroll down until you find FORT ?= ...modify it so it reads FORT ?= g95 ...as shown below.
* Save and close the makefile
* Then go into the Compilers folder and open CYGWIN-g95.mk using wordpad
* Now you have to tell ROMS where to find the NetDCF include and library directories. In the lines below I wrote the path where I installed NetCDF (step 4 above). If you follow my steps, your path is likely the same. Nevertheless, you should check.Code: Select all
NETCDF_INCDIR ?= /usr/local/include NETCDF_LIBDIR ?= /usr/local/lib
Also, you have to be careful because the text NETCDF_INCDIR and NETCDF_LIBDIR appears a few times in the file. Use the pic below to guide you.
*Save and close the CYGWIN-g95.mk file
(8 ) Compile ROMS
Before you run ROMS, you need to compile it to create an executable oceanS file. ROMS Source-Code files are readable by humans while executable files are readable by computers. The compilation process translates the source files into executables. Here are the instructions:
- * In cywin, go to the trunk directory where the makefile lives. For me... cd /ROMS/trunk
* Then type...* and then type...Code: Select all
make clean
* If lots of stuff comes on the screen... then you are good. Poor one more cup of coffee, sit back, and enjoy the compiling show. This will take ~15 min.Code: Select all
make
* When it finishes... type ls ...if you can see oceanS (your executable file), then the compilation was successful.
- * In cygwin and within the trunk directory, where your oceanS file lives.... type:
If lost of numbers are displayed on the screen... ROMS is running! Poor a one last cup of coffee and enjoy the show (~15 min). Out of the box, ROMS comes programed to run the Upwelling test case, which is what you are running now. When if finishes, the following output files are created:
Code: Select all
./oceanS < ROMS/External/ocean_upwelling.in
- ocean_avg.nc
ocean_dia.nc
ocean_his.nc
ocean_rst.nc
To learn one way to visualize them, click here. - ocean_avg.nc
Now comes the hard part: Learn how to use ROMS. But by now you are probably all coffeed-up and ready learn more. Click here for a good place to start.
Good luck!
Diego
PS. Just as I was reviewing the last changes to this post, the power when off (wicked storm in Halifax). Oh well, the second time was definitely faster to write.