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.

mpheval command

Please login with a confirmed email address before reporting spam

Dear all,


I have got some questions regarding the mpheval command, which are not very clear in the documentation.

There is a model file, that I export to matlab, that contains 2 studies, with a parametric sweep and a transient solver in each of the two studies.

The mpheval command does not like the parameter 'dataset', solution [number whatever].
It won't find any of the solution datasets, that are defined in the Model file itself.
There is one solution data set for the first study and one for the second.
My most important issue is: how can I address the results of the two different studies of the model file?

An other question is the 'solnum' parameter. With this I can obviously define the time step number.
E.g. 'solnum', 10 would give the data of the 10th time step.
So why is there also a parameter 't' in the mpheval? And what happens, if I use both in one call of mpheval with contradicting values.
E.g. 'solnum', 10 (the 10th time step, eg. t=1000) and 't', 2000 in one call?
Will it then return data from t=1000 or t=2000?
At least it does not give an error message, which is strange to me.



Thanks a lot for any answers,
Juergen

5 Replies Last Post 6 août 2015, 16:39 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 27 janv. 2011, 11:17 UTC−5
For the first issue I just found a solution finally.
MPHEVAL expects not the "visible" name of the solution dataset, which you can see in the comsol model, e.g. "Solution 1", etc.

You have to right click the "Solution 1" in the model tree and click on properties.
There you can see the "Tag" propertie, which is e.g. "dset1".

This is, what MPHEVAL needs.
'dataset', 'dset1' will be accepted, whereas 'dataset', 'solution 1' will fail.
For the first issue I just found a solution finally. MPHEVAL expects not the "visible" name of the solution dataset, which you can see in the comsol model, e.g. "Solution 1", etc. You have to right click the "Solution 1" in the model tree and click on properties. There you can see the "Tag" propertie, which is e.g. "dset1". This is, what MPHEVAL needs. 'dataset', 'dset1' will be accepted, whereas 'dataset', 'solution 1' will fail.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17 févr. 2011, 16:00 UTC−5
Hello Jürgen,

sounds german, I am also a german kraut :)

Your issue sounds similar to mine, and I just found a solution to it.
It really does depend, what you want to evaluate.
mpheval is a strange command. At first I also thought I have to use it for evaluating an physical expression (eg magnetic flux density) on a specified point in my model... wrong.
mpheval evaluates expression on all node points. Therefore you get very much postdata with coordiates of the node points and much more you do not want to know.

If you want to evaluate a Variable or global expression defined in your model you need to use mphglobal command, which is not that complicated.

Example:

F_Matlab_var = mphglobal(model,'F_comsol_var'); % Evaluation of a variable defined in your comosl model

If you want to do a real pointevaluation, as your are used to do in comsol, you need to use the mphinterp
command!!!

Example:

point_coord = [40-0.625,-27]' % coordinates of point to evaluate -Attention ' (transposition) --> coords. in column

P_normB = mphinterp(model,'mf.normB','coord',point_coord) % evaluation of normal Flux density at 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 I could help
Sincerely
Oliver
Hello Jürgen, sounds german, I am also a german kraut :) Your issue sounds similar to mine, and I just found a solution to it. It really does depend, what you want to evaluate. mpheval is a strange command. At first I also thought I have to use it for evaluating an physical expression (eg magnetic flux density) on a specified point in my model... wrong. mpheval evaluates expression on all node points. Therefore you get very much postdata with coordiates of the node points and much more you do not want to know. If you want to evaluate a Variable or global expression defined in your model you need to use mphglobal command, which is not that complicated. Example: F_Matlab_var = mphglobal(model,'F_comsol_var'); % Evaluation of a variable defined in your comosl model If you want to do a real pointevaluation, as your are used to do in comsol, you need to use the mphinterp command!!! Example: point_coord = [40-0.625,-27]' % coordinates of point to evaluate -Attention ' (transposition) --> coords. in column P_normB = mphinterp(model,'mf.normB','coord',point_coord) % evaluation of normal Flux density at 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 I could help Sincerely Oliver

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 21 févr. 2011, 02:46 UTC−5
Hi Oliver,

thanks for your reply.
I will try the things you suggested!
It sounds promising, maybe it is less memory consuming than mpheval.

Best regards,
Juergen

Hi Oliver, thanks for your reply. I will try the things you suggested! It sounds promising, maybe it is less memory consuming than mpheval. Best regards, Juergen

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10 déc. 2013, 17:39 UTC−5
I was trying to figure out how to deal with this myself...
Incase someone finds this thread before they find what they're looking for in the LiveLink Help Manual. I'm going to suggest you look at the help manual, for the command: mphsolutioninfo
Also instead of navigating the trees that this command creates, it may be simpler to just export the data.
The trees that can be read with mphsolutioninfo will most likely provide you with the proper tags necessary.
I was trying to figure out how to deal with this myself... Incase someone finds this thread before they find what they're looking for in the LiveLink Help Manual. I'm going to suggest you look at the help manual, for the command: mphsolutioninfo Also instead of navigating the trees that this command creates, it may be simpler to just export the data. The trees that can be read with mphsolutioninfo will most likely provide you with the proper tags necessary.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 6 août 2015, 16:39 UTC−4
Hi everyone,
taking into account you are talking about "mpheval" function, I would like to know if someone know how to set the number of decimals of the output data.
Thanks in advance
Catalina
Hi everyone, taking into account you are talking about "mpheval" function, I would like to know if someone know how to set the number of decimals of the output data. Thanks in advance Catalina

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.