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/)
-   -   3D Velocity profile for turbulent flow (https://www.cfd-online.com/Forums/fluent-udf/139099-3d-velocity-profile-turbulent-flow.html)

Kirill July 17, 2014 04:17

3D Velocity profile for turbulent flow
 
To all good day!

I have small experience with programming and working with Fluen.
I need to create the velocity profile on inlet!
How I had read posts, I will need to make the UDF file for profile.
I have the turbulent flow. Location axis is the next: Z - along the pipe, X, Y - perpendicular to the axis Z.
The equation of velocity is the next:
U=u'*(((n+1)*(2n+1))/((2n)^2))*(1-r/R)^(1/n)
where
u' - the average velocity,
u'=Q/A, Q -flow rate,
A - area of inlet
n=1,66*log(Re), in my model the n I take 9.
R - dia/2 of inlet (radius)

How I seen, I have two variant of creating of UDF file.
1) to make the two UDF files for z-x plane of velocity profile and UDF file for z-y plane of velocity profile.
2) to make one UDF file for common velocity profile.

If I use the first variant of decision. The text of UDF file will be the next:

#include "udf.h"
#define Q 4.444e-3 //unit m3/sec
#define Diameter 0.158 //unit m
#define n 9

DEFINE_PROFILE(inlet_zx_velocity,t,i)

{

real x[ND_ND];

real y;

real U,A,Um,K,Kn,Ko,R;

A=(M_PI/4.0)*pow(Diameter,2);

Um=Q/A;

Kn=((n+1)*(2*n+1))/(2*pow(n,2));

Ko=1/n;

K=Um*Kn;

R=Diameter/2;

face_t f;

begin_f_loop(f,t)

{

F_CENTROID(x,f,t);

y = x[1];

U = pow(1-y/R,Ko);

F_PROFILE(f,t,i) = K*U;

}

end_f_loop(f,t)

}

How to modify this UDF file to realize the second variant: The one UDF file?

And how to write down the equation of y=log(X), for example?

Many thanks!

Kirill July 17, 2014 07:14

If I think right, that the UDF File for 3D turbulent velocity profile will be:



#include "udf.h"
#define Q 4.444e-3 //unit m3/sec
#define Diameter 0.158 //unit m
#define n 9

DEFINE_PROFILE(inlet_z_velocity,t,i)

{

real x[ND_ND];

real x;

real y;

real U,A,Um,K,Kn,Ko,R,rad;

A=(M_PI/4.0)*pow(Diameter,2);

Um=Q/A;

Kn=((n+1)*(2*n+1))/(2*pow(n,2));

Ko=1/n;

K=Um*Kn;

R=Diameter/2;

face_t f;

begin_f_loop(f,t)

{

F_CENTROID(x,f,t);

x = x[0];

y = x[1];

rad = pow(x*x+y*y,0.5);

U = pow(1-rad/R,Ko);

F_PROFILE(f,t,i) = K*U;

}

end_f_loop(f,t)

}

Kirill July 17, 2014 08:17

1 Attachment(s)
I apply the my UDFFile in Fluent and the error is occured:


Please, can somebody help me?

Kirill July 17, 2014 08:42

1 Attachment(s)
changed the variable in 12-th line on z.
And Now error is in 30 and 32-th lines?


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