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

Define velocity profile for cavity

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 4, 2014, 15:28
Default Define velocity profile for cavity
  #1
New Member
 
arrif toufik
Join Date: Apr 2009
Posts: 9
Rep Power: 17
arriftou is on a distinguished road
Hi
I m trying to write a UDF for a velocity profile for a cavity problem. The velocity profile is only in the horizontal direction(x direction) like : =-4340.4Z2+8608.2Z-4267 (see figure attached)
But im new in udf programming
I was found some examples in fluent tutorial like this
/************************************************** ***********************/
/* udfexample.c */
/* UDF for specifying a steady-state velocity profile boundary condition */
/************************************************** ***********************/

#include "udf.h"


DEFINE_PROFILE(inlet_x_velocity, thread, index)
{
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, index) = 20. - y*y/(.0745*.0745)*20.;
}
end_f_loop(f, thread)
}

But must I applic this code simply?
Please can anyone help me?
arriftou is offline   Reply With Quote

Old   January 4, 2014, 21:24
Default
  #2
Member
 
shuai_manlou's Avatar
 
CAO Liushuai
Join Date: Apr 2012
Posts: 30
Rep Power: 14
shuai_manlou is on a distinguished road
Where is the attached figure ?
What is the Z means ? If it means the coordinate in the z-axis direction, then you can write your own udf similar to the example. If you have any problem, I can help you.
shuai_manlou is offline   Reply With Quote

Old   January 6, 2014, 10:38
Default velocity profile _file attached missed?
  #3
New Member
 
arrif toufik
Join Date: Apr 2009
Posts: 9
Rep Power: 17
arriftou is on a distinguished road
thank you shuai ,
1-about attached figure i dont now i try to do it again
2-about the z coordinate : no sorry i was wrong its the y direction,The velocity profile is only in the horizontal direction(x direction) like:
u (x=0; 0 < z< W ; 1-h/H <y<1)=-4340.4y2+8608.2y-4267 (see file:cavity.docx attached),
thank u in advance
Attached Files
File Type: docx cavity.docx (56.3 KB, 14 views)
arriftou is offline   Reply With Quote

Old   January 6, 2014, 19:00
Default
  #4
Member
 
shuai_manlou's Avatar
 
CAO Liushuai
Join Date: Apr 2012
Posts: 30
Rep Power: 14
shuai_manlou is on a distinguished road
#include "udf.h"

DEFINE_PROFILE(velocity_inlet, thread, index)
{
real x[ND_ND]; /* this will hold the position vector */
real y, h;
real H = 20; /* the height H, for example */
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);

y = x[1];
h = (H-y)/H;

F_PROFILE(f, thread, index) = -4340.4*h*h+8608.2*h-4267.;
}
end_f_loop(f, thread)
}

You may try my code
shuai_manlou is offline   Reply With Quote

Old   January 7, 2014, 12:32
Default
  #5
New Member
 
arrif toufik
Join Date: Apr 2009
Posts: 9
Rep Power: 17
arriftou is on a distinguished road
thank, u i will try it and reply to u
arriftou is offline   Reply With Quote

Old   February 4, 2014, 09:21
Default inlet profile
  #6
New Member
 
arrif toufik
Join Date: Apr 2009
Posts: 9
Rep Power: 17
arriftou is on a distinguished road
i tested your example but didnt work ,i dnt now why

I want to test the tutorial provided by fluent about: Example 2 - Velocity, Turbulent Kinetic Energy, and Turbulent Dissipation Rate Profiles in 2D configuration, to my case which is a cavity with an inlet an outlet vent,
My configuration is attached
Please help


/************************************************** ********************
Concatenated UDFs for fully-developed turbulent inlet profiles
************************************************** *********************/
#include "udf.h"
#define YMIN 0.0 /* constants */
#define YMAX 0.4064
#define UMEAN 1.0
#define B 1./7.
#define DELOVRH 0.5
#define VISC 1.7894e-05
#define CMU 0.09
#define VKC 0.41
/* profile for x-velocity */
DEFINE_PROFILE(x_velocity,t,i)
{
real y, del, h, x[ND_ND], ufree; /* variable declarations */
face_t f;
h = YMAX - YMIN;
del = DELOVRH*h;
ufree = UMEAN*(B+1.);
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
if (y <= del)
F_PROFILE(f,t,i) = ufree*pow(y/del,B);
else
F_PROFILE(f,t,i) = ufree*pow((h-y)/del,B);
}
end_f_loop(f,t)
}
/* profile for kinetic energy */
DEFINE_PROFILE(k_profile,t,i)
{
real y, del, h, ufree, x[ND_ND];
real ff, utau, knw, kinf;
face_t f;
h = YMAX - YMIN;
del = DELOVRH*h;
ufree = UMEAN*(B+1.);
ff = 0.045/pow(ufree*del/VISC,0.25);
utau=sqrt(ff*pow(ufree,2.)/2.0);
knw=pow(utau,2.)/sqrt(CMU);
kinf=0.002*pow(ufree,2.);
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y=x[1];
if (y <= del)
F_PROFILE(f,t,i)=knw+y/del*(kinf-knw);
else
F_PROFILE(f,t,i)=knw+(h-y)/del*(kinf-knw);
}
end_f_loop(f,t)
}
/* profile for dissipation rate */
DEFINE_PROFILE(dissip_profile,t,i)
{
real y, x[ND_ND], del, h, ufree;
real ff, utau, knw, kinf;
real mix, kay;
face_t f;
h = YMAX - YMIN;
del = DELOVRH*h;
ufree = UMEAN*(B+1.);
ff = 0.045/pow(ufree*del/VISC,0.25);
utau=sqrt(ff*pow(ufree,2.)/2.0);
knw=pow(utau,2.)/sqrt(CMU);
kinf=0.002*pow(ufree,2.);
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y=x[1];
if (y <= del)
kay=knw+y/del*(kinf-knw);
else
kay=knw+(h-y)/del*(kinf-knw);
if (VKC*y < 0.085*del)
mix = VKC*y;
else
mix = 0.085*del;
F_PROFILE(f,t,i)=pow(CMU,0.75)*pow(kay,1.5)/mix;
}
end_f_loop(f,t)
}
Attached Files
File Type: docx cavity.docx (90.8 KB, 3 views)
arriftou is offline   Reply With Quote

Old   September 21, 2023, 03:23
Default
  #7
New Member
 
ANH VU LE
Join Date: Apr 2023
Posts: 1
Rep Power: 0
anhvulee is on a distinguished road
Hi,
I'm trying to create the UDF based on the examples above. Please elaborate to me about this functions below:
h = YMAX - YMIN;
del = DELOVRH*h;
ufree = UMEAN*(B+1.);
ff = 0.045/pow(ufree*del/VISC,0.25)

What is the meaning of "h", "del", "ff", "DELOVRH" ?

Thank you so much
anhvulee is offline   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
UDF for inlet velocity profile Bollonga Fluent UDF and Scheme Programming 4 June 29, 2021 04:40
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 9 June 25, 2016 19:08
Velocity profile boundary condition Tuca FLOW-3D 1 April 23, 2013 12:02
How to apply an outlet velocity profile to another inlet? siw FLUENT 4 April 10, 2013 11:19
Velocity Profile Jeff FLUENT 1 November 24, 2008 08:21


All times are GMT -4. The time now is 04:59.