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 Nov 5, 2014, 3:47 a.m. EST
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: 1 decade ago Oct 27, 2014, 6:24 p.m. EDT
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: 1 decade ago Nov 4, 2014, 9:10 p.m. EST
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: 1 decade ago Nov 5, 2014, 3:47 a.m. EST
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.