Adding New Output Variables to MCPL()

<Under Construction !!>
Feedback appreciated -- CJC

Here is a checklist:

  1. Decide what file the variable belongs in, on the basis of

  2. Decide on and document the name, units specification, text-description line, and type for the new variable.

  3. Decide which worker routine is appropriate to extract/reorder/decouple/compute the required output, or construct and document a new worker routine if necessary.

  4. Increment the PARAMETER for maximum number of variables in the relevant output file (e.g., MXMD3 if the variable goes to file MET_DOT_3D).

  5. Add a LOGICAL flag variable to the MCPL() code for this variable (e.g., if it is new variable "FOO" for MET_DOT_3D, the flag variable would be named MD3FOO.

  6. Put the flag variable into the DATA statement initializing that file's flag-variables.

  7. Put the flag variable into the SAVE statement for flag-variables.

  8. Add the name of the variable to the DATA statement initializing the file's supported-variables list (e.g., MD3LIST for MET_DOT_3D).

  9. If there are particular grid-and-window dependent conditions for this variable, implement the appropriate flags for them (e.g., dot-point decoupled variables require that the output window be a proper window into the current MM5 domain. Logical array WNDWFLAG(GRID) is used to implement this condition). If you need to add a new logical variable for this purpose, make sure you SAVE it.

  10. Within the file's initialization-clause inside entry MCPL_OUT, add a CKVBLE call specifying the name, flag, type, units, and description for the new variable (as well as the active-variables counter and active-variables list for the file). For the example above, that would be:
                    CALL CKVBLE( 'FOO', GD3FOO, M3REAL, 'dingbats',
         &                       'plings the Inghams',
         &                       NMD3,      !  active-varaibles counter
         &                       MD3NAMES ) !  active-variables list
              
    If there are physics-process-dependent conditions for the variable, enclose this CKVBLE call within an IF block for the appropriate logical variable. Set the variable's flag to .FALSE. in the ELSE-clauses for that condition (if any), and for the file's initialization-clause.

  11. In the appropriate section of MCPL_OUT, add an IF block output-section for this variable, using any extra flags if necessary. For best performance, the output blocks should be in exactly the same order as the CKVBLE calls for that file. For our example:
            IF ( MD3FOO .AND. WNDWFLAG( N ) ) THEN	!  decouple va
                CALL MMDDCPL( 1.0, MIX, MJX, MKX, VA, PSA, 
         &                    NCDOT( N ), NRDOT( N ), NLAYS,
         &                    CDOT0( N ), RDOT0( N ), 1, RBUF )
                IF ( .NOT. WRITE3( MD3FILE( N ), 'FOO', 
         &                         JDATE, JTIME, RBUF ) ) THEN
                    MESG = 'Could not write FOO to ' // MD3FILE( N )
                    CALL M3EXIT( 'MM5v2/MCPL', JDATE, JTIME, MESG, 2 )
                END IF
            END IF		!  if md3vwind
              

  12. To output this variable in MM5 model runs, add the name of the variable to the relevant variables-list file (e.g., add for the example above, add a line with the word FOO to file MD3_VARS for our example above).

  13. Enjoy!

Back to MCPL() Contents