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.
Running Comsol Desktop Model with Matlab Script: Updating Parameters
Posted 08.07.2016, 02:51 GMT-4 Fluid & Heat, Interfacing, Computational Fluid Dynamics (CFD), Studies & Solvers Version 5.1 0 Replies
Please login with a confirmed email address before reporting spam
Now, do I need to place the "model.study('std1').run" command line after each matlab update, as schematically illustrated below:
begin code
import com.comsol.model.*
import com.comsol.model.util.*
model=mphload('XYZ');
model.study('std1').run;
% Extract Initial Pressure and Velocity based on initial prescribed parameters in comsol desktop
vf1=(mphinterp(model,'u','coord',coord1a,);
pf1=(mphinterp(model,'p','coord',coord1a);
% Given Criterion
if criterion is met
rho=rho2 (rho2 has been determined in matlab)
mu=mu2;
else if criterion is not met
rho=rho1 (rho1 is the intial fluid density)
mu=mu1;
%Updating the Parameters in Comsol
model.param.set('mu',mu)
model.param.set('rho',rho)
((model.study('std1').run; ))...xxxxxx
% Extracting the Pressure and Velocity Values
vf2=(mphinterp(model,'u','coord',coord1a,);
pf2=(mphinterp(model,'p','coord',coord1a);
% Other Calculations to be done with the second extracted pressure and velocity
end of code
Do I need to put the "xxxxx" marked line above, since I have updated the parameters, and I need to get the new pressure and velocity values? In case I erase the xxxxx line, will the extracted pressure and velocity values, (1) an (2) be different or same, considering the update on fluid properties?
In a nutshell, will the current value of the parameter in the matlab script (since the value of the parameter at latter line of the code is the current) be the current parameter in comsol desktop or do I need to rerun the comsol model with the xxxxx line command, so that I can get the corresponding flow properties based on the updated fluid properties?
Regards
Hello Femi Oyedokun
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.