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

UDF velocity profile

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By willroca
  • 1 Post By adelbaew

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2015, 17:41
Default UDF velocity profile
  #1
New Member
 
will
Join Date: Jun 2015
Posts: 2
Rep Power: 0
willroca is on a distinguished road
Hi, I'm simulating a case in FLUENT with a domain of 5x5x1 km³, for micositing of wind turbines.

I'm trying to enter a velocity UDF defined as logarithmic profile in two surfaces, which is described below. My problem is that the profile it results is basically a constant speed profile for the two surfaces I'm entering the UDF.

I did a quick research for other threads that could help, but I can't solve my problem. Any help would be appreciated, thanks!

#include "udf.h"

DEFINE_PROFILE(velocidade_log,t,i){
real x[ND_ND];
real z,Uf=0.43,k=0.4,zo=0.13;
face_t f;
begin_f_loop(f,t){
F_CENTROID(x,f,t);
z=x[1];
F_PROFILE(f,t,i)=(Uf/k)*log(z/zo);
}
end_f_loop(f,thread);
}
willroca is offline   Reply With Quote

Old   June 6, 2015, 17:50
Default
  #2
New Member
 
will
Join Date: Jun 2015
Posts: 2
Rep Power: 0
willroca is on a distinguished road
Oh nevermind, I found the problem. This one below works if anyone is interested

#include "udf.h"

DEFINE_PROFILE(velocidade_log,t,i){
real x[ND_ND];
real z,Uf=0.43,k=0.4,zo=0.13;
face_t f;
begin_f_loop(f,t){
F_CENTROID(x,f,t);
z=x[2];
if(z<0) z=z*(-1);
F_PROFILE(f,t,i)=(Uf/k)*log(z/zo);
}
end_f_loop(f,thread);
}
sircorp and soheil_r7 like this.
willroca is offline   Reply With Quote

Old   January 10, 2016, 03:13
Default Environmental Monitoring. CFD-technology. UDF-function
  #3
New Member
 
adel kuptsoff
Join Date: Feb 2012
Posts: 9
Rep Power: 15
adelbaew is on a distinguished road
Kuptsov A.I. "Environmental Monitoring. CFD-technology. UDF-function ". - The scientific journal "Vestnik teknologicheskogo universiteta", №20 - 2015, p. 203-207;

UDF unstable atmospheric stratification

Quote:
#include "udf.h"
#include "mem.h"
#include "flow.h"

DEFINE_PROFILE(inlet_velocity, thread, index)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
real ud=0.0497;
real kk=0.41;
real zz=0.002;
real lmo=-108.1;
face_t f;
real fm;
real f1;
real fe;
real AA;
real BB;
real CC;
real DD;

begin_f_loop(f, thread) /* loops over all faces in the thread passed
in the DEFINE macro argument */
{
F_CENTROID(x,f,thread);
y = x[1];

f1 = 1-(16*y/lmo);
fm = pow(f1, -0.25);


AA = 8*pow(fm, 4);
BB = pow((fm+1), 2);
CC = pow(fm, 2)+1;
DD = -(3.14/2)+2*atan(1/fm);

F_PROFILE(f, thread, index) = (ud/kk) * ( log(y/zz) + log(AA / (BB *CC))+DD );

}
end_f_loop(f, thread)
}
DEFINE_PROFILE(temperature, thread, index)
{

real x[ND_ND]; /* this will hold the position vector */
real y;
real tz=303.15;
real mt=-0.1779;
real kk=0.41;
real zz=0.002;
real lmo=-108.1;
face_t f;
real fm;
real f1;

begin_f_loop(f, thread) /* loops over all faces in the thread passed
in the DEFINE macro argument */
{
F_CENTROID(x,f,thread);
y = x[1];

f1 = 1-(16*y/lmo);
fm = pow(f1, -1/4);

F_PROFILE(f, thread, index) = tz+((mt/kk)*(log(y/zz)-(log(1+(1/(fm*fm))))))-(0.01*(y-zz))+(-0.009775*y);

}
end_f_loop(f, thread)
}

DEFINE_PROFILE(k_profile,t,i)
{
real y, del, h, ufree, x[ND_ND];
real ff, utau, knw, kinf;
real ud=0.0497;
real lmo=-108.1;
face_t f;
real fm;
real f1;
real fe;

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

f1 = 1-(16*y/lmo);
fm = pow(f1, -1/4);
fe = 1-(y/lmo);

F_PROFILE(f,t,i)=5.48*ud*ud*sqrt((fe)/(fm));
}
end_f_loop(f,t)
}

DEFINE_PROFILE(dissip_profile,t,i)
{
real y, x[ND_ND], del, h, ufree;
real ff, utau, knw, kinf;
real mix, kay;
real ud=0.0497;
real lmo=-108.1;
real kk=0.41;
face_t f;
real fm;
real f1;
real fe;

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

f1 = 1-(16*y/lmo);
fm = pow(f1, -1/4);
fe = 1-(y/lmo);

F_PROFILE(f,t,i)= ud*ud*ud*(fe)/(kk*y) ;

}
end_f_loop(f,t)
}
UDF neutral atmospheric stratification

