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.

Matlab with Comsol

Please login with a confirmed email address before reporting spam

Hello,

I need to run Matlab and Comsol simultaneously.

I have a m.file containing following function:

f(u1, t)

I also need to make a comsol model with two PDE as following:

PDE1: du1/dt + gradient(u2) = f(u1, t)
PDE2: grad(u2) = c*gradient(u1)

At each time, PDE1 is used to calculate u1, and then PDE2 is solved using u1 to calculate u2.

My question is how can I link my Matlab equation to Comsol for this purpose?

Thanks
Samineh

2 Replies Last Post 2011年1月6日 GMT-5 16:09

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年1月6日 GMT-5 03:28
Im not sure I fully understand what your asking but assuming you have your comsol model working and the livelink set up correctly...

In comsol V4.0 you will need to launch the comsol with matlab program.

Then into the matlab interface type:

model=ModelUtil.model('Model');

this will export your comsol model to matlab. If you then type the name of your m-file into matlab it will execute all the commands stored within the m-file on the comsol model.

If i'm correct that will apply pde1 on the model? So then create another m-file to solve for pde2 and type it into matlab.

Hope that helps.

Chris
Im not sure I fully understand what your asking but assuming you have your comsol model working and the livelink set up correctly... In comsol V4.0 you will need to launch the comsol with matlab program. Then into the matlab interface type: model=ModelUtil.model('Model'); this will export your comsol model to matlab. If you then type the name of your m-file into matlab it will execute all the commands stored within the m-file on the comsol model. If i'm correct that will apply pde1 on the model? So then create another m-file to solve for pde2 and type it into matlab. Hope that helps. Chris

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年1月6日 GMT-5 16:09
Chris,

Thank you so much :) I will try it.

Samineh
Chris, Thank you so much :) I will try it. Samineh

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.