40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  COMSOL elog  Not logged in ELOG logo
Message ID: 76     Entry time: Mon Sep 16 10:07:32 2013
Author: Evan 
Type: General 
Category: Configuration 
Subject: COMSOL 4.3 on the OS X command line 

If you're running Matlab scripts that iterate over simulation parameters (à la Tara), you might find it useful to be able to run everything from the command line (instead of launching the "Comsol with Matlab" GUI application).

First, the comsol command wasn't in my path, so I symlinked it to someplace where bash could find it:

ln -s /Applications/COMSOL43a/bin/comsol /opt/local/bin/comsol

I then started Comsol/Matlab using a slight modification of the commands given in the Comsol 4.3 help file "Running A COMSOL M-file In Batch Mode Without Display":

comsol server > server_log.txt &

matlab -nodesktop -nosplash -r "run /Applications/COMSOL43a/mli/mphstart; comsol_script; exit"

The first command starts the Comsol server in the background and cats its output into a log file. The second command launches Matlab, runs the initialization script which makes Matlab aware of Comsol, runs my Comsol/Matlab script (comsol_script.m), and then exits.

ELOG V3.1.3-