Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

ON-OFF function and txt loaded file

Please login with a confirmed email address before reporting spam

Hello,

I'm Stefano Casson and I'm using COMSOL to model the behavior of a heat storage in the gravel: my intention is to use a function as an input of temperature (I chose the interpolation) so in this way I can load a txt file where there are 8760 values of temperature, one per each hour of the year. The problem is that sometimes the system works, let's say when T > 30°C, (during sunny days), but most of the time the system should be turn off because there is no heat to storage: I couldn't figure out how to express this in COMSOL. For example if I put zero as temperature in the txt loaded file when T < 30°C, for the program "zero" is a value but I want COMSOL to understand to stop the injection of fluid for those hours, and to star it again when T > 30°C. A function ON-OFF could describe better this kind of trend but if I use different types of function I can't load an external file. Can anyone help me please?
Kind Regards,

Stefano.

2 Replies Last Post 31.03.2014, 05:22 GMT-4
Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 31.03.2014, 03:45 GMT-4
You can use an if-expression: if(T>30, myfunc(x,y,z), 0). Either you can use this expression where you are using the function, or you can create an analytic function where you enter the expression. The latter approach is definitely better if you are using the interpolation function in several places.
You can use an if-expression: if(T>30, myfunc(x,y,z), 0). Either you can use this expression where you are using the function, or you can create an analytic function where you enter the expression. The latter approach is definitely better if you are using the interpolation function in several places.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 31.03.2014, 05:22 GMT-4
Thanks for the tip: very useful!But the problem lasts when T<30°C: if I put 0 in the expression, this zero is a value for COMSOL, and actually I would like to stop the injection, not to inject air at 0°C... how can I express this?
Kind Regards,

Stefano.
Thanks for the tip: very useful!But the problem lasts when 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.