Quote:
#include "udf.h"
#include "mem.h"
#include "flow.h"

DEFINE_PROFILE(inlet_velocity, thread, index)
{

real x[ND_ND]; /* this will hold the position vector */
real y;
real ud=0.0481;
real kk=0.41;
real zz=0.002;
face_t f;

begin_f_loop(f, thread) /* loops over all faces in the thread passed
in the DEFINE macro argument */
{
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, index) = ud*(log(y/zz))/kk;
}
end_f_loop(f, thread)
}

DEFINE_PROFILE(temperature, thread, index)
{

real x[ND_ND]; /* this will hold the position vector */
real y;
real tz=303.15;

face_t f;

begin_f_loop(f, thread) /* loops over all faces in the thread passed
in the DEFINE macro argument */
{
F_CENTROID(x,f,thread);
y = x[1];

F_PROFILE(f, thread, index) = tz+(-0.009775*y);
}
end_f_loop(f, thread)
}

DEFINE_PROFILE(k_profile,t,i)
{
real y, del, h, ufree, x[ND_ND];
real ff, utau, knw, kinf;
real ud=0.0481;
face_t f;

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

F_PROFILE(f,t,i)=5.48*ud*ud;
}
end_f_loop(f,t)
}

DEFINE_PROFILE(dissip_profile,t,i)
{
real y, x[ND_ND], del, h, ufree;
real ff, utau, knw, kinf;
real mix, kay;
real ud=0.0481;
real kk=0.41;
face_t f;

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

F_PROFILE(f,t,i)= ud*ud*ud/(kk*y) ;

}
end_f_loop(f,t)
}
UDF stable atmospheric stratification
Quote:
#include "udf.h"
#include "mem.h"
#include "flow.h"

DEFINE_PROFILE(inlet_velocity, thread, index)
{

real x[ND_ND]; /* this will hold the position vector */
real y;
real ud=0.0472;
real kk=0.41;
real zz=0.002;
real lmo=309.5;
face_t f;

begin_f_loop(f, thread) /* loops over all faces in the thread passed
in the DEFINE macro argument */
{
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, index) = ud*(log(y/zz)+(5*y/lmo))/kk;
}
end_f_loop(f, thread)
}

DEFINE_PROFILE(temperature, thread, index)
{

real x[ND_ND]; /* this will hold the position vector */
real y;
real tz=303.15;
real mt=0.0507;
real kk=0.41;
real zz=0.002;
real lmo=109.5;
face_t f;

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

F_PROFILE(f, thread, index) = tz+((mt/kk)*(log(y/zz)+(5*y/lmo)));

}
end_f_loop(f, thread)
}

DEFINE_PROFILE(k_profile,t,i)
{
real y, del, h, ufree, x[ND_ND];
real ud=0.0472;
real lmo=309.5;
face_t f;

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

F_PROFILE(f,t,i)=5.48*ud*ud*sqrt((lmo+(4*y))/(lmo+(5*y)));
}
end_f_loop(f,t)
}

DEFINE_PROFILE(dissip_profile,t,i)
{
real y, x[ND_ND], del, h, ufree;
real ud=0.0472;
real lmo=309.5;
real kk=0.41;
face_t f;

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

F_PROFILE(f,t,i)= ud*ud*ud*(1+((4*y)/lmo))/(kk*y) ;

}
end_f_loop(f,t)
}
and UDF source term

Kuptsov A.I., Akberov R.R., Islamkhuzin D.Y., Gimranov F.M. Numerical modeling of the atmospheric boundary layer with the account of its stratification // Fundamental research. – 2014. – No.9. – P.1452-1460.

Quote:
#include "udf.h"
#include "mem.h"
#include "flow.h"

DEFINE_SOURCE(xmom_source_K, c, t, dS, eqn)
{
real y, x[ND_ND];
real source;
real mut = C_MU_T(c,t);

C_CENTROID(x, c, t);
y = x[1];

source = -0.00367*(-9.81)*(-9.81)*mut/(0.85*1005);
dS[eqn]=0;
return source;
}
soheil_r7 likes this.
adelbaew is offline   Reply With Quote

Reply

Tags
fluent - udf, logarithmic, velocity


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
3-d velocity profile udf Aylabam Fluent UDF and Scheme Programming 0 October 14, 2013 13:39
Velocity profile UDF egge24 Fluent UDF and Scheme Programming 2 May 10, 2012 13:03
Logarithmic velocity profile cfdworker Fluent UDF and Scheme Programming 0 April 23, 2009 19:09
How to specify the Velocity profile (eqn) by UDF Anant FLUENT 1 February 27, 2008 14:54
Multi step transient UDF velocity profile problem William177 FLUENT 1 February 3, 2008 06:47


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