CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   help calculate a function (

hassenwalid September 6, 2011 15:15

help calculate a function
1 Attachment(s)
I work on a problem of natural convection in fluent
I would like to compute a function as follows:see attached file
how to do this please

hassenwalid September 8, 2011 19:03

:confused::confused::confused::confused::confused: please help

m2montazari September 9, 2011 11:17

If you want to define such a function in udf, first you should Keep temporary solver memory from being freed in solve-set in text mode of fluent. then use suffix _G or _RG for each variable and use any coordinate of gradient vector you want. take a look at page 265 of udf help manual pdf of fluent or find "Flow Variable Macros for Cells" in html mode. it has almost complete instruction.

hassenwalid September 9, 2011 15:08

hank you very much mohammad
but I new to programming in fluent
it will be very nice of you if you help me in developing this udf

m2montazari September 10, 2011 03:31

first of all tell me that you want this function to be calculated for postprocessing or you want to use it inside solution algorithm?
if you want it for post processing, simply use define->custom field function and use derivatives of velocity and temprature and ....
but if you want to use it in equations that fluent solve, you must write a udf and compile it. so be more clear.

hassenwalid September 10, 2011 08:22

yes i want it to be calculated postprocessing
can you give me more detail how to do it

thank you very much for your help

hassenwalid September 13, 2011 14:34

hello Mr. mohammad
I hope that I does not bother you
can you please help me
I really need to have the steps to calculate this function
thank you in advance

m2montazari September 15, 2011 02:05

if you want to calculate this function for postproccessing, just go to define->custom field function and use the menus in it and buttons to define any function you want.
if something went wrong or any other problem ask it...!

hassenwalid September 15, 2011 19:33

thank you mohammad
I'll try to do it

Nikolopoulos September 16, 2011 04:03

You can do it with custom field functions.
But the variables you want are not available (the derivatives).

In order to make them available

In the text promt: solve-> set -> expert
and answer YES [in Keep temporary solver memory from being freed?]


hassenwalid September 16, 2011 19:27

thank you very much, aris, for your help
juste i want to know one more thing

if the component of the velocity vector is (u, v, w)
dx-velocity/dx mean du/dx ??????????????
dy-velocity/dx mean dv/dx ?????????????
dz-velocity/dx mean dw/dx ???????????

Nikolopoulos September 19, 2011 04:05

dx-velocity /dx is du/dx and so on!

hassenwalid September 19, 2011 04:58

I tried but I got this message

"SEGMENTATION VIOLATION":confused::confused::confused::confused:

m2montazari September 23, 2011 04:00

in which state you got errors?
did you set fluent to keep the temporary?
first check defining a very simple function, does it returns error too? then a simple fuction containing velocity derivatives may be a good choice for checking, does it returns error too?
you should do these just as you are debugging a program!

Rahul123 December 26, 2012 07:17

can any1 tell me how to apply du/dy=0 at the boundary condition
I am confused between differentiating between du/dx=0 and du/dy=0 in the UDF
Thank you

All times are GMT -4. The time now is 01:49.