Comsol w/Matlab: CLI vs GUI issues

  • Context: MATLAB 
  • Thread starter Thread starter grumpymrgruff
  • Start date Start date
  • Tags Tags
    Comsol Gui Issues
Click For Summary
SUMMARY

The discussion centers on issues encountered when running Comsol with Matlab through a command-line interface (CLI) as opposed to the graphical user interface (GUI). Users report that the geomimport() function fails to import the geom.mphbin file, resulting in a java.lang.NullPointerException. The problem persists across different machines, and the user seeks workarounds for executing the code on a computer cluster without GUI access. A potential typo in the function name was addressed, but it was confirmed that the code itself is correct.

PREREQUISITES
  • Familiarity with Comsol Multiphysics and its integration with Matlab.
  • Understanding of command-line interfaces (CLI) and their usage in running scripts.
  • Knowledge of Java exceptions and debugging techniques in Matlab.
  • Experience with file formats used in Comsol, specifically .mphbin files.
NEXT STEPS
  • Investigate the use of Comsol's command-line options for batch processing.
  • Explore alternatives to geomimport() for importing geometry files in CLI mode.
  • Learn about error handling in Matlab, particularly for Java-related exceptions.
  • Research best practices for running long computations on computer clusters without GUI access.
USEFUL FOR

Researchers and engineers using Comsol with Matlab, particularly those working in high-performance computing environments and needing to execute simulations without a graphical interface.

grumpymrgruff
Messages
16
Reaction score
2
Hi all - I've been working on some code in Comsol w/ Matlab that works fine on any machine I run it on - so long as I run it through the Comsol w/ Matlab GUI.

No matter which machine I run it on, the program fails if I run Comsol w/ Matlab through a CLI. Specifically, the geominport() function fails to import my geom.mphbin file with the following error (gap is the name of my model m-file):

Code:
>> gap
? Java exception occurred:
java.lang.NullPointerException
        at com.femlab.server.MlProgressDlg.runAndWait(Unknown Source)
        at com.femlab.server.FlRunnable.a(Unknown Source)
        at com.femlab.server.FlRunnable.smartRunner(Unknown Source)

Error in ==> geomimport at 208
glr.jptr.smartRunner(report, 500);

Error in ==> gap at 23
garr = geomimport('./geom.mphbin');

I am planning to submit this code as a job on a computer cluster where any kind of GUI interface will be out of the question. Has anyone using Comsol/Matlab encountered this problem before, and do you know any workarounds that will let me get my code running without a GUI?

Thanks much!
 
Physics news on Phys.org
Hi,

Can it be that you try to use the function geomimport() but misspelled it to geominport() ?

Good luck
/ T

grumpymrgruff said:
Hi all - I've been working on some code in Comsol w/ Matlab that works fine on any machine I run it on - so long as I run it through the Comsol w/ Matlab GUI.

No matter which machine I run it on, the program fails if I run Comsol w/ Matlab through a CLI. Specifically, the geominport() function fails to import my geom.mphbin file with the following error (gap is the name of my model m-file):

Code:
>> gap
? Java exception occurred:
java.lang.NullPointerException
        at com.femlab.server.MlProgressDlg.runAndWait(Unknown Source)
        at com.femlab.server.FlRunnable.a(Unknown Source)
        at com.femlab.server.FlRunnable.smartRunner(Unknown Source)

Error in ==> geomimport at 208
glr.jptr.smartRunner(report, 500);

Error in ==> gap at 23
garr = geomimport('./geom.mphbin');

I am planning to submit this code as a job on a computer cluster where any kind of GUI interface will be out of the question. Has anyone using Comsol/Matlab encountered this problem before, and do you know any workarounds that will let me get my code running without a GUI?

Thanks much!
 
dontommazo said:
Hi,

Can it be that you try to use the function geomimport() but misspelled it to geominport() ?

Good luck
/ T

Good eye. I didn't notice that. Unfortunately, the typo is only in my post, not in the code. Right now I'm running the job on a cluster with X11 forwarding for the GUI and hoping that I don't lose my connection to the cluster for about a week's worth of computation. ;-)
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
11K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K