Skip navigation links
(Wind-US Documentation Home Page) (Wind-US User's Guide) (GMAN User's Guide) (MADCAP User's Guide) (CFPOST User's Guide) (Wind-US Utilities) (Common File User's Guide) (Wind-US Installation Guide) (Wind-US 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 external processes from Wind-US


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

Spawned processes will be run in the same directory as Wind-US. For convenience, you may thus want to use the -runinplace option with the wind script. See the description of the -runinplace and -runroot options to the wind script for details about the Wind-US run directory.

The keyword arguments and options are:

    process   Full path name for the process (must be in quotes, 80 characters max)
freq Frequency for spawning the process, in terms of cycles, time levels, or stages, as determined by the option CYCLES, TIME-LEVELS, or STAGES. The default is to spawn the process every time level when Newton iteration or dual time stepping is used, and every cycle otherwise. CYCLES may not be specified with Newton iteration or dual time stepping unless NOCHECKPOINT is also specified.

Wind-US will tack the current cycle number (even when the frequency is in terms of time levels or stages) onto the end of the process call for potential use by the process as a parameter.

NOCHECKPOINT By default, Wind-US will update the common flow (.cfl) file and boundary data (.tda) file before spawning the process. NOCHECKPOINT will disable this update. In either case, the checkpoint interval specified by the checkpoint directive in the multi-processing control (.mpc) file will be unchanged.
CFLONLY Similar to NOCHECKPOINT, but this option will update the common flow (.cfl) file.
READ_SOLUTION The solution file will be re-read prior to resuming iterations. This option is useful if the spawned process modifies the solution file.

Multiple processes may be spawned by using multiple SPAWN keywords. The keyword options may be specified independently for each process.

Note that while a process is being executed, Wind-US's input and output files (i.e., the .lis file, .cfl file, etc.) remain connected to the Fortran units used by Wind-US. Thus, if a 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.


A common use for the SPAWN keyword, especially for unsteady flows, is to save intermediate .cfl files during a Wind-US 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 .cfl files.  This script is intended
   #            to be spawned during a 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 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 ]
      echo 'Error: save_cfl: Path name for saved .cfl files not specified' >& 2
      echo '       Use SPAWN keyword, as:' >& 2
      echo '       SPAWN "path-to-script path-to-cfl" FREQUENCY num' >& 2
      exit 1
   # $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 (assuming the run does not use Newton iteration or dual time stepping) 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.

Last updated 1 Apr 2016