5.9.1. Restart Files and Processing

The restart capability allows you to specify intervals at which restart files are written. Each time a restart write point is reached, a restart file (.ftrst) is created containing the information needed to perform a restart from that point. When the run is successfully completed, the Ansys Forte results index file (.ftind) contains indices to solution files as well as all the other crank angles or time steps. By selecting a restart file and associated results index file, the simulation will begin from that restart point after first initializing the results index file with the solution values for crank angles or time steps that occurred prior to the restart point. In this way, the results index file for a job using a restart file will contain a complete set of results, not just those results from the restart point to the end point.

Note that when you select a previous results index (.ftind) in the restart run, the previous .ftres files will be indexed in the file using relative paths to the location of those .ftres files from your previous restart run(s). It is also possible to edit the results index file manually if you want to combine results files from different runs in different folders.

You can run with specific result files using the Forte User Interface or Command Line Interface. Both workflows are described in the next two sections (Restarting from the Forte User Interface and Restarting from the Forte Command Line Interface).

5.9.1.1. Restarting from the Forte User Interface

If you want to specify a restart file so the simulation starts with a previously saved state, you can use the Browse button to select the restart (.ftrst) file and the associated results (.ftind) index file. The new results file will have the results from the previous run (up to the restart point) copied into it and will then be appended with the new results as each crank angle (or time) is simulated. The Browse function will attempt to automatically match a results file when you select a restart file (by matching the file names). You can also directly type or paste into these table cells.

The Run Simulation section of the set-up allows you to specify one of these saved restart files (.ftrst) when the Use Restart check box is selected. The Browse button will open a file browser to help specify the Restart File column. To set up a restart file, first make sure that the Use Restart item is checked in the Run Simulation panel shown in Figure 5.10: Run Simulation Panel with Use Restart checked. This action enables the Restart File input and allows you to Append to Existing Forte Results.

Figure 5.10: Run Simulation Panel with Use Restart checked

Run Simulation Panel with Use Restart checked

Clicking Browse opens a file browser for locating a .ftrst restart file. A blank entry for the "Results File" does not cause any errors, but the results will only contain solutions after the restart point. A "Results File" provides an option to include solution data written before the restart point.

Providing this existing results file to prepend to the new results is optional. If you do not need the results prepended, you can still use the restart file and omit the prior results file.

Since you may want to run a variety of simulations from an existing restart point, Ansys Forte generates the job scripts to specify uniquely named files for each run— by looking at the existing restart and results files in the Run directory. Distinct file names are generated by using a different root name that includes a sequential number, allowing the subsequent runs to be identified and grouped. Of course, if those files are on a remote node and you are generating the scripts for purposes of transferring the files to a compute cluster, then the Forte User Interface will not know of any existing runs. (Forte examines the directory; this information is not saved in the project file itself.) You can modify the run name root in the Run Settings panel to avoid any conflicts, or you can edit the generated scripts using the information provided below.

Within the run*.bat/sh file in the Run directory, the forte executable is invoked with arguments that specify the names generated using -rn <file name root>.

  • Original run (no restart):

    forte.exe -i example.ftsim -rn Run_001_ -o Run_001.ftind

  • Restart run:

    forte.exe -i example.ftsim -rf selected.ftrst -rs selected.ftind -rn Run_001_1_ -o Run_001_1.ftind

selected.ftrst and selected.ftind are local copies of the restart and results index files. The solution files associated with the index files also need to be copied into the working directory. You must use the cgns_util restartcopy command to make sure these files are internally consistent.

The restart files naming is designed to give the best sort order.

Due to the solver crank-angle or time-step incrementing, the restart files may not be generated at exactly the precise point you request. For instance, the restart files in Figure 5.11: Restart points at CA = -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 were generated based on a custom setting of creating a restart file at these crank angles: -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5.

Figure 5.11: Restart points at CA = -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5

Restart points at CA = -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5

As you can see, there is only 1 results file and the simulation ended before the crank angle 5 threshold was reached. The format of the file names uses the Run name (Run_001) and then "CA" for crank angle or "T" for time step. Next is the numeric value with either "n" or "p" prefix (in addition to a minus sign) that was added to force consistent sorting in the 5 different viewing scenarios described earlier. Finally, in addition to the crank angle or time step, the final numeric value is the specific simulation step at which the restart was generated. This is done to allow a case in which the restart files are generated so frequently that the same name would otherwise be generated. For instance, if 2 distinct restart files were generated at CA of 0.04, the names might be Run_001_CA_p_0.04_42.ftrst and Run_001_CA_p_0.04_43.ftrst.


Note:  When the File Size Control option is used to split the spatially resolved solutions across more than one .ftres file, then the same naming format is used in both the .ftres files and the .ftrst files, to help identify the range of crank angles in each .ftres.


The listing in Figure 5.11: Restart points at CA = -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 is for an initial run that generated restart files. The next listing, in Figure 5.12: Restart using Run_001_CA_p_0.04_42.ftrst (New files highlighted), shows rerunning the same simulation, but using Run_001_CA_p_0.04_42.ftrst as the restart file. As you can see, none of the existing restart or results files are modified by this second run. Distinct file names are generated by using a different root name that includes a sequential number purely to distinguish and group these subsequent runs. The new files created are highlighted. If a 3rd run was performed using restart, then you would see Run_001_2.ftres and any associated restart files.


Note:  If a subsequent run is performed not using restart, then the original file names are used and overwritten.


Figure 5.12: Restart using Run_001_CA_p_0.04_42.ftrst (New files highlighted)[2]

Restart using Run_001_CA_p_0.04_42.ftrst (New files highlighted)From as restart file.

Save Restart Point: While a job is running, the Save Restart button allows you to signal the job to save a solution and a restart file at the current crank angle during the run.

Figure 5.13: Run panel showing Save Solution & Restart button

Run panel showing Save Solution & Restart button

5.9.1.2. Restarting from the Forte Command Line Interface

You can use the Forte Command Line Interface to prepare a job so it uses a restart file as follows (this is also described in Commands)

Windows

call run_forte.bat CLI-project myProject.ftsim --prepare -mpi_args 8 -restart_file\
restart.ftrst -restart_results restart.ftind

Linux

forte.sh CLI-project myProject.ftsim --prepare -mpi_args 8 -restart_file restart.ftrst\
-restart_results restart.ftind

which will create a run_mpi.bat/.sh that will use the specified result file restart.ftrst and index file restart.ftind.

You may need to modify the restart.ftind file when performing a restart run where the original run was performed on a different compute resource and/or disk.