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
Posted 28 ago 2009, 09:01 GMT-4 13 Replies
Please login with a confirmed email address before reporting spam
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
Please login with a confirmed email address before reporting spam
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
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
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
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
Please login with a confirmed email address before reporting spam
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
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
Please login with a confirmed email address before reporting spam
Edit: Just found this Thread: www.comsol.de/community/forums/general/thread/8837/ where the problem seems to be discussed in more detail.
Please login with a confirmed email address before reporting spam
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
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
... 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
Please login with a confirmed email address before reporting spam
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
Please login with a confirmed email address before reporting spam
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.