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.

How to identify subdomains after geomcsg()

Please login with a confirmed email address before reporting spam

Hello Comsol community,

I want to identify subdomains I built with an m-file.

What I do is to build objects, e.g. block3. Then I create arrays out of these blocks. Finally I create the "fem"-geometry by using geomcsg.
Afterwards I need complicated algorithms to identify my single subdomains (e.g. I want to access the first block3 in the first array). The order of these objects has regularities but it would be easier for me, if I could define the order to know that object 5 is the fifth object in array 1.
Why do I need to know the order of objects? For example to define subdomain conditions or to calculate results for a certain object. Additionally, when I add one object to the geometry I do not know whether it is first, last or at whatever position.

Is there any possibility to define the order of these objects?

Thanks for your help!

Clemens



Example:

b1=block3(1,1,1,'base','center','pos',{'1','1','1'},'rot','0');
b1_a = geomarrayr(b1,0,2,0,1,2,1);

b2=block3(1,1,1,'base','center','pos',{'1','1','3'},'rot','0');
b2_a = geomarrayr(b2,2,0,0,2,1,1);

b3=block3(3,3,1,'base','corner','pos',{'1','1','5;},'axis',{'0','0','1'},'rot','0');

clear fem;
geom = geomcsg({geomcsg(b1_a),geomcsg(b2_a),b3});
fem.geom = geom;
fem.draw = geom;

2 Replies Last Post 14 apr 2010, 12:03 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14 apr 2010, 10:27 GMT-4
The way I do it is I rotate my entire model geometry so that the subdomain I want to have as sub 1 is positioned at the lowest coordinates. It's kind of hard to explain whithout pictures, but if you create a 3D array of structures (say cubes) in the COMSOL GUI and go into subdomain settings and look at the way they're numbered, you should be able to figure it out. It's the same numbering scheme with boundaries and edges.

Hope that helps,

-Matt
The way I do it is I rotate my entire model geometry so that the subdomain I want to have as sub 1 is positioned at the lowest coordinates. It's kind of hard to explain whithout pictures, but if you create a 3D array of structures (say cubes) in the COMSOL GUI and go into subdomain settings and look at the way they're numbered, you should be able to figure it out. It's the same numbering scheme with boundaries and edges. Hope that helps, -Matt

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14 apr 2010, 12:03 GMT-4
Thank you for replying. I figured this scheme. But it does just help for a certain design. When I add an additional block3 to right in the middle of the old design I need to know how many objects are "before" it (in x- and y-direction). I was wondering whether there is a possibility to number or order all subdomains (e.g. in the order of creating).

Clemens
Thank you for replying. I figured this scheme. But it does just help for a certain design. When I add an additional block3 to right in the middle of the old design I need to know how many objects are "before" it (in x- and y-direction). I was wondering whether there is a possibility to number or order all subdomains (e.g. in the order of creating). Clemens

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.