CFD Online Discussion Forums

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

cfdworker April 23, 2009 19:09

Logarithmic velocity profile
 
Hello, I have a problem with the definition of a boundary condition with UDF to simulation of the wind in a terrain. I have to define a velocity inlet in a 3d domain; this condition is a logarithmic velocity profile. I can define the logarithmic velocity profile with UDF, like this:



#include "udf.h"

DEFINE_PROFILE(log_velocity,thread,index)
{
real x[ND_ND];
real z;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
z = x[2];
F_PROFILE(f,thread,index) = 3*log(z/0.01)/log(10/0.01);
}
end_f_loop(f,thread)
}


My domain is this:

http://img151.imageshack.us/img151/6542/semttulog.png

I have to impose the logarithmic profile in the front face that is shown in figure.
My question is how I define in the UDF so that the velocity in bottom of the face is equal 0.
My problem is the coordinates that I use in UDF are absolute and I donít know how to define relative coordinates, in order to the z in the equation that defines the velocity profile, is the height relatively to the bottom of the face and not the absolute height.
I tried to use the C_WALL_DIST(c,thread) macro to resolve this issue (this macro estimate the distance from any cell to the nearest WALL, which is the terrain), like this:


#include "udf.h"

DEFINE_PROFILE(log_velocity,thread,index)
{
real z;
face_t f;
cell_t c;

begin_f_loop(f,thread)
{
z = C_WALL_DIST(c,thread);
F_PROFILE(f,thread,index) =3*log(z/0.01)/log((10)/0.01);
}
end_f_loop(f,thread)
}



But when i selected the udf in velocity inlet in boundary condition, fluent gave me this message:


Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()



I think the problem is that the boundary condition that I set is to a face and I use a macro for cells in the udf.
I donít know how to use this macro for my situation. Can anyone help me with this issue ?

I would appreciate any suggestions.

PS: Sorry for repeat the thread of fluent forum but only now I noticed that there is a sub-forum dedicated to udf :o


All times are GMT -4. The time now is 06:31.