
[Sponsors] 
December 16, 2014, 03:08 
3D Turbulent Velocity at Inlet

#1 
New Member
daniel
Join Date: Sep 2014
Posts: 16
Rep Power: 4 
Hi all,
I am attempting to use the power law to model turbulent flow at the inlet of a horizontal pipe (3D). I dont know almost anything about programming in C, So here is the script I have managed to piece together from other random posts. Can someone please help me find any potential bugs + improvements? Currently I believe it only works for an inlet in the YZ plane (X normal). I would like it to both work for a Y normal and Z normal. Can someone help with this? Additionally, I would like the program to define the diameter as half of the maximum value in the plane. Its a circular inlet centered on the respective axis. so that should work. I dont know how to the command for finding the max value. 

December 16, 2014, 11:49 

#2 
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 121
Rep Power: 6 
Possible bugs:
z =x[1]; //should be x[2]? F_PROFILE(...)=...sqrt(pow(x,2)+pow(z,2))/... //should that be pow(y,2)+pow(z,2)? Why is d in cm instead of m? There are prettier methods to handle other directions, but the easiest would be simply to make three DEFINE_PROFILE UDFs, one for each direction. I don't know if there's a quicker way, but the direct approach to finding the diameter would be to loop across all nodes in the inlet face and record the max value. 

December 16, 2014, 13:56 

#3 
New Member
daniel
Join Date: Sep 2014
Posts: 16
Rep Power: 4 
Im not sure if it should be x[2]. Thats actually a question I had. Im not sure how the "face" commands in fluent generate data points. It should be pow(1pow(pow(x,2)+pow(z,2),.5), thanks for that.
Youre right about d. It should be meters. I realize I have to make three UDFS. I dont know what changes I should make is the issue. What would be the command to loop through the nodes, and then find the max? Im unfamiliar with C. . . if this were Matlab I could do all of this no problem haha Thanks 

December 17, 2014, 09:01 

#4 
Senior Member
Daniele
Join Date: Oct 2010
Location: Italy
Posts: 993
Rep Power: 17 
x[ND_ND] is a vector, for 3d simulation is:
x[0]>x coordinate x[1]>y coordinate x[2]>z coordinate So declare: real xcoord; real ycoord; real zcoord; xcoord=x[0]; ycoord=x[1]; zcoord=x[2]; Then use xcoord, ycoord and zcoord in your functions (delete also real y and real z). Move after face_t f, before the face loop this block: Code:
real xcoord; real ycoord; real zcoord; xcoord=x[0]; ycoord=x[1]; zcoord=x[2]; n = 7; d = 10; /* cm */ Umean = 3.1; /* m/s */ Umax = Umean*(((n+1)*(2*n+1))/(2*pow(n,2))); I don't know if you can write this in c: Code:
real a n; real Umax Umean; Code:
real a, n, Umax, Umean; Code:
real a; real n; real Umax; real Umean;
__________________
Google is your friend and the same for the search button! 

December 17, 2014, 13:41 
Thank you!

#5 
New Member
daniel
Join Date: Sep 2014
Posts: 16
Rep Power: 4 
Thank you so much!
Lots of help. One more question is that of looping through the nodes to find the maximum value. Would you happen to know how to do that? Thanks 

Tags 
inlet, pipe, power law, turbulent, udf 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Setting Density for Velocity Inlet Face  arkie87  FLUENT  0  November 7, 2012 16:15 
Steady pipe flow mean velocity higher than inlet velocity  anita  OpenFOAM Running, Solving & CFD  7  September 25, 2012 05:35 
FSI Pipe uniform velocity profile inlet  Absy  Main CFD Forum  0  April 6, 2010 03:01 
Neumann pressure BC and velocity field  Antech  Main CFD Forum  0  April 25, 2006 02:15 
UDF paraboloid velocity inlet  Ronak Shah  FLUENT  0  June 4, 2003 09:44 