# UDF which defines the surfaces temperature as a function of the surface heat flux?

Is there any Ansys Fluent UDF which defines the surfaces temperature as a function of the surface heat flux?

I want to model a radiation adiabatic wall condition for hypersonic flow (energy balance). This way I define a variable temperature wall boundary condition that implies a dynamic evolution of the wall temperature governed by a surface energy balance at the wall interface.

q_in+q_out=0

q_out = radiativ heat flux from wall to gas = e*sigma*T^4 (Stefan Boltzmann Equation)

For this I need to access the Heat Flux from wall to gas which is, I think, defined in Fluent as BOUNDARY_HEAT_FLUX(f,t)

Thanks!

## Answers

6,649Yes that is the right macro you mentioned.

What shall your function return?

48The function shall return the wall boundary Temperature.

I wrote the following UDF but it doesn't work. The UDF is for a 2D profile so I thought I have to define a x and y variable. Does this work generally and do you know why this UDF in particular doesn't work? Thanks a lot.

#include "udf.h"

#include "math.h"

DEFINE_PROFILE(calc_surf_temp,t,i)

{

real boltzmann = 5.670374419E-08;

real emissivity = 0.8;

real x;

real y;

face_t f; /* declare face identifier for FLUENT */

begin_f_loop(f,t)

{

F_CENTROID(x,y,f,t);

x = pos[1];

F_PROFILE(f,t,i) = pow((BOUNDARY_HEAT_FLUX(x,y,f,t)/boltzmann*emissivity),(1/4));

}

end_f_loop(f,t)

}

8,395You've defined x as the y coordinate and not defined y. Not sure if that's the entire solution though.

48Thanks for your reply Rob.

But in general is this procedure correct? And will it work if I set this UDF temperature as a isothermal wall BC?

6,649The procedure should have a good starting value as it depends on the boundary heat flux which depends on the temperature you are trying now to provide as function.

In Fluent there is the DEFINE_HEAT_FLUX macro which define the way Fluent would interpret how the heat should be accounted for.

48Hello, thanks for your reply. I tried to improve the UDF, but when I want to compile it for the use on our cluster I receive several error warnings. As I am not very experienced with UDFs I would be very thanksful if you could give me a hint what could be wrong. As this UDF isn't that complex I guess I made some basic mistake(s). Thank you very much!

#include "udf.h"

#include "math.h"

DEFINE_PROFILE(calc_surf_temp,t,i)

{

real boltzmann = 5.670374419E-08;

real emissivity = 0.8;

real x;

real y;

face_t f; /* declare face identifier for FLUENT */

begin_f_loop(f,t)

{

F_CENTROID(x,y,f,t);

y = x[1];

F_PROFILE(f,t,i) = pow((BOUNDARY_HEAT_FLUX(x,y,f,t)/boltzmann*emissivity),(1/4));

}

end_f_loop(f,t)

}

8,395Have a look at the x and y definitions, the F_AREA and F_CENTROID examples in the manual should help. Posting the errors tends to be helpful too!

6,649Face centroid macro is wrong. Check the documentation.

6,649Same with boundary heat flux.

48To my knowledge the BOUNDARY_HEAT_FLUX is not really documented? At least not in the FLuent UDF Manual. And what exactly do you mean? I checked the documentation. I got the code to run without sytax errors now, but the wall temperature is set to 0 with the following UDF. Is there still anything obvious I made wrong?

#include "udf.h"

#include "math.h"

DEFINE_PROFILE(calc_surf_temp,t,i)

{

real boltzmann = 5.670374419E-08;

real emissivity = 0.8;

real pos[2];

face_t f; /* declare face identifier for FLUENT */

begin_f_loop(f,thread)

{

F_CENTROID(pos,f,thread);

F_PROFILE(f,thread,i) = pow((BOUNDARY_HEAT_FLUX(f,thread)/boltzmann*emissivity),(1/4));

}

end_f_loop(f,thread)

}

8,395How are you initialising the model? In your code if the flux is zero at the start the temperature will be zero which may not work very well. Also, what's the other temperature as Qrad = f( T^4 - T^4).

48I am initialising using the Boundary Conditions at the Farfield. I saw that if I initialise using the wall, the wall temperature is 1K for initialisation.

The other temperature, to my understanding, is the external radiation temperature, which I assumed to be 0 K. This is of course not correct but a simplification I chose.

Is there a way in whcih I can initialize my model with a sepecific wall temperature? Or any other way to make this work?

Thanks alot!

6,649Patch temperature in the first cell layers of the wall. Or start with constant temperature for some iterations.

Look at my first post as I was not really convinced about the approach as it might lead to some issues.