firstly, you should get the index of the bounday. Use one macro to obtain the coordinate of this bounday. Then specify the velocity as u want by looping. U can refer to the following simple code i have written for a parabolic flow in the inlet boundary:
#include "udf.h"
#define Ua 0.05
DEFINE_PROFILE(y_velocity,t,i)
{
real y[ND_ND];
real x;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(y,f,t);
x=y[0];
F_PROFILE(f,t,i)=Ua*6*x/0.03*(1-x/0.03);
}
end_f_loop(f,t)
}
Where i is the id of the boundary, t is the index of the boundary. y-velocity is the name of the function. F_Centroid is the macro to obtain the face center coordinate in the boundary (after meshing, bounday consist of several face elements). F_profile is the macro to specify the velicty value u want.
I think DEFINE_PROFILE can only be functional at inlet and outlet boundary, but fail to work at symmetry condition, because fluent doesn't allow to give udfs at this boundary condition.
Thanks for your response. I donnot know whether the DEFINE_Profille function works for the symmetry condition. If this function really fails, I recommand to try the DEFINE_ADJUST function. One of my previous code likes the following:
The DEFINE_ADJUST works fine, however, it changes the values of the variables that you are intending to modify before the transport equations are solved. This can pose problems once the solutions have been obtained.
So this is indeed not a very appropriate way to use UDFs.
I have read elsewhere that Fluent journal files are a good way to modify the variables. However, I have no experience in that.
I agree with u that the DEFINE_ADJUST function could modify the value. However, this function really works for some special condition. In some case, the boundary value is not specified one and changes with the adjecent cell's value, but not the transport equation controls. Then this function works. Besides, in the UDF, one doesnot have to ascribe the boundray value every iteration, but could specify it after several iteration when the convergence solution is obtained.
Still in regard of this question and symmetry boundary condition, do you know if there is any way in FLUENT to impose a profile on symmetry boundaries, through DEFINE_PROFILE?
I have the necessity to impose the value of velocity, turbulent kinetic production and turbulent dissipation. Right now I'm doing this through DEFINE_ADJUST and, after looping over the faces of the thread of the boundary of interest, I impose a specific value of C_PRODUCTION, epsilon and u at the first cell (wall adjacent cell). Namely: C_PRODUCTION(c0,t0)=.....; C_D(c0,t0)=.....; and C_U(c0,t0)=.....; This seems to work only partially on fluent..... Any suggestion?