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.
subdomain number tracking
Posted 2009年12月3日 GMT-5 06:41 8 Replies
Please login with a confirmed email address before reporting spam
I am using Matlab interface to draw parameterized geometries and do some post processing after COMSOL solves the magnetostatic problem. The problem I am facing is, when I change the geometry, sometimes the subdomain/boundary/point numbers that COMSOL associates with them changes as well. Then I need to figure out what subdomain numbers COMSOL have given them, and change my physics settings (material definitions etc) accordingly.
I was wondering if you can think of a better way of doing this. For example, is there a function that would give me the subdomain/boundary number of a given geometry?
Thanks!
Arda
Please login with a confirmed email address before reporting spam
I had a similar problem. I was using a m-file script that automatically generates geometry and do the analysis in for-next loop. But every time i changed a geometry dimension(like scaling), the subdomain IDs were changing.
I solved it by "geomcsg" command.
The syntax of this command is :
[g,st] = geomcsg(sl)
Here, st is the variable that subdomain IDs are stored.
If you use FIND(x) command on that variable, you can get the subdomain IDs that are associated with the geometry ID x.
I hope this will work for you,too..
Oguz
Please login with a confirmed email address before reporting spam
That solved my problem. Do you know if I can use the same function to track the edges/boundaries in a 2D geometry?
Please login with a confirmed email address before reporting spam
I actually didnt try to do it but i think it should work with a little tweak.
There is some information about this command in COMSOL Reference Guide.
" [g,st,ft,ct] = geomcsg(sl,fl,cl,...) additionally returns the curve table, ct, which relates curve objects in cl to edge segments in g. "
I think you should a edge list into the "geomcsg" command. But i'm not sure about it.
If it works, please let me know. I've got a similiar problem that i couldnt find the time to work on..
Please login with a confirmed email address before reporting spam
I tried the following:
ctx = geomcsg(s.obj,'Out','ctx'); % s.obj being the object list
ctx{10}; % gives the edges of 10th object in the object list.
Hope it helps!
Arda
Please login with a confirmed email address before reporting spam
I have a geometry produced in a m-file. The solid3 object has 7 subdomains, their numbring depends on the length and scaling that is subject to change each round in the for-loop. I used the [g,st] = geomcsg(fem.draw) command. What I am getting is
g =
3D geometry object
subdomains: 7
faces: 36
edges: 60
vertices: 32
st =
(1,1) 1
(2,1) 1
(3,1) 1
(4,1) 1
(5,1) 1
(6,1) 1
(7,1) 1
So, basically, there is no detailed information about the "location" of each subdomain. What I'm exactly looking for is "where" the subdomain X is located, so that I can assign proper settings to that subdomain.
Appreciate any help.
Cheers,
Sattar
Please login with a confirmed email address before reporting spam
Unfortunately I don't have time to go back to my files and see what I exactly did, but the general idea should be somethiong like the following.
what you get in st variable is the link between your objects and their subdomains. So you don't find the answer to "where is each subdomain" but "which object is assigned what subdomain". In your m-file, if the ordering of your objects are not changing you can use this information to track which object is subdomain X and which one is Y. Then you can do the correct assignments.
Again, this might not be 100% correct, or work in all cases, but what solved my problem has to be something like this.
Hope it helps,
Arda
Please login with a confirmed email address before reporting spam
And use the function geomanalyze instead of geomcsg so the relationship between names and objects will stay the same.
Attachments:
Please login with a confirmed email address before reporting spam
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.