CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

UDF modification

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2001, 05:26
Default 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) }
  Reply With Quote

Old   February 21, 2001, 07:24
Default 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)

}
  Reply With Quote

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

Old   February 28, 2001, 08:10
Default 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?
  Reply With Quote

Old   March 1, 2001, 07:42
Default 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)

}
  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed on UDF for modification of default syamlal o' brien drag law caai9 Fluent UDF and Scheme Programming 9 August 20, 2014 09:52
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
Flowfield temperature modification through UDF Hypersonicflow Fluent UDF and Scheme Programming 2 April 18, 2011 14:27
modification of UDF ammi FLUENT 2 January 18, 2007 22:35
Modification of turb. viscosity using UDF? moon FLUENT 4 October 2, 2003 12:19


All times are GMT -4. The time now is 14:46.