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.

Time Step Function

Please login with a confirmed email address before reporting spam

I am interested in applying a heat source when the temperature reaches a certain value, then I want to have the source on for a couple of seconds, and then off again. Something like a rectangular step function that goes from 0 to 1 (when the temperature limit is reached), stays 1 for a couple of seconds, and then goes to 0 again. Is there any straight-forward method to implement this in COMSOL?

7 Replies Last Post 10 mar 2016, 07:58 GMT-5
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 9 mar 2016, 09:44 GMT-5
Yes, just use a rectangular function to define your heat source: Definitions>Functions>Rectangle.
Best,
Jeff
Edit: I am not sure if that feature already existed in version 4.3. If not, you can get something similar by taking the product of two smoothed Heaviside step functions, etc.
Yes, just use a rectangular function to define your heat source: Definitions>Functions>Rectangle. Best, Jeff Edit: I am not sure if that feature already existed in version 4.3. If not, you can get something similar by taking the product of two smoothed Heaviside step functions, etc.

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 9 mar 2016, 09:48 GMT-5
Hey Jeff,

But how do I make it start when the temperature reaches the desired value? I can definitely define a rectangular step function as a function of time. But I need the temperature condition.

Paul
Hey Jeff, But how do I make it start when the temperature reaches the desired value? I can definitely define a rectangular step function as a function of time. But I need the temperature condition. Paul

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 9 mar 2016, 09:50 GMT-5
I had not realized you did not know in advance how long your up time needs to be.
Instead you can use the concept of Events. See this link: www.comsol.com/blogs/implementing-a-thermostat-with-the-events-interface/
Best,
Jeff
I had not realized you did not know in advance how long your up time needs to be. Instead you can use the concept of Events. See this link: http://www.comsol.com/blogs/implementing-a-thermostat-with-the-events-interface/ Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 9 mar 2016, 09:56 GMT-5
Hey Jeff,

Thanks for the help. I was thinking about events. But an event would give me a temperature dependence and that's all. I can have for example an event that has 0 until the temperature is reached. Then 1 when the temperature is reached. How do I make it back to 0 after a certain time?

Is it me, or I didn't see this information in the thread you have just provided (I know it from before)? And can I also implement time conditions in the events?

Paul
Hey Jeff, Thanks for the help. I was thinking about events. But an event would give me a temperature dependence and that's all. I can have for example an event that has 0 until the temperature is reached. Then 1 when the temperature is reached. How do I make it back to 0 after a certain time? Is it me, or I didn't see this information in the thread you have just provided (I know it from before)? And can I also implement time conditions in the events? Paul

Walter Frei COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 9 mar 2016, 10:59 GMT-5
Dear Paul,

You can indeed expand upon the approach outlined here:
www.comsol.com/blogs/implementing-a-thermostat-with-the-events-interface/

and modify as demonstrated in the attached file.
Note these features:
- An additional ODE for a variable "HeaterOnTime" that simply integrates "1" over time, thereby keeping track of time since any event at which HeaterOnTime is set to zero.
- An indicator state variable called "On_Time" that goes from negative to positive after a specified time.
- Implicit Event 1, that triggers when the temperature gets too low, and sets HeaterOnTime = 0
- Implicit event 2, that triggers based in the On_Time > 0 which turns off the heater.

Hopefully this is all fairly self-explanatory from here on. Please note that this file is created in version 5.2.

Best Regards,
Dear Paul, You can indeed expand upon the approach outlined here: http://www.comsol.com/blogs/implementing-a-thermostat-with-the-events-interface/ and modify as demonstrated in the attached file. Note these features: - An additional ODE for a variable "HeaterOnTime" that simply integrates "1" over time, thereby keeping track of time since any event at which HeaterOnTime is set to zero. - An indicator state variable called "On_Time" that goes from negative to positive after a specified time. - Implicit Event 1, that triggers when the temperature gets too low, and sets HeaterOnTime = 0 - Implicit event 2, that triggers based in the On_Time > 0 which turns off the heater. Hopefully this is all fairly self-explanatory from here on. Please note that this file is created in version 5.2. Best Regards,


Please login with a confirmed email address before reporting spam

Posted: 8 years ago 9 mar 2016, 16:00 GMT-5
Dear Walter,

Thank you very much! I don't have 5.2, but I will install it for this and I will write back if I encounter any problems.

Best Regards,
Paul
Dear Walter, Thank you very much! I don't have 5.2, but I will install it for this and I will write back if I encounter any problems. Best Regards, Paul

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 10 mar 2016, 07:58 GMT-5
Dear Walter,

Thank you very much. It works as it should.

Paul
Dear Walter, Thank you very much. It works as it should. Paul

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.