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.
problem in initial value in matlab
Posted 05.11.2012, 05:30 GMT-5 Interfacing, Heat Transfer & Phase Change, Computational Fluid Dynamics (CFD), LiveLink for MATLAB, Materials, Modeling Tools & Definitions, Parameters, Variables, & Functions, Studies & Solvers Version 4.3a 1 Reply
Please login with a confirmed email address before reporting spam
I'm simulating a model in matlab for a sampling time 3 s. After this i use the last simulation as initial condition for the next iteration. I use the following code (as the tutorial):
for k = 1:nit
model.study('std1').run;
temp = mpheval(model,'T','edim','edge','selection',3);
% update initial time for next iteration
t0 = mphglobal(model,'t','solnum','end');
model.param.set('t0',t0);
% initial condition for the next iteration
model.physics('nipfl').feature('init1').set('p', 1, 'p');
model.physics('nipfl').feature('init1').set('u', 1, 'u');
model.physics('nipfl').feature('init1').set('T', 1, 'T');
model.physics('ge').feature('init1').set('Tm',1, 'Tm');
v1 = model.sol('sol1').feature('v1');
v1.set('initsol', 'sol1');
data = [data;temp.d1(end,3)]; % store in a vector the output
end
My dependent variables are p, u, T and Tm, as can be seen. But when I plot the temperature i have a wrong result (blue line).
I compare this result with other simulation, without use a loop 'for' (in red line). For this case I run the model from time = 0 to time final, don't using the interpolation.
The image is in attach.
Anyone have the same problem?
best regards
Geovani
Attachments: