Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
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.
LocalSelectionImpl/set error when using mphinterp
Posted 2012年9月25日 GMT-4 01:19 Interfacing Version 4.2a 2 Replies
Please login with a confirmed email address before reporting spam
I followed these steps:
1. Build a model.
2. Delete everything non-essential.
3. File -> Reset History
4. File -> Save As Model M-File...
5. Opened the m-file and added a few commands at the end to post-process the results. Including a call to mphinterp(..).
6. Ran it using a command like
comsolserver matlab "tbc_test, exit" -mlroot "C:\Program Files\MATLAB\R2012a" -np 6 -Dcs.ckl -nodesktop
7. Received the following error:
Error using com.comsol.model.impl.LocalSelectionImpl/set
Java exception occurred:
Exception:
java.lang.NullPointerException
(rethrown as com.comsol.util.exceptions.FlException)
Messages:
Stack trace:
at com.comsol.model.internal.impl.SelectionImpl.a(Unknown Source)
at com.comsol.model.internal.impl.SelectionImpl$a.a(Unknown Source)
at com.comsol.model.internal.impl.SelectionImpl$a.execute(Unknown Source)
at com.comsol.model.clientserver.ClientManagerImpl$e.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error in C:\Programs\COMSOL42a\mli\mphinterp.p>mphinterp (line 153)
Error in tbc_test (line 192)
[t, unit] = mphinterp(model, ...
Solution: to avoid this happening, a "Solution 1" under "Data Sets" under "Results" should still be present when saving the model as an M-file. I had deleted it before saving, and this, somehow, lead to the error message above.
How I figured it out:
• Started COMSOL with MATLAB, copied-and-pasted the contents of the M-file (except the function header) into it. This way I could experiment with mphinterp(..) without having to run the model from the command line every time I change something.
• Made a very simple model, and experimented with it. Figured out that the difference was the presence of "model.result.dataset.remove('dset1');" in the original M-file.
• This took a long time because of the unhelpful error message and no access to the source.
Hello Evgeni Sergeev
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.