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.

Data sets retrieved from Comsol through Matalab deviates from the Comsol plots (even without refinement)

Tom Alexander Solgård

Please login with a confirmed email address before reporting spam

Hello. I am modelling a loudspeaker Horn in 3D pressure acoustics.

I am retrieving these parameters along a boundary in my COMSOL model from MATLAB:

p_LP = mpheval(model,'acpr.Lp','Edim',1,'Selection',boundaryNumber); %
p_real = mpheval(model,'real(p)','Edim',1,'Selection',boundaryNumber); %
p_imag = mpheval(model,'imag(p)','Edim',1,'Selection',boundaryNumber); %

% and finding the sound pressure phase:
phase= atan2(p_imag,p_real);


Without refinement, Comsol plots have a denser dataset and are much smoother than the plots in Matlab. I have to export the data to Matlab in order to unwrap the phase plots.

In addition to the smaller dataset, there are some strange deviations in the Matlab plots. This can be seen in the enclosed pictures. Ideally, these plots should be identical (except for the phase unwrapping).

Any idea on whats going on, and how to solve this issue?

I feel that I can not rely on the results when this happens.

Tom A.


5 Replies Last Post 2010/12/16 5:18 GMT-5
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 2010/12/13 16:17 GMT-5
Hi

I havent used matlab with V4 so far, but I suspect that the difference could come from the polynomial order used to analyse the data, comsol uses higher order polynomials normally and smoothen the traces, while I suspect that you have the raw data in matlab. Have you tried to make a matlab callable function to unwrap the phase within the GUI environment ?

That could be of general interest, by the way, for us other out here too

--
Good luck
Ivar
Hi I havent used matlab with V4 so far, but I suspect that the difference could come from the polynomial order used to analyse the data, comsol uses higher order polynomials normally and smoothen the traces, while I suspect that you have the raw data in matlab. Have you tried to make a matlab callable function to unwrap the phase within the GUI environment ? That could be of general interest, by the way, for us other out here too -- Good luck Ivar

Tom Alexander Solgård

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/12/14 6:00 GMT-5


I haven't been able to get the callable matlab function to work, as the documentation is a little weak on this point. I t would be very useful. In any case, a complete data set in Matlab is neccessary for some other post processing. It would be nice to get the data after the use of higher order polynomials and smoothing. I am waiting for an answer from Comsol support, and hopefully they will adress this issue.

I haven't been able to get the callable matlab function to work, as the documentation is a little weak on this point. I t would be very useful. In any case, a complete data set in Matlab is neccessary for some other post processing. It would be nice to get the data after the use of higher order polynomials and smoothing. I am waiting for an answer from Comsol support, and hopefully they will adress this issue.

Tom Alexander Solgård

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/12/15 8:22 GMT-5

Hi

I havent used matlab with V4 so far, but I suspect that the difference could come from the polynomial order used to analyse the data, comsol uses higher order polynomials normally and smoothen the traces, while I suspect that you have the raw data in matlab.


From the Livelink maual on mpheval:

Use Recover to recover fields using polynomial-preserving recovery. This
techniques recover fields with derivatives such as stresses or fluxes with a higher
theoretical convergence than smoothing. Recovery is expensive so it is turned off by
default. The value pprint means that recovery is performed inside domains. The
value ppr means that recovery is also applied on all domain boundaries.

Might this be what you are talking about?

Alternatively:

The property Refine constructs evaluation points by making a regular refinements
of each element. Each mesh edge is divided into Refine equal parts.

The property Smooth controls if the post data is forced to be continuous on element
edges. When Smooth is set to internal, only elements not on interior boundaries are
made continuous.


I will try with Rercover, Smooting and Refinement on like this:
p_LP = mpheval(model,'acpr.Lp','Edim',1,'Selection',boundaryNumber, 'Matherr', on, 'Recover', ppr, 'Refine', 10, 'Smooth', everywhere); %
[QUOTE] Hi I havent used matlab with V4 so far, but I suspect that the difference could come from the polynomial order used to analyse the data, comsol uses higher order polynomials normally and smoothen the traces, while I suspect that you have the raw data in matlab. [/QUOTE] From the Livelink maual on mpheval: Use Recover to recover fields using polynomial-preserving recovery. This techniques recover fields with derivatives such as stresses or fluxes with a higher theoretical convergence than smoothing. Recovery is expensive so it is turned off by default. The value pprint means that recovery is performed inside domains. The value ppr means that recovery is also applied on all domain boundaries. Might this be what you are talking about? Alternatively: The property Refine constructs evaluation points by making a regular refinements of each element. Each mesh edge is divided into Refine equal parts. The property Smooth controls if the post data is forced to be continuous on element edges. When Smooth is set to internal, only elements not on interior boundaries are made continuous. I will try with Rercover, Smooting and Refinement on like this: p_LP = mpheval(model,'acpr.Lp','Edim',1,'Selection',boundaryNumber, 'Matherr', on, 'Recover', ppr, 'Refine', 10, 'Smooth', everywhere); %

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 2010/12/15 9:32 GMT-5
Hi

my experience qith recovery (3.5a) was that it took veeeery long, but could be useful in some cases

lykke til

--
Ivar
Hi my experience qith recovery (3.5a) was that it took veeeery long, but could be useful in some cases lykke til -- Ivar

Tom Alexander Solgård

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/12/16 5:18 GMT-5

With the following code, I got a lot mot points out from Comsol, but they still included the same errors.

boundaryNumber=189; % For stepped horn
p_LP = mpheval(model,'acpr.Lp','Edim',1,'Selection',boundaryNumber, 'Matherr', 'on', 'Recover', 'ppr', 'Refine', 10, 'Smooth', 'everywhere'); %
p_real = mpheval(model,'real(p)','Edim',1,'Selection',boundaryNumber, 'Matherr', 'on', 'Recover', 'ppr', 'Refine', 10, 'Smooth', 'everywhere'); %
p_imag = mpheval(model,'imag(p)','Edim',1,'Selection',boundaryNumber, 'Matherr', 'on', 'Recover', 'ppr', 'Refine', 10, 'Smooth', 'everywhere'); %

Hm....
With the following code, I got a lot mot points out from Comsol, but they still included the same errors. boundaryNumber=189; % For stepped horn p_LP = mpheval(model,'acpr.Lp','Edim',1,'Selection',boundaryNumber, 'Matherr', 'on', 'Recover', 'ppr', 'Refine', 10, 'Smooth', 'everywhere'); % p_real = mpheval(model,'real(p)','Edim',1,'Selection',boundaryNumber, 'Matherr', 'on', 'Recover', 'ppr', 'Refine', 10, 'Smooth', 'everywhere'); % p_imag = mpheval(model,'imag(p)','Edim',1,'Selection',boundaryNumber, 'Matherr', 'on', 'Recover', 'ppr', 'Refine', 10, 'Smooth', 'everywhere'); % Hm....

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.