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.

Numbering of the boundaries in *.m file

Please login with a confirmed email address before reporting spam

Hello all,

I am working on a parametric geometry model and I want to create my geometry/solution fully in script. I have to say that it is a rather complex geometry and till now I took the short and easy way by first creating my geometry in MatLab script with Comsol functions, exporting it to Comsol, doing the necessary subdomain and boundary settings there, exporting the model back to a "*.m" file (letting Comsol deal with the numbering for me) and proceeding with the solution.

Now, the geometry became more complex and the number of boundaries are not constant anymore and I need to understand how Comsol numbers the boundaries so that I can assign the correct boundary conditions without switching between Comsol and MatLab. When I look at bnd.ind=[] and equ.ind=[] there seems to be a logic behind the numbering but I couldn't be able to find any documentation explaining that systematic.

Thanks in advance,
Onur

13 Replies Last Post 2010年11月26日 GMT-5 09:44

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2009年9月3日 GMT-4 07:45
Hi,
It seems that the index of boundary begins on the left bottom corner of your windows and then increase until the right top corner with priority to the horizontal boundaries.
It's what I noticed. I hope it can help you in your project.
Hi, It seems that the index of boundary begins on the left bottom corner of your windows and then increase until the right top corner with priority to the horizontal boundaries. It's what I noticed. I hope it can help you in your project.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2009年9月4日 GMT-4 04:28
Hello,

Comsol increment with a sort of triple loop (for x=1:end; for y=1:end; for z=1:end) to find the boundary number.

I have a matlab code which finds a face (or boundary) number (If you know the boundary position (x,y,z)).
the second matlab code finds vertex number.

I hope codes will help you,

Y.
Hello, Comsol increment with a sort of triple loop (for x=1:end; for y=1:end; for z=1:end) to find the boundary number. I have a matlab code which finds a face (or boundary) number (If you know the boundary position (x,y,z)). the second matlab code finds vertex number. I hope codes will help you, Y.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2009年9月4日 GMT-4 08:52
Hello Jean and Yannick,

Thanks to both of you! It seems I am benefiting fully form the experiences of the users who have been there before.

/Onur
Hello Jean and Yannick, Thanks to both of you! It seems I am benefiting fully form the experiences of the users who have been there before. /Onur

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2009年11月3日 GMT-5 12:42
Hi,

This is an excellent function! Just should have provided an example of its use.

function result = face(geometry,x,y,z,tol,density)


I would emphasis that the x,y,z co-ordinates are "rubberband" co-ordinates i.e.

face(fem.geom,[3.6e-6 3.8e-6],[4e-6 4.5e-6],[0 40e-6],1e-3,2)

Orginally I entered tol=1 which resulted in all the boundaries in the model being returned, this is because this is the tolerance and 1 = 1m which is larger than my model space.

I am still to work-out what the density is? I have it set to 2 and it is working well!

Good Work!!


Regards,
Tom
Hi, This is an excellent function! Just should have provided an example of its use. [quote] function result = face(geometry,x,y,z,tol,density) [/quote] I would emphasis that the x,y,z co-ordinates are "rubberband" co-ordinates i.e. face(fem.geom,[3.6e-6 3.8e-6],[4e-6 4.5e-6],[0 40e-6],1e-3,2) Orginally I entered tol=1 which resulted in all the boundaries in the model being returned, this is because this is the tolerance and 1 = 1m which is larger than my model space. I am still to work-out what the density is? I have it set to 2 and it is working well! Good Work!! Regards, Tom

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年3月15日 GMT-4 12:04
Hi,

Thanks for the great functions. I have another problem setting the boundary of a complicated geometry in Matlab that is somewhat related to the above topic. The problem that I am trying to solve is involving more than 400 faces. A lot of them are in contact. I am wondering if there is function or list of commands able to find faces that are in contact.

Regards,

Francis
Hi, Thanks for the great functions. I have another problem setting the boundary of a complicated geometry in Matlab that is somewhat related to the above topic. The problem that I am trying to solve is involving more than 400 faces. A lot of them are in contact. I am wondering if there is function or list of commands able to find faces that are in contact. Regards, Francis

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年4月12日 GMT-4 23:59
Hi Yannick,

