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.

Setting If statement in COMSOL ODE

Please login with a confirmed email address before reporting spam

Hi, I am trying to solve an ODE in COMSOL (time-dependent) but i want the ode to be initiated only if the temperature is below certain value, say 272K. Is it possible to implement this in comsol?

Thanks

4 Replies Last Post 7 oct. 2015, 04:50 UTC−4
Walter Frei COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 6 oct. 2015, 09:23 UTC−4
Hello,
You may want to look at this material, it may point you towards an alternative approach to what you are attempting:
www.comsol.com/blogs/implementing-a-thermostat-with-the-events-interface/
www.comsol.com/blogs/using-the-previous-solution-operator-in-transient-modeling/
www.comsol.com/blogs/tracking-material-damage-with-the-previous-solution-operator/
Hello, You may want to look at this material, it may point you towards an alternative approach to what you are attempting: http://www.comsol.com/blogs/implementing-a-thermostat-with-the-events-interface/ http://www.comsol.com/blogs/using-the-previous-solution-operator-in-transient-modeling/ http://www.comsol.com/blogs/tracking-material-damage-with-the-previous-solution-operator/

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 6 oct. 2015, 09:45 UTC−4
Alright thanks :)
Alright thanks :)

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 7 oct. 2015, 00:49 UTC−4
If I want to apply a specific ODE in the region with temperature < 272K, like du/dt = F, but in other region where T>272, I wish to implement another ODE, du/dt=0. This means that depending on the temperature in that particular region, the ODE will switch. Can this be done in comsol?

Thanks
If I want to apply a specific ODE in the region with temperature < 272K, like du/dt = F, but in other region where T>272, I wish to implement another ODE, du/dt=0. This means that depending on the temperature in that particular region, the ODE will switch. Can this be done in comsol? Thanks

Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 7 oct. 2015, 04:50 UTC−4
Use the following expression in the Source Term in the Distributed ODE node: ut-if(T<272,F,0)
Use the following expression in the Source Term in the Distributed ODE node: ut-if(T

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.