Please enable JS

Blog

ROMS Installation

May 20, 2022

Installing and Setting Up ROMS – for the Upwelling Test Case

To install and setup ROMS on your Linux Ubuntu machine, do the following steps. You need an Internet connection to download the required files.

  1. Note that this step might be repetitive of step 3. Navigate into the intended folder. In the console or terminal, type the command below to download ROMS files from the ROMS repository to the local directory roms_project.

    $ svn checkout --username yusriy https://www.myroms.org/svn/src/trunk roms_project

    Note that, if you have made your own myroms.org account, you can use your own username in place of yusriy. Input the password for the account when prompted.

  2. Create another folder called roms and navigate into the folder.

    $ mkdir roms
    $ cd roms

  3. Copy the ROMS files into the trunk of the new folder and the subfolder trunk.

    $ svn co https://www.myroms.org/svn/src/trunk ./trunk

  4. Create another directory for projects, roms_project.

    $ cd
    $ mkdir roms_project
    $ cd roms_project
    $ mkdir test
    $ cd test

  5. Copy the build_roms.sh file into the test folder.

    $ cp ~/roms/trunk/ROMS/Bin/build_roms.sh .

  6. Modify the build_roms.sh file using the nano command to choose the correct directories and compilers. Search for the lines shown below and modify the code.

    $ nano build_roms.sh <------------- Nano is an app to edit a text file
    export ROMS_APPLICATION=UPWELLING # the test case name
    export MY_ROOT_DIR=${HOME}/ROMS
    export MY_PROJECT_DIR=`pwd` <----- ‘pwd’ prints the current working directory, i.e., roms_project
    export MY_ROMS_SRC=${MY_ROOT_DIR}/trunk
    #export USE_MPI= # disable <----- use # to disable or comment a line
    #export USE_MPIF90= # disable
    #export FORT=ifort # disable
    export FORT=gfortran # enable
    #export FORT=pgi # disable
    export USE_DEBUG=on # enable
    export USE_NETCDF4=on # disable by deleting “on”; leave it on if netcdf4 is installed
    export MY_HEADER_DIR=${MY_PROJECT_DIR} # enable
    export MY_ANALYTICAL_DIR=${MY_PROJECT_DIR} # enable

  7. Copy files from the source folder to the working directory. The upwelling.h and roms_upwelling.in are used in this example.

    $ cp ~/roms/trunk/ROMS/Include/upwelling.h .
    $ cp ~/roms/trunk/ROMS/External/roms_upwelling.in .

  8. Copy files from the source folder to the working directory.

    $ cp ~/roms/trunk/ROMS/External/varinfo.dat .

  9. Update the roms_upwelling.in file by searching for the varinfo.dat line and modifying the path. When editing then *.in file, VARNAME should be the location of varinfo.dat, which will be copied to the working directory. This can vary based on the directory structure.

    $ nano roms_upwelling.in
    $ VARNAME=~/roms_project/upwelling/varinfo.dat

  10. Copy the ana_smflux.h files from the source folder to the working directory. If the test case requires input forcing, the *.in file would need to be edited. Find the section on the input forcing to make the changes. The usual change for the test case is to correct the directory of the data file.

    $ cp ~/roms/trunk/User/Functionals/ana_smflux.h .

  11. Compile the executable.

    $ ./build_roms.sh -j 2

  12. After successfully building the executable run the model by typing

    $ ./romsG < roms_upwelling.in


Notes on ROMS Installation

Note 1: If failed to build the executable, check the versions of gfortran and netcdf.

$ gfortran --version
$ nc-config --version
# And search for their location in the PC
$ which gfortran
$ which nc-config

Note 2: Install gfortran and netcdf using the same compiler (e.g., gfortran).

Note 3: Edit the appropriate (e.g., Darwin-gfortran) file in the Compilers folder of the source folder by updating the path of the netcdf and compiler (gfortran). Need to search the file for the entries. The most important netcdf file is the netcdf.mod and typesizes.mod file that should be in the include folder. Two folders need to be set the correct path: the include and the lib folders.

Note 4: One entry to set gfortran is the INCDIR := /usr/local/bin entry in the compiler file.

Note 5: To update Linux, type the following commands.

$ sudo apt-get upgrade
$ sudo apt-get update

Note 6: To install gfortran, type the following commands.

$ sudo apt-get install gcc gfortran

Note 7: To install netcdf4, type the following commands.

$ sudo apt-get install libnetcdf-dev libnetcdff-dev

Note 8: To check netcdf version, type the following command.

$ nc-config --all

Note 9: On Linux, the pathway for the installation is:

/usr/bin/gfortran
/usr/bin/nc-config

Note 10: Install make if not installed yet:

/sudo apt-get install make

CONTACT US

EXPERIMENT

LATEST PUBLICATIONS

This research is funded by the Universiti Sains Malaysia Research University Grant No. 1001/PTEKIND/811316 and Bridging Grant 2018 Grant No. 304.PTEKIND.6316289.

Some of the sensors used are contributed by Elite Scientific Instruments Sdn Bhd. A-LG-03, Block A, Serdang Perdana Selatan, Section 1, 43300 Seri Kembangan, Selangor Darul Ehsan, Malaysia Tel.: +603 89456100; +603 89454613 (Office) | Fax.:+603 8945 7100 | E-mail: sales@esi.com.my