CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF to calculate average temperature outlet? (https://www.cfd-online.com/Forums/fluent-udf/185577-udf-calculate-average-temperature-outlet.html)

h0rst March 29, 2017 02:33

UDF to calculate average temperature outlet?
 
Hello everybody,

I am simulating a heated pipe flowed through by water and I would like to know the temperature at the outlet. In the program, I can do that by Reports/Surface Integrals/area weighted average/outlet.

Now, I want to write an UDF to calculate this value because I need to work with this parameter in the simulation.


My idea was to use an if-function that asks for the location of the outlet surface cells. The location of the outlet face are

x: 10 to 20 mm
y: -5 to 5 mm
z: 0

I tried to use this UDF:

real x[ND_ND]; // array of face coordinates
F_CENTROID(x,f,t);

if (x[1]>=0.01 && x[0]<=0.02 && x[1]>=-0.005 && x[1]<=0.005 && x[2]==0)
{
printf("F_T(f,t)=%f\n",face temperatures);
}

With this UDF, the face centroids are not choosen. I need to specify a wider range of cells and it looks like it still tries to select the cell centroids.

Can someone tell me what is wrong and if this is the right way to calculate the outlet temperature?


Best regards
h0rst


All times are GMT -4. The time now is 21:58.