Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

point evaluation by Matlab

Please login with a confirmed email address before reporting spam

Hello comsol users,

I am working on a model of electromagnetic actuator and now I am about to use the matlab livelink for further calcualtions and have issues with evaluating data. User guide offers some info about some commands e.g. mpheval, mphglobal.

First I tried to evaluate the electromagnetic force on an object by a variable (var_force_comsol=mf.Forcez_objekt).
I defined this variable in my comsol model and saved it as m-file. By the way it is always a got idea to clear the model history before saving it as m-file. Otherwise you get a matlab script of the model history and not of the model itself and you might get several sites of unrelevant confusing data. Cost me several hours to find the simple solution for that :)
Back to evaluation of data:
After several trial and erros of a global evaluation I finally had success using the mphglobal command as follows:
var_force_matlab = mphglobal(model,'var_force_comsol');

If somebody thinks that was not that difficult, then maybe he/she can help me with the point evaluation? please?

In this case I first added in my axisymmetric comsol model a cutpoint2D standardly named (tag name) 'cpt1' (Model->Results->Datasets) and defined the coordinates of it. Then I added a point evaluation standardly named (tag name) 'pev1' (Model->Results->Derived values) and defined the expression to evaluate (in my case radial flux density 'mf.Br'). Then clearing history and saving model as m-file.
Now the user guide offers the mpheval command for the purpose to evaluate expressions of so called datasets e.g. points, line,etc. but with followig command mpheval(model, 'mf.Br','Dataset','cpt1') I get an error message that the Dataset is not valid. Not using a Dataset results in getting evaluated data of many points (so called node points due to user guide) but not from the one i want to. The mpheval isn´t working with the comsol created point evaluation 'pev1' either. So I am perplexed.
I am trying to find a solution myself for a couples of days and still trying... drives me crazy. Please help!

Sincerely
Oliver




4 Replies Last Post 2012/05/07 23:03 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011/02/17 16:10 GMT-5
I found a Solution, I am a genius ...not :)


Example for pointevaluation via matlab:

point_coord = [40-0.625,-27]' % coordinates of point to evaluate -Attention ' (transposition) --> coords. in one column (x,y,z or in my case r,z due to axisymmetric model)

P_normB = mphinterp(model,'mf.normB','coord',point_coord) % evaluation of normal Flux density at defined coords.

User guide sometimes i a little cryptic to me but finally it helped. interp just made me think of interpolation, so I didn't gave attention to it. Took me almost a week to find out and unfortunatelly nobody could help in the Forum. I am still even waiting for a comsol support answer.

Hope someone else can benefit from this.


I found a Solution, I am a genius ...not :) Example for pointevaluation via matlab: point_coord = [40-0.625,-27]' % coordinates of point to evaluate -Attention ' (transposition) --> coords. in one column (x,y,z or in my case r,z due to axisymmetric model) P_normB = mphinterp(model,'mf.normB','coord',point_coord) % evaluation of normal Flux density at defined coords. User guide sometimes i a little cryptic to me but finally it helped. interp just made me think of interpolation, so I didn't gave attention to it. Took me almost a week to find out and unfortunatelly nobody could help in the Forum. I am still even waiting for a comsol support answer. Hope someone else can benefit from this.

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: 1 decade ago 2011/02/17 16:23 GMT-5
Hi

welcome to the club ;)

there will be a few other of these goodies along the road, I'm afraid,
Comsol is rather complex as the GUI is masking, but also concentrating, the numerous lines of codes hidden behind

Thanks for the explanations

--
Good luck
Ivar
Hi welcome to the club ;) there will be a few other of these goodies along the road, I'm afraid, Comsol is rather complex as the GUI is masking, but also concentrating, the numerous lines of codes hidden behind Thanks for the explanations -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012/05/07 23:02 GMT-4
That's a work around when you need data at points. But I am trying to evaluate data on a cutline and am using data_t006=mpheval(model,'fsi.sr_fluid','dataset','cln1','edim',1) and I keep getting the error "invalid data set type".

I tried several things but nothing is working. Can someone help me resolve this error?

Thanks,
Sirisha
That's a work around when you need data at points. But I am trying to evaluate data on a cutline and am using data_t006=mpheval(model,'fsi.sr_fluid','dataset','cln1','edim',1) and I keep getting the error "invalid data set type". I tried several things but nothing is working. Can someone help me resolve this error? Thanks, Sirisha

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012/05/07 23:03 GMT-4
That's a work around when you need information at points.

I am trying to evaluate data on a cutline and am using
data=mpheval(model,'fsi.sr_fluid','dataset','cln1','edim',1).

But this is not working and I am getting the "invalid data set type" error.

Can someone please help resolve this?

Thanks,
Sirisha
That's a work around when you need information at points. I am trying to evaluate data on a cutline and am using data=mpheval(model,'fsi.sr_fluid','dataset','cln1','edim',1). But this is not working and I am getting the "invalid data set type" error. Can someone please help resolve this? Thanks, Sirisha

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.