CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Syntax errors with Thread Types and Wall Heat Transfer calculation (

jcespada August 22, 2011 04:55

Syntax errors with Thread Types and Wall Heat Transfer calculation

I am trying to let Fluent calculate the temperature of a wall that gives a certain heat flux at the end of the calculation. First i run some iterations with a constant temperature at the wall and then I compile (interpreted) the udf and assign it to the wall temperature.

The code looks like this:


face_t f;
Thread *f_thread;
Domain *domain = Get_Domain(1);
real x[ND_ND];
real end_heat = 52.939E+06; /* goal heat transfer from the gas to the wall */
real alpha = 1.2; /* correction factor for the wall temperature */
real curr_heat = 0.0; /* current heat transfer from the flow to the wall */
real temper = 300.0; /* face temperature */

thread_loop_f(f_thread, domain)
if(THREAD_TYPE(f_thread) == THREAD_F_WALL)
curr_heat += abs(BOUNDARY_HEAT_FLUX(f,f_thread));

temper = F_T(f,t);
F_PROFILE(f,t,i) = temper * alpha;


if (temper >= 1000) temper = 1000; /* temperature is clipped 200K =< T =< 1000 */
if (temper <=200) temper = 200;

The line "if(THREAD_TYPE(f_thread) == THREAD_F_WALL)" does not work. I thought it should be quite easy to verify if a thread is a wall, but I always get the error message "structure reference not implemented". Maybe it has something to do with the installation or the version. I use Fluent 13.0.0.

The macro BOUNDARY_HEAT_FLUX(f,f_thread); gives after 1 iteration "access violation" as output and I have to restart FLUENT.

Finally abs() doesn't work either, since there is no math.h file in the src directory. Any idea how to overcome this?

I would be very thankful, if someone could help.
Thanks in advance and best regards.

jcespada August 22, 2011 05:24

Sorry, the calculation of the correction factor is missing in the code.
There is a line looking like this between the two big loops:
alpha = curr_heat / end_heat;

cdf_user March 16, 2012 03:23

what does this statement mean?

if(THREAD_TYPE(f_thread) == THREAD_F_WALL)

All times are GMT -4. The time now is 04:37.