For developers

From ccrmwiki
Revision as of 10:41, 5 March 2013 by Yjzhang (talk | contribs)
Jump to: navigation, search

All svn account holders need to familiarize themselves with the following rules.

Sharing I/O channels in SELFE

You need to exercise caution when dealing with parallel I/O especially for writing. For writing outputs, you’d generally let only 1 process do the job, e.g.

if(myrank==0) write(10,*)…..

If you do need to have all processes write e.g. debug messages, you’d then use channel 12 (see below).

Here are all I/O channel numbers used in different sub-models of SELFE (bold numbers mean they have been used by other sub-models and you’d avoid using them):

  • Hydro/: Channels between 8 and 200 are used by various codes for I/O. In particular:
    • 12: this channel is initialized by different processes to point to files outputs/nonfatal_xxxx, where “xxxx” are the process IDs. Therefore it’s very useful for debugging purpose; you can use it anywhere
    • 101 to 100+noutputs (inclusive of both): reserved for global outputs (including from tracers from sediment, EcoSim, ICM, as well as WWM);
    • 201-250: non-standard outputs (e.g. at sidecenters, prism centers);
    • 251 to 259: reserved for station outputs
    • 301 to 300+ntracers: reading channels for non-point source inputs for ICM
    • 10, 31, 32: used for one-off I/O – can be used by other sub-models as long as you close them immediately after use in your part of the code to dump messages to these files
    • 16: this channel points to mirror.out (on rank 0), the main message output for info about the run. You should use it with if(myrank==0)
  • WWM
    • 1100 to 1200: handles for inputs/outputs etc
  • EcoSim
    • 600: outputting some messages
  • Sediment
  • Sed2D
    • 26, 2626

Rules for contributing your code to be included in the SELFE package

Here are some rules for preparing your own code:

  • No spaces between “#” (pre-processor) and if/else/end;
  • Don’t use “!” inside write/print or any other non-comment portion;