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.

negative concentrations with high reaction terms in biokinetic models

Please login with a confirmed email address before reporting spam

Hi,

I am using a biokinetic model based on the ASM (activated sludge models) to simulate water contaminant removal in a gravel filter. This kind of models consider the degradation of the influent solute components by several species of microorganisms. As a result of the degradation, this microorganisms also grow.

For the flow simulation I am using Darcy's Law. The contaminant removal is modeled using the solute transport module with a reaction term, in which monod-like expressions are deffined. These reaction expressions are also multiplied by the concentration of the different species of microorganisms that consume each solute component (the higher the concentration of microorganisms the more they consume).
The growth of bacteria is modeled using PDE general form expressions.

This works just fine for short periods of time (e.g. 1 day), but when bacteria start to grow considerably, the reaction terms become very big and negative (consumption), and thus the concentrations of the solutes become also negative. I've tackled this by deffinig variables s=max(eps^2,S), were S is the concentration of the solute. So when S becomes negative, in the next time step it is seen as a 0 instead of a negative value. If I don't do this, a part from getting negative solute concentrations, the growth of bacteria also gets corrupted (as it depends on S), and therefore this error impacts the whole model. I also tried to add expressions such as *(S>0) in the reaction term of S, but I have not been successful either.

I have checked the solutions suggested in this link, www.comsol.com/support/knowledgebase/952/ but it did not help much.

Could anyone tell me how to make the reaction rate 0 when the concentration of the substrate becomes zero? I do not understand where exactly should I introduce the term max(eps^2,Q).

Hope I made myself clear.

Thank you in advance

5 Replies Last Post 20 mar 2013, 06:29 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 7 ott 2011, 10:51 GMT-4

I also met a problem of negative concentrations appearing in the COMSOL solution in a completely different problem related to diffusion. There is a discussion on the topic in the Knowledge base here:
www.comsol.eu/support/knowledgebase/952/

There one uses the variable change
c=exp(w) (1)
where c is the concentration and w is a new dependent variable. Than you should rewrite your equations in terms of w and good lack. The advantage is that whatever w you get c is always positive. There are two disadvantages though.
1. You cannot fix a boundary condition c=0, since this corresponds to w=-infinity. You can go around by equating w to some negative value, such as w=-10, or w=-100.
2. Instead of linear diffusion equation you get a non-linear one. This is unavoidably: it is due to the non-linear transformation (1). This may be just fine, but may create problem with convergence. Depends upon your problem.

You may use another transformation. Say,
c=w^2 (2)
This one does not have the problem Nr. 1, but has Nr. 2 like any non-linear change will produce.

Concerning your last question, it seems unphysical to introduce such a dependence of the reaction rate upon the concentration of one of species. But if you think that this makes no harm in your case, why not to use such a construct
k=if(c>0,k0,0) (3)
where k0 is the number which is your actual reaction rate. Alternatively you may try to use a built-in step-function or a smooth function such as
k=k0*0.5*(tanh(10*(c - 0.2)) + 1)
but in this case take care that in the transition region your rate will behave not like it should.

Have success, Alexei

I also met a problem of negative concentrations appearing in the COMSOL solution in a completely different problem related to diffusion. There is a discussion on the topic in the Knowledge base here: http://www.comsol.eu/support/knowledgebase/952/ There one uses the variable change c=exp(w) (1) where c is the concentration and w is a new dependent variable. Than you should rewrite your equations in terms of w and good lack. The advantage is that whatever w you get c is always positive. There are two disadvantages though. 1. You cannot fix a boundary condition c=0, since this corresponds to w=-infinity. You can go around by equating w to some negative value, such as w=-10, or w=-100. 2. Instead of linear diffusion equation you get a non-linear one. This is unavoidably: it is due to the non-linear transformation (1). This may be just fine, but may create problem with convergence. Depends upon your problem. You may use another transformation. Say, c=w^2 (2) This one does not have the problem Nr. 1, but has Nr. 2 like any non-linear change will produce. Concerning your last question, it seems unphysical to introduce such a dependence of the reaction rate upon the concentration of one of species. But if you think that this makes no harm in your case, why not to use such a construct k=if(c>0,k0,0) (3) where k0 is the number which is your actual reaction rate. Alternatively you may try to use a built-in step-function or a smooth function such as k=k0*0.5*(tanh(10*(c - 0.2)) + 1) but in this case take care that in the transition region your rate will behave not like it should. Have success, Alexei

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 11 ott 2011, 10:05 GMT-4
Thank you for your detailed response. It turns out that the negative concentrations may come from a mistake on the conceptual model. I'll keep you updated.
Thank you for your detailed response. It turns out that the negative concentrations may come from a mistake on the conceptual model. I'll keep you updated.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 13 mar 2013, 12:40 GMT-4
Hi,
Did you ever figure out where to introduce the variable max(esp^2,c) if c is the species?
I am running into the same problem, and cannot find much help in the comsol document about that command/variable.
Thank you,
Kelley
Hi, Did you ever figure out where to introduce the variable max(esp^2,c) if c is the species? I am running into the same problem, and cannot find much help in the comsol document about that command/variable. Thank you, Kelley

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 13 mar 2013, 13:52 GMT-4
Hi

negative mesh effects can come from local high concentration gradients, nd a too corase mesh in the hgh gradient region (typically the case for initial conditions all "0" while you have a constrant entry concentration). This is rather for me a badly posed model, and you should improve slightly the initial conditions to get smooth transition.

Another point is that sometimes, you get overshoots when the refinement is done on coarse meshes with steep gradients, if its a plot issue, try first to turn off the refinement of the plot and turn on the wireframe to see unsmoothened plotting, based on the raw mesh data.

These points apply particularly to diffusion equation driven physis (Concentration, HT ...) and paticularly to time solving

--
Good luck
Ivar
Hi negative mesh effects can come from local high concentration gradients, nd a too corase mesh in the hgh gradient region (typically the case for initial conditions all "0" while you have a constrant entry concentration). This is rather for me a badly posed model, and you should improve slightly the initial conditions to get smooth transition. Another point is that sometimes, you get overshoots when the refinement is done on coarse meshes with steep gradients, if its a plot issue, try first to turn off the refinement of the plot and turn on the wireframe to see unsmoothened plotting, based on the raw mesh data. These points apply particularly to diffusion equation driven physis (Concentration, HT ...) and paticularly to time solving -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 20 mar 2013, 06:29 GMT-4
you can add a variable named C in the variables list defined as C=max(eps²,c), where c is your negative concentration.
you can add a variable named C in the variables list defined as C=max(eps²,c), where c is your negative concentration.

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.