CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   User defined function for backflow temperature in fluent (

harshit September 10, 2012 14:58

User defined function for backflow temperature in fluent
Hello everyone,
I am looking forward for making a UDF that calculates the area-weighted average of all the faces where backflow doesn't occurs and assign it as the backflow temperature. I have never done coding in fluent before, therfore I have the algo in my mind but couldn't find apt commands.
Can someone please brief me with some commands that will be useful to me and also there uses.
I will greatly appreciate your help.

macfly January 29, 2013 21:21

Here's a code that calculates the arithmetic mean temperature of outgoing flow in the x direction. It's ok if the outlet cell faces have the same area. Then the mean T is used in a profile.

#include "udf.h"
real T_mean;

DEFINE_ADJUST(u_outflow, domain,t)
real T_tot;
real u;
real counter = 0;

face_t f;
int ID = 20; /* outlet ID displayed in Fluent boundary conditions panel */
Thread *thread;
thread = Lookup_Thread(domain, ID);
begin_f_loop(f, thread)
u = F_U(f,thread); /* x velocity */
if (u >= 0)
T_tot += F_T(f,thread);
counter = counter + 1;
T_mean = T_tot/counter; /* arithmetic mean T of outflow */

DEFINE_PROFILE(T_backflow, thread, position)
face_t f;
begin_f_loop(f, thread)
F_PROFILE(f, thread, position) = T_mean;
end_f_loop(f, thread)

macfly January 29, 2013 21:22

Nevermind the present post, I can't find how to erase it.:D

All times are GMT -4. The time now is 00:43.