Difference between revisions of "ROMS Mac"

From WikiROMS
Jump to navigationJump to search
 
Line 3: Line 3:
Special thanks to Parker MacCready at the University of Washington. Most of this tutorial is taken verbatim from his website. The particular system this is tested on is a MacBook Pro running Mac OS X 10.5.4, Darwin 9.4.0.
Special thanks to Parker MacCready at the University of Washington. Most of this tutorial is taken verbatim from his website. The particular system this is tested on is a MacBook Pro running Mac OS X 10.5.4, Darwin 9.4.0.


{{note}}<span class="red">'''Note:''' This tutorial is quite outdated with but we hope to update it soon.</span>
{{note}}<span class="red">'''Note:''' This tutorial is quite outdated but we hope to update it soon.</span>


==Install Supporting Software==
==Install Supporting Software==

Latest revision as of 15:22, 28 January 2021

Tutorial: Installing ROMS on a Macintosh

Special thanks to Parker MacCready at the University of Washington. Most of this tutorial is taken verbatim from his website. The particular system this is tested on is a MacBook Pro running Mac OS X 10.5.4, Darwin 9.4.0.

NoteNote: This tutorial is quite outdated but we hope to update it soon.

Install Supporting Software

NoteNote: most of this software needs to be installed in the order given (e.g. you need Xcode to have the installation of gfortran be right, and you need gfortran to make NetCDF).

Xcode

Download the Apple Developers Tools Xcode, from developer.apple.com/technology/tools.html, click the Xcode 3: free download link. Follow the standard installation (this means that it will install itself when you click on it, and you just need to click to accept a few defaults). To download this you need to sign up as an ADC member, but if you already have an Apple account (e.g. for iTunes) you can use that. It is free. WarningCaution: the download is about 1 GB.

GNU Fortran Compiler

Get gfortran-4.2.3.dmg (the GNU Fortran compiler) from r.research.att.com/tools/ and follow the standard installation. If the install is successful, executing which gfortran in the Mac Terminal should give you the full path to the gfortran compiler:

which gfortran
/usr/local/bin/gfortran

GNU Make

NoteNote: if you already have version 3.8.1 you can skip this step.

Get make-3.8.1.tar.gz from ftp.gnu.org/pub/gnu/. Create the directory ~/src (~ is your home directory, normally a sub-directory of /Users). Put the tar file into ~/src (note that the Mac download tool already gets rid of the ".gz"), and then extract it by executing:

tar xvf make-3.8.1.tar

Next, go into the new directory make-3.8.1 and execute the following three commands:

./configure
make
sudo make install

Perl

Perl is most likely already installed. However, if executing which perl from a Mac Terminal tells you perl isn't found, you will need to install it.

NetCDF

Download netcdf-3.6.3.tar.gz from www.unidata.ucar.edu/software/netcdf (down on the lower right part of the page). This is the source code for NetCDF 3, which you are going to compile on your machine using gfortran, the same compiler you will use for compiling ROMS. You could also move up to NetCDF 4, but this requires installing HDF5. Perhaps those instructions will be added later. Put the tar file in ~/src, extract it, and go into the directory netcdf-3.6.3 that is created. Also, make sure that the directory /opt exists on your machine. Then execute (the second command has a capital "o" not a zero):

export FC=gfortran
export FFLAGS='-O3'
./configure --prefix=/opt/gfortran/serial/netcdf3
make
make check
sudo make install

Subversion (SVN)

Get subversion 1.5.2-2 from www.collab.net/downloads/community and follow the standard installation.

Download ROMS

This section assumes that you have registered and obtained your ROMS username/password.

Create the directory ~/ROMS and checkout the ROMS source code replacing 'joeroms' with your ROMS user name:

cd ~
mkdir ROMS
cd ROMS
svn checkout --username joeroms https://www.myroms.org/svn/src/trunk

You will see many lines stream by. When it finishes, type ls. You have a folder named trunk that contains the ROMS source code.

NoteNote: The first time you run the svn command you will be asked for your ROMS password and store it for future use.

