CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   UDF for linear temperature gradient (https://www.cfd-online.com/Forums/main/172925-udf-linear-temperature-gradient.html)

shg June 9, 2016 06:48

UDF for linear temperature gradient
 
Hi
I am trying to apply a UDF for linear temperature gradient across a surface. The left wall of the surface is at 700K, while the right wall is at 300K. Length of surface is 10mm.
The UDF goes this way:
#include "udf.h"

DEFINE_PROFILE(temperature_profile, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
y = x[0];
F_PROFILE(f, thread, position) = 500-40*y;
}
end_f_loop(f, thread)
}
However, this temperature profile doesn't show up in the results.
Can someone please send me a correct UDF for this?


All times are GMT -4. The time now is 16:09.