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.

How to implement a recursive function (in time) in COMSOL 3.5a?

Please login with a confirmed email address before reporting spam

I have a multiphysics problem, where I have a coupled, PDEs, and and one of them needs the viscosity to be updated. The updating formula uses both the concentration of a substance (from the transport equation), and the velocity (this comes from the other equation. The problem is, the velocity needs the viscosity as well, hence the recursivity. Of course, one can set initial values, but then, I would like to do something similar as in the imperative languages (Fortran, C), where you can set

set initial viscosity

FOR time =1 to N, step deltat
solve flow equation (with a given viscosity for the fluid)
solve transport equation
update viscosity with formula
viscosity(t+1)= viscosity (t) + concentration/velocity
NEXT time step

Can it be done without resorting to MATLAB? if so, how?
I tried on MATLAB, but I couldn't figure out how to call the model, it kept telling me that it could not be found. I do not know if it was that I didn't set a proper path, or was it the loop or something more subtle about the way this recursive functionality must be set up.

Thank you!

0 Replies Last Post May 21, 2013, 10:01 a.m. EDT
COMSOL Moderator

Hello Arturo Ortiz Tapia

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.

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.