|
[Sponsors] |
March 26, 2009, 00:54 |
How to write an UDF programming inside FLUENT?
|
#1 |
New Member
oscar
Join Date: Mar 2009
Posts: 7
Rep Power: 17 |
I have a brick region..the front surface i make it as inlet and i would like to write a UDF programme for the inlet velocity which is parabolic shape.. eg: at the center of the inlet is the highest velociy. (a parabolic shape)
secondly, left, right and behind surface i make it as pressure outlet and write a UDF programme for pressure different. Due to the brick region as a sea. and the lower surface is a seabed.. therefore if from top surface to lower surface(deeper) , the pressure will increase..(a triangle shape) May I know how to write a UDF programme for this..THX Last edited by coolyihao; March 26, 2009 at 22:19. |
|
March 26, 2009, 06:19 |
|
#2 |
Senior Member
Rami Ben-Zvi
Join Date: Mar 2009
Posts: 155
Rep Power: 17 |
There is a detailed example of a parabolic velocity profile in the UDF manual (chapter 8). Once you learn how to do it, the pressure BCs would be easy to add.
|
|
March 26, 2009, 06:49 |
|
#3 |
New Member
oscar
Join Date: Mar 2009
Posts: 7
Rep Power: 17 |
ya..i saw it be4..but then i got the result that doesnt make sense..for example: i put X=0 , Y=1, Z=0..inside the grapgh, ya i get the parabolic shape which is 'u' shape..OR is it suppose a 'n' shape.
But for the pressure difference is it necessary use this function?F_CENTROID(x,f,thread) regards |
|
March 28, 2009, 21:12 |
|
#4 |
New Member
Andrew Slezak
Join Date: Mar 2009
Posts: 1
Rep Power: 0 |
yes, probably. f_centroid will return the position vector of the cell in 'x'. The solver should produce the pressure profile throughout your domain given appropriate initial and boundary conditions.
|
|
April 1, 2009, 03:07 |
|
#5 | |
Member
Buddy
Join Date: Mar 2009
Location: P.R.C.
Posts: 30
Rep Power: 17 |
Quote:
and if the using of the cell will return the vector of it,what will return if we use face instead? O(∩_∩)O~ thx in advance |
||
March 8, 2016, 13:24 |
UDF for derivatives if fluctuating velocities
|
#6 |
Member
Join Date: May 2013
Posts: 32
Rep Power: 13 |
Hello,
Does anyone know how to calculate 1st derivatives (partial derivative) of the fluctuating velocities in UDF? Appreciate any help. Thanks, |
|
March 8, 2016, 14:23 |
|
#7 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
you gotta define an UDS as the value you want (fluctuating velocities in this case) and then you can calculate the gradient using C_UDSI_G(c,t,i)[0] whereas i is the number of the UDS you define and [0] is in the x direction (1 and 2 for y and z direction respectively).
|
|
March 8, 2016, 14:53 |
|
#8 |
Member
Join Date: May 2013
Posts: 32
Rep Power: 13 |
Bruno Machado,
Thank you for your reply. I really appreciate your help. I never tried a UDF and UDS before. Could you please give me some more help on this? I have added an image file of the equation that I am trying to define in Fluent. Thank you, |
|
March 11, 2016, 10:02 |
|
#9 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
The macro C_UDSI_G(c,t,i)[0] is the derivative with respect of X, whilst C_UDSI_G(c,t,i)[1] is in the Y direction and C_UDSI_G(c,t,i)[2] is with respect of Z direction. What you gotta do is to define a UDS (fluctuating velocity) and then using the macros previous mentioned, you can easily reproduce the equation you attached. |
||
June 5, 2016, 22:08 |
nested if statement in udf
|
#10 |
New Member
mm
Join Date: May 2016
Posts: 24
Rep Power: 9 |
Respected members
I am using udf for defining transient temperature at inlet boundary of my model in fluent. I am writing nested if statement, but model keeps on using the same equation after 180 seconds, and does not move to the next if else statement. My udf is as follows: #include"udf.h" DEFINE_PROFILE(inlet_temperature,thread,position ) { face_t f; begin_f_loop(f,thread) { real t = RP_Get_Real("flow-time"); if ( t <= 100.0 ) F_PROFILE(f,thread,position) = 379.48 + 0.0004*t; else if (100.0 < t <= 180.0 ) F_PROFILE(f,thread,position) = 1.0624*t + 352.0; else if (180.0 < t <= 200.0 ) F_PROFILE(f,thread,position) = 0.2716*t + 494.4; else if (200.0 < t <= 400.0 ) F_PROFILE(f,thread,position) = 328.14*pow(t,0.097); else F_PROFILE(f,thread,position) = 727.82; } end_f_loop(f,thread) } sorry for my poor knowledge of programming. please help me on this error. Thanks. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fluent UDF in CFX | CFX User | CFX | 9 | July 25, 2023 10:20 |
developing FLUENT UDF programs by VC++ 6.0 IDE | huang peng | FLUENT | 2 | February 25, 2007 15:58 |
Parallel UDF data passing causes Fluent to hang | Tom | FLUENT | 2 | June 9, 2006 14:17 |
Trying to Write pitch and Plunge UDF | Alex | FLUENT | 0 | March 18, 2006 17:14 |
How to write UDF for pitching&plunging airfoil? | Alex | FLUENT | 0 | March 17, 2006 13:37 |