11 November 2018 11 1K Report

I am kinda new to UDF, my question probably is simple for many others: I hope to apply a temperature distribution T(x) on a sidewall of duct as a boundary condition, and check it's effect on internal flow. The sidewall is parallel to x-y plane with two diagonal corners (0, 0.25, 1.25), and (9.5, -0.25, 1.25). In addition, T(x)= -0.0023x^4 + 0.0331x^3 - 0.1478x^2 - 0.0779x + 296.17.

I made a coding as follows, please correct it for me if you are familiar with UDF, please.

#include "udf.h"

DEFINE_PROFILE(temperature_profile,t,i)

{

real y[ND_ND]; /* this will hold the position vector */

real z[ND_ND];

real x;

face_t f;

begin_f_loop(f,t)

{

F_CENTROID(x,f,t);

x = x[1];

F_PROFILE(f,t,i) = -0.0023*x*x*x*x+0.0331*x*x*x-0.1478*x*x-0.0779*x+296.17;

}

end_f_loop(f,t)

}

Similar questions and discussions