CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF velocity profile (https://www.cfd-online.com/Forums/fluent-udf/153925-udf-velocity-profile.html)

willroca June 6, 2015 17:41

UDF velocity profile
 
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 June 6, 2015 17:50

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);
}

adelbaew January 10, 2016 03:13

Environmental Monitoring. CFD-technology. UDF-function
 
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;
}


All times are GMT -4. The time now is 19:09.