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.

modeling of Diffusion

Please login with a confirmed email address before reporting spam

Hi,
I want to model a simple mass diffusion process, but with a concentration dependent diffusion coefficient.
In variable I defined a function for diffusion coefficient. but when I want to solve the problem it end with error ("Failed to find consistent initial values. Last time step is not converged.").

Is there any solution for this problem?
Thanks.
Saeed.

6 Replies Last Post Mar 26, 2017, 11:39 p.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 15, 2013, 4:14 a.m. EDT
Hi,


See if your problem works by keeping D constant. If it works then you could say D(C) could be a problem, in which case make sure that when C becomes negative or zero that you still have a positive D value. Otherwise, from the information you have given it is difficult to say what the problem is. May be check also that you have defined boundary condition correctly and that you have finite concentration in your domain.


Suresh
Hi, See if your problem works by keeping D constant. If it works then you could say D(C) could be a problem, in which case make sure that when C becomes negative or zero that you still have a positive D value. Otherwise, from the information you have given it is difficult to say what the problem is. May be check also that you have defined boundary condition correctly and that you have finite concentration in your domain. Suresh

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Dec 30, 2014, 2:11 a.m. EST
I am also facing the similar problem. Did you solve the problem of defining the concentration-dependent Diffusion problem in COMSOL?
I am also facing the similar problem. Did you solve the problem of defining the concentration-dependent Diffusion problem in COMSOL?

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Dec 30, 2014, 4:28 a.m. EST
I tried to use Kohlrausch law in the form of

D = D0*(1 - K*sqrt(c/C0))

where I have defined the parameters D0, K and C0 (1[mol/l]), and c is (obviously) my concentration variable. The problem appears to be related to the square root function. Comsol tries to calculate its derivative (I do not know why), as I got error messages due to negative square roots etc. I added "abs" function but it did not help either. When I used a linear dependence instead of square root, no errors were reported.
I tried to use Kohlrausch law in the form of D = D0*(1 - K*sqrt(c/C0)) where I have defined the parameters D0, K and C0 (1[mol/l]), and c is (obviously) my concentration variable. The problem appears to be related to the square root function. Comsol tries to calculate its derivative (I do not know why), as I got error messages due to negative square roots etc. I added "abs" function but it did not help either. When I used a linear dependence instead of square root, no errors were reported.

Ed Gonzalez COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Dec 30, 2014, 7:19 a.m. EST
Hi Lasse,
you get the error message since d(D,c) is undefined when c=0. also, negative concentrations will give you a complex number.
Try the modified expression

D = D0*(1 - K*sqrt(max(c,eps)/C0))

where eps is a very small number defined as the "machine epsilon". If you still need to used the average of the concentration, use

D = D0*(1 - K*sqrt((abs(c)+eps)/C0))
Hi Lasse, you get the error message since d(D,c) is undefined when c=0. also, negative concentrations will give you a complex number. Try the modified expression D = D0*(1 - K*sqrt(max(c,eps)/C0)) where eps is a very small number defined as the "machine epsilon". If you still need to used the average of the concentration, use D = D0*(1 - K*sqrt((abs(c)+eps)/C0))

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Dec 30, 2014, 8:03 a.m. EST
Yes,

it helped, thanks a lot!

Lasse
Yes, it helped, thanks a lot! Lasse

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Mar 26, 2017, 11:39 p.m. EDT
Hi
I have similar kind of problem.My model converges with D as constant but when I use it as a function of temperature(D=((kB*T)/(3*pi*eta_f*d_p)) it does not converge. Can you please help me with this.

Thanks
Abhinav.
Hi I have similar kind of problem.My model converges with D as constant but when I use it as a function of temperature(D=((kB*T)/(3*pi*eta_f*d_p)) it does not converge. Can you please help me with this. Thanks Abhinav.

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.