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.

LiveLink "selection.set"

Please login with a confirmed email address before reporting spam

Hello All,
I'm having what I believe to be a pretty straightforward problem getting the selection.set function to work properly. I am learning LiveLink by building up a model step by step, exporting to an m file at every step and keeping the parts of the script I need. For some reason, playing back any commands which require me to set a selection do not work (even if I did not modify them at all after export). For example:

model.physics('es').selection.set([1]);

Here is the error I get in matlab (where the illegal input vector is, I believe, the key part):

??? Java exception occurred:
Exception:
java.lang.IllegalArgumentException: Illegal input vector
(rethrown as com.comsol.util.exceptions.FlException)
Messages:
Illegal input vector

Stack trace:
at com.comsol.model.impl.SelectionImpl.a(Unknown Source)
at com.comsol.model.impl.SelectionImpl$b.a(Unknown Source)
at com.comsol.model.impl.SelectionImpl$b.execute(Unknown Source)
at com.comsol.model.clientserver.ClientManagerImpl$d.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 ==> scratch_10142010 at 111
model.physics('es').selection.set([1 2 3]);

As a side note, how does Comsol number the domains that are created from the various geometry operations? If I were writing this code 'blind' how would I know how to select domains, boundaries, etc..

Thanks, Mike

5 Replies Last Post 2015年7月17日 GMT-4 19:42
COMSOL Moderator

Hello Michael Norton

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.


Maximilian Gowarzewski

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年5月25日 GMT-4 08:12
Hi,
i have exactly the same problem and i dont understand why it occurs, have you found a solution?

Regards,
Hi, i have exactly the same problem and i dont understand why it occurs, have you found a solution? Regards,

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年5月26日 GMT-4 04:14
Hi Michael

Did you remember to call run on the geometry?

You should have something like this:
model.geom('geom1').run

Comsol only identifies geometric entity numbers after the geometry has been finalized, which happen if you call the run method (and not when you use the runAll method).

If you did call the run method and still sees this problem (and you are certain that you have three domains) then send the model to support.


Finding out what domain number Comsol uses can be tricky. In the LiveLink for MATLAB that is released with Comsol 4.1 you have two functions mphselectbox and mphselectcoords that can be used to identify domains, boundaries, edges and points numbers based on their coordinates.

In Comsol 4.2 there are even more advanced selection methods built into Comsol.


Lars Gregersen
Comsol Denmark
Hi Michael Did you remember to call run on the geometry? You should have something like this: model.geom('geom1').run Comsol only identifies geometric entity numbers after the geometry has been finalized, which happen if you call the run method (and not when you use the runAll method). If you did call the run method and still sees this problem (and you are certain that you have three domains) then send the model to support. Finding out what domain number Comsol uses can be tricky. In the LiveLink for MATLAB that is released with Comsol 4.1 you have two functions mphselectbox and mphselectcoords that can be used to identify domains, boundaries, edges and points numbers based on their coordinates. In Comsol 4.2 there are even more advanced selection methods built into Comsol. Lars Gregersen Comsol Denmark

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年12月13日 GMT-5 08:55
I got the message "illegal input vector" while using the GUI after saving a model (with solutions) with new name and updating its geometry parameters.
Using "Clear all solutions" from the menu solved the problem. Maybe you also have an old solution in your model?
I got the message "illegal input vector" while using the GUI after saving a model (with solutions) with new name and updating its geometry parameters. Using "Clear all solutions" from the menu solved the problem. Maybe you also have an old solution in your model?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2013年5月20日 GMT-4 18:23
Hi,

It is quite confusing that the introduction has not been updated, because I have exactly the same problem with Comsol 4.3a when following the LiveLink Introduction.

LiveLink™ for MATLAB® > Introduction to LiveLink™ for MATLAB® > A Thorough Example: The Busbar
Selections

sel1 = model.selection.create('sel1');
sel1.set([2 3 4 5 6 7]);
sel1.name('Ti bolts');

cheers,
Nicolas
Hi, It is quite confusing that the introduction has not been updated, because I have exactly the same problem with Comsol 4.3a when following the LiveLink Introduction. LiveLink™ for MATLAB® > Introduction to LiveLink™ for MATLAB® > A Thorough Example: The Busbar Selections sel1 = model.selection.create('sel1'); sel1.set([2 3 4 5 6 7]); sel1.name('Ti bolts'); cheers, Nicolas

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年7月17日 GMT-4 19:42
Hi,

I had the same problem and it came from the geometry.
When you have build your geometry, you must run it.
"model.geom('geom1').run;"
On this way, you can select what you want.

I hope it helped.
Hi, I had the same problem and it came from the geometry. When you have build your geometry, you must run it. "model.geom('geom1').run;" On this way, you can select what you want. I hope it helped.

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.