CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   diffusivity (

Joerg Brozio February 16, 2001 05:01


I am just trying to use the porous media model including transport eqaution. Therefore I need to deifine a direction dependent diffusivity. A si have seen, this is not directly possible. So I inetended to use the scalar transport equation including diffusivity and source term. In the source term there has to be included a diffusion term, i.e. I need to get the second gradient of a UDS in space. I havenīt seen anything like this. Is this somehow possible? Or has somebody a different idea?

Thanks for help.

Greg Perkins February 18, 2001 03:11

Re: diffusivity
You can write a user defined diffusivity for you user scalars thus eliminating the need to get the second derivatives. Though you can get the first derivative by accesing


where i = scalar number, x = direction = 0,1,2


Joerg Brozio February 19, 2001 04:56

Re: diffusivity
Thank you Greg,

I will try this.

It just seemed to me, that it is not possible to return a vector diffusivity from the UDF (define diffusivity macro). At least I read out of the manual that diffusivity has to be a scalar.

So the problem seems to be smaller than I thought.



Greg Perkins February 19, 2001 18:01

Re: diffusivity
Oh, yeah you might be right - sorry I wasn't sure what you meant. Yes I think that you are correct and it may not be so easy. I believe Fluent will apply the returned diffusivity to all gradient terms.

Getting around this may not be very easy - since you'd have to calculate the source term yourself. I'm not sure you can access directly second derivatives - though ask Fluent. You could try by passing the scalar - ie temperature - to a scalar uds, then taking the gradient of the gradient using the C_UDSI_G(c,t,i)[x] macro (see previous posts) twice.

Whether this is good numerically I'm not sure.


Joerg Brozio February 20, 2001 04:29

Re: diffusivity
Thanks again, Greg!!!

I think this is a very good idea of yours.

I hope to the numerical problems will be not so great!!



Joerg Brozio February 21, 2001 14:00

Re: equ number in source
Hi Greg,

just set up my UDF.

Was able to compile it and will test to run it today.

While setting it up I saw one difficulty. To enhance stability of the solver, it is recommended to define the gradient of the source term with respect to all coupled equations. The equation number is passed as an argument to the DEFINE_SOURCE macro. Actually with my code I got different source terms with gradients dependent on several UDS. So I need to know the equation number of the transport equations.

Can you (or somebody else) give me a hint where to find it?? I searched the UDF manual for it, but wasnīt succesful.

Thanks a lot again.

I hope I will remember to set UDF in the UDF list at cfd-online, just in case it really works.



All times are GMT -4. The time now is 03:08.