Configuring ROMS for South of Java
description
Transcript of Configuring ROMS for South of Java
![Page 1: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/1.jpg)
Configuring ROMS for South of Java
Kate Hedstrom, ARSC/UAFOctober, 2007
![Page 2: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/2.jpg)
Requirements
• Input files– Grid– Initial conditions– Boundary conditions– Forcing
• Code changes– JAVA_1 cpp flag– ocean_java.in– makefile
![Page 3: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/3.jpg)
Define Grid Coordinate System
• Provide a coastline file and point to it with XCOASTDATA
• Run xcoast• Set the map
projection
![Page 4: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/4.jpg)
Specify the Grid Boundary
![Page 5: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/5.jpg)
Save and Recompute Corners to Make a Rectangular Grid
![Page 6: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/6.jpg)
Find lat,lon of Each Point, then Bathymetry
![Page 7: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/7.jpg)
Land Mask
• The bathymetry finder will optionally set the land mask based on sea level
• The land mask might not be quite how you want it, so run editmask
• Interactive matlab tool needing a matlab coastline file too
![Page 8: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/8.jpg)
Editmask
![Page 9: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/9.jpg)
Smooth the Bathymetry
![Page 10: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/10.jpg)
Another View
![Page 11: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/11.jpg)
Bathymetric Slopes
![Page 12: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/12.jpg)
Bathymetric Steepness
• Ratio of |h1-h2| / (h1+h2)
![Page 13: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/13.jpg)
Grid Metrics on a Sphere
![Page 14: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/14.jpg)
Initial and Boundary Files
• Matlab scripts to create them from the North Pacific run
• Requires matlab-netcdf interface• Requires rnt toolbox from Emanuelle
di Lorenzo• Tell rnt_gridinfo about both grids -
location of the files, vertical grid information
![Page 15: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/15.jpg)
![Page 16: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/16.jpg)
North Pacific at 18 km
• Run with CCSM CORE forcing and POP boundary conditions
• CORE files from 1958 through 2004• NPAC was run through 1976 so far• Pick a file from 1976 to use as initial
conditions 100 days before the end• Enrique saved four-day averages
![Page 17: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/17.jpg)
Southern Boundary v
![Page 18: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/18.jpg)
Initial Zeta
![Page 19: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/19.jpg)
Forcing Files
• ROMS can now internally interpolate from coarse forcing files to the ROMS grid
• Liz Dobbins prepared the CORE (Large and Yeager) forcing files in a format that ROMS can use
• This saves a lot of time, effort, and disk space
![Page 20: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/20.jpg)
ROMS Code
• Outline of the code• cpp• cppdefs.h• Modules• ocean.in• Note: understanding gnu make is
important, but not covered in this talk
![Page 21: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/21.jpg)
ls roms
Atmosphere/ Lib/ User/Build/ makefile Waves/Compilers/ Master/Data/ ROMS/
I also have an Apps directory here for my applications.
![Page 22: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/22.jpg)
ls ROMS
Adjoint/ License_ROMS.txtBin/ Modules/ SeaIce/Drivers/ Nonlinear/ Tangent/External/ Obsolete/ Utility/Functionals/ Programs/ VersionInclude/ Representer/
![Page 23: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/23.jpg)
Most Important• Drivers
– Various model main programs• Nonlinear
– The regular ocean physics (forward model)• Modules
– Ocean model data types, with allocation and initialization routines
• Utility– File reading and writing routines and other
files common to the various models
![Page 24: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/24.jpg)
Support
• Include– Include files, including cppdefs.h
• Bin– Perl and shell scripts
• Compilers– System-dependent parts of the makefile
• Lib– ARPACK and MCT libraries (optional)
• External– ASCII input files
![Page 25: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/25.jpg)
Other
• Data Assimilation– Adjoint– Representer– Tangent
• SeaIce• Functionals
– Analytic expressions for initial conditions, etc.• Obsolete• Programs
![Page 26: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/26.jpg)
cpp
• The C preprocessor, cpp, comes with some C compilers, or the functionality can be built into a C compiler
• Very simple macro processor• Used in ROMS primarily for conditional
compilation• We probably won’t switch to coco
when it becomes widely available
![Page 27: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/27.jpg)
cpp Versions
• People started using the C preprocessor before there was a C standard - the Standard cpp isn’t quite the version we want
• Gnu “cpp -traditional” does the right thing for Fortran
![Page 28: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/28.jpg)
File Inclusion
• In Fortran, you can include files with: include ‘file.h’• In cpp, the equivalent is: #include “file.h”• We use the cpp version to make sure
the #defines in the include files are seen
![Page 29: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/29.jpg)
Macro Substitution
• A macro definition has the form: #define text replacement text• This is done in ROMS: #define WESTERN_EDGE Istr.eq.1• and used in: if (WESTERN_EDGE) then ….• Safe as long as the replacement text is
not much longer than the original
![Page 30: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/30.jpg)
More on Macros
• Another type of macro substitution is like statement functions in Fortran
• Statement functions and the more modern inlined functions are better because the compiler can do type checking
![Page 31: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/31.jpg)
Logical Macros
• A third kind of macro is something like: #define MASKING• or #define MASKING 1• These can be tested like: #ifdef MASKING (first case) #if MASKING (second case)• We use the first style for historical reasons,
gnu has officially gone to the second
![Page 32: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/32.jpg)
Conditional Compilation
• ROMS uses conditional code everywhere. #ifdef ICE ! Stuff having to do with sea ice
#endif• If you want to find out about (say)
sediment code, do a search on SEDIMENT
![Page 33: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/33.jpg)
More on Conditionals
• When setting up a problem of your own, it’s best to surround code you add with a unique cpp flag:
#define LOMBOK_STRAIT :
#ifdef LOMBOK_STRAIT
! My code
#endif
![Page 34: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/34.jpg)
Still More
• The #define for our case is now happening in the makefile, passed in with a -DMY_CASE flag
• The name of our case is used in the search for an include file, -DROMS_HEADER=my_case.h
![Page 35: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/35.jpg)
Even More
• The ROMS Makefile will take our .F files and run them through cpp for us before passing them to the compiler
• The intermediate files have a .f90 extension
• The compiler errors will refer to line numbers in the .f90 file, not the original source file
• Fix the .F file, but feel free to look at the .f90 files to see what happened
![Page 36: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/36.jpg)
cppdefs.h• Every ROMS source file starts with: #include “cppdefs.h”• This file has been changed to contain
#if defined ROMS_HEADER# include ROMS_HEADER#endif
• The ROMS_HEADER variable comes from the makefile
![Page 37: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/37.jpg)
Modules
• The model variables are stored in Fortran 90 modules defining specific types
• You no longer have to modify mod_param.F for your domain
![Page 38: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/38.jpg)
Input file• ROMS has an ascii input file which it
reads during initialization• The file is not a namelist, but similar
in intent• It specifies things like:
– Number of timesteps– Number of gridpoints (Lm, Mm, N)– Parallel grid partitioning– Other input filenames, output options– Many others
![Page 39: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/39.jpg)
Code Changes
• makefile - ROMS_APPLICATION := JAVA_1
• Create User/Include/java_1.h file with cpp options
• Specify grid dimensions in ocean_java.in
• User/Functionals/ana_hmixcoef.h - add sponge layer with #ifdef JAVA_1
![Page 40: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/40.jpg)
Horizontal Viscosity
![Page 41: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/41.jpg)
ocean_java.in
• ASCII input file for ROMS• Tells number of gridpoints• Provide the paths to the grid, forcing,
etc. files• Specify the timestep and timestep
ratio, viscosity values, etc.• Which fields do you want to output
and how often?
![Page 42: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/42.jpg)
makefile
• Check the name of the compiler• Set Debug/MPI/OpenMP/Large as needed• Set name of application: JAVA_1• Provide number of grids (usually 1)• Check “uname -s” on your computer• Check location of netcdf library and set it
in the Compilers/system-compiler.mk fragment
• Type “make”
![Page 43: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/43.jpg)
Run it!
• Create a working directory with:• oceanS• External/
– ocean_java.in– varinfo.dat
• Run the thing: ./oceanS < External/ocean_java.in
![Page 44: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/44.jpg)
• It should spit out a lot of text• You can redirect this with: ./oceanS < External/ocean.in > ocean.out
• If successful, you will also obtain some other output files in NetCDF format
![Page 45: Configuring ROMS for South of Java](https://reader038.fdocuments.in/reader038/viewer/2022102819/5681439c550346895db01930/html5/thumbnails/45.jpg)
• Get bold and try it in parallel!– Change the makefile (MPI or OpenMP)– The executable will be called OceanM or
OceanO– If using MPI, run it with the input file as an
argument, not standard in:
./oceanM External/ocean_java.in