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 Mar 10, 2016, 7:58 a.m. EST
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Mar 9, 2016, 9:44 a.m. EST
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: 9 years ago Mar 9, 2016, 9:48 a.m. EST
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: 9 years ago Mar 9, 2016, 9:50 a.m. EST
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: 9 years ago Mar 9, 2016, 9:56 a.m. EST
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: 9 years ago Mar 9, 2016, 10:59 a.m. EST
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: 9 years ago Mar 9, 2016, 4:00 p.m. EST
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: 9 years ago Mar 10, 2016, 7:58 a.m. EST
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.