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 to define material property

Please login with a confirmed email address before reporting spam

Hi All,
I would like to define a material with thermal conductivity (k) that is dependent on both temperature (T) and the absolute pressure (pA) using piecewise function. I know that COMSOL has default models for k that is T dependent only -such as for Nitrogen defined within the 200 - 1200 K range.

How is the syntax -if possible to employ two parameters in the same piecewise function ? I tried separating them using comma and space but did not work.


Thanks,

-Ozan

2 Replies Last Post 16.02.2016, 02:00 GMT-5
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: 9 years ago 15.02.2016, 14:09 GMT-5
Hi

If you take the built-in material "air" you get an example of a two argument "T, pA" relation for the density but that is for an "analytical" function.

If you check the HELP for "Piecewise" it states clearly function of ONE argument (variable) so indeed your are limited here.

You may define an "Interpolate" function of up to 3 arguments, and you may load that in from a ".txt", ".csv", ".m", or excel file, so you can then make a matrix/table in Matlab or Excel from your piecewise function and import that. Check the help/doc

But there might be a more direct way. Have you checked the COMSOL web "Knowledge Base" and the "Blog pages" with a search, or even the "Forum" ?
--
Good luck
Ivar
Hi If you take the built-in material "air" you get an example of a two argument "T, pA" relation for the density but that is for an "analytical" function. If you check the HELP for "Piecewise" it states clearly function of ONE argument (variable) so indeed your are limited here. You may define an "Interpolate" function of up to 3 arguments, and you may load that in from a ".txt", ".csv", ".m", or excel file, so you can then make a matrix/table in Matlab or Excel from your piecewise function and import that. Check the help/doc But there might be a more direct way. Have you checked the COMSOL web "Knowledge Base" and the "Blog pages" with a search, or even the "Forum" ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 16.02.2016, 02:00 GMT-5
Hi Ivar,
I was aware of analytical function of air in the built-in library -but totally missed the "one variable" section on the piecewise help section; Thanks!

I did a search on various forums and interpolation is what people go by. I guess interpolation is going to be the way to go since I do not have an analytical function for the material. I can define points as you suggested using my piecewise expression then feed them to the interpolation function.

Thanks again!
-Ozan

Hi Ivar, I was aware of analytical function of air in the built-in library -but totally missed the "one variable" section on the piecewise help section; Thanks! I did a search on various forums and interpolation is what people go by. I guess interpolation is going to be the way to go since I do not have an analytical function for the material. I can define points as you suggested using my piecewise expression then feed them to the interpolation function. Thanks again! -Ozan

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.