This is amazing, but I cannot seem to get it to work in 2D :( can you advise me on how to get it done into2D? and it will give me the index of boundaries if I'm not wrong.

Thanks!
Hi Yannick, This is amazing, but I cannot seem to get it to work in 2D :( can you advise me on how to get it done into2D? and it will give me the index of boundaries if I'm not wrong. Thanks!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月26日 GMT-4 11:26
In 3.5a I was able to do this using a combination of geomcsg and flgeomnbs. However, I cannot figure out how to do this with version 4.0a? Has anyone figured out how to track the boundaries or more specifically how to determine what boundary numbers are assigned to a specific geometry feature?
In 3.5a I was able to do this using a combination of geomcsg and flgeomnbs. However, I cannot figure out how to do this with version 4.0a? Has anyone figured out how to track the boundaries or more specifically how to determine what boundary numbers are assigned to a specific geometry feature?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月25日 GMT-5 06:25
Sorry for bringing up this old Thread, but I still find this an important question. Imho the whole usability of the MATLAB LiveLink depends on this feature, e.g. if you have simulations with geometrie-sweeps.

Edit: Just found this Thread: www.comsol.de/community/forums/general/thread/8837/ where the problem seems to be discussed in more detail.
Sorry for bringing up this old Thread, but I still find this an important question. Imho the whole usability of the MATLAB LiveLink depends on this feature, e.g. if you have simulations with geometrie-sweeps. Edit: Just found this Thread: http://www.comsol.de/community/forums/general/thread/8837/ where the problem seems to be discussed in more detail.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月25日 GMT-5 15:20
Hi

be aware that the numbering methode might well have changed between 3.5a and 4, and could too in the future, from what I have understood, but to be sure ask directly "support" (I'm not COMSOL;)

--
Good luck
Ivar
Hi be aware that the numbering methode might well have changed between 3.5a and 4, and could too in the future, from what I have understood, but to be sure ask directly "support" (I'm not COMSOL;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月26日 GMT-5 09:13
Hi Ivar,

thanks for your reply! I think that's the point: Why does the user have to care about some numbering methods when using the Matlab LiveLink? Why is there no method to reference e.g. all boundarys that belong to a certain 3D-block by the feature-tag of the block? Every COMSOL 4 example that I could find had a hard-coded list like this:

model.geom('geom1').feature.create('blk1', 'Block'); ...
model.selection('sel1').set([1 2 3 4 7 8]); ...

But what I need is something like this:

model.geom('geom1').feature.create('blk1', 'Block'); ...
model.selection('sel1').set(getAllBoundarysFromFeature('blk1')); ...

I often have to make hundreds of simulations with complex geometry variations via script, and there is no way to know the boundary-numbers in advance and code them hard into the script. For 3.5a it was possible to create a reliable workaround to receive the numbers/ids of faces, subdomains etc. corresponding to a certain geometry. It was very extensive to do this and you had to use some creepy, badly documented functions, but it worked. ;) In COMSOL 4.0a there seems to be no way to do this...

I think I'll wait until I get my hands on the 4.1 Version next week and If I don't get it working in 4.1, I contact the support. I don't understand, why there are so few people with the same problem. Is everyone else using the GUI only? ;-)

kind regards
David
Hi Ivar, thanks for your reply! I think that's the point: Why does the user have to care about some numbering methods when using the Matlab LiveLink? Why is there no method to reference e.g. all boundarys that belong to a certain 3D-block by the feature-tag of the block? Every COMSOL 4 example that I could find had a hard-coded list like this: model.geom('geom1').feature.create('blk1', 'Block'); ... model.selection('sel1').set([1 2 3 4 7 8]); ... But what I need is something like this: model.geom('geom1').feature.create('blk1', 'Block'); ... model.selection('sel1').set(getAllBoundarysFromFeature('blk1')); ... I often have to make hundreds of simulations with complex geometry variations via script, and there is no way to know the boundary-numbers in advance and code them hard into the script. For 3.5a it was possible to create a reliable workaround to receive the numbers/ids of faces, subdomains etc. corresponding to a certain geometry. It was very extensive to do this and you had to use some creepy, badly documented functions, but it worked. ;) In COMSOL 4.0a there seems to be no way to do this... I think I'll wait until I get my hands on the 4.1 Version next week and If I don't get it working in 4.1, I contact the support. I don't understand, why there are so few people with the same problem. Is everyone else using the GUI only? ;-) kind regards David

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月26日 GMT-5 09:31


... It was very extensive to do this and you had to use some creepy, badly documented functions, but it worked. ;) In COMSOL 4.0a there seems to be no way to do this...

... Is everyone else using the GUI only? ;-)



If a code is working okay, why update it in the first place ;)
/Onur
[QUOTE] ... It was very extensive to do this and you had to use some creepy, badly documented functions, but it worked. ;) In COMSOL 4.0a there seems to be no way to do this... ... Is everyone else using the GUI only? ;-) [/QUOTE] If a code is working okay, why update it in the first place ;) /Onur

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月26日 GMT-5 09:33
Hi

I agree with you, and I can only suggest that you ask support too, it might already be on their to do list, but will not be there if nobody asks for it ;)

--
Good luck
Ivar
Hi I agree with you, and I can only suggest that you ask support too, it might already be on their to do list, but will not be there if nobody asks for it ;) -- Good luck Ivar

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月26日 GMT-5 09:44
Hi

but COMSOL is so complex that there might be other reasons why things change, ... no ?
This does not mean that renumering is not (very) important, I agree, send a suggestion to COMSOL

V4 can do much more than v3.5 so I'm rather happy

--
Good luck
Ivar
Hi but COMSOL is so complex that there might be other reasons why things change, ... no ? This does not mean that renumering is not (very) important, I agree, send a suggestion to COMSOL V4 can do much more than v3.5 so I'm rather happy -- Good luck Ivar

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.