CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Need help: strange problem of unsteady B.C. UDF (

Z. T. April 11, 2003 19:03

Need help: strange problem of unsteady B.C. UDF

In my project, a unsteady velocity condition is applied to the outlet. I used piece-wise function:

1) In the first half period(T=0.02s), it is sine function: v(t)=-21.87*sin(314.16*t) ('-' means outflow direction);

2) In the second half period, velocity magnitude is zero.

I made a UDF as follows:

#include "udf.h"

DEFINE_PROFILE(unsteady_velocity, thread, position) {

face_t f;

real t;

real t1;

int t2;

t = RP_Get_Real("flow-time");

t1 = t*10000.0;

t2 = ((int)t1)%200;

begin_f_loop(f, thread)


if (0 < t2 <= 100 )

F_PROFILE(f, thread, position) = -21.87*sin(314.16*t);

if (100 < t2 <= 200 )

F_PROFILE(f, thread, position) = 0.0;


end_f_loop(f, thread)


In this UDF, modulus operation is used to describe the perodic behavior. The time step size is 0.0004s. After I prescribed it as B.C. and perform calculation, the monitor for outlet shown that velocity manitude is always zero. I don't know what lead to this problem. Does it lie in wrong flow time when UDF is called? Any suggestion is appreciated. Thanks!


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