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.

ComsolwithMatlab: Results are different for different calls, mpheval , mphinterp and mphgetu

Please login with a confirmed email address before reporting spam

Hi! When using ComsolwithMatlab, there seem to be different ways to extract solutions on node points, namely, mpheval(model,fields), mphinterp(model,fields,nodes) and mphgetu(model). I find that the results for different calls are quite different. Theoretically, mphgetu returns the 'raw' solution from the solver. mphinterp returns the interpolated values of the solution. and mpheval returns non-interpolated values on the nodes (simplex mesh is also included in the struct). Are they based on different meshes and shape functions? How should I access the counterparts for each results? (It seems mphgetu<->mphxmesh; but what about mpheval & mphinterp)


2 Replies Last Post 3 dic 2020, 02:53 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 30 nov 2020, 10:57 GMT-5

Hi, YS Chen. I think you can see how different they are by working with the maltab command windows and the livelink for matlabe user's guide. Mpheval and mphinterp are preferred to get the values what you want. Unless you want to use getU to get the solution from the solver, and then use setU to reset the solution.

All the best,

Songcai

Hi, YS Chen. I think you can see how different they are by working with the maltab command windows and the livelink for matlabe user's guide. Mpheval and mphinterp are preferred to get the values what you want. Unless you want to use getU to get the solution from the solver, and then use setU to reset the solution. All the best, Songcai

Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 4 years ago 3 dic 2020, 02:53 GMT-5

mphinterp is the most easy to use function for getting data out of Comsol. It performs interpolation of the solution on the coordinates you specify while taking into account the shape function and order that the model uses.

mpheval returns values for the entire mesh. It returns coordinoates and values for the mesh. You have to use the argument 'refine' in order to adjust the detail. Note the refine=1 is the default even if you are using second order elements.

mphgetu returns the raw solution vector directly from the Comsol solvers. It interpretations depend on the shape functions, mesh etc., which you can get information about using mphxmeshinfo. This is a low level function and requires that you understand how FEM works.

All three functions return data based on the solution vector and the data returned by xmheshinfo.

-------------------
Lars Gregersen
Comsol Denmark
mphinterp is the most easy to use function for getting data out of Comsol. It performs interpolation of the solution on the coordinates you specify while taking into account the shape function and order that the model uses. mpheval returns values for the entire mesh. It returns coordinoates and values for the mesh. You have to use the argument 'refine' in order to adjust the detail. Note the refine=1 is the default even if you are using second order elements. mphgetu returns the raw solution vector directly from the Comsol solvers. It interpretations depend on the shape functions, mesh etc., which you can get information about using mphxmeshinfo. This is a low level function and requires that you understand how FEM works. All three functions return data based on the solution vector and the data returned by xmheshinfo.

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.