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

3D rectangular velocity profile UDF

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 20, 2014, 14:54
Red face 3D rectangular velocity profile UDF
  #1
New Member
 
John
Join Date: Nov 2014
Posts: 2
Rep Power: 0
Chalke06 is on a distinguished road
Hi guys,

I am quite inexperienced with UDFs and was wondering if anyone could help me, I am trying to create a UDF for a fluent simulation. It is a 3D domain (cuboid) with an inlet face that needs to have a boundary layer conforming to the law:
U=((y/d)^(1/7))*Ufree


Where U is the inlet velocity at a given point, y is the vertical coordinate, d (delta) is the boundary layer thickness and Ufree is the freestream velocity.

When y=d (top of boundary layer) then U=Ufree


When I try to interpret the file in fluent I get several errors, but I can't see where the code is wrong. The fluent UDF manual only has one a code for a 2D velocity profile. The code I've been trying is below:


#include "udf.h"

#define P 1./7. //power law n value 7//
#define del 0.005 // boundary layer thickness value//
#define ufree 0.05 //freestream velocity value//


DEFINE_PROFILE(x_velocity,thread,position)
{
real x[ND_ND], real y, real z;


{
face_t f;
begin_f_loop(f, thread)
}

{
F_CENTROID(x, f, thread);
y=x[1];
z=x[2];
if (y<=del)
F_PROFILE(f, thread, position) = ufree*pow(y/del,P);
else
F_PROFILE(f, thread, position) = ufree;
}

end_f_loop(f, thread)
}

Does anyone have a working 3D velocity profile UDF that is similar I could use? Or if anyone could help me I'd really appreciate it.
Chalke06 is offline   Reply With Quote

Old   November 21, 2014, 04:17
Default
  #2
Member
 
Join Date: Jul 2013
Posts: 75
Rep Power: 6
upeksa is on a distinguished road
#include "udf.h"

#define P 1./7. //power law n value 7//
#define del 0.005 // boundary layer thickness value//
#define ufree 0.05 //freestream velocity value//


DEFINE_PROFILE(x_velocity,thread,position)
{
real x[ND_ND], y;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
y=x[1];

if (y<=del)
F_PROFILE(f, thread, position) = ufree*pow(y/del,P);
else
F_PROFILE(f, thread, position) = ufree;
}
end_f_loop(f, thread)
}

//Cheers
upeksa is offline   Reply With Quote

Old   November 21, 2014, 08:49
Default
  #3
New Member
 
John
Join Date: Nov 2014
Posts: 2
Rep Power: 0
Chalke06 is on a distinguished road
Eureka!! It works perfectly!

Thank you so much, really appreciate it!

Chalke06 is offline   Reply With Quote

Old   August 6, 2016, 13:37
Default
  #4
New Member
 
Join Date: Aug 2016
Posts: 1
Rep Power: 0
Torante is on a distinguished road
This is over a year later, but I wanted to add that Upeksa's answer helped me a lot also. I modified it to apply to 2D duct flow (ie, walls at both top and bottom of domain, instead of flow over a flat plate). The modified code reads as follows:

#include "udf.h"

#define P 1./7. //power law n value 7//
#define del 0.0061 // boundary layer thickness value//
#define ufree 17.8778 //freestream velocity value//
#define ymin -0.0381
#define ymax 0.0381

DEFINE_PROFILE(x_velocity,thread,position)
{
real x[ND_ND], y;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
y=x[1];

if (y >= ymax-del)
F_PROFILE(f, thread, position) = ufree*pow((ymax-y)/del,P);
else if (y <= del+ymin)
F_PROFILE(f, thread, position) = ufree*pow((y-ymin)/del,P);
else
F_PROFILE(f, thread, position) = ufree;
}
end_f_loop(f, thread)
}


I spent a great deal of time struggling to find another case of a double power law profile in duct flow, so I'm adding this here in case it can help someone else.
Torante is offline   Reply With Quote

Reply

Tags
fluent, power law, udf, velocity profile

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF of Inlet Velocity Profile help nabster Fluent UDF and Scheme Programming 0 September 7, 2014 04:01
UDF for a 3D inlet velocity profile with wave motion kailingkk Fluent UDF and Scheme Programming 6 June 25, 2014 09:52
How to make a UDF to have a velocity profile in a square channel Gigis Fluent UDF and Scheme Programming 8 January 13, 2013 23:20
Logarithmic velocity profile cfdworker Fluent UDF and Scheme Programming 0 April 23, 2009 19:09
Multi step transient UDF velocity profile problem William177 FLUENT 1 February 3, 2008 07:47


All times are GMT -4. The time now is 11:41.