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.

Evaluating Global Expressions in MATLAB

Please login with a confirmed email address before reporting spam

Hi,

I have set up a series of Global Expressions in my model through the COMSOL GUI. I now solve the model through MATLAB and would like to evaluate the Global expressions.

The problem is I cannot find the function to do this? From the documentation it would seem postglobaleval is my best bet:


>> postglobaleval(femt,'iOut')
??? Error using ==> postglobaleval at 70
Expression must be a cell array.


I have also tried


>> posteval(femt,'iOut')

ans =

p: [3x28840 double]
t: [4x38934 double]
q: [8x0 double]
d: [1x28840 double]
elind: [1x28840 double]


but then I am unsure of where to go from here? I have read this, but it confuses me greatly


The output is post data, a structure with fields p, t, q, d, and elind. The field p contains node point coordinate information. The number of rows in p is the number of space dimensions. The field t contains the indices to columns in p of a simplex mesh (each column in t represents a simplex). The field q contains the indices to columns in p of a quadrilateral mesh, with each column in q representing a quadrilateral. The field d contains data values. The columns in d correspond to node point coordinates in columns in p.


Any assistance would be greatly appreciated.

Regards,
Tom

4 Replies Last Post 2014年7月21日 GMT-4 03:34
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: 2 decades ago 2009年10月29日 GMT-4 08:41
Hi

easiest to sort out these cases (I always restart from scratch) is to start with a simple beam and only mesh it with very few elemnts 2-8 so you can easily track them in your head and on papaer with a simple analytical case.

then you can understand the use and identification of the p, d, t, q

I beleive I remeber (I do not have my manuals here), that the t are the tetrahedral elements, the q the quad (often you have only one of the two types), p are the node coordinates, and d the data

So and if I have it right "t" is the "indexes" of nodes "p" making up the thets and "q" the indexes making up the quad elements (careful with orientation to not invert them). And d are the data values at the nodes "p"

Pls check this carefully, because I'm recording from what I remember and cannotcheck.

hope this helps
Good luck
Ivar
Hi easiest to sort out these cases (I always restart from scratch) is to start with a simple beam and only mesh it with very few elemnts 2-8 so you can easily track them in your head and on papaer with a simple analytical case. then you can understand the use and identification of the p, d, t, q I beleive I remeber (I do not have my manuals here), that the t are the tetrahedral elements, the q the quad (often you have only one of the two types), p are the node coordinates, and d the data So and if I have it right "t" is the "indexes" of nodes "p" making up the thets and "q" the indexes making up the quad elements (careful with orientation to not invert them). And d are the data values at the nodes "p" Pls check this carefully, because I'm recording from what I remember and cannotcheck. hope this helps Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 2 decades ago 2009年10月29日 GMT-4 11:23
Hi Ivar,

I have found the solution:


iout = postglobaleval(fem,{'iOut'})


which returns:



iout =

x: [101x1 double]
y: [101x1 double]
legend: {'iOut'}



I may then access the expression at a single data point with:


iout.y(90)


or plot the results with:


plot(iout.x,iout.y)


Regards,
Tom
Hi Ivar, I have found the solution: [quote] iout = postglobaleval(fem,{'iOut'}) [/quote] which returns: [quote] iout = x: [101x1 double] y: [101x1 double] legend: {'iOut'} [/quote] I may then access the expression at a single data point with: [quote] iout.y(90) [/quote] or plot the results with: [quote] plot(iout.x,iout.y) [/quote] Regards, Tom

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: 2 decades ago 2009年10月30日 GMT-4 02:42
Hi Tom

As often, it's "evident" once you have found the error, it was almost written litterally, I searched for a comsol explanation but it was a programming cast error, I should too have seen it too, willdo better next time ;)

Thanks for the reply
Ivar
Hi Tom As often, it's "evident" once you have found the error, it was almost written litterally, I searched for a comsol explanation but it was a programming cast error, I should too have seen it too, willdo better next time ;) Thanks for the reply Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年7月21日 GMT-4 03:34
I solved my problem thanks to this thread.

It was a big help for me.

Thank you again for discussion.

- Seong Jae
I solved my problem thanks to this thread. It was a big help for me. Thank you again for discussion. - Seong Jae

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.