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.

Step function based on interpolation function

Please login with a confirmed email address before reporting spam

Hi,

I have an interpolation function which is based t and f(t).
If I want to switch on and off this function, then is it possible to use step function?

Then if answer is yes:
I want to switch on my function when the values of f(t) are less than 0.4 [which I think should be set as "location" in step function].

If the answer is no, then how is it possible to switch on and off a function in comsol?

[attached my interpolation function]
I am looking forward to hear your answer.
Thanks
Sepideh




4 Replies Last Post Nov 4, 2015, 8:55 a.m. EST

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Nov 4, 2015, 4:53 a.m. EST
Sorry to raise up the question again.

But is it possible to switch on or off an interpolation function in COMSOL?

I am looking forward to hear your answer.
Sepideh
Sorry to raise up the question again. But is it possible to switch on or off an interpolation function in COMSOL? I am looking forward to hear your answer. Sepideh

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Nov 4, 2015, 5:13 a.m. EST
Sepideh,

your question is not really clear to me. What exactly do you mean by switching on and off? Do you want the function to return g(t) = f(t) if f(t) < 0.4 and g(t) = 0 if f(t) >= 0.4 ?

Cheers
Edgar

--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Sepideh, your question is not really clear to me. What exactly do you mean by switching on and off? Do you want the function to return g(t) = f(t) if f(t) < 0.4 and g(t) = 0 if f(t) >= 0.4 ? Cheers Edgar -- Edgar J. Kaiser emPhys Physical Technology http://www.emphys.com

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Nov 4, 2015, 7:13 a.m. EST
I have an interpolation function which the first column is time and the second column is water level (water level is changing with time [increasing and decreasing]).

I defined this input data as an interpolation function F5(t) in COMSOL.

I want to define inflow boundary condition which is: rainfall(t)*stepfn(F5(t))
which means imposing rainfall to the domain as far as the water level is less than 0.4[m] which is based on the interpolation function and switch it off this boundary condition when the water level is higher than 0.4[m].

[rainfall is also imposed as interpolation fn].

Please let me know if my question is not clear.
Hope to hear from you.
Sepideh
I have an interpolation function which the first column is time and the second column is water level (water level is changing with time [increasing and decreasing]). I defined this input data as an interpolation function F5(t) in COMSOL. I want to define inflow boundary condition which is: rainfall(t)*stepfn(F5(t)) which means imposing rainfall to the domain as far as the water level is less than 0.4[m] which is based on the interpolation function and switch it off this boundary condition when the water level is higher than 0.4[m]. [rainfall is also imposed as interpolation fn]. Please let me know if my question is not clear. Hope to hear from you. Sepideh

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Nov 4, 2015, 8:55 a.m. EST
Sepideh,

this should do the trick:

rainfall(t)*(F5(t)<0.4)

This will return rainfall(t) as long as F5(t) < 0.4 and return 0 if F5(t) >= 0.4.

Hope I understood it correctly.
Cheers
Edgar

--
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Sepideh, this should do the trick: rainfall(t)*(F5(t)= 0.4. Hope I understood it correctly. Cheers Edgar -- Edgar J. Kaiser emPhys Physical Technology http://www.emphys.com

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.