# 3D Turbulent Velocity at Inlet

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

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.

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.
Attached Files
 PowerLaw.c (596 Bytes, 15 views)

 December 16, 2014, 11:49 #2 Senior Member   Andrew Kokemoor Join Date: Aug 2013 Posts: 122 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(1-pow(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: 996 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)));``` Always use SI units in udf. I don't know if you can write this in c: Code: ```real a n; real Umax Umean;``` Write: Code: `real a, n, Umax, Umean;` or 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 Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post arkie87 FLUENT 0 November 7, 2012 16:15 anita OpenFOAM Running, Solving & CFD 7 September 25, 2012 05:35 Absy Main CFD Forum 0 April 6, 2010 03:01 Antech Main CFD Forum 0 April 25, 2006 02:15 Ronak Shah FLUENT 0 June 4, 2003 09:44

All times are GMT -4. The time now is 08:17.