Running the RFM

07SEP17

Running the RFM

The program is run in the same way as any other executable under Linux/Unix. Assuming that the RFM executable file rfm has been
compiled in, for example, directory RFM/source/, type
RFM/source/rfm
The program will expect a file rfm.drv in the local directory. This is the Driver Table, an ASCII file which controls the RFM operation. Unless otherwise directed (via the Driver Table), all output files will also be created in the local directory. A single run of the RFM typically produces spectra for one or more viewing geometries over one or more spectral ranges, as specified in this Driver File.

Terminal Input: Run_ID

On starting, the RFM prompts the user (via the terminal) for an optional 'run_ID'. The normal response would just be <CR>, but can be any contiguous text label (up to 80 characters) which is then appended to all filenames generated from this particular run.

In the following example the user responds to the prompt by typing '_x':

Optional ID to be appended to filenames (<CR>=none):  
_x 
This would then generate files such as rfm.runlog_x and rad_40000.asc_x instead of the default rfm.runlog and rad_40000.asc (obtained if the user had responded with <CR>). The file contents are unaffected, ie the output files contain no internal record of the run_ID label.

The run_ID may be convenient for:

However, even if no run_ID is required, this prompt does make life slightly more difficult if performing a series of RFM runs as part of a shell script since the user's terminal input has to be simulated.

One permanent option is simply to edit rfm.for and comment out that part:

(part of rfm.for)
C
C Prompt for any run identifier label to be appended to all output file
C
c      WRITE ( *, * ) 
c     &  'Optional ID to be appended to filenames (=none):'
c      READ ( *, '(A)' ) RUNID
c      IF ( RUNID .NE. ' ' ) THEN
c        MESSGE = 'R-RFM:    Filename append string='//RUNID
c        WRITE ( *, * ) MESSGE
c      END IF
       runid = ' '                    ! add this line instead

With RFM v5 it is slightly simpler: set the PROMPT parameter to .FALSE.

(part of rfm.f90)
! LOCAL CONSTANTS
    LOGICAL, PARAMETER :: PROMPT = .FALSE. ! T=prompt user for appended ID
If you do want to use a script to run RFM for multiple driver tables while effectively responding to the prompt with a <CR>, the following gives an example
Example of a shell script which runs a series of RFM driver tables
#! /bin/sh

# create a temporary file containing just the <CR> terminal response
cat <<EOF>> inprfm_$$

EOF

# loop through all files rfm_*drv linking to name rfm.drv
for i in rfm_*.drv
do
  ln -f $i rfm.drv
  RFM/source/rfm < inprfm_$$
done

rm inprfm_$$

exit 0
For those not familiar with shell scripts, suppose you copy the contents of the above box into a file rfm.sh. To make this an 'executable' script, type
chmod +x rfm.sh
You should then be able to run it in the same way as an executable program, ie simply type rfm.sh

If you've cut and paste a file rfm.sh from this web-page, as opposed to typing in the text line by line with an editor, depending on your browser, you may then get an error "Command not found" which is due to the incompatibility between the way windows and unix handles line feed characters. See no.2 under Other Errors for how to fix this.

Terminal Output

A typical (short) run of the RFM generates the following messages on the terminal
R-RFM:    Program RFM v4.25 
Optional ID to be appended to filenames (<CR>=none): 
_x                                                [ = user response ]
R-RFM:    Filename append string=_x 
R-RFM:    Commencing Wide Mesh Calculation 
R-RFM:    Commencing Fine Mesh Calculation 
          1           4
          2           4
          3           4
          4           4
R-RFM:    Successful completion

The R-RFM: ... messages are routine status information, the first one indicating the version of the RFM is being run. This version identifier also appears in the first header record of all output files.

Note that if the user had typed '<CR>' instead of '_x' the second R-RFM: ... record confirming the run_ID would have been suppressed.

The Wide Mesh Calculation usually starts a few seconds after the user responds to the run_ID prompt. During this interval, the Driver Table is completely processed, so after this message appears it is safe to alter the Driver Table to set up another run.

Most errors are likely to occur before the Wide Mesh calculation starts so once this message is printed it is usually safe to assume that the code will continue to a successful completion.

The sequence of number pairs refer to the current wavenumber interval processed during the Fine Mesh Calculation, and the (fixed) total number required, which gives some idea of progress (this is the time-consuming part of any major run of the RFM). These progress messages can be suppressed by the SHH flag.

The 'R-RFM: Successful completion' message indicates a successful completion, i.e. no fatal errors. Any 'underflow' messages can be ignored.

If, for some reason, a fatal error occurs (most likely while the Driver Table is being processed, i.e. before the commencement of the Wide Mesh Calculation) the program will halt and print a message to the terminal beginning with 'F-' (see Error Messages).

It is possible that various 'warning' (rather than 'fatal') conditions may arise, in which case an extra message will be printed to the terminal just before the 'R-RFM: Successful completion' message, e.g.

R-RFM:          3 Warning messages in RUNLOG file
The rfm.runlog file should then be inspected for details.