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.

Updating COMSOL variables at each time step

Please login with a confirmed email address before reporting spam

Hi all,

I am trying to solve a model which requires updating a variable (something like a boundary condition) based on the solution at each TIME STEP. I am planning to use MATLAB LiveLink on order to have a control over COMSOL model solution as it progresses in time. I know there is a function to run the study node (something like Model.sol('xxx').run('xxx')); but it does not work for me, as it starts to solve the whole study. I want to have control over time stepping.

A brief description of what is going to happen in my model is as follows:
1. set initial/boundary conditions and start to solve the model
2. advance one time step
3. evaluate some predefined expression (specifically, a line integral of a solution variable)
4. check if this line integral has the value that you expect (e.g. we want it to be equal to 2)
5. if yes, then advance one time step. If not, do this time step again with updated boundary condition (until criteria are satisfied) and then advance in time.

Thanks!
Ali

3 Replies Last Post 2014年11月5日 GMT-5 03:47
COMSOL Moderator

Hello Ali Hemmatifar

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.


Ajay Karthik Kunuthur

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年10月27日 GMT-4 18:24
Hello Ali,
I am facing with similar problem. Please let me know, if you have found a solution or approached this problem with a completely new approach.

Thanking you,
Ajay
Hello Ali, I am facing with similar problem. Please let me know, if you have found a solution or approached this problem with a completely new approach. Thanking you, Ajay

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年11月4日 GMT-5 21:10
I haven't tried it, but you should be able to define a Probe on your solution and use that Probe value in your boundary condition.

--
Steven Conrad, MD PhD
LSU Health
I haven't tried it, but you should be able to define a Probe on your solution and use that Probe value in your boundary condition. -- Steven Conrad, MD PhD LSU Health

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 2014年11月5日 GMT-5 03:47
Hi,

i never tried how matlab live link works, but i'm sure you can put an 'if'- condition in combination with paremetric sweep.

On model builder SHOW -> check on advance study options

regards
akmal

Hi, i never tried how matlab live link works, but i'm sure you can put an 'if'- condition in combination with paremetric sweep. On model builder SHOW -> check on advance study options regards akmal

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.