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.

Conditional Expressions

Please login with a confirmed email address before reporting spam

Hi All,

I was wondering if there is a way to make a dependent variable's expression be different depending on the value of another dependent variable.

For example, suppose we have the expression
ut-u=0

and wanted
y-u^2 = 0
for some u, but
y-u^3 = 0
for other u values.

Is there a way to do that?

Thanks for any advice in advance,

3 Replies Last Post 2012年9月28日 GMT-4 14:33
Nagi Elabbasi Facebook Reality Labs

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年9月28日 GMT-4 11:53
You can setup expressions such as this (y-u^2)*(u<2)+(y-u^3)*(u>=2)
You can setup expressions such as this (y-u^2)*(u=2)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年9月28日 GMT-4 14:18
I see, so to make sure I understand, COMSOL evaluates inequalities as 0 if they are false, and 1 if they are true? Or is it -1 if they are false?
I see, so to make sure I understand, COMSOL evaluates inequalities as 0 if they are false, and 1 if they are true? Or is it -1 if they are false?

Nagi Elabbasi Facebook Reality Labs

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年9月28日 GMT-4 14:33
0 if false 1 if true
0 if false 1 if true

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.