Ocean Modeling Discussion


Search for:
It is currently Wed Feb 21, 2018 3:24 pm

Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Author Message
 Post subject: My ROMS
PostPosted: Wed Feb 14, 2018 3:37 am 
User avatar

Joined: Tue Jul 01, 2003 4:12 am
Posts: 494
Location: NIWA
Like many ROMS users--I suspect--I have my own lightly hacked version of the ROMS source code and a collection of roms-related scripts. I have just put a selection of these on GitHub.com for the edification and amusement of the ROMS community. There are 3 repositories:

  • roms-trunk-mgh: There are two branches in this repository. The roms-trunk branch is the code from the Rutgers Subversion repository trunk. The master branch is my locally modified copy, into which I regularly merge from roms-trunk. The modifications are minor. I have submitted a few to the Trac system as bug fixes/improvements and there are a few more I may submit. (I've just discovered the delights of using Meld as a Git difftool, which makes it easy to review the differences.) One that I won't be submitting (because it only makes sense to use it for code that's managed by Git) is one that I've just finished: printing Git rather than Subversion revision information to the log file.
  • roms-scripts-mgh: Bash and Python 3 scripts for building the model executable, creating a series of model input files for a multi-segment run, and post-processing model output files. The one I'd specifically like to mention is roms_build, which does the same job as build.bash, but avoids the need to have a separate script for every simulation.
  • roms-test-mgh: This is structured like roms-trunk-mgh, but based on the Subversion repository test directory. The roms-test branch is the Rutgers test tree and the master branch is my modified version. I have been working though a few of the simulations replacing the build.bash script with a "build environment" file, .build_env, required by roms_build.

Regarding the Git revision information, here is an excerpt from some model output:
 Input Script  : ocean_inlet_test.in

 Git Root URL  : git@github.com:hadfieldnz/roms-trunk-mgh.git
 Git Revision  : branch master commit 51965b32fdaf4014a3d69b96f94c27efad45aabb

 Local Root    : /home/hadfield/ROMS/roms-trunk-mgh
 Header Dir    : /home/hadfield/ROMS/roms-test-mgh/inlet_test
 Header file   : inlet_test.h
 Analytical Dir: /home/hadfield/ROMS/roms-test-mgh/inlet_test

One cool thing about this is that Git hashes are globally unique, so the commit identifier, 51965b32..., uniquely identifies the codebase for that model run. And this particular commit is on GitHub.com in a public repository, so anyone can find it by entering the hash code, or just the leading digits, into the GitHub.com search box. It's a bit like a DOI system for code revisions.

Actually the above will hold true only if the working copy was clean when the model was built, i.e. without any untracked or uncommitted changes. Generally you should only build from a clean repository, but you might do otherwise by mistake, or when debugging. So I'm going to add a field based on git status output to warn about dirty working copies.

The roms_build script, as I said, is a single replacement for the simulation-specific build.bash scripts, but it requires a bit of guidance to carry out this role:
  • Platform-specific environment variables (eg. FORT, USE_NETCDF4) should be set in the shell before invoking roms_build. I do this with Bash functions defined in .bashrc--see the attached file for examples.
  • Simulation-specific environment variables are specified by a "build environment" file (./build_env by default)--see this example.
  • The roms_build script accepts options to control the compilation mode: -o for OpenMP, -m for MPI, -g to turn on bounds-checking, traceback, etc.

The license is MIT so you can do what you like with this stuff. I'd appreciate suggestions for improvements. Documentation is a bit thin, I'm afraid.

File comment: Bash functions to set ROMS variables on different platforms
bash_functions.txt [2 KiB]
Downloaded 3 times
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group