UDS
I am trying to write a UDF for the source term of a UDS equation. Is there any possibility to access gradient of the UDS (something like the macros C_DUDX(c,t), C_DUDY(c,t)... used for velocity components)?

Re: UDS
Try the array C_UDSI_G(c,t,i)[j]. i is the user defined scalar number and j is the direction. 0 for x direction gradient, 1 for y direction and 2 for z direction.

Re: UDS
This works, but you may need to be careful how you use it. For example if you want to modify the pde by adding a term like d/dx_i(thi) where thi is your uds, adding the term above will not strictly be conservative and numerical errors could result.
For these applications, its better to apply the divergence theorem and determine the face fluxes yourself in the udf source term than use the precalculated gradient term. The section on the solver in the manual details this discretization process. This requires more programming and takes longer to compute inside Fluent, but it will give you the correct answer to your pde, which will not be the case if you add the gradient term. Greg 
Re: UDS
Thanks for your note, I already noticed it, but i have been using dUDS0/dx for another source term in my momentum equation. WIll it create the same problem?
Ugur 
Re: UDS
I suggest checking against an analytical solution for a pde to see the difference. You will need to decide for your application.
You could always ask Fluent how that value is actually calculated  I think it might be cell to cell, rather than at faces, as required by the CV method etc. Greg 
All times are GMT 4. The time now is 12:15. 