36.8. Creating and Reading Journals / Scripts

A journal contains a sequence of Fluent Post-Analysis commands, arranged as they would be entered through the graphical user interface (GUI). The GUI commands are recorded in the journal file as Python 2.7 code lines. You can also create journal files manually with a text editor. If you want to include comments in your file, be sure to put a hash (#) at the beginning of each comment line.

The purpose of a journal file is to automate a series of commands. Another use is to produce a record of the input to a program session for later reference, although transcript files are often more useful for this purpose. (For details, see Creating Transcript Files).

Command input is taken from the specified journal file until its end is reached, at which time control is returned to the standard input (usually the mouse). Each line from the journal file is echoed to the standard output (usually the Console) as it is read and processed.

When using journal files, note the following:

  • Journal files written in one release of Fluent Post-Analysis should only be read back in the same release; the use of a journal from a different release is not supported.

  • A journal file is, by design, a record and playback facility. It contains no information about the state in which it was recorded or the state in which it is being played back.

  • Be careful not to change the folder while recording a journal file. Also, try to re-create the state in which the journal was written before you read it into the application.

    For example, if your journal file includes an instruction to save a new file with a specified name, you should check to see if a file with that name exists in your folder before you read in your journal file. If a file with that name exists and you read in your journal file, when the program reaches the write instruction, it will prompt for a confirmation to overwrite the old file. Since the journal file does not contain any response to the confirmation request, Fluent Post-Analysis cannot continue to follow the instructions of the journal file.

  • Other conditions that may affect the application's ability to perform the instructions contained in a journal file can be created by modifications or manipulations that you make within the program.

    For example, if your journal file creates several surfaces and displays data on those surfaces, you must be sure to read in appropriate case and data files before reading the journal file.

  • At a point of time, only one journal file can be open for recording, but you can write a journal and a transcript file simultaneously. You can also read a journal file at any time.

  • Only successfully completed commands are recorded. For example, if you stopped the execution of a calculation using the Interrupt button, it will not be recorded in the journal file.

To start the journaling process:

 File Write Start Journal...

After you enter a name for the file in the Select File dialog box (being sure to include the .py extension, to make it easier to later filter by file type), journal recording begins. The Start Journal... menu item becomes the Stop Journal menu item. You can end journal recording by selecting Stop Journal, or by exiting the program.

 File Write Stop Journal

After you have created a journal to capture a series of commands, you can modify it in a text editor so that it behaves as a script, that is, you can add Python commands so that it contains more complex programming constructs, such as loops and branching.

You can read a journal / script file into the program using the Select File dialog box opened by selecting:

 File Read Script/Journal File...

Alternatively, you can specify that a journal / script file is read immediately after Fluent Post-Analysis opens, as described in Starting the Fluent Post-Analysis Workspace Using the Command Line.