Batch (Job Configurations)
The Batch () job configuration is the main node for running batch jobs. Batch jobs run in separate processes. You can therefore continue working in the COMSOL Desktop once a batch job is run. Model changes in the COMSOL Desktop after the batch job is submitted do not affect the model in the batch job. The Batch job has a special Batch Data subnode, which collects External Process subnodes containing job status information.
As in the Parametric Sweep (Job Configurations) node, the batch job is defined by a number of subnodes (see below). The batch job then runs each subnode. Use the Save as Default button in the toolbar to save the current directory setting as the default directory for batch files.
A batch job can contains steps to run all solutions, save the model to a file, and evaluate derived values, for example. You add those steps by right-clicking the Parametric Sweep node and selecting one of the following options:
Job
Solution
Other
Save Model to File, which saves the solved model to an MPH-file. See Save Model to File.
Results
Job refers to another job that is to be run from this batch job, while Solution (see Solution) runs a Solution node as available under the Solver Configurations node, available further up in the Study tree.
Under Other, you can choose External Class (see External Class), which calls an external Java® class file. Another option, Method Call (see Method Call), runs a model method. The Geometry (see Geometry), builds the Geometry node (runs the geometry sequence). This can be used, for example, in combination with a parametric sweep to generate a sequence of MPH-files with different geometry parameters. The Mesh option (see Mesh) builds the Mesh node (runs the meshing sequence).
Under Results, you can choose Plot Group (see Plot Group) to run all or a selected set of plot groups. This is useful for automating the generation of plot groups after solving. The Derived Value option is there for legacy reason, and it is instead recommended that you use the Evaluate Derived Values option (see Evaluate Derived Value), which evaluates nodes under Results>Derived Values. The option Export to File (see Export to File) runs any node for data export under the Export node.
General
Use the Defined by study step list to specify if the settings are synchronized with the corresponding study step.
Set the number of cores that the batch job should use in the Number of cores field if desired, by first selecting the corresponding check box. The default behavior is to use all available cores. If you set Number of simultaneous jobs to more than one, several jobs can run at once. When you are running more than one job at once, it is important that the product of Number of cores and Number of simultaneous jobs does not exceed the number of cores available on the computer. Otherwise you experience performance degradation. When you run multiple batch jobs on your computer, COMSOL Multiphysics makes sure this does not happen if you are using the automatic setting. If you have a multicore machine, you can change these settings to control the number of simultaneous processes that are allowed to run in the batch sweep and also how many cores each of them is allowed to use. If you have a six-core machine, for example, change the Number of simultaneous jobs to three and the Number of cores to two. This allows three parameters to be solved in parallel, where each solver process gets access to two cores. For simulations where each parameter represents a small computational problem, you can increase the number of simultaneous jobs to as many cores as you have on your computer. For larger problems, keep this setting to one simultaneous job (the default setting) to fully utilize the multicore processing power of the solvers.
You can also control the number of simultaneous jobs from the Batch Sweep node’ Settings window, in the Study Extensions section. In that case, the number of cores is automatically computed from the number of physical cores divided by the number of simultaneous jobs (for this to be automatic, you must not select the Number of cores check box).
Select the Use graphics check box when the batch process should run results nodes that create graphical contents such as exporting to file.
Enter the Number of job restarts. The default is 0. This is the maximum number of times the job can be restarted if it fails to complete.
Enter a value for the Alive time (seconds). The default is 300 seconds. This is the longest time the process is allowed to run before it must inform that it is still running. Failure to do so means that the process is considered dead and a new process is started if the maximum number of job restarts is not reached.
You can set a Start time if you want the batch process to start at a later time. Select the hour (0–23 hours) to start the run from the Start time list, or select Now to start the batch process without a delay.
Files
Set the Filename of the model. If the batch job is generated from a parametric sweep, a unique name that depends on the parameter names and values is created. The default is to overwrite any previous models with the same name. Disable the default by clearing the Clear previous model check box. Select the Clear meshes check box to clear the meshes before running the batch sweep. The default is to not clear the meshes. Select the Clear solutions check box to clear the solutions before running the batch sweep.
Specify the Directory to store the model. The directory refers to the location where the client (COMSOL Desktop) reads and writes data. Click Browse if you want to browse to a directory.
From the Add parameters to filename list, choose Parameter name and value (the default), or choose Index, which instead of parameter names and parameter values uses an index scheme iX, iY,...., where same indices relate to the same parameter value. This option gives much shorter filenames.
If you are connected to a COMSOL Multiphysics server on another computer, you can control the working directory used by the COMSOL Multiphysics server if you select the Specify server directory path check box and enter the path to the server Directory or Browse for the path. Otherwise a temporary directory on the COMSOL Multiphysics server is used to save files. The server directory path refers to the location where the COMSOL Multiphysics server reads and writes the corresponding data (assuming a client-server configuration).
If the batch job has another path to the directory, you select the Specify external COMSOL batch directory path check box and enter the path to the batch Directory or Browse for the path. If the batch job has another path to the directory, you select the Specify external COMSOL batch directory path check box and enter the path to the batch Directory or Browse for the path. The external COMSOL batch directory path refers to the location where the batch process reads and writes the data.
If COMSOL Multiphysics is installed in a different directory from where the batch job runs, enable the Specify external COMSOL installation directory path and specify the install directory (click Browse or enter the path to the Directory). This can occur if you are submitting jobs to a job scheduler with the Cluster Computing node.
Click the Save As Default button () at the top of the Settings window to save the current directory setting as the default directory for batch files.
How to Specify Directory Paths for Batch Jobs and Cluster Jobs
Some examples of how to specify the paths for the directories where the batch job reads and writes data:
If you use a Windows client connected to a server running on a Linux server head node that in turn is submitting a job to a job scheduler, that setup then requires the main Directory (which is a local Windows path) and a server directory path (which is a Linux path on the head node). Most likely, an external COMSOL batch directory path is not needed in this case because it is likely that the cluster and the head node are using the same file system.
With a COMSOL Desktop running on a remote machine, the main Directory path refers to the COMSOL Desktop path, and the external COMSOL batch directory path refers to a remote batch job or cluster job path.
With a client-server configuration running on a remote machine, the main Directory path refers to the COMSOL Desktop path, the server directory path refers to the server path, and the external COMSOL batch directory path refers to the remote batch job or cluster job path.
To summarize: If the batch job and the COMSOL Desktop do not share the same view of the file system, you must specify at least the main Directory and the external COMSOL batch directory.
Synchronization
Select the Synchronize solutions check box to synchronize the solutions computed by the batch processes with the model. This allows additional postprocessing after the sweep has finished. The default is to disable solution synchronization. Select the Synchronize accumulated probe table check box to synchronize the accumulated probes computed by the batch processes with the model. The accumulated probe synchronization is enabled by default. Select the Output model to file check box to enable that all batch processes save the models to file. In most cases, use the solution synchronization and probe synchronization functionality instead because otherwise the data ends up in one file for each process and cannot be postprocessed efficiently. Use the Probes list to select probes to update during the batch sweep. The default is All, which selects all probes for plotting and tabulation of probe data. Select Manual to open a list with all available probes. Use the Move Up (), Move Down (), Delete (), and Add () buttons to make the list contain the probes that you want to see results from while solving. Select None to disable probe updating for batch sweep.
Select the Accumulated probe table check box to activate the accumulation of probe updates for both the variation on the solver level (time, frequency, and so forth) and on the batch sweep level. Use the Output table to select where to put the data. Select the Use all probes check box if all the model probes should be accumulated in the table. If the check box is not selected, the probes selected from the Probes list are used.
Client Settings
The Batch node can also be used as a client to drive a server on another machine. You enable the client functionality by selecting the Client check box. You can then set the Hostname (default: localhost) and Port number of the server for the batch job (default: 2036) to connect to. This number is the default port number. If the server you want to connect to is using another port, then edit this number accordingly.
Micromixer — Batch Version: Application Library path COMSOL_Multiphysics/Tutorials/micromixer_batch.