CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF for Inlet velocity (http://www.cfd-online.com/Forums/fluent/68654-udf-inlet-velocity.html)

Mijin Kim September 28, 2009 04:50

UDF for Inlet velocity
 
Hello guys.
My study is about blood flow.


I'm a beginner for CFD programs so I have some difficulties to complete my UDF for Inlet velocity.

Inlet velocity has parabolic profile, and the maximum velocity magnitude varies with time.(that is, Velocity is a pulsatile wave form)
I don't have any explicit expression for the velocity wave form but discrete velocity magnitude data vesus undimentionalized timestep.

It's a 3-D pipe flow
Please see the code and data below and give me some advise.
How can i make the correct UFD for my model?

------------------------------------------------------
//udf1
#include <udf.h>
#define R 40
#define UDF_FILENAME "pulse"
DEFINE_PROFILE(inlet_x_velocity, thread, position){
float x[3]; /* this will hold the position vector*/
float r;
int garbage=0;
float umax[60];
int i=0;
face_t f;
FILE *fp= fopen(UDF_FILENAME ,"r");

for (i=0;i=<59 ;i++){
fscanf(fp, "%d, %f",&garbage, &umax++);
begin_f_loop(f, thread){
F_CENTROID(x,f,thread);
r = x[1];
F_PROFILE(f, thread, position) = umax[i]*(1.-r*r/R/R));
}
end_f_loop(f, thread)
}
int fclose(fp);
}

------------------------------------------------------
pulse.txt

0 0.034
1 0.034
2 0.034
3 0.034
4 0.0342
5 0.031
6 0.023
7 0.0195
8 0.0165
9 0.0145
10 0.01
11 0.0045
12 0.0055
13 0.0125
14 0.023
15 0.043
16 0.115
17 0.216
18 0.32
19 0.33
20 0.278
21 0.2325
22 0.205
23 0.19
24 0.174
25 0.1525
26 0.13
27 0.106
28 0.078
29 0.045
30 0.015
31 -0.01
32 -0.01
33 0.008
34 0.0205
35 0.0285
36 0.029
37 0.0315
38 0.038
39 0.041
40 0.0435
41 0.046
42 0.046
43 0.043
44 0.039
45 0.0325
46 0.027
47 0.018
48 0.011
49 0.014
50 0.023
51 0.032
52 0.0355
53 0.035
54 0.034
55 0.034
56 0.034
57 0.034
58 0.034
59 0.034


All times are GMT -4. The time now is 12:30.