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.

How to define a maximum value for a dependent variable?

Please login with a confirmed email address before reporting spam

I have been trying to develop a performance model for an electrochemical system.
However, I got some evaluation errors of powers or logarithms when starting
the solver. This is due to concentrations getting negative values at some
solver step. I need to assure that I do not evaluate negative values, and use a maximum concentration value for all species like max(1e-9, c).

How can I define it?

Thanks,

Ertan

2 Replies Last Post Jun 17, 2015, 1:42 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 12, 2011, 8:13 p.m. EDT
I have just found how to define it. If you use max(c, 1e-9) everywhere in the model instead of "c", the max function will return 1e-9 if the concetration is lower than 1e-9. Therefore, you can eliminate errors due to getting negative concentrations values at some solver step.

I have just found how to define it. If you use max(c, 1e-9) everywhere in the model instead of "c", the max function will return 1e-9 if the concetration is lower than 1e-9. Therefore, you can eliminate errors due to getting negative concentrations values at some solver step.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Jun 17, 2015, 1:42 a.m. EDT
Hi,

where have I to type in the function?

Best regards,
Adnan
Hi, where have I to type in the function? Best regards, Adnan

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.