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.
exporting data from the boundary
Posted 22 lug 2009, 20:24 GMT-4 12 Replies
Please login with a confirmed email address before reporting spam
I am wondering if anyone exported somehow in COMSOL or postprocessed in (COMSOL with) MATLAB the results from an interior boundary (or from a particular boundary). If you could give me an advice on how to access data from a specific boundary, I would very much appreciate it.
Thank you,
Noemi
Please login with a confirmed email address before reporting spam
I am not really sure if I got your point. But it seems that you are looking to plot a variable located at a certain boundary. in Comsol it is simple. Just go to post processing/domain plot parameter/line or whatever and select the boundary and the variable that you are looking for.
I hope it helps
Cheers,
Please login with a confirmed email address before reporting spam
Thanks!
Noemi
Please login with a confirmed email address before reporting spam
postinterp
or
posteval
typing ">> help postinterp" or ">> help posteval" should tell you what to do.
Please login with a confirmed email address before reporting spam
Best,
Noemi
Please login with a confirmed email address before reporting spam
I have also been stuck on this issues several times, how to make a "fictuous group" just to define parts of the geometry for later improved post-processing ? as an item can only belong to "one" group.
My work-around, but only when the item is not already in a "group", or fully within one, is to change one parameter by a small fraction, not important for the calculation, (this might impliy to turn "on" interior boundaries, making the model heavier) just to distinguis the item from the others, then to use the group name as "quick pick". It's very handy when you are working with complex geometry in the GUI environment for later postprocessing.
Try it and take alook at the "history file" to see hoe COMSOL treats the indirect addressing.
It's true that on could propose to COMSOL to add "postprocessing groups" not having any physics attached, hence alloving an item to belong to "two or more groups, but at most one with physics" just for the purpouse for later postprocessing within the GUI environment, or for easier Matlab integration.
Often I have the feeling COMSOL developpers only work with models/subdomains having 6 faces, 12 edges and 8 points ! my models have rarely less than several tousand of those, keeping track of them all is a hell of a work (though it has always been like that also for "older" FEM programmes, but why not come with a great idea to help us here ?).
What do the COMSOL developpes say ?? are you following ;)
Good luck Noemi, and keep us informed with your advance
Ivar
Please login with a confirmed email address before reporting spam
in the mean time I have also been stuck on how to easily access a "named" boundary from within matlab/script.
This gives me the opportunity to correct one comment I made earlier, you do not need to change any boundary property "just a little" to make a named group, it's in fact much easier to go to the group window, select new and define in a new name, and then return to the element selection window, select your items and add them to the new group.
To access the group indices from matlab was slightly trickier, but once I have found the way around, its rather "logical"
in the example below I have 2 application modes, I have defined a boundary (surface) of a 3D suctural model with a given name and then I use this for my plots:
I'm running V3.5a, have heard it will change and be much easier in V4, hope this is so,
my 'TopZernikeSurf' surface definition, from the history file is:
bnd.name = {'','Bottom_Surf','TopZernikeSurf'};
bnd.ind = [1,1,2,2,3,3,1,2,3,2,3,1];
appl.bnd = bnd;
and later I'm plotting with something like:
postcrossplot(fem, 2, [5,6,9,11], 'surfdata','z11*1e6', ...
Ideally I would like to write:
postcrossplot(fem, 2, 'TopZernikeSurf', 'surfdata','z11*1e6', ...
but this is not possible in v3.5a
so with some fiddling with matlab cells I get this to work:
postcrossplot(fem, 2, [find(fem.appl{1}.bnd.ind==strmatch('TopZernikeSurf',fem.appl{1}.bnd.name))], 'surfdata','z11*1e6', ...
in fact you can check that:
[5,6,9,11] = [find(fem.appl{1}.bnd.ind==strmatch('TopZernikeSurf',fem.appl{1}.bnd.name))]
I'm matching the string 'TopZernikeSurf' to the content of "fem.appl{1}.bnd.name" as I'm working on the 2D surfaces of a 3D body (you must adapt the names if you are running on other boundaries types) this gives me the index value to compare to the index list "fem.appl{1}.bnd.ind", and the "find" extracts the indexed list values I need. Note that the {1} is there because I have 2 different application modes and I'm addressing the first one, I expect it would also work if you have only one application, or you might need to smply drop the {1}.
I haven’t had much time to cross check how stable this is, certainly you must return to the GUI to redefine the elements of the group if you modify the geometry and rerun the calculation, but normally I do not expect to have to do this if the geometry is not changed.
Hope this might help you too
Ivar
Please login with a confirmed email address before reporting spam
If you know the number index of your boundary you can use postcoord to get the coordinates of the points in your boundary, and ten you use the results of postcoord in postinterp.
I tried in 2 dimensionnal models. It seems it works, so It worth the try.
Good luck
Please login with a confirmed email address before reporting spam
I've too have worked with similar questions in mind. I've found when modeling from the command prompt the optional output from geomcsg is very usful.
Imagine I have a complete geometry defined as a solid object;
>>fem.draw.s.objs = mygeom;
Then I have certain area of interest, which might be made up of several boundaries in the analyzed geometry. If I add an extra draw object for the area of interest I can later know the indices of boundaries making up this area. The draw object is not necessary to define the geometry, it simply acts as a hook to fetch indices of interest, and should overlap with parts of the existing 'mygeom'.
>>fem.draw.c.objs = c1;
>>fem.draw.c.name = mybound;
...
>>[fem.geom,st,ct] = geomcsg(fem);
This line creates a solid table 'st', and curve table 'ct' which contains the indices of draw objects in the order which they are assigned above. So the indices to my draw object is found by;
>>mybound_ind = find(ct(:,find(strcmp(fem.draw.c.name,'mybound'))));
This way I can assign boundary conditions and postprocess with 'mybound_ind'.
Cheers
Lars Ottar
Please login with a confirmed email address before reporting spam
If I undertand you well, you are complementary to my approach, by working fully in the matlab environment, as I was defining mostly my model in the GUI and then used a GUI defined "group" to do some further matlab tratment.
Interesting, need to try this out closer
Med takk og hilsen
Ivar
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
I can't find a way to avoid the interpolation.
I try this command:
pd = posteval(fem,'w','solum','end','dl',4,'Edim',1);
but it returns much more data points than I have vertices on that line. How can I get just the solution it calculated on the mesh?
Please login with a confirmed email address before reporting spam
could it be that your "dl" should be written "Dl" with un uppercase "D" ?
normally Comsol is rather case sensitve
My way around is to index the COMSOL documents, and then search i.e. posteval to have a look at different examples scattered in the different books, this helps to identify how to use the functions
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.