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.

restrict codomain of dependent variables, i,e. make them positive always?

Hey everybody,

I have a model with ion concentrations as dependent variables amongst others. When solving my problem, COMSOL makes one of the concentrations negative! But it can only be posititve of course. So, how can I restrict the codomain of my dependent variable, i.e. tell COMSL that making the it negative is not allowed?

All best and thank you very much for your answers,
Sabine

2 Replies Last Post 2012年10月4日 GMT-0400上午10:10
Posted: 5 years ago 2012年10月3日 GMT-0400下午12:46
Hi

You can stat by checking the KB (knowledge base) and te Forum, there are many discussions around how to cope with negative concentration, and often why they occure, and how to get around ;)

--
Good luck
Ivar
Hi You can stat by checking the KB (knowledge base) and te Forum, there are many discussions around how to cope with negative concentration, and often why they occure, and how to get around ;) -- Good luck Ivar

Posted: 5 years ago 2012年10月4日 GMT-0400上午10:10
Dear Ivar,
thank you very much for the answer!
I was indeed not aware of that problem being a rather common problem, and searching specifically for negative *concentrations* did not come into my mind, so I am happy the appearance of them does apparently not necessarily mean that anything is fundamentally wrong with my problem :)
Do you know if the hint Tero gave in the thread you linked (defining a new variable that is set to a little bit over zero every step it is found to be negative if I understand it right), works in the newest version of COMSOL only, or in the old 3.5a one as well? (I do not know what kind of variable I should it define as, and how to tell COMSOL to solve for this instead of for my original dependent variable.. If you say it could work, I will try to figure out how to do it..)
All best,
Sabine
Dear Ivar, thank you very much for the answer! I was indeed not aware of that problem being a rather common problem, and searching specifically for negative *concentrations* did not come into my mind, so I am happy the appearance of them does apparently not necessarily mean that anything is fundamentally wrong with my problem :) Do you know if the hint Tero gave in the thread you linked (defining a new variable that is set to a little bit over zero every step it is found to be negative if I understand it right), works in the newest version of COMSOL only, or in the old 3.5a one as well? (I do not know what kind of variable I should it define as, and how to tell COMSOL to solve for this instead of for my original dependent variable.. If you say it could work, I will try to figure out how to do it..) All best, Sabine

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.