-
Filter by Topic
Most Popular
All Topics
- List all discussions
exporting data from the boundary
|
Thread index | Previous thread | Next thread | Start a new discussion |
July 23, 2009 12:24am UTC
exporting data from the boundary
Hi,
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
Reply | Reply with Quote | Send private message | Report Abuse
July 23, 2009 3:29pm UTC in response to N Z
Re: exporting data from the boundary
Hi,
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,
Reply | Reply with Quote | Send private message | Report Abuse
July 23, 2009 4:23pm UTC in response to R. Faycal Hamou
Re: exporting data from the boundary
Yeah, I know that. Unfortunately I need to export this data OUT from COMSOL so that I can import it in COMSOL with MATLAB and use it for another model as a boundary condition information.
Thanks!
Noemi
Reply | Reply with Quote | Send private message | Report Abuse
July 23, 2009 4:32pm UTC in response to N Z
Re: exporting data from the boundary
Try the MATLAB functions (given by COMSOL):
postinterp
or
posteval
typing ">> help postinterp" or ">> help posteval" should tell you what to do.
Reply | Reply with Quote | Send private message | Report Abuse
July 23, 2009 6:10pm UTC in response to Sumedh Joshi
Re: exporting data from the boundary
You are right, but my problem is that my boundary is a little bit complicated hence I cannot simply specify the points p from the boundary to use postinterp(fem, 'u', p), ... unless there is a way to extract all the points from the boundary?
Best,
Noemi
Reply | Reply with Quote | Send private message | Report Abuse
July 24, 2009 5:13pm UTC in response to N Z
Re: exporting data from the boundary
Hi
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
Reply | Reply with Quote | Send private message | Report Abuse
September 2, 2009 7:29pm UTC in response to N Z
Re: exporting data from the boundary
Hi, how is it progressing ?
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
Reply | Reply with Quote | Send private message | Report Abuse
September 4, 2009 9:28am UTC in response to N Z
Re: exporting data from the boundary
Hi,
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
Reply | Reply with Quote | Send private message | Report Abuse
September 29, 2009 9:06am UTC in response to Ivar K
Re: exporting data from the boundary
Hi Ivar,
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
Reply | Reply with Quote | Send private message | Report Abuse
September 30, 2009 7:51am UTC in response to Lars Ottar Aschim Kvåle
Re: exporting data from the boundary
Hei
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
Reply | Reply with Quote | Send private message | Report Abuse
October 30, 2009 2:42pm UTC in response to Ivar K
Re: exporting data from the boundary
Problem with the postcrossplot is that it actually doesn't return a proper post data struct. If you use it on a line the 'd'-field won't appear.
Reply | Reply with Quote | Send private message | Report Abuse
October 30, 2009 2:49pm UTC in response to Grunde Waag
Re: exporting data from the boundary
How do you get the values at the vertices?
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?
Reply | Reply with Quote | Send private message | Report Abuse
November 1, 2009 7:57am UTC in response to Grunde Waag
Re: exporting data from the boundary
Hi
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
Reply | Reply with Quote | Send private message | Report Abuse
Rules and guidelines
