Running COMSOL Batch with Models in Databases
The COMSOL Multiphysics batch mode, when launched from a command-line interface, supports using models stored in a Model Manager database as both source input and target output for the simulation run. You specify a model version as input using the command-line argument -inputfile with a model version location as its value — see Copying Model and File Locations. The output is specified using the command-line argument -outputfile and a second model version location. The output of the simulation run is saved as a new version for the same model and branch that the version specified by the output argument belongs to. You may skip the output argument altogether, in which case it defaults to that of the input argument. You may also combine a model version in a database as input with an MPH file on the file system as output, and vice versa.
See COMSOL Batch Commands (Windows) and COMSOL Batch Commands (Linux) in the COMSOL Multiphysics Reference Manual for general details on running batch from a command-line interface.
You can stop a batch run involving a model version by launching a new batch process using the same arguments as the first process but with an additional -stop argument. The batch run can be restarted using an additional -continue argument. For the case when the output is saved to a database, however, it becomes important to use the model version that was saved when the previous batch run was stopped as a new argument value for -inputfile. Otherwise, you will end up recomputing all solutions already obtained by the previous batch run. You would typically find the saved model version as the latest version of the model by browsing the corresponding branch in the Model Manager workspace, or via the Model Manager API using the -outputfile argument of the previous run as an “anchor” — see Navigating a Model Manager Database.
In case of a failure or otherwise interrupted run, and when the output target is a database, an attempt is first made to save the current run as a model version to be used later as a recovery. If this save fails, a recovery is instead saved on the file system. You can recover the batch run by launching a new batch process with the extra -recover argument in addition to the arguments used by the previously failed batch run.
You should not use the recovery model version for the -inputfile argument when recovering a failed batch run. That version will be automatically discovered by the recovering process.