UDF modification

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

 February 21, 2001, 05:26 UDF modification #1 merac Guest   Posts: n/a Hi folks, I'm relatively new to CFD & Fluent and am trying to simulate (in 3D) the flow of water through a pipe. I've spotted a boundary condition UDF on the Fluent documentation site ('parabolic velocity inlet profile in a turbine vane')which I think will help my simulation. The problem is that this UDF is for a 2D problem. My question is (given my very basic knowledge of C) how can I modify the UDF to work in 3D? I've tried to edit here and there, but the results are incorrect. Is it just a case of adding a z component to the UDF? and if so, how? Please help! Here's the UDF: /************************************************** ***********************/ /* vprofile.c */ /* UDF for specifying a steady-state velocity profile boundary condition */ /************************************************** ***********************/ #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, position) = 20. - y*y/(.0745*.0745)*20.; } end_f_loop(f, thread) }

 February 21, 2001, 07:24 Re: UDF modification #2 Ashutosh Guest   Posts: n/a Try like shown below: It should work. #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ face_t f; cell_t c; real x[ND_ND]; real y,xref,yref,zref; xref=0.0; yref=0.0; zref=0.0; begin_f_loop (f,thread) { F_CENTROID(x,f,thread); y = sqrt((x[0]-xref)*(x[0]-xref)+(x[2]-zref)*(x[2]-zref)); F_PROFILE(f,thread,nv)= 20. - y*y/ (.0745*.0745) *20.; } end_f_loop(f, thread) }

 February 27, 2001, 14:21 Re: UDF modification #3 cfd Guest   Posts: n/a it can't work

 February 28, 2001, 08:10 Re: UDF modification #4 merac Guest   Posts: n/a Sorry, but it didn't work. I switched around the x,y,z terms as my flow is in the -ve z direction and it gives a wild overestimation of the inlet velocity at initialisation. It wouldn't compile at first, and when I sorted that out, it didn't seem to work anyway. When I tried using the unmodified 2D UDF supplied by Fluent, the inflow was like a slot within the pipe, so it it not just a case of adding the z direction (x[0] x[1] x[2]) to this UDF?

 March 1, 2001, 07:42 Re: UDF modification #5 Ashutosh Guest   Posts: n/a This works. You should have y-axis along the length of cylinder.The center of cylinder should pass though the center point. Create a plane slicing at x=0, and see the x-y plot of y-velocity on this sliced plane. You will see the parabola. Your cylinder radius should be 0.0745 to get the parabolic profile. You will see 20m/s at the center and zero at the walls. Try for more cells in radial direction. Enjoy!!! #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ face_t f; cell_t c; real y,xref,yref,zref; xref=0.0; yref=0.0; zref=0.0; begin_f_loop (f,thread) { F_CENTROID(x,f,thread); y = sqrt((x[0]-xref)*(x[0]-xref)+(x[2]-zref)*(x[2]-zref)); F_PROFILE(f,thread,position)= 20. - y*y/ (.0745*.0745) *20.; } end_f_loop(f, thread) }

 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 caai9 Fluent UDF and Scheme Programming 9 August 20, 2014 08:52 shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14 Hypersonicflow Fluent UDF and Scheme Programming 2 April 18, 2011 13:27 ammi FLUENT 2 January 18, 2007 22:35 moon FLUENT 4 October 2, 2003 11:19

All times are GMT -4. The time now is 16:26.