Customizing the Build Script

The ROMS source code comes with a build script in the ROMS/Bin directory. Examples written with bash (build.bash) and csh (build.sh) are provided. For convenience, we will work with build.bash since bash is the default shell on a Mac. A full description of the build script can be found here.

  • At the same level as your new trunk directory create a new folder named Projects and change into it.
mkdir Projects
cd Projects
  • Create a folder named Upwelling and change into it. 'Upwelling' is the name of the ROMS test case we are going to compile and run.
mkdir Upwelling
cd Upwelling
  • Copy the roms_upwelling.in file into the Upwelling directory you just created.
cp ../../trunk/ROMS/External/roms_upwelling.in .
  • Copy the upwelling.h file into the Upwelling directory in the same way.
cp ../../trunk/ROMS/Include/upwelling.h .
  • Copy the build.bash file into the Upwelling directory.
cp ../../trunk/ROMS/Bin/build.bash .
  • Open the build.bash script you just copied into your Upwelling directory using your favorite text editor.
  • Scroll down until you find MY_ROOT_DIR and MY_ROOT_DIR. Set them as follows (replacing 'joeroms' with your Mac user name).
 export MY_ROOT_DIR=/Users/joeroms/ROMS
 export MY_PROJECT_DIR=${MY_ROOT_DIR}/Projects/Upwelling
  • Now set MY_ROMS_SRC to:
 export MY_ROMS_SRC=${MY_ROOT_DIR}/trunk
  • Make sure that MY_CPP_FLAGS is not set. I had to comment out one line with the # symbol like so:
#export MY_CPP_FLAGS="-DNPZD_POWELL"
  • We are compiling in serial using the gfortran compiler so make your build.bash match the following:
 export USE_MPI=
 export USE_MPIF90=
 export FORT=gfortran
  • Uncomment the line:
#export USE_MY_LIBS=on
to look like:
 export USE_MY_LIBS=on
  • Find the gfortran ) section inside the if [ -n "${USE_MY_LIBS:+1}" ] block.
  • Near the bottom of the gfortran ) section you will find the following lines:
      else
          export NETCDF_INCDIR=/opt/gfortransoft/serial/netcdf3/include
          export NETCDF_LIBDIR=/opt/gfortransoft/serial/netcdf3/lib
      fi
change them to:
      else
          export NETCDF_INCDIR=/usr/local/include
          export NETCDF_LIBDIR=/usr/local/lib
      fi
  • Save and close the build.bash file.

Create the Darwin-gfortran.mk file

ROMS does not have a Mac-gfortran make module so you will need to create one. Luckily, the Linux-gfortran.mk can be used without modification:

cd ~/ROMS/trunk/Compilers
cp Linux-gfortran.mk Darwin-gfortran.mk
cd ~/ROMS/Projects/Upwelling

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 cygwin, if you're not there already, go to the Upwelling directory:
cd ~/roms/Projects/Upwelling
  • Then type:
./build.bash
  • If lots of stuff comes on the screen then you are good. This will take ~15 min.
  • When it finishes type ls; if you can see oceanS (your executable file), then the compilation was successful.


Run ROMS

  • We need to make one change to our roms_upwelling.in file so open it with your favorite editor and find the following line:
    VARNAME = ROMS/External/varinfo.dat
    and change it to (again replacing 'joeroms' with your Mac user name):
    VARNAME = /home/joeroms/ROMS/trunk/ROMS/External/varinfo.dat
  • Save and close the roms_upwelling.in file
  • In cygwin, within the Upwelling directory where your oceanS and roms_upwelling.in files live, type:
./oceanS < roms_upwelling.in

If lots of numbers are displayed on the screen ROMS is running! Out of the box, ROMS comes programmed to run the Upwelling test case, which is what you are running now. When it finishes, the following output files are created:

ocean_avg.nc
ocean_dia.nc
ocean_his.nc
ocean_rst.nc


To learn one way to visualize them, click here.


Thats it! You got ROMS running!

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!