CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Mass Diffusion via UDF (

Ryan February 8, 2003 02:58

Mass Diffusion via UDF
I am trying to implement mass diffusion in a mixture of CH4 and H2 in my model. Because I'm trying to reproduce a model of the same process done by someone in homemade code I am trying to implement the same mass diffusion coefficient calcs they used, namely Chapman-Enskog (sp?). My thoughts for implementing are to use DEFINE_DIFFUSIVITY in a udf. My question is what to do about the argument 'i' or 'index' required by the DEFINE_DIFFUSIVITY function. I know 'i' refers to species, but will I need a case structure or if then statement to evaluate which species the solver contains or something? Thanks in advance for any clearer explanation. The Fluent documentation is surprisingly lacking in the explanation of this 'i' argument.

Keil February 12, 2003 02:23

Re: Mass Diffusion via UDF

The "i" is species index , as you know. "i" can be got from 0 to the number of species you defined. If you push the edit button on Define-Material-Mixture species panel ,you can see "Selected Species". For example, If the "Selected Species" are defined as h2o, o2, n2 in sequence ,this h2o is represented by i=0. As the same manner, o2 is represented by i=1, n2 is i=2.



Greg Perkins February 12, 2003 19:25

Re: Mass Diffusion via UDF
My Understanding is the kinetic theory model built-in is in fact the same as the Chapman-Enskog model.

If you want to code it yourself, you can use the DEFINE_DIFFUSIVITY udf. Fluent have not documented all the internal species details - you'd have to ask them etc. You can look in the.h files to get some insights, but its not very time efficient.

I've written similar functions, and to avoid all the hassles getting info from Fluent, I simply implement my own database internally - or from a file - and make sure that my internal species are the same as those define in you species panel in Fluent. Its not perfect but it works ok and you avoid all this stuffing around with the fact you don't know whats going on in Fluent.


Ryan February 13, 2003 00:56

Re: Mass Diffusion via UDF
Thanks Greg and Keil for your responses. Greg: I found out soon after posting here that the kinetic-theory model was essentially the same as the Chapman-Enskog method. The best I could come up on my udf was that when using DEFINE_DIFFUSIVITY the i argument is passed to the udf by function and takes on any value 0...n-1 where you have n species. I have implemented my model with kinetic-theory, but at some point I plan to shift to the udf. Like you, sometimes I'm more comfortable with udf overkill so that I know exactly what the code is doing. Thanks again.


Greg Perkins February 13, 2003 01:10

Re: Mass Diffusion via UDF
Just as a matter of interest how did you calculate the collision integral in the kinetic theory model?

When I did it I used Bird et al 1960 etc. and got data from there and used Excel to develop a correlation which I implemented as a C macro. This seems to work well enough, since it gave about 1% maximum deviation from Fluent's own model.

I originally developed this for multiphase flows where I used my own multiphase model and hence had to multiply the diffusion by a factor - but alas had to write the diffusivity routine myself.

Anyway let me know how you did it?


All times are GMT -4. The time now is 11:52.