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.

Calling for a function that defines conditions for a boundary in heat transfer (transient analysis)

Please login with a confirmed email address before reporting spam

If a function has been defined to set the temperature for a boundary or a domain (the function's name is "temp" and it is defined as an interpolation function where x column represents time (with values 0, 20, 40,.. ) and f(x) temperature values (0, 23, 57,..) ), how to call for this function when setting up the boundary conditions? The intention is to make the temperature change in an area according to those set values. Btw, I'm still using 3.5a.

A million thanks for replying =)

12 Replies Last Post Jun 1, 2010, 7:28 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 30, 2010, 4:17 a.m. EDT
Hey friends, I know you know this one. Share the fun, please =)
Hey friends, I know you know this one. Share the fun, please =)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 31, 2010, 9:16 a.m. EDT
I have not done any transient cases or much with temperatures but...
If I understood correctly, you have a defined function for temperature named "temp". And to put it on a boundary you could try just to set "temperature" boundary condition, and write the function name as the temperature.
Any help?
I have not done any transient cases or much with temperatures but... If I understood correctly, you have a defined function for temperature named "temp". And to put it on a boundary you could try just to set "temperature" boundary condition, and write the function name as the temperature. Any help?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 31, 2010, 9:37 a.m. EDT
Thanks for replying, but unfortunately that doesn't help. I believe the function name should be typed somehow differently in the mentioned temperature BC field, but I don't know how. If I type only the function's name, the unit K becomes red.. =S
Thanks for replying, but unfortunately that doesn't help. I believe the function name should be typed somehow differently in the mentioned temperature BC field, but I don't know how. If I type only the function's name, the unit K becomes red.. =S

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 31, 2010, 9:46 a.m. EDT
The unit's name becoming red doesn't affect anything. It just means that the expression doesn't have units defined in it or has the wrong units. So if you know your function gives the right values for temperature (K) then there is no problem.
The unit's name becoming red doesn't affect anything. It just means that the expression doesn't have units defined in it or has the wrong units. So if you know your function gives the right values for temperature (K) then there is no problem.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 31, 2010, 9:53 a.m. EDT
Thanks for that! And if I know my function is working in degrees C should I type in the temperature BC field "temp[degC]" or do I have to modify my function values manually?
Thanks for that! And if I know my function is working in degrees C should I type in the temperature BC field "temp[degC]" or do I have to modify my function values manually?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 31, 2010, 10:11 a.m. EDT
I don't know about that. It would probably work also with "temp + 273.15".
I don't know about that. It would probably work also with "temp + 273.15".

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 31, 2010, 10:16 a.m. EDT
Sounds nice. I haven't had the time to test this yet though, but hopefully it works. Thanks again.
Sounds nice. I haven't had the time to test this yet though, but hopefully it works. Thanks again.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 31, 2010, 12:15 p.m. EDT
Hi

You should learn the use of the units in COMSOl it really helps, for the details search for UNITS over the doc, but here are some ideas:

Note 1: that unit are not 100% implemented everywhere inside COMSOL 3.5, therefore check carefully all results !
Note 2: a red unit flag does not necesarily mean something wrong with the results, just that COMSOL does not understand how to check the units, either because a variable is unitless and is expected with units, or that the variable is i.e. a coupling variable without units
Note 3: in V4.0 the unit are better implementd, but still not 100% everywhere

if you have a variable T1 = 5[K] and T2 = 5[degC] then T=T1+T2 (by default in Kelvin) = 283.15[K]

To enter a function it's often usefull to have unitless values that is if you have defined a function MyFun(T) based on [degC] for T then call it with MyT=Myfun(T[1/deC]) this means that if T is already in degC it will enter as is, if T is in Kelvin then COMSOL will automatically add the required value to get it transformed to degC

