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.

If statement in material properties

Please login with a confirmed email address before reporting spam

Hi, I am a complete beginner in COMSOL and I am wondering how to include an if statement in material properties. For example, I want the density,p to be dependent on temperature, T such that if T<273K, p=998 and if T>273K, p=1000. Thanks :)

2 Replies Last Post 30 ago 2015, 05:06 GMT-4
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 30 ago 2015, 04:56 GMT-4
Hi
there are a simpler way for 2 levels:

998+2*(T[1/K]>273)

But as COMSOL solvers (as we were thought once in our math courses ;) prefer continuous functions you should rather use one of the built in Step functions with smoothing for the transition region, or the piecewise interpolation functions. Check the sub nodes under "Definitions", and check out the Videos on functions and operators

--
Good luck
Ivar
Hi there are a simpler way for 2 levels: 998+2*(T[1/K]>273) But as COMSOL solvers (as we were thought once in our math courses ;) prefer continuous functions you should rather use one of the built in Step functions with smoothing for the transition region, or the piecewise interpolation functions. Check the sub nodes under "Definitions", and check out the Videos on functions and operators -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 30 ago 2015, 05:06 GMT-4
Alright Thanks for the information :)
Alright Thanks for the information :)

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.