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.

Setting variables for different domains ('if...then'-function)

Konstantinos Serafeimidis

Please login with a confirmed email address before reporting spam

Hello everybody

I am pretty new in COMSOL. I have following (easy) problem: I study an advection-diffusion problem, where the reaction rate variable Rc is given by following equation:

Rc=(ceqA-c)/ceqA (it is actually the dissolution of a mineral)

I want that when this term does not become negative, i.e. when ceqA<c then it must be set equal to zero by the program. In excel this would be a simple 'if' function. How does one do it in COMSOL?

Thank you very much in advance

4 Replies Last Post 2010年7月8日 GMT-4 11:29

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月8日 GMT-4 10:51

Hello everybody

I am pretty new in COMSOL. I have following (easy) problem: I study an advection-diffusion problem, where the reaction rate variable Rc is given by following equation:

Rc=(ceqA-c)/ceqA (it is actually the dissolution of a mineral)

I want that when this term does not become negative, i.e. when ceqA<c then it must be set equal to zero by the program. In excel this would be a simple 'if' function. How does one do it in COMSOL?

Thank you very much in advance


How about Rc=(ceqA-c)*(c>ceqA)/ceqA?

Normally it is like if (condition, case A, case B).

[QUOTE] Hello everybody I am pretty new in COMSOL. I have following (easy) problem: I study an advection-diffusion problem, where the reaction rate variable Rc is given by following equation: Rc=(ceqA-c)/ceqA (it is actually the dissolution of a mineral) I want that when this term does not become negative, i.e. when ceqAceqA)/ceqA? Normally it is like if (condition, case A, case B).

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月8日 GMT-4 10:54
Try .....*(c<ceqA) which is 1 when it is true and zero when it is false.
Try .....*(c

Konstantinos Serafeimidis

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月8日 GMT-4 11:13
Thank you very much for the rapid answers!

Best regards

Kostas
Thank you very much for the rapid answers! Best regards Kostas

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月8日 GMT-4 11:29

Try .....*(c<ceqA) which is 1 when it is true and zero when it is false.


oops :) my bad. Wrote it quickly.
[QUOTE] Try .....*(c

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.