1.8 Using the ANSYS Session and Command Logs
The ANSYS program records every command it executes, at two places: the session log file and the internal database command log.
The session log file is a text file which is saved in the working directory. The database command log is saved in the ANSYS database. This log can be copied to a file at any time by choosing Utility Menu> File> Write DB Log File. Both files are command logs that can be used as input to the ANSYS program.
1.8.1 Session Log File
Every ANSYS session produces a session log named Jobname.LOG. Jobname is determined by the jobname defined at ANSYS entry. The default jobname is FILE or file, depending on the operating system. The program opens the log file when the analyst first enters the program, and closes it when s/he exits the program.
The session log file provides a complete record of the ANSYS session in terms of commands and is quite valuable as a means of recovering from a system crash or catastrophic user mistake. By reading in a renamed copy of the log file or by submitting it as a batch file, the s/he can re-execute every command in the log file, recreating the database exactly as it existed previously. The log file is also useful as a debugging tool that can help to reveal any mistakes that might have been made in an ANSYS session.
Each new ANSYS session appends commands to the existing file Jobname.LOG. That is, the log file is not overwritten during a new ANSYS session, but added to. A "time stamp," consisting of the current date and time, is included so that the analyst can identify the start of each session. The entire log file can be listed during an interactive run by picking Utility Menu> List> Files> Log File. Because this file is in ASCII format, it can be viewed and edited readily using an external text editor.
1.8.2 Using the Database Command Log
ANSYS captures commands generated during an ANSYS session not only in the log file but also in memory. This in-memory version of the command history is called the internal database log. When the database is saved, the program saves this command log in the database file (Jobname.DB) along with the other database information.
Use Utility Menu> File> Write DB Log File to write the database command log to a named ASCII file. Then edit this file, make desired changes, and use the file as command input to the program. This capability is especially useful to use the command history that was created during an interactive session, but have somehow lost or corrupted the session log file (Jobname.LOG) that was associated with the database.
If the database is created in multiple sessions by saving and resuming the database file, the ANSYS program keeps the database log continuous by appending each new command that is processed. Therefore, the internal database log is not fragmented; it will represent the complete database.
1.8.3 Command Log File as Input
The procedure for re-executing the commands contained in a Jobname.LOG file or in the database log consists of three main steps: 1. Establish the command log file 2. Edit the command log file as desired 3. Read the edited file into the ANSYS session.
Step 1: Establish the Command Log File
The method to do this depends on whether the analyst uses the session log file or the database log.
Session Log File
Perform the following steps to establish a command log file from the session log file, (Jobname.LOG):
1. Rename or copy the session log file to a different name. This can be done at the system level or from within the program.
2. List the log file by choosing Utility Menu> List> Files> Log File.
3. Choose File> Save as from the Log File window.
Database Command Log
Pick Utility Menu> File> Write DB Log File to establish a command log file from the database log. A file name can be specified or the default name, Jobname.LGW can be executed.
Step 2: Edit the Command Log File
Sometimes, it is necessary to edit the command log file before using it as program input. As the analyst edits the log file, s/he may want to add comments or indentation to improve its readability. Comments can be added to the log file by using comment commands or by using the comment character (!).
Step 3: Read in the Edited Log File
Pick Utility Menu> File> Read Input fromĀ  to read in the edited command log file.