CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

How to write UDF programme inside FLUENT?

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

Like Tree1Likes
  • 1 Post By Bruno Machado

Reply
 
LinkBack Thread Tools Display Modes
Old   March 26, 2009, 00:54
Default How to write an UDF programming inside FLUENT?
  #1
New Member
 
oscar
Join Date: Mar 2009
Posts: 7
Rep Power: 9
coolyihao is on a distinguished road
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.
coolyihao is offline   Reply With Quote

Old   March 26, 2009, 06:19
Default
  #2
Senior Member
 
Rami Ben-Zvi
Join Date: Mar 2009
Posts: 148
Rep Power: 9
Rami is on a distinguished road
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.
Rami is offline   Reply With Quote

Old   March 26, 2009, 06:49
Default
  #3
New Member
 
oscar
Join Date: Mar 2009
Posts: 7
Rep Power: 9
coolyihao is on a distinguished road
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
coolyihao is offline   Reply With Quote

Old   March 28, 2009, 21:12
Default
  #4
New Member
 
Andrew Slezak
Join Date: Mar 2009
Posts: 1
Rep Power: 0
Drew is on a distinguished road
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.
Drew is offline   Reply With Quote

Old   April 1, 2009, 02:07
Default
  #5
Member
 
Buddy
Join Date: Mar 2009
Location: P.R.C.
Posts: 30
Rep Power: 9
zjbwow is on a distinguished road
Quote:
Originally Posted by Drew View Post
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.
there are two kinds of parallel functions such as begin _c_loop and begin_f_loop, can you tell me the differents bwteen face and cell?

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
zjbwow is offline   Reply With Quote

Old   March 8, 2016, 13:24
Default UDF for derivatives if fluctuating velocities
  #6
Member
 
Join Date: May 2013
Posts: 32
Rep Power: 5
maphd is on a distinguished road
Hello,

Does anyone know how to calculate 1st derivatives (partial derivative) of the fluctuating velocities in UDF? Appreciate any help.

Thanks,
maphd is offline   Reply With Quote

Old   March 8, 2016, 14:23
Default
  #7
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 240
Rep Power: 5
Bruno Machado is on a distinguished road
Quote:
Originally Posted by maphd View Post
Hello,

Does anyone know how to calculate 1st derivatives (partial derivative) of the fluctuating velocities in UDF? Appreciate any help.

Thanks,
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).
maphd likes this.
Bruno Machado is online now   Reply With Quote

Old   March 8, 2016, 14:53
Default
  #8
Member
 
Join Date: May 2013
Posts: 32
Rep Power: 5
maphd is on a distinguished road
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,
Attached Images
File Type: jpg strain rate.JPG (36.5 KB, 26 views)
maphd is offline   Reply With Quote

Old   March 11, 2016, 10:02
Default
  #9
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 240
Rep Power: 5
Bruno Machado is on a distinguished road
Quote:
Originally Posted by maphd View Post
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,
I recommend you to have a read in the fluent manual, in the UDS (User Define Scalar) section. There you will understand how to setup a scalar in your case.

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.
Bruno Machado is online now   Reply With Quote

Old   June 5, 2016, 21:08
Default nested if statement in udf
  #10
New Member
 
mm
Join Date: May 2016
Posts: 17
Rep Power: 2
mmunige is on a distinguished road
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.
mmunige is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent UDF in CFX CFX User CFX 6 October 22, 2008 17:21
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 13: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


All times are GMT -4. The time now is 10:40.