Help with COMSOL Script Issues

In summary, The person is seeking help with using COMSOL Script and is encountering a null pointer Java error when running a certain command. They mention trying to run the program in the background and suggest a solution for avoiding the error.
  • #1
py_engineer
12
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
  • #2
...got a geometry and a mesh out of it so perhaps there is an error "somewhere else"?
 
  • #3
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'..
 
  • #4
An error keep repeating myself very often :blushing: .
 

1. What is COMSOL and why is scripting important?

COMSOL is a software used for modeling and simulating physical systems. Scripting allows for more customization and automation of tasks within COMSOL, making it an essential tool for efficient and accurate simulations.

2. How do I debug my COMSOL script?

To debug a COMSOL script, you can use the built-in debugger tool or add print statements to your code to check for errors or unexpected results. You can also refer to the COMSOL documentation for troubleshooting tips and techniques.

3. Can I use external libraries or modules in my COMSOL script?

Yes, COMSOL allows you to import external libraries or modules into your script. However, you may need to make sure they are compatible with the COMSOL environment and follow any necessary installation steps.

4. How can I improve the performance of my COMSOL script?

There are several ways to improve the performance of your COMSOL script, such as using vectorized operations, minimizing the use of loops, and avoiding unnecessary calculations. You can also refer to the COMSOL documentation for tips on optimization.

5. Can I run multiple simulations simultaneously using COMSOL scripting?

Yes, you can use COMSOL scripting to run multiple simulations simultaneously. This can be achieved by using parallel computing methods or by creating multiple instances of the COMSOL application to run different simulations at the same time.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
Back
Top