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.

communication between Comsol 5.3a and Matlab really slow

Please login with a confirmed email address before reporting spam

Hello, I want Matlab to calculate my pressure distribution for an optimization. Right now I do have a my pressure distribution over time (constant in x,y,z). With Matlab I want to make a 4 dimensional Inteprolation to have it in x,y,z,t.

But I realized that the optimiziation starts to be really slow. My initial optimization took like 40hours. The optimization with my Matlab function barely finished the first iteration after that time. To test if my Matlab function was the problem I just wrote a function which gives a constant pressure.

So my current Matlab function is a one liner like

function [p] = myFunction (x,~,~,~) p = zeros(1,length(x)); for i=1:length(x) p(i)=100000; end end

Even with this simple code my optimization barely calculates one iteration in 40 hours.

So I think the issue is between the communication of Matlab and Comsol.

Can I speed this up somewhere? Like: Comsol asking for more values at once and store them in the RAM?

Thanks in advance


1 Reply Last Post 12 feb 2018, 09:44 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 12 feb 2018, 09:44 GMT-5

I am not sure about the link between COMSOL and MATLAB, but if you can do the interpolation in Java, you get rid of the linking all together. From a performance perspective, this would probably be the best solution.

I am not sure about the link between COMSOL and MATLAB, but if you can do the interpolation in Java, you get rid of the linking all together. From a performance perspective, this would probably be the best solution.

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.