CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Fluent UDF - polynomial profile description (https://www.cfd-online.com/Forums/fluent/234198-fluent-udf-polynomial-profile-description.html)

mihnea333 February 26, 2021 03:19

Fluent UDF - polynomial profile description
 
4 Attachment(s)
Good morning everyone. Young and inexperienced Fluent user here.
I am trying to describe a temperature profile for my boundary condition. Please see Image1. Attachment 82993
My domain is formed of a nozzle which injects fuel in a coflow domain. Both jet and coflow have their velocities, temperatures, compositions. I want to mention the domain is 3D as I aim to use LES in a later phase.
I want to describe a profile for the coflow based on a polynomial. For this I have taken some available experimental data points and have used Matlab to fit a 4th degree polynomial. The function reads:
p1t=-4.941e+09;
p2t=-4.007e+08;
p3t=-1.272e+07;
p4t=-1.884e+05;
p5t=398.6;
yt=p1t*r_exp_T.^4 + p2t*r_exp_T.^3 + p3t*r_exp_T.^2 + p4t*r_exp_T + p5t;
Matlab implementation to check the polynomial behaviour on the Fluent extracted coordinates
Attachment 82996
I have tried implementing the same function in a UDF for Fluent. Image2 shows the UDF function for the coflow. Attachment 82994
I have plotted the temperature vs radial coordinate. The profile obtained is flat. I then extracted my radial coordinates and put them in Matlab. The polynomial works fine and gives a good profile for my coordinates.
My UDF for describing the profile reads:

DEFINE_PROFILE(coflow_T_profile, thread, position)
{

real xt[ND_ND];
real yt;
real zt;
real rt;
face_t ft;
#define p1t -4.941e+09
#define p2t -4.007e+08
#define p3t -1.272e+07
#define p4t -1.884e+05
#define p5t 398.6



begin_f_loop(ft, thread)
{
F_CENTROID(xt,ft,thread);
yt = xt[1];
zt= xt[2];
rt=sqrt(zt*zt+yt*yt);
F_PROFILE(ft, thread, position)=p1t*pow(rt,4.)+p2t*pow(rt,3.)+p3t*pow(rt ,2.)+p4t*pow(rt,1.)+p5t;
}
end_f_loop(ft, thread)
}


I have tried using pow(rt,4.), pow(rt,4), rt*rt*rt*rt. The polynomial seems unresponsive. I came with the idea to check if it is working at all. So I used an if statement to set a fixed value along the coordinate. It seems to work. but the polynomial is still flat.
Attachment 82995
Would you be so kind to indicate what I might be doing wrong in my profile definition. Thank you in advance!


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