How can I run COMSOL Multiphysics computations in batch mode?

Solution Number: 980
Title: How can I run COMSOL Multiphysics computations in batch mode?
Platform: All Platforms
Applies to: All Products
Versions: 3.5a
Created: January 30, 2006
Last Modified: April 15, 2010
Categories: Installation
Keywords:

Problem Description

How can I run COMSOL Multiphysics computations in batch mode?

Solution

The following explanation applies to COMSOL version 3.5a

The general syntax for the command for starting COMSOL Batch is

comsol [< options >] batch [< target arguments >]

An example of using the comsol batch command on Linux is

comsol batch -input mymodel.mph

On Windows, run the following command:

comsolbatch.exe -input mymodel.mph

or

comsolbatch64.exe -input mymodel.mph

on 64-bit operating systems.

This command starts COMSOL Batch, solves the model in the Model MPH-file with the given file name using the active solver settings in the model, and stores the solution in the same file. For more command line options, please see the section The COMSOL Command in the COMSOL Installation and Operations Guide, version 3.5a.

Using the MATLAB interface of COMSOL Multiphysics

If you run COMSOL Multiphysics with MATLAB, you can run your m-file in a session without the desktop and the splash screen. This is corresponds running COMSOL in batch mode through an m-file.

On the Linux command line:

comsol matlab -ml -nodesktop -ml -nosplash -mlr "myscript, exit"

On Windows, specify the target of the COMSOL shortcut to

c:\COMSOL35a\bin\comsol.exe matlab -ml /nodesktop -ml /nosplash -mlr "myscript, exit"

or use comsol64.exe if you have a 64-bit Windows operating system.

  • The command above runs the file myscript.m. The exit command is used to close the MATLAB session after the m-file run has completed. As an alternative you can insert an exit command in the m-file itself. The exit command is important if you use a job manager or scheduler for several different jobs.
  • Add a line flreport('off') at the beginning of the script to suppress any Java windows with progress bars during meshing and solving. If you have no display available, the run will crash if a Java window tries to open.

For more command line options, type comsol matlab -h or refer to the COMSOL Installation and Operations Guide, version 3.5a. For more informatin about the COMSOL commands for interfacing to MATLAB, see the COMSOL Multiphysics MATLAB Interface Guide and Reference Guide. All manuals are available from the menu Help->Help Desk.

Related Files

myscript.m 1 KB

Feedback

Poor | Excellent
Document quality?



Disclaimer

COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.