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.

Interp numerical feature is not updated automatically?

Please login with a confirmed email address before reporting spam

Hi!

I was trying to run several cases with different parameters and plot results, but after switching to `tout` taken by solver (and back), I noticed that `Interp` numerical feature `flux` is not getting updated:( At least its length. An excerpt follows. Does anybody experience similar problem?

>> sol1.feature('t1').set('tout', 'tlist');
sol1.runAll;
model.result.numerical('flux').set('coord', -2);
model.result.numerical('flux').set('expr', 'dl.U');
fprintf('interp: %g\n',length(model.result.numerical('flux').getReal));
fprintf('mphinterp: %g\n', length(mphinterp(model, 'dl.U', 'coord', -2)));
interp: 105
mphinterp: 601
>> model.result.numerical('flux').run;
sol1.runAll;
model.result.numerical('flux').set('coord', -2);
model.result.numerical('flux').set('expr', 'dl.U');
fprintf('interp: %g\n',length(model.result.numerical('flux').getReal));
fprintf('mphinterp: %g\n', length(mphinterp(model, 'dl.U', 'coord', -2)));
interp: 105
mphinterp: 601
>> sol1.feature('t1').set('tout', 'tsteps');
model.result.numerical('flux').run;
sol1.runAll;
model.result.numerical('flux').set('coord', -2);
model.result.numerical('flux').set('expr', 'dl.U');
fprintf('interp: %g\n',length(model.result.numerical('flux').getReal));
fprintf('mphinterp: %g\n', length(mphinterp(model, 'dl.U', 'coord', -2)));
interp: 105
mphinterp: 118

Shall I run something before reading values? Do I forget to do something else? As a workaround I can switch to use mphinterp().

It is a bit annoying to recreate `Interp` feature inside of the loop.

>> model.result.numerical.remove('flux');
model.result.numerical.create('flux', 'Interp');
model.result.numerical('flux').set('coord', -2);
model.result.numerical('flux').set('expr', 'dl.U');
fprintf('interp: %g\n',length(model.result.numerical('flux').getReal));
interp: 118

2 Replies Last Post 12 mag 2011, 09:36 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 mag 2011, 07:19 GMT-4
I am also facing a similar problem. I want to solve a model for the first time and than to use this solution as initial value for similar simulations with different parameter changes. I also got the impression that my results are not updated.
Did you get already an answer to your case? It could be helpful to post it as other users might experience similar problems.
I am also facing a similar problem. I want to solve a model for the first time and than to use this solution as initial value for similar simulations with different parameter changes. I also got the impression that my results are not updated. Did you get already an answer to your case? It could be helpful to post it as other users might experience similar problems.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 mag 2011, 09:36 GMT-4
No, I did not. I'm still using a "workaround" with mph... functions. I actually find it more convenient as let's say I can get all time steps taken by solver (with mpheval(?)) right away instead of creating a separate feature for 't'.

Original reason for me to use interpolation was that I was about to get a plot of one derived quantity vs another (i.e. one probe vs another instead of time), but I got reply from support that it was impossible. So any post-processing is fine for me.

Are you also using Interp at some point? I have a feeling that choosing last solution as an initial one for next simulation is another issue and should not be related. As I said, other features are updated correctly.

Otherwise I guess it worth letting support know about incorrect updates since I'm not the only one with this issue.
No, I did not. I'm still using a "workaround" with mph... functions. I actually find it more convenient as let's say I can get all time steps taken by solver (with mpheval(?)) right away instead of creating a separate feature for 't'. Original reason for me to use interpolation was that I was about to get a plot of one derived quantity vs another (i.e. one probe vs another instead of time), but I got reply from support that it was impossible. So any post-processing is fine for me. Are you also using Interp at some point? I have a feeling that choosing last solution as an initial one for next simulation is another issue and should not be related. As I said, other features are updated correctly. Otherwise I guess it worth letting support know about incorrect updates since I'm not the only one with this issue.

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.