Skip navigation links
(WIND Documentation Home Page) (WIND User's Guide) (GMAN User's Guide) (MADCAP User's Guide) (CFPOST User's Guide) (WIND Utilities) (Common File User's Guide) (WIND Installation Guide) (WIND Developer's Reference) (Guidelines Documents)

(Introduction) (Tutorial) (Geometry and Flow Physics Modeling) (Numerical Modeling) (Boundary Conditions) (Convergence Monitoring) (Files) (Scripts) (Parallel Processing) (Keyword Reference) (Test Options)



SPAWN - Run an external process from WIND

SPAWN "process" [FREQUENCY freq] [NOCHECKPOINT]

This keyword allows the user to start (spawn) a process without stopping WIND. The process can be any valid Unix script or executable. When the new process is spawned, WIND will wait until the spawned process completes before continuing.

WIND will tack the current cycle number onto the end of the process call for potential use by the process as a parameter.

The spawned process will be run in the same directory as WIND. See the description of the -runinplace and -runroot options to the wind script for details about the WIND run directory.

The keyword arguments and options are:

    process   Full path name for the process (must be in quotes, 80 characters max)
freq Spawn process every freq cycles (default is 1)
NOCHECKPOINT By default, WIND will override the checkpoint interval so that it aligns with the spawn frequency. NOCHECKPOINT will disable the realignment and cause the checkpoint interval to be unchanged.

Note that while the process is being executed, WIND's input and output files (i.e., the .lis file, .cfl file, etc.) remain connected to the Fortran units used by WIND. Thus, if the process runs a program like resplt or cfpost, these files cannot be used directly as input. Instead, the process must copy the needed file(s) to temporary files, and use the temporary files as input.

Example

A common use for the SPAWN keyword, especially for unsteady flows, is to save intermediate .cfl files during a WIND run. A shell script may be SPAWN'ed at specified intervals to save the file under a unique name.

For example, consider the following shell script, named save_cfl.

   #! /bin/sh 
   #
   # save_cfl - Save intermediate WIND .cfl files.  This script is intended
   #            to be spawned during a WIND run using the SPAWN keyword, as
   #
   #               SPAWN "path-to-script path-to-cfl" FREQUENCY num
   #
   #            where 'path-to-script' is the full path name for this
   #            script, 'path-to-cfl' is the full path name for the saved
   #            .cfl files (the current cycle number will automatically
   #            be appended to this name), and 'num' is the frequency in
   #            cycles for the SPAWN command.  Note that the quote marks
   #            around "path-to-script path-to-cfl" must be included.
   
   # Check for enough arguments
   
   if [ $# -lt 2 ]
   then
      echo 'Error: save_cfl: Path name for saved .cfl files not specified' >& 2
      echo '       Use WIND''s SPAWN keyword, as:' >& 2
      echo '       SPAWN "path-to-script path-to-cfl" FREQUENCY num' >& 2
      exit 1
   fi
   
   # $1 is path name for the saved .cfl files, $2 is current cycle number
   
   cp FOR020 $1.$2
If the above script is located in the directory /home/user/bin, the SPAWN keyword may be used as follows to save the .cfl file every 1000 cycles in the directory /home/user/wind.
   SPAWN "/home/user/bin/save_cfl /home/user/wind/runa.cfl" FREQUENCY 1000
Since the cycle number is automatically added to the end of the process when it's spawned, the above use of the SPAWN keyword causes the save_cfl script to be run as
   /home/user/bin/save_cfl /home/user/wind/runa.cfl ncycle
where ncycle is the current cycle number. The result is that the intermediate .cfl files will be stored in the directory /home/user/wind, with names runa.cfl.1000, runa.cfl.2000, etc.