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.

Finding the boundary number with the Comsol Java API

Please login with a confirmed email address before reporting spam

Hi everyone,

I am using the Java API with Comsol and I really like it's abilities overall. I build a block first, so there are six boundaries, later I want to set boundary #1(the first index of boundary) and #6(the last index of boundary) as periodic boundaries. However, the index of boundary changes when I add ellipsoids in the block. Is there a way to find the number of last index of boundaries or do you have other suggestion to solve my problem? The code like this:

model.physics("ec").feature("pc1").selection().set(new int[]{1, 54}); // when I add two ellipsoids in the block, the number of last index of boundary changes to 54.

The problem is that IDs of the boundaries – 1, 54 – often change as result of geometry changes. I guess there should be a way to get the IDs through API at runtime, but cannot understand how exactly from reading APIReferenceManual. Did anyone solve such problems? If possible, please write a example code.

Thanks in advance for your help,
Zijiang

0 Replies Last Post Oct 17, 2015, 6:10 p.m. EDT
COMSOL Moderator

Hello Zijiang Yang

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.

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.