# (ask) how to create UDF for inlet velocity profile

 Register Blogs Members List Search Today's Posts Mark Forums Read

 March 18, 2011, 08:38 (ask) how to create UDF for inlet velocity profile #1 Member   wibi ario Join Date: Feb 2011 Posts: 46 Rep Power: 12 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

 March 18, 2011, 08:49 #2 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 20 Hi, refer to DEFINE_PROFILE macro in UDF-manual. saifmasood likes this.

 March 18, 2011, 09:34 #3 Member   wibi ario Join Date: Feb 2011 Posts: 46 Rep Power: 12 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.

 March 18, 2011, 10:44 #4 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 20 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) }``` soheil_r7, ArmanCFD, Abdulrajak Buradi and 7 others like this.

 March 18, 2011, 11:49 #5 Member   wibi ario Join Date: Feb 2011 Posts: 46 Rep Power: 12 mmm...is it UDF for 3D case amir??

March 18, 2011, 14:07
#6
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 20
Quote:
 Originally Posted by sincity 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.

 March 19, 2011, 00:32 #7 Member   wibi ario Join Date: Feb 2011 Posts: 46 Rep Power: 12 amir my friend, i am very confuse about what were you talking about, since i'm new user for UDF so i hope you have more time to explain about this topic. 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? please answer.regards

 March 19, 2011, 09:51 #8 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 20 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. if you post your velocity function, I may help you more. regards, Amir

 March 21, 2011, 00:44 #9 Member   wibi ario Join Date: Feb 2011 Posts: 46 Rep Power: 12 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??

 March 21, 2011, 04:01 #10 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 20 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.

 March 21, 2011, 04:31 #11 Member   wibi ario Join Date: Feb 2011 Posts: 46 Rep Power: 12 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

 March 21, 2011, 04:36 #12 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 735 Blog Entries: 1 Rep Power: 20 you can use any forms of explicit functions in UDfs. e.g.: V_x=V_x(x,y,z),....

November 16, 2011, 18:41
#13
New Member

Yingying Wang
Join Date: Nov 2011
Posts: 2
Rep Power: 0
Quote:
 Originally Posted by Amir 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".

November 17, 2011, 03:40
#14
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 20
Quote:
 Originally Posted by wangy16 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,
__________________
Amir

 November 22, 2011, 06:46 #15 Member   Naimah Join Date: Nov 2011 Posts: 58 Rep Power: 12 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

November 22, 2011, 08:39
#16
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 20
Quote:
 Originally Posted by wanna88 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,
__________________
Amir

 November 22, 2011, 21:59 #17 Member   Naimah Join Date: Nov 2011 Posts: 58 Rep Power: 12 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

November 23, 2011, 05:57
#18
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 20
Quote:
 Originally Posted by wanna88 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,
__________________
Amir

 December 5, 2011, 05:12 #19 Member   Naimah Join Date: Nov 2011 Posts: 58 Rep Power: 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

December 5, 2011, 09:53
#20
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 20
Quote:
 Originally Posted by wanna88 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,
__________________
Amir