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/)
-   -   Transient parabolic 3D velocity profile (https://www.cfd-online.com/Forums/fluent-udf/221101-transient-parabolic-3d-velocity-profile.html)

mattialupo October 4, 2019 09:47

Parabolic 3D velocity profile
 
Good afternoon,
I've written the following UDF in order to obtain a 3D transient parabolic velocity profile for a cylindrical pype.
The outlet is at 0 static pressure, L=0.02 m, D=0.00156 m.

#include "udf.h"
#include "math.h"
DEFINE_PROFILE(inlet_x_velocity,thread,index)
{
real posVector[ND_ND];
real y;
real x;
real z;
real a;
real R;
face_t f;
real v_in_avg;
real a0,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,a8,b8 ,w;
real tt;



tt=CURRENT_TIME;

a0 = 1.204; a1 = -0.7902 ; b1 =0.6605;
a2 = -0.304; b2 = -0.6178; a3 = 0.2219;
b3 =-0.09491; a4 = 0.07092 ; b4 = 0.1358 ;
a5 = -0.05621; b5 = 0.08825; a6 = -0.09846;
b6 = -0.00592; a7=-0.01869; b7=-0.06586;
a8=0.01712; b8=-0.02417; w =25.48;

v_in_avg = a0 + a1*cos(tt*w) + b1*sin(tt*w) + a2*cos(2.0*tt*w) +
b2*sin(2.0*tt*w) + a3*cos(3.0*tt*w) + b3*sin(3.0*tt*w)+
a4*cos(4.0*tt*w) + b4*sin(4.0*tt*w)+a5*cos(5.0*tt*w) +
b5*sin(5.0*tt*w)+ a6*cos(6.0*tt*w) +b6*sin(6.0*tt*w)+
a7*cos(7.0*tt*w) + b7*sin(7.0*tt*w)+a8*cos(8.0*tt*w) +
b8*sin(8.0*tt*w);

begin_f_loop(f,thread)
{
F_CENTROID(posVector,f,thread);
x=posVector[0];
y=posVector[1];
z=posVector[2];
a=pow((pow(y,2)+pow(z,2)),0.5);
R=0.00078;
F_PROFILE(f,thread,index)=2*v_in_avg*(1-(pow(a,2)/(pow(R,2)));
}
end_f_loop(f,thread)
}

The UDF is interpreted correctly.
The first problem is that the velocity profile is not parabolic from the inlet, but it needs approximately 10 mm (1/3 of the total length).
I've tried a steady-state simulation and the profile is parabolic from the inlet.

Another issue regards the pressure values calculcated at each time step. I've noticed they are different from the steady-state simulations (and so are the pressure drops). For example, by applying Pouiselle's law far from the inlet, I can't obtain the expected values.

Does anyone have any thoughts about it?

Thank you if you read until here :)

AlexanderZ October 15, 2019 07:35

you had type

Code:

F_PROFILE(f,thread,index)=2*v_in_avg*(1-(pow(a,2)/(pow(R,2))));


All times are GMT -4. The time now is 19:49.