I am studying a laminar fluid flow through a channel. I would like to get the velocity gradient at each cell. What kind of macro and thread I have to use? Please anyone answer. Regards, vivek.
There are macros for accessing flow velocity gradients in a FLUENT UDF. If you look in the UDF manual, you will find quite a few macros where _G is appended. For example, C_U_G(c,t) would return the vector of the x-velocity gradient. C_U_G(c,t)[0] would be du/dx, C_U_G(c,t)[1] would be du/dy etc.
However, I've had some trouble with these in certain UDF's and often first load the variable I want the gradient of into a user-defined scalar (UDS) using a DEFINE_ADJUST UDF before taking the gradient of this UDS to do whatever it is I want to do. I have attached a UDF for calculating the vorticity magnitude as an example.
One way is the UDF. Other is that you can export gradients of velocity directly in a text file. These files provide information as x,y,z, variable in a text format. You can then use any graphical software to plot or use it in any other way you like.
What I want is obtaining the velocity gradient at different time steps to modify some property. So basically i have to write a macro UDF. So do you know what is the corresponding command for collecting gradient at each time step for different velocity components?. Is is possible in reality?
Look into Fluent manuals. Journal files are series of text commands of the activities you would like Fluent to perform. By doing this you can automate the whole process. I regularly do that to make my computer load the case data files, change the boundary conditions, sol for iterations, write out outputs, load a new case data file, solve it and likewise. This way you can automate your whole design of experiment. Sample this
file rcd xxx.cas.gz ; Read the case and data file called xxx.cas.gz and zzz.dat.gz
sol iter 100 ; Solve it for 100 time steps
define models energy yes ; switch on the energy equation
sol iter 50 ; solve for another 50 steps
file wcd xxx-completed.cas.gz ; Write down case and data file after completing the simulation.
Hope you got the essence of how you can make your life easier
There are macros for accessing flow velocity gradients in a FLUENT UDF. If you look in the UDF manual, you will find quite a few macros where _G is appended. For example, C_U_G(c,t) would return the vector of the x-velocity gradient. C_U_G(c,t)[0] would be du/dx, C_U_G(c,t)[1] would be du/dy etc.
However, I've had some trouble with these in certain UDF's and often first load the variable I want the gradient of into a user-defined scalar (UDS) using a DEFINE_ADJUST UDF before taking the gradient of this UDS to do whatever it is I want to do. I have attached a UDF for calculating the vorticity magnitude as an example.