• Skip to Main Content
  • Go to the Website's Home
  • Go to Website News
  • Go to About this site
  • Skip to Audience Navigation Menu
  • About
    • Welcome to the College
    • Facts and Figures
    • Message from the Dean
    • Visit Us
    • College Administration
    • News Center
  • Research
    • Research Home
    • Departments
    • Centers & Labs
    • Faculty Directory
    • Opportunities for Undergraduates
  • Admissions
    • Undergraduate Admissions
    • Undergraduate Recruiting
    • Graduate Admissions
  • Academics
    • Departments
    • Undergraduate Programs and Degrees
    • Graduate Programs and Degrees
    • Course Guide/Bulletin
    • Teaching
    • Support Services
  • Departments
    • Aerospace Engineering
    • Atmospheric, Oceanic and Space Sciences
    • Biomedical Engineering
    • Chemical Engineering
    • Civil and Environmental Engineering
    • Electrical Engineering and Computer Science
    • Industrial and Operations Engineering
    • Interdisciplinary Professional Programs
    • Materials Science and Engineering
    • Mechanical Engineering
    • Naval Architecture and Marine Engineering
    • Nuclear Engineering and Radiological Sciences
  • Support the College
    • Giving
    • Involve Yourself
    • Corporate Relationships
  •   

College of Engineering

Center for Advanced Computing

  • Welcome
  • About
  • Getting Started
    • Getting Started
    • Learning About HPC
    • CAC Training Courses
  • Resources
    • Resources
    • Systems
    • Software
    • Storage
    • Networking
    • Visualization
    • Teragrid
  • Academics
  • Contact Us
  • Frequently Asked Questions
Follow Us On Twitter

Contact Information

[Contact] Center for Advanced Computing
College of Engineering
cac-support@umich.edu Link

Center for Advanced Computing  /  Resources  /  Software  /  Comsol Batch

Comsol Batch

PBS Example
Creating m File
Comsol Notes

Before Comsol can be used, users must run module load comsol

To run Comsol on the cluster, Comsol inputs must be in the form of Comsol Script (a .m file). Regular Comsol models may be exported as Comsol Script easily. Scripts must not have any plotting.

PBS Example

#PBS -N jobname
#PBS -q route
#PBS -M email@umich.edu
#PBS -V
#PBS -l nodes=1:ppn=4,software=COMSOL,mem=2gb,walltime=4:00:00

#comment
#Run comsol on 4 cpus assuming the solver supports it
echo "I ran on: "
cat $PBS_NODEFILE

#change to input directory
cd $PBS_O_WORKDIR

#run comsol script in batch,
# file is input.m, do not type .m here
comsol -np 4 batch input

Creating m Files

To create a comsol input for batch, users must create an 'm' file. m files are inputs to comsol script/batch and are text representations of a comsol model and solver.

To create an m file, setup a normal comsol problem and save it. Re-open the saved comsol problem and select File->Save As, Change the file type to m file and save. m files are regular text and may need editing, before they will run on the cluster.

Comsol Notes

Comsol Licensing

There is a limited number of comsol tokens available. The CAC clusters are aware of this though. In the PBS example #PBS -l software=COMSOL will let the CAC cluster know that it should check that a comsol token is available before starting the job. This will prevent errors with licensing.

Post Processing:

Use the function flsave() to save a solved FEM structure. Comsol normally calls your object xfem, when you have comsol generate your input for you. So to save xfem to a file output, use: flsave('output', xfem);. flsave writes a file that can be ether read back in in comsol script with fload() or most commonly, can be opened by the gui and post processed as though it had been run on that workstation.

Comsol Script

The comsol input for batch is really a comsol script file. You can test the script on a workstation to verify it does what you wish. All commands in the input .m file is documented by running 'help command' in the comsol script window. Example: 'help flsave'.

Syntax error, Line 1, Column 1:
Exception:
com.femlab.util.FlException: Syntax error.
Messages:
Syntax error.
- Line: 1
- Column: 1
- Type: Parse error

This is commonly because your input file starts with a number, eg 12input.m. Do not start input file names with a number. It confuses Comsol.

Cannot Find File:
Exception:
com.femlab.util.FlException: Cannot find file.
Messages:
Cannot find file.
- Built-in function: javaMethod
- Callstack:   geomimport   135   glr.jptr.smartRunner(report, 500);
test          18   garr = geomimport('/home/username/model.dxf');

Your model is using the function geoimport() to import a geometry from an external file. Be sure to copy the requested file to the cluster also, and update your input file as to the files new location. The best action is to place the model.dxf file in this case, into the same directory as you will be running comsol in your script. Then update your input to have just geomimport('model.dxf');.

HeadlessException, No X11 DISPLAY variable was set:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
(rethrown as com.femlab.util.FlFatalException)
Messages:
Fatal error.
- Type: HeadlessException
- Built-in function: newplot
- Callstack:   postnewplot    22   hAx=newplot(false);
postplot      624   ax = postnewplot;
test          214   postplot(fem, ...

You are trying to use a function (in this case postplot) that creates graphics on the screen. When running in batch inside PBS there is no screen. Comment out the plotting function lines. Try using flsave() to collect the data to plot later

XHTML 1.0 Valid
CSS 2.1 Valid
University of Michigan
  • Home
  • Contact Us
  • Site Map
  • Site Feedback
  • Accessibility
  • Emergency Procedures
  • Jump to top of the page
© 2009 College of Engineering, University of Michigan