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.
Setting an initial solution from Matlab
Posted 8 janv. 2021, 20:52 UTC−5 LiveLink for MATLAB, Simulation Apps, Results & Visualization 1 Reply
Please login with a confirmed email address before reporting spam
Good afternoon Comsol community.
I am working with Matlab Livelink and I want to set an initial solution vector of a comsol model and use it in a loop.
The documentaion says the following: To extract the solution vector of the computed solution, run the function mphgetu as in this command:
U = mphgetu(model);
So here is my code idea:
import com.comsol.model.* import com.comsol.model.util.* modelin = mphopen('C:\Users\Lenovo\Desktop\Two_layers_modifiedDIC2020.mph') componin = modelin.component geometrin = modelin.component('comp1').geom('geom1')
fr_ini = app.FrecuenciainicialEditField.Value; fr_fin = app.FrecuenciafinalEditField.Value;
for i = fr_ini:10:fr_fin
%%%CODE TO SET THE SOLUTION VECTOR TO WORK%%%
modelin.param.set('f', fr_ini);
modelin.study('std2').run;
subplot(1,1,1);
mphplot(modelin,'pg17');
u = mphgetu(modelin)
end
Thanks in advance.