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 8 juil. 2010, 11:29 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 8 juil. 2010, 10:51 UTC−4

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 8 juil. 2010, 10:54 UTC−4
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 8 juil. 2010, 11:13 UTC−4
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 8 juil. 2010, 11:29 UTC−4

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.