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.

piecewise function

Please login with a confirmed email address before reporting spam

Hi forum,

I have made a piecewise function
start end function
0 0.125 1
0.125 1 0
1 1.125 1
1.125 2 0
.........and so on.
It means, every second, only 1/8s there is a high temperature and 7/8s there is only room temperature.
but after the study I have seen that the high temperature exists only at the first 0-0.125s, and after that it has only room temperature. So maybe someone can tell me how may I optimize it. Thank you.

8 Replies Last Post May 23, 2015, 6:38 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 22, 2015, 7:11 a.m. EDT
Probably your time stepping does not coincide with the stepwise function.

Lasse
Probably your time stepping does not coincide with the stepwise function. Lasse

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 22, 2015, 7:59 a.m. EDT

Probably your time stepping does not coincide with the stepwise function.

Lasse


Hi Lasse,

Thanks for you answer. But I still have a question. How to understand that the time not coincide with the stepwise function? Because at first period, the result at 0 to 0.125s is correctly 1, but after that, the result of function is always 0. I'm sure that the stepwise function is correct, because I have also seen the waveform, every second it has a high value.
[QUOTE] Probably your time stepping does not coincide with the stepwise function. Lasse [/QUOTE] Hi Lasse, Thanks for you answer. But I still have a question. How to understand that the time not coincide with the stepwise function? Because at first period, the result at 0 to 0.125s is correctly 1, but after that, the result of function is always 0. I'm sure that the stepwise function is correct, because I have also seen the waveform, every second it has a high value.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 22, 2015, 8:03 a.m. EDT
I mean that when the solver takes time steps, it may jump over your pulse. I had this problem a few years ago, when I had a very short pulse every hour. I had to define solver time stepping explicitly so that the solver was able to "see" the pulses.

Lasse
I mean that when the solver takes time steps, it may jump over your pulse. I had this problem a few years ago, when I had a very short pulse every hour. I had to define solver time stepping explicitly so that the solver was able to "see" the pulses. Lasse

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 22, 2015, 8:07 a.m. EDT

I mean that when the solver takes time steps, it may jump over your pulse. I had this problem a few years ago, when I had a very short pulse every hour. I had to define solver time stepping explicitly so that the solver was able to "see" the pulses.

Lasse


Thanks Lasse. I have upload some pictures about the waveform, the temperature, temperature distribution at 0.1s, at 1.1s. So the problem is the temperature at 1.1s.
[QUOTE] I mean that when the solver takes time steps, it may jump over your pulse. I had this problem a few years ago, when I had a very short pulse every hour. I had to define solver time stepping explicitly so that the solver was able to "see" the pulses. Lasse [/QUOTE] Thanks Lasse. I have upload some pictures about the waveform, the temperature, temperature distribution at 0.1s, at 1.1s. So the problem is the temperature at 1.1s.


Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 22, 2015, 8:11 a.m. EDT
And I have defined the time step range(0,0,1,30). I think with the step of 0.1s it has enough time to see the impulse.
And I have defined the time step range(0,0,1,30). I think with the step of 0.1s it has enough time to see the impulse.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 22, 2015, 8:30 a.m. EDT
You have yellow color in the temperature definition. Check the units in the function definition: argument in seconds, function in K.

Your step is 0.1 s but the step 0.125 s. I wonder if that is enough. Have you tried "range(0,0.0625,30)?"

I do not remember any more how I did my model, it was Comsol version 3.5 and the year was 2009.
You have yellow color in the temperature definition. Check the units in the function definition: argument in seconds, function in K. Your step is 0.1 s but the step 0.125 s. I wonder if that is enough. Have you tried "range(0,0.0625,30)?" I do not remember any more how I did my model, it was Comsol version 3.5 and the year was 2009.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 22, 2015, 9:02 a.m. EDT

You have yellow color in the temperature definition. Check the units in the function definition: argument in seconds, function in K.

Your step is 0.1 s but the step 0.125 s. I wonder if that is enough. Have you tried "range(0,0.0625,30)?"

I do not remember any more how I did my model, it was Comsol version 3.5 and the year was 2009.


I have input the argument in seconds and function in K, and change the step rage(0,0.0625,30). But the definition of temperature is still in yellow and the results are nearly the same. there is no high temperature after 1sec.
[QUOTE] You have yellow color in the temperature definition. Check the units in the function definition: argument in seconds, function in K. Your step is 0.1 s but the step 0.125 s. I wonder if that is enough. Have you tried "range(0,0.0625,30)?" I do not remember any more how I did my model, it was Comsol version 3.5 and the year was 2009. [/QUOTE] I have input the argument in seconds and function in K, and change the step rage(0,0.0625,30). But the definition of temperature is still in yellow and the results are nearly the same. there is no high temperature after 1sec.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago May 23, 2015, 6:38 a.m. EDT
Do you still have argument name x, as in your jpg-image?
Do you still have argument name x, as in your jpg-image?

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.