Hope this helps on the way
HAve fun Comsoling
Ivar
Hi You should learn the use of the units in COMSOl it really helps, for the details search for UNITS over the doc, but here are some ideas: Note 1: that unit are not 100% implemented everywhere inside COMSOL 3.5, therefore check carefully all results ! Note 2: a red unit flag does not necesarily mean something wrong with the results, just that COMSOL does not understand how to check the units, either because a variable is unitless and is expected with units, or that the variable is i.e. a coupling variable without units Note 3: in V4.0 the unit are better implementd, but still not 100% everywhere if you have a variable T1 = 5[K] and T2 = 5[degC] then T=T1+T2 (by default in Kelvin) = 283.15[K] To enter a function it's often usefull to have unitless values that is if you have defined a function MyFun(T) based on [degC] for T then call it with MyT=Myfun(T[1/deC]) this means that if T is already in degC it will enter as is, if T is in Kelvin then COMSOL will automatically add the required value to get it transformed to degC Hope this helps on the way HAve fun Comsoling Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jun 1, 2010, 2:57 a.m. EDT
After all the pondering I figured out, that to call for a function "temp", I need to write "temp(t)" or actually temp(t)[1/degC] as the values of temperature are in celsius. It didn't however work with only "temp" as there came an error.

But now I'm wiser and will sure have fun comsoling ;)

Thanks Ivar, I appreciate it!
After all the pondering I figured out, that to call for a function "temp", I need to write "temp(t)" or actually temp(t)[1/degC] as the values of temperature are in celsius. It didn't however work with only "temp" as there came an error. But now I'm wiser and will sure have fun comsoling ;) Thanks Ivar, I appreciate it!

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jun 1, 2010, 4:09 a.m. EDT
Hi

you have a "temp" of time "t" yes ? because "t" is reserved for time in COMSOL ?

temp(t) is then a value so multiply by [1/degC] forces it to deg C, but note that COMSOL uses Kelvin as default so I would advise to use [K] too,and transform your values to [K] as rapidly as possible, else its easy to do stupid errors

HAve fun Comsoling
Ivar
Hi you have a "temp" of time "t" yes ? because "t" is reserved for time in COMSOL ? temp(t) is then a value so multiply by [1/degC] forces it to deg C, but note that COMSOL uses Kelvin as default so I would advise to use [K] too,and transform your values to [K] as rapidly as possible, else its easy to do stupid errors HAve fun Comsoling Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jun 1, 2010, 7:07 a.m. EDT
Hi

That's right, I have function "temp" of time. I now changed my values to kelvins and hope my model would start running somehow so I could see if the values are what I expect them to be x) Seems to have some problem finding initial values now.. I'll let you know if there is anything interesting =)
Hi That's right, I have function "temp" of time. I now changed my values to kelvins and hope my model would start running somehow so I could see if the values are what I expect them to be x) Seems to have some problem finding initial values now.. I'll let you know if there is anything interesting =)

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jun 1, 2010, 7:28 a.m. EDT
Hi

by default all initial values are set to "0", but often this is not optimum, even if mostly COMSOL manages to get around with that.
It's always worth setting the best initial values one know about (something one mostly forget to do, COMSOL makes us lazy).

I mostly us the Solve - Get initial values first to check my model, fill the matrices, do some subdomain or domain integrations to check everything, and to review "logical" initial conditions. Or to run a static case to get a good starting pint and use a restart (or the solver sequencer) to continue from the stored solution with a more complex solveing.

Have fun Comsoling
Ivar
Hi by default all initial values are set to "0", but often this is not optimum, even if mostly COMSOL manages to get around with that. It's always worth setting the best initial values one know about (something one mostly forget to do, COMSOL makes us lazy). I mostly us the Solve - Get initial values first to check my model, fill the matrices, do some subdomain or domain integrations to check everything, and to review "logical" initial conditions. Or to run a static case to get a good starting pint and use a restart (or the solver sequencer) to continue from the stored solution with a more complex solveing. Have fun Comsoling Ivar

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.