* I am new to ROMS - new to linux.
* I got ROMS up & running and ran several test cases
* I read most articles in WikiROMS, most tutorials / Webinars, most posts in this forum and the 2000 SCRUM manual.
* I started with (and successfully ran) a simple 5 by 5 grid application with periodic boundaries.
* I started scaling up to a coastal grid when... hell broke loose! ...I keep causing ROMS to blow-up within the first time-step. I need help!
* Payment: In return for your help, I plan to pay with a nice series of WikiROMS tutorials... so that the next generation of ROMS users don't have to ask too many questions in this forum.
-------------------
Step one
As I said above, I started with a 5 by 5 grid with East-West and North-South periodic boundaries that I got from Katia Fennel. She uses this grid as a simple 1-D model to do quick tests. It seemed a good idea to start simple and work my way up. As I said, this first try ran fine, here are cpp definitions that I used for compilation:
Code: Select all
#define UV_ADV /* use to turn ON or OFF advection terms */
#define UV_COR /* use to turn ON or OFF Coriolis term */
#define UV_QDRAG /* use to turn ON or OFF quadratic bottom friction */
#define DJ_GRADPS /* use if splines density Jacobian (Shchepetkin, 2000) */
#define UV_VIS2 /* use to turn ON or OFF harmonic horizontal mixing */
#define MIX_S_UV /* momentum mixing on s-surfaces */
#define TS_DIF2 /* use to turn ON or OFF harmonic horizontal mixing */
#define MIX_GEO_TS /* tracer mixing on constant z surfaces */
#define TS_U3HADVECTION /* use if 3rd-order upstream horiz. advection */
#define TS_C4VADVECTION /* use if 4th-order centered vertical advection */
#define TS_MPDATA /* use if recursive MPDATA 3D advection */
#define SOLAR_SOURCE /* use if solar radiation source term */
#define NONLIN_EOS /* use if using nonlinear equation of state */
#define SALINITY /* use if having salinity */
#define SPLINES /* use to activate parabolic splines reconstruction */
#define AVERAGES /* use if writing out time-averaged data */
#define AVERAGES_FLUXES /* use if writing out time-averaged fluxes */
#define AVERAGES_AKV /* use if writing out time-averaged AKv */
#define AVERAGES_AKT /* use if writing out time-averaged AKt */
#define SOLVE3D /* use if solving 3D primitive equations */
#define EW_PERIODIC /* use if East-West periodic boundaries */
#define NS_PERIODIC /* use if North-South periodic boundaries */
#define MY25_MIXING /* use if Mellor/Yamada Level-2.5 closure */
#ifdef MY25_MIXING
# define N2S2_HORAVG /* use if Large et al. (1994) interior closure */
# define KANTHA_CLAYSON /* use if Kantha and Clayson stability function */
#endif
#undef ECOSIM
#if defined ECOSIM || defined BIO_FASHAM
# undef ANA_BIOLOGY /* use if analytical biology initial conditions */
# define ANA_SPFLUX /* use if analytical surface passive tracers fluxes */
# define ANA_BPFLUX /* use if analytical bottom passive tracers fluxes */
# define ANA_CLOUD /* use if analytical cloud fraction */
#endif
#define BULK_FLUXES /* use if bulk fluxes computation */
#ifdef BULK_FLUXES
# define EMINUSP /* use if computing E-P */
# define LONGWAVE /* use if computing net longwave radiation */
# undef ANA_RAIN /* use if analytical rain fall rate */
#else
# define ANA_SMFLUX /* use if analytical surface momentum stress */
# define ANA_STFLUX /* use if analytical surface temperature flux */
#endif
#if defined BULK_FLUXES || defined ECOSIM
# undef ANA_CLOUD
# undef PAPA_CLM /* ? */
#endif
#define ANA_SSFLUX /* use if analytical surface salinity flux */
#define ANA_BSFLUX /* use if analytical bottom salinity flux */
#define ANA_BTFLUX /* use if analytical bottom temperature flux */
Step 2: Varying the grid size
I modified the Matlab code that Katja used to create the 5by5 grid to do a 25by40 grid... Then I wrote Matlab code to do the corresponding initialization NetCDF file (i.e. that match the new grid size). The larger grid also ran fine. Then, I played with different initialization values and with different grid sizes, but with the same forcing file. All tests ran successfully.
Step 3: Realistic Grid and masking
I tried SeaGRID but my Matlab just keep crashing and not linking it. So I tried GRIDGEN but I got stuck with Python... so I decided to write my own Matlab code (following Katja's 5by5-grid as an example): I added the capability to rotate the grid, but I only allow for rectangular domains and squared grid cells. I also included bathymetry. Below is an image of the grid. The geographical location is a fjord in Nova Scotia called Ship Harbour. This first grid is probably too coarse, but it is just for testing.
The next figure is just a zoom of the figure above. I included, for reference, the rho, U, V and PSI grids. All graphs were generated with John Wilkin's version of pcolor (I was going to put a link to the download, but I can't find where I got it).
Then I created the masks. The rho_mask was created with the bathymetry (depths > 0 are land). Then I created the U, V and PSI masks from the RHO mask as follows:
Code: Select all
%This is a Matlab code snipet...
%u mask
for j = 1:length(mask_rho(:,1));
for i = 1:length(mask_rho(1,:))-1;
if mask_rho(j,i)==0 | mask_rho(j,i+1)==0;
mask_u(j,i) = 0;
else
mask_u(j,i) = 1;
end
end
end
%v mask
for i = 1:length(mask_rho(1,:));
for j = 1:length(mask_rho(:,1))-1;
if mask_rho(j,i)==0 | mask_rho(j+1,i)==0;
mask_v(j,i) = 0;
else
mask_v(j,i) = 1;
end
end
end
%psi mask
for j = 1:length(mask_rho(:,1))-1;
for i = 1:length(mask_rho(1,:))-1;
if mask_u(j,i)==0 | mask_u(j+1,i)==0 | mask_v(j,i)==0 | mask_v(j,i+1)==0;
mask_psi(j,i) = 0;
else
mask_psi(j,i) = 1;
end
end
end
Below is the RHO mask for the same (zoomed) domain of the figure above (blue=land=0 and red=ocean=1):
I recompiled ROMS with all the cpp's from above but including also masking and turning off the periodic boundaries.
Code: Select all
#undef EW_PERIODIC /* use if East-West periodic boundaries */
#undef NS_PERIODIC /* use if North-South periodic boundaries */
#define MASKING /* use if analytical masking is enabled */
ROMS run
I used the same forcing NetCDF file used in "step one" above... but I created a new initialization NetCDF file, where parameters where defined at the rho points. ROMS blew up in the first time step
I went back to the working 25 by 40 grid... and I did some basic experimentation:
* Turn off periodic boundaries.
RESULT: ROMS blows up
* Turn periodic boundaries back on and add a 5by5 island in the middle on the grid.
RESULT: ROMS blows up
* Same as above but with: #define MASKING
RESULT: ROMS blows up
* Modify as follows:
Code: Select all
#define WESTERN_WALL /*use if Western edge, closed wall condition*/
#define NORTHERN_WALL /*use if Northern edge, closed wall condition*/
#define SOUTHERN_WALL /*use if Southern edge, closed wall condition*/
#define EASTERN_WALL /*use if Eastern edge, closed wall condition*/
At this point is pretty obvious that I can keep going with this trial-an-error system for a few decades (or at least until November 2008 when the ROMS manual comes out). It is time to ask for help!
As I mentioned above, I plan to make tutorials for WikiROMS where I will include the "cleaned up" outcome of this process of setting up a realistic application. This will be very useful for next generations of users.
Thanks in Advance!
Diego