CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Syntax errors with Thread Types and Wall Heat Transfer calculation (http://www.cfd-online.com/Forums/fluent-udf/91758-syntax-errors-thread-types-wall-heat-transfer-calculation.html)

jcespada August 22, 2011 04:55

Syntax errors with Thread Types and Wall Heat Transfer calculation
 
Hello,

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:
#include"udf.h"


DEFINE_PROFILE(wall_temp,t,i)
{

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)
{
begin_f_loop(f,f_thread)
{
curr_heat += abs(BOUNDARY_HEAT_FLUX(f,f_thread));
}
end_f_loop(f,f_thread)
}
}

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

}
end_f_loop(f,t)


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.
J.

jcespada August 22, 2011 05:24

Correction
 
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 03:29.