Is There a Fix for COMSOL Script Null Pointer Java Error?

  • Thread starter Thread starter py_engineer
  • Start date Start date
  • Tags Tags
    Comsol Issues
AI Thread Summary
The discussion revolves around troubleshooting a COMSOL Script issue where a user encounters a NullPointerException error when attempting to initialize a mesh. The user shares their script, which includes creating a rectangle geometry and setting up a mesh. Despite successfully generating geometry and mesh, the error occurs when running the script, particularly due to the attempt to open a progress window on a remote server lacking graphics capability. The solution identified is to use the 'comsol batch filename' command instead of 'comsol script filename' to avoid the graphical interface issue, which leads to crashes in a non-graphical environment. The user expresses relief at resolving the issue after a lengthy process.
py_engineer
Messages
11
Reaction score
0
Hi,

Is there anyone who can help me with COMSOL Script?

Is there anything wrong with this statement:

flclear fem

g6=rect2(1.0E-6,11.0E-6,'base','corner','pos',[0,0]);

clear s
s.objs={g6};
s.name={'CO1'};
s.tags={'g6'};

fem.draw=struct('s',s);
fem.geom=geomcsg(fem);

fem.mesh=meshinit(fem,'hauto',5);

---------------------

However, when I run this, I get this f..#@>*^& null pointer Java error! :(

Error: java.lang.NullPointerException
at com.femlab.server.MlProgressDlg.runAndWait(Unknown Source)

Error in built-in function javaMethod.
meshinitaux 67 MeshRun.smartRunner(report, loopTime);
meshinit 351 varargout = meshinitaux(fem,'meshinit',varargin{:});
comsol_DLPH_basefile 116 fem.mesh=meshinit(fem.geom,'hauto',5)
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at com.femlab.jline.ConsoleReader.readBinding(Unknown Source)
at com.femlab.jline.ConsoleReader.readLine(Unknown Source)
at com.femlab.jline.ConsoleReader.readLine(Unknown Source)
at com.femlab.script.Terminal.a(Unknown Source)
at com.femlab.script.Terminal.b(Unknown Source)
at com.femlab.script.Terminal.main(Unknown Source)

--------------------------

Any help would be greatly appreciated!

Thanks!
 
Physics news on Phys.org
...got a geometry and a mesh out of it so perhaps there is an error "somewhere else"?
 
Ok, I got it, that wasn't too difficult, but it took me so long!

So I was trying to run COMSOL in the background. But 'comsol script filename' tries to open a progress window, and this makes the simulation crash since I was running this on a remote server with no graphics capability.. To avoid that, you just do 'comsol batch filename'..
 
An error keep repeating myself very often :blushing: .
 

Similar threads

Replies
2
Views
5K
Back
Top