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 model a diffusion problem in a multicomponent system

Please login with a confirmed email address before reporting spam

Hello everyone

I am newcomer with this software. I would like to request for your help. I want to do a formulation of system composed by 2 domains with lenght L1 and L2 respectively. (Lets assume 1-D problem), so that L=L1+L2. Each domain has its specific diffusion coefficient (D1 and D2, and they are concentration dependent) I want to study the diffusion of a species (for example carbon) ,along the distance L by solving the transient Fick's law. My questions are i dont know how to define the size L1 and L2, and D1 and D2, because I am not sure how comsol formulate this problem. Any idea? Thanks


10 Replies Last Post 13 mars 2018, 08:25 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 31 janv. 2018, 07:12 UTC−5

Your problem is otherwise an elementary one but making diffusion coefficients concentration dependent may pose a problem. I have not been able to do that. Each domain can have its own diffusion coefficients, just add a Transport properties node below Transport of Diluted Species.

BR Lasse

Your problem is otherwise an elementary one but making diffusion coefficients concentration dependent may pose a problem. I have not been able to do that. Each domain can have its own diffusion coefficients, just add a Transport properties node below Transport of Diluted Species. BR Lasse

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 31 janv. 2018, 15:15 UTC−5
Updated: 6 years ago 31 janv. 2018, 15:16 UTC−5

Your problem is otherwise an elementary one but making diffusion coefficients concentration dependent may pose a problem. I have not been able to do that. Each domain can have its own diffusion coefficients, just add a Transport properties node below Transport of Diluted Species.

BR Lasse

Hello Sir, thanks for you reply. Well, when we have a continuos domain, make the difussion coefficient concentration dependent is not a big problem, but in this case the domain is not continuos, since the difussion coefficient is not the same along the domains, such that when comsol assembly the global matrix for instance stiffness matrix, some terms corresponds to domain1 and other correspond to domain2. I would like to know how to do that.

>Your problem is otherwise an elementary one but making diffusion coefficients concentration dependent may pose a problem. I have not been able to do that. Each domain can have its own diffusion coefficients, just add a Transport properties node below Transport of Diluted Species. > >BR >Lasse Hello Sir, thanks for you reply. Well, when we have a continuos domain, make the difussion coefficient concentration dependent is not a big problem, but in this case the domain is not continuos, since the difussion coefficient is not the same along the domains, such that when comsol assembly the global matrix for instance stiffness matrix, some terms corresponds to domain1 and other correspond to domain2. I would like to know how to do that.

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 1 févr. 2018, 06:15 UTC−5
  • I'd like to see how you make the concentration dependence of the diffusion coefficient.
  • What do you mean a domain not being continuous?
- I'd like to see how you make the concentration dependence of the diffusion coefficient. - What do you mean a domain not being continuous?

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 8 févr. 2018, 16:32 UTC−5
Updated: 6 years ago 9 mars 2018, 08:47 UTC−5

Sorry for my delayed reply. With regard to your first question, in a previous simulation (a simple 1D problem and continuos domain, i mean, the difussion coefficient is the same nature) the module of "global definition", i define an "Analytic parameter", function name: D0, expression f(T,c) where T and c is the temperature a field variable respectively. Finally, in the module of Transport of diluted species, transport properties,Diffusion , we can define Dc as D0(c,T0[1/K]).

So how can I do this simultion but for 2 domains?, that is with 2 differente Dc

Sorry for my delayed reply. With regard to your first question, in a previous simulation (a simple 1D problem and continuos domain, i mean, the difussion coefficient is the same nature) the module of "global definition", i define an "Analytic parameter", function name: D0, expression f(T,c) where T and c is the temperature a field variable respectively. Finally, in the module of Transport of diluted species, transport properties,Diffusion , we can define Dc as D0(c,T0[1/K]). So how can I do this simultion but for 2 domains?, that is with 2 differente Dc

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 9 févr. 2018, 07:20 UTC−5
Updated: 6 years ago 9 févr. 2018, 07:20 UTC−5

I tried this way: I defined an analytic function

1 - sqrt(K*c)

where K is a constant; this follows the Kohlrausch's law. But when inserting for the diffusion coefficient this expression (multiplied with D0) gives an error message due to the square root; the usual trick of writing c+eps did not work.

Attached a model where I used D = D0(1 - Kc) for the left domain and D = 0.1·D0(1 - Kc) for the right domain. D0 = 10^-5 cm²/s.

BR Lasse

I tried this way: I defined an analytic function 1 - sqrt(K*c) where K is a constant; this follows the Kohlrausch's law. But when inserting for the diffusion coefficient this expression (multiplied with D0) gives an error message due to the square root; the usual trick of writing c+eps did not work. Attached a model where I used D = D0(1 - Kc) for the left domain and D = 0.1·D0(1 - Kc) for the right domain. D0 = 10^-5 cm²/s. BR Lasse


Please login with a confirmed email address before reporting spam

Posted: 6 years ago 26 févr. 2018, 04:47 UTC−5

Thank you so much for your example, from what i see, it is possible to raise this problem. Well, i am going to open another discussion, concerning this topic but with more complex situation. Thanks! Your comments will be welcome as well.

Thank you so much for your example, from what i see, it is possible to raise this problem. Well, i am going to open another discussion, concerning this topic but with more complex situation. Thanks! Your comments will be welcome as well.

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 9 mars 2018, 09:20 UTC−5

Hello Julio, I tried "Analytic parameter" as you metioned above but I couldn't plot the figure. Actually what I want to do is just to change constant diffusion coefficient D to diffusion dependent concentration, namely D/(1-c/c0), c is my variable in the module of Transport of diluted species. However when I set up this equation I got the error message as following: Failed to evaluate temporary symbolic derivative variable. - Variable: comp1.tds.D_cpxx@VDN$comp1.cp - Defined as: -((-Dp)/((1-comp1.cp)^2)) I am confused that where is the square from? It will be very kind to get any reply.

BR Liang

>Hello Julio, >I tried "Analytic parameter" as you metioned above but I couldn't plot the figure. Actually what I want to do is just to change constant diffusion coefficient D to diffusion dependent concentration, namely D/(1-c/c0), c is my variable in the module of Transport of diluted species. >However when I set up this equation I got the error message as following: >Failed to evaluate temporary symbolic derivative variable. > - Variable: comp1.tds.D_cpxx@VDN$comp1.cp > - Defined as: -((-Dp)/((1-comp1.cp)^2)) >I am confused that where is the square from? >It will be very kind to get any reply. >BR >Liang

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 9 mars 2018, 10:28 UTC−5

Hello Julio, I tried "Analytic parameter" as you metioned above but I couldn't plot the figure. Actually what I want to do is just to change constant diffusion coefficient D to diffusion dependent concentration, namely D/(1-c/c0), c is my variable in the module of Transport of diluted species. However when I set up this equation I got the error message as following: Failed to evaluate temporary symbolic derivative variable. - Variable: comp1.tds.D_cpxx@VDN$comp1.cp - Defined as: -((-Dp)/((1-comp1.cp)^2)) I am confused that where is the square from? It will be very kind to get any reply.

BR Liang

Hello Liang, it is really strange that you can not plot your analytic function, check carefully the module "Analytic parameter", and define well your arguments section, in this case i dont understand very well how you define the diffussion coefficient, i mean you wrote D=D/(1-c/co) or D=D0/(1-c/co), in the latter case your parameters must be "c,co and Do". Finally, in the module Transport of diluted species, subsection Transport Properties 1 you must type the name function in the section Dc. I hope you can comprehend my explanation. Best regards!

>>Hello Julio, >>I tried "Analytic parameter" as you metioned above but I couldn't plot the figure. Actually what I want to do is just to change constant diffusion coefficient D to diffusion dependent concentration, namely D/(1-c/c0), c is my variable in the module of Transport of diluted species. >>However when I set up this equation I got the error message as following: >>Failed to evaluate temporary symbolic derivative variable. >> - Variable: comp1.tds.D_cpxx@VDN$comp1.cp >> - Defined as: -((-Dp)/((1-comp1.cp)^2)) >>I am confused that where is the square from? >>It will be very kind to get any reply. > >>BR >>Liang Hello Liang, it is really strange that you can not plot your analytic function, check carefully the module "Analytic parameter", and define well your arguments section, in this case i dont understand very well how you define the diffussion coefficient, i mean you wrote D=D/(1-c/co) or D=D0/(1-c/co), in the latter case your parameters must be "c,co and Do". Finally, in the module Transport of diluted species, subsection Transport Properties 1 you must type the name function in the section Dc. I hope you can comprehend my explanation. Best regards!

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 13 mars 2018, 05:18 UTC−4

Hello Julio,

Thank you for your reply, It works now! However, what if c is a variable? I think I need to use other method, do you have any suggestion for this?

BRs Liang

Hello Julio, Thank you for your reply, It works now! However, what if c is a variable? I think I need to use other method, do you have any suggestion for this? BRs Liang

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 13 mars 2018, 08:25 UTC−4

Hello Julio,

Thank you for your reply, It works now! However, what if c is a variable? I think I need to use other method, do you have any suggestion for this?

BRs Liang

What do you mean?? c is the field variable, thus is variable.

>Hello Julio, > >Thank you for your reply, It works now! >However, what if c is a variable? I think I need to use other method, do you have any suggestion for this? > >BRs >Liang What do you mean?? c is the field variable, thus is variable.

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.