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

Velocity profile with cylindrical components

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 7, 2015, 16:31
Default Velocity profile with cylindrical components
  #1
New Member
 
Shobhan Roy
Join Date: Jun 2015
Posts: 1
Rep Power: 0
Shobhan is on a distinguished road
Hi,
I am writing a UDF for velocity profile at inlet of a draft tube. The inlet is in cylindrical (radial, azimuthal, axial) components. In this case, particularly azimuthal component. I need it to vary with inlet radius. The code is as follows:

#include "udf.h"

DEFINE_PROFILE(inlet_v_velocity,thread,position)
{
real a[ND_ND]; /* this will hold the position vector */
real r, R=0.123, E=2.71828;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(a,f,thread);
r = a[1];
if (r<=R)
F_PROFILE(f,thread,position) = ((100*R)/(r/R))*(1-pow(E,-(r/R)*(r/R));
r=r+0.001;
}
end_f_loop(f,thread);
}



The error is shown as on line 15: parse error;
I suspect some changes are to be made since the face is 2d but then the equation is to vary with radius only.
Please help.
Shobhan is offline   Reply With Quote

Old   June 7, 2015, 17:31
Default
  #2
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
There is a mismatch between the number of opening and closing parentheses in F_PROFILE(f,thread,position) = ((100*R)/(r/R))*(1-pow(E,-(r/R)*(r/R));

Aditionally, it is always a good idea to write real values instead of integer values to avoid integer arithmetic if you dont want it. Change 100 to 100.0 and so on

And the last line in your loop does not seem to make any sense to me.
The value of r is fetched at the beginning of the loop from the face centroid position. This will overwrite any changes you made at the end of the loop anyway.

Be sure that a[1] is in fact the radial coordinate you need. I am not 100% sure about the convention in fluent, consult the UDF manual.
flotus1 is offline   Reply With Quote

Reply

Tags
cylindrical coordinates, udf, velocity profile


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
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 9 June 25, 2016 20:08
Problem with assigned inlet velocity profile as a boundary condition Ozgur_ FLUENT 5 August 25, 2015 05:58
velocity profile as boundary condition MK. OpenFOAM Pre-Processing 2 November 11, 2014 03:08
FSI- Pipe- uniform velocity profile inlet Absy Main CFD Forum 0 April 6, 2010 04:01
How to obtain cylindrical velocity components? Rikio CFX 2 February 23, 2009 05:37


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