Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Matlab with Comsol

Please login with a confirmed email address before reporting spam

Hello everyone.

I am new to Comsol and Im trying to automate some measurements via matlab, by changing few parameters and exporting results to txt (from matlab), but i actually faced a problem on the begining. After loading a model and changing parameter i cant get a new solution (run procedure is not working).
Q. Do anyone know why this situation occured and have solution for it?
Here is the code :

model11 = mphload('path')
model11.param.set('wdef', '6[mm]');
% model11.study('std2').run;
model11.study('std2').run(); % i tried both methods and they dont work
mphplot(model11,'pg2')
model11.param.set('hdef', '2[mm]');
figure(2)
mphplot(model11,'pg2')


And there is a error :

Error using model1 (line 5)
Java exception occurred:
Exception:
com.comsol.util.exceptions.FlException: java.lang.NullPointerException
Messages:
java.lang.NullPointerException


Stack trace:

at com.comsol.model.selections.SelectionMethod.assocUpdate(SourceFile:1133)

at com.comsol.model.selections.LocalSelectionMethod.assocUpdate(SourceFile:55)

at com.comsol.model.internal.impl.SelectionImpl.assocUpdateThis(SourceFile:1152)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:900)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.ModelEntityMethod.assocUpdate(SourceFile:895)

at com.comsol.model.method.GeomSequenceMethod.updateSelectionsAfterFinGeomChange(SourceFile:200)

at com.comsol.model.internal.impl.GeomSequenceImpl.updateSelectionsAfterFinGeomChange(SourceFile:4357)

at com.comsol.model.method.GeomSequenceMethod.setGeomAndAssoc(SourceFile:2478)

at com.comsol.model.internal.impl.GeomSequenceImpl.a(SourceFile:4349)

at com.comsol.model.internal.impl.GeomSequenceImpl.setGeomAndAssoc(SourceFile:3541)

at com.comsol.model.method.GeomSequenceMethod.setGeomFromLastActiveFeature(SourceFile:2497)

at com.comsol.model.method.GeomSequenceMethod.build(SourceFile:1956)

at com.comsol.model.method.GeomSequenceMethod.b(SourceFile:1827)

at com.comsol.model.method.GeomSequenceMethod.run(SourceFile:1748)

at com.comsol.model.internal.impl.GeomSequenceImpl.ap(SourceFile:4099)

at com.comsol.model.internal.impl.GeomSequenceImpl.run(SourceFile:3236)

at com.comsol.model.method.ModelMethod.multiphysics(SourceFile:927)

at com.comsol.model.internal.impl.ModelImpl.a(SourceFile:4826)

at com.comsol.model.internal.impl.ModelImpl.multiphysics(SourceFile:4078)

at com.comsol.model.method.SolverSequenceMethod.doCreateAutoSequence(SourceFile:2432)

at com.comsol.model.internal.impl.SolverSequenceImpl.k(SourceFile:3792)

at com.comsol.model.internal.impl.SolverSequenceImpl.createAutoSequence(SourceFile:984)

at com.comsol.model.method.StudyMethod.b(SourceFile:333)

at com.comsol.model.method.StudyMethod.doCreateAutoSequences(SourceFile:228)

at com.comsol.model.method.StudyMethod.doRun(SourceFile:51)

at com.comsol.model.internal.impl.StudyImpl.c(SourceFile:349)

at com.comsol.model.internal.impl.StudyImpl.a(SourceFile:348)

at com.comsol.model.internal.impl.StudyImpl$1.a(SourceFile:328)

at com.comsol.model.internal.impl.StudyImpl$1.execute(SourceFile:1)

at com.comsol.model.clientserver.ClientManager$1.call(SourceFile:169)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

I would be grateful, if someone can help me with this issue.

2 Replies Last Post 2 mai 2017, 07:32 UTC−4
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2 mai 2017, 03:10 UTC−4
Hi

Is it this line that fails "model11.study('std2').run(); "?

Do you have other studies in the model? If yes, is 'std2' depending on the results from other studies?

What version of Comsol are you using? Can you post your model or send it to support@comsol.com ?


--
Lars Gregersen
Comsol Denmark
Hi Is it this line that fails "model11.study('std2').run(); "? Do you have other studies in the model? If yes, is 'std2' depending on the results from other studies? What version of Comsol are you using? Can you post your model or send it to support@comsol.com ? -- Lars Gregersen Comsol Denmark

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2 mai 2017, 07:32 UTC−4
Thank you for reply Mr.

Yes, exactly this line.
I have only one study(std2), which consists two steps - stationary and coil geometry analysis. Im gonna send model via support, cause its quite big.

Im using comsol 5.2a.
Thank you for reply Mr. Yes, exactly this line. I have only one study(std2), which consists two steps - stationary and coil geometry analysis. Im gonna send model via support, cause its quite big. Im using comsol 5.2a.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.