CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   (ask) how to create UDF for inlet velocity profile (http://www.cfd-online.com/Forums/fluent-udf/86275-ask-how-create-udf-inlet-velocity-profile.html)

 sincity March 18, 2011 08:38

(ask) how to create UDF for inlet velocity profile

hi all
i have a question
what should i do if i wanna go to use UDF for my inlet velocity profile 3D case
how can i define it
just a simple question, hope it will be answered by you.regards

 Amir March 18, 2011 08:49

Hi,
refer to DEFINE_PROFILE macro in UDF-manual.

 sincity March 18, 2011 09:34

hi amir thanks for attention
actually the UDF manual is not helping me at all because i want to create UDf for 3D case inlet velocity profile, but i dont know how to define the velocity function in 3D vector (x,y,z)
maybe you have some tutorial or case example??regards.

 Amir March 18, 2011 10:44

Hi Wibi,
here's a example for fully developed flow in a pipe:
Code:

```#include "udf.h" #define Q 1.5625e-5  //unit m3/sec #define Diameter 4.5e-3  //unit m DEFINE_PROFILE(axialVelocity,t,i) {     real x[ND_ND];     real r,Area;     face_t f;     Area=(M_PI/4.0)*pow(Diameter,2);     begin_f_loop(f,t)     {         F_CENTROID(x,f,t);         r=sqrt(pow(x[0],2)+pow(x[1],2));         F_PROFILE(f,t,i)=(2.0*Q/Area)*(1-pow(2.0*r/Diameter,2));     }     end_f_loop(f,t) }```

 sincity March 18, 2011 11:49

mmm...is it UDF for 3D case amir??

 Amir March 18, 2011 14:07

Quote:
 Originally Posted by sincity (Post 300064) mmm...is it UDF for 3D case amir??
it computes axial velocity magnitude in a pipe(z-direction) as a function of x & y.
you can also define three UDFs for each velocity components that are similar to above. it depends on the method that you want to set velocity in B.C. panel; magnitude normal or components.

 sincity March 19, 2011 00:32

amir my friend,
i am very confuse about what were you talking about, since i'm new user for UDF
amir in defining UDF should i plot my velocity data first to get the function
or just go straight use your UDF example that you gave to me?

 Amir March 19, 2011 09:51

Ok,
first you should decide what kind of velocity declaration you want to use.(in B.C. panel) e.g. you can use velocity magnitude normal to plane or setting individual velocity components. without UDF, you can set constant values for them in GUI.
but for your case that three components change with coordinates(I think), you should write 3 UDF for velocity components and declare them as functions of x,y,z and hook them in respective places. it's obvious that you should have velocities as functions of x,y,z.

regards,

Amir

 sincity March 21, 2011 00:44

its going converging.. my question is i have no idea about that velocity function, that's what i want to talk about you. how can i extract my own velocity function, especially in my 3D case??

 Amir March 21, 2011 04:01

if your inlet velocity profile is obtained from another FLUENT calculation, it's easy to handle. else you need to use other post processing softwares like MATLAB or others to fit functions to them and then use obtained functions in UDFs.

 sincity March 21, 2011 04:31

could i just adapting the function from another velocity function and put it on my UDF??maybe your function? or maybe any general form of function that i could use

 Amir March 21, 2011 04:36

you can use any forms of explicit functions in UDfs.
e.g.:
V_x=V_x(x,y,z),....

 wangy16 November 16, 2011 18:41

Quote:
 Originally Posted by Amir (Post 300294) if your inlet velocity profile is obtained from another FLUENT calculation, it's easy to handle. else you need to use other post processing softwares like MATLAB or others to fit functions to them and then use obtained functions in UDFs.
Can you tell me how to extract the 3D velocity profile from another FLUENT calculation and load the velocity file as the input? I don't know how to get the velocity file. I read some tutorial saying the velocity file can be obtained as a file format of "XY".

 Amir November 17, 2011 03:40

Quote:
 Originally Posted by wangy16 (Post 332416) Can you tell me how to extract the 3D velocity profile from another FLUENT calculation and load the velocity file as the input? I don't know how to get the velocity file. I read some tutorial saying the velocity file can be obtained as a file format of "XY".
Hi,

Bests,

 wanna88 November 22, 2011 06:46

Hi,

My project is to perform CFD analysis on dissecting aneurismal aorta.

I have to create pulsatile inlet velocity and pulsatile outlet pressure waveform at inlet and outlet of the aorta respectively.

The example of pulsatile inlet velocity is as shown in the link below

May I know how to define this type of graph using UDF?

Thank you so much

 Amir November 22, 2011 08:39

Quote:
 Originally Posted by wanna88 (Post 333062) Hi, My project is to perform CFD analysis on dissecting aneurismal aorta. I have to create pulsatile inlet velocity and pulsatile outlet pressure waveform at inlet and outlet of the aorta respectively. The example of pulsatile inlet velocity is as shown in the link below http://www.google.com.my/imgres?q=Ti...Wl_WbBw&zoom=1 May I know how to define this type of graph using UDF? Thank you so much
Hi,

you have 2 choices:
1) you can prepare a file with special format which defines desires parameter at different time; it this method, you cannot specify spacial variation. (you can find further explanation in manual in setting unsteady BCs)
2) you can fit functions for different segments and write a UDF for it; this method doesn't have ant restrictions in special declaration.

Bests,

 wanna88 November 22, 2011 21:59

2) you can fit functions for different segments and write a UDF for it; this method doesn't have ant restrictions in special declaration.

May I know in details what is mean by fir functions for different segments and write a UDF for it?

Thank you.

REgards,
Naimah

 Amir November 23, 2011 05:57

Quote:
 Originally Posted by wanna88 (Post 333193) 2) you can fit functions for different segments and write a UDF for it; this method doesn't have ant restrictions in special declaration. May I know in details what is mean by fir functions for different segments and write a UDF for it? Thank you. REgards, Naimah
In UDFs, you have to declare parameter variations via functions, so you can digitize your graph and then find a functions which fit to your discrete data; for this purpose, it's better to fit different functions for different segments for better accuracy but it's straight forward.

Bests,

 wanna88 December 5, 2011 05:12

Hi Amir,

May I know how to do post processing in FLUENT?

For example I would like to see the plotted graph (pressure/velocity) vs time.
Besides, how to get the data for cross sectional area at certain parts of geometry at certain time?

Thank you.

Regards,
Naimah

 Amir December 5, 2011 09:53

Quote:
 Originally Posted by wanna88 (Post 334640) Hi Amir, May I know how to do post processing in FLUENT? For example I would like to see the plotted graph (pressure/velocity) vs time. Besides, how to get the data for cross sectional area at certain parts of geometry at certain time? Thank you. Regards, Naimah
Dear Naimah,

It depends, e.g. if you want to have pressure or velocity in a specified point, you can use "solve->monitor->surface ...."; if you didn't activate it before iteration, you have to write a simple journal file for this purpose.
For extracting data of cross-sections; firstly you need to generate these cross-sections in "surface->quadratic or plane" then you can export desired data to other post processors in "file->export". But if you want to export these data for successive time steps; you have to choices: 1) there is such capability in ver. 13 in "file-> export" I think. 2) you can write a journal file to do what you want during iteration.

Bests,

All times are GMT -4. The time now is 07:32.