Difference between revisions of "For developers"

From ccrmwiki
Jump to: navigation, search
Line 9: Line 9:
 
If you do need to have all processes write e.g. debug messages, you’d then use channel 12 (see below).
 
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 (red numbers mean they have been used by other sub-models and you’d avoid using them):
+
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:
 
* Hydro/: Channels between 8 and 200 are used by various codes for I/O. In particular:
** 101 to 100+noutputs (inclusive of both): reserved for global outputs (including from tracers from sediment, EcoSim, ICM, as well as WWM);  
+
** '''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);
+
** '''201-250''': non-standard outputs (e.g. at sidecenters, prism centers);
** 251 to 259: reserved for station outputs
+
** '''251 to 259''': reserved for station outputs
** 301 to 300+ntracers: reading channels for non-point source inputs for ICM
+
** '''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
 
** 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
 
** 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 in your part of the code to dump messages to these files
 
** 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 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)
 
** 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
 
* WWM
** 1100 to 1200: handles for inputs/outputs etc
+
** '''1100 to 1200''': handles for inputs/outputs etc
 
* EcoSim
 
* EcoSim
** 600: outputting some messages
+
** '''600''': outputting some messages
 
* Sediment
 
* Sediment
 
** 26, 2626
 
** 26, 2626

Revision as of 10:24, 5 March 2013

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:
    • 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
    • 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 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
    • 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;