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/)
-   -   Udf --define_profile (http://www.cfd-online.com/Forums/fluent-udf/105070-udf-define_profile.html)

sagila July 22, 2012 05:19

Udf --define_profile
 
Dear all,
I want to define these F_PROFILEs for different Zs.

Z
F_PROFILE
0.0000 <= z < 0.0755
(z - 63.9902)/(-0.2162)
0.0755 <= z < 0.7327
(z + 195.4362)/(0.6614)
0.7327 <= z < 1.3900
(z + 333.8888)/(1.1283)
1.3900 <= z < 2.0382
(z + 377.9390)/(1.2765)
2.0382 <= z < 2.6775
(z - 2114.1705)/(-7.0954)
2.6775 <= z <= 2.7500
(z + 10.9611)/(0.0458)


And, I have writen the UDF file as follows. But, when I check it in FLUENT, it does not work correctly. Could you please help me?


#include "udf.h"
DEFINE_PROFILE(temp_profile,t,i)
{
real x[ND_ND];
face_t f;
begin_f_loop (f,t)
{
F_CENTROID(x,f,t);
if (0.0000 <= x[2] < 0.0755)
F_PROFILE(f,t,i) = (x[2] - 63.9902)/(-0.2162);
else if (0.0755 <= x[2] < 0.7327)
F_PROFILE(f,t,i) = (x[2] + 195.4362)/(0.6614);
else if (0.7327 <= x[2] < 1.3900)
F_PROFILE(f,t,i) = (x[2] + 333.8888)/(1.1283);
else if (1.3900 <= x[2] < 2.0382)
F_PROFILE(f,t,i) = (x[2] + 377.9390)/(1.2765);
else if (2.0382 <= x[2] < 2.6775)
F_PROFILE(f,t,i) = (x[2] - 2114.1705)/(-7.0954);
else
F_PROFILE(f,t,i) = (x[2] + 10.9611)/(0.0458);
}
end_f_loop(f,t)
}



Thanks in advance.
Best,

sagila July 22, 2012 08:29

Hi all,
I would appreciate if anyone could help me.
Thanks.

Patrick1 July 22, 2012 08:48

Quote:

Originally Posted by sagila (Post 372851)
Dear all,
I want to define these F_PROFILEs for different Zs. And, I have writen the UDF file as follows. But, when I check it in FLUENT, it does not work correctly. Could you please help me?


#include "udf.h"
DEFINE_PROFILE(temp_profile,t,i)
{
real x[ND_ND];
face_t f;
begin_f_loop (f,t)
{
F_CENTROID(x,f,t);
if (0.0000 <= x[2] < 0.0755)
F_PROFILE(f,t,i) = (x[2] - 63.9902)/(-0.2162);
else if (0.0755 <= x[2] < 0.7327)
..........
F_PROFILE(f,t,i) = (x[2] + 10.9611)/(0.0458);
}
end_f_loop(f,t)
}



Thanks in advance.
Best,

OnE problem is that you haven't properly defined the conditional AND statement, I think it should be:

else if (0.0755 <= x[2] && x[2]< 0.7327)

sagila July 22, 2012 11:41

Hi Patrick,
Thank you very much for your help. I corrected my UDF file as you told me and it works now :)


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