Skip to main content

System Coupling Python library 2023 R2

Creating Restart Points and Restarting a Coupled Analysis

Last update: 10.07.2023

System Coupling supports creating restart points during the coupled analysis and, subsequently, restarting the coupled analysis from any previously created restart point. See the System Coupling User's Guide for more information.

System Coupling participant library provides the APIs to create restart points.

Setup Stage

During the setup stage, the participant should indicate whether the restarts are supported.

When using the participant library to setup the participant, the restartsSupported flag can be set in the Setup Info structure. Once that structure is created, the setup can be completed. See Completing the System Coupling Participant Setup for more details.

Creating Restart Points

During the coupled analysis, if the participant solver supports restarts, a callback function that can be called to create the restart points should be registered. This function will be called during outputs update if a restart point needs to be created. The callback function should be implemented and registered prior to the coupled analysis initialization. The function is expected to return a string that identifies that restart point. This string will in turn be provided to the participant solver during a restart run.

C++

...
// sample implementation of the restart callback function
std::string createRestartPoint()
{
std::string restartPoint;
... // solver-specific implementation, sets string value
return restartPoint;
}
...
// System Coupling object
sysc::SystemCoupling sc(host, port, name);
...
// register restart point creation callback
sc.registerRestartPointCreation(&createRestartPoint);
...

C

char restartPoint[STRING_MAX_SIZE];
...
/* sample implementation of the restart callback function */
const char* createRestartPoint()
{
/* solver-specific implementation, sets string value */
...
return restartPoint;
}
...
/* register restart point creation callback */
syscRegisterRestartPointCreation(&createRestartPoint);
...

Fortran

...
! sample implementation of the restart callback function
function createRestartPoint() result(restartPoint)
character(len=SyscFilePathLen) :: restartPoint
! solver-specific implementation, sets string value
...
end function createRestartPoint
...
! register restart point creation callback
syscRegisterRestartPointCreationF(createRestartPoint)

Python

from pyExt import SystemCouplingParticipant as sysc
...
def createRestartPoint():
``` sample implementation of the restart callback function

restartPoint = str()

solver-specific implementation, sets string value

... return restartPoint ...

System Coupling object

sysc.SystemCoupling sc(host, port, name); ...

register restart point creation callback

sc.registerRestartPointCreation(createRestartPoint) ...

### Restarting the Analysis from a Restart Point
When restarting the coupled analysis, System Coupling will provide
the string that was returned when the restart point was created.
This string will be passed into the participant solver via the
following command line argument:

–screstart RESTART_STRING ```

The participant solver is expected to resume the analysis from its state when the restart point was created. The participant steps in a coupled analysis are the same as for the initial run. See Participant Steps in a Coupled Analysis for more details.