USING IF statement in a UDF for defining Velocity profile at Inlet
Hi,
I want to define a velocity profile at my inlet boundary condition. This is my UDF which is working for parabolic velocity, but I want to add a function for y<0.003 and another one for y>0.004, so I need to define and if statement. but UDF does not underestand y in the line (If y<0.003). How could I define y in my IF statement? Thanks. #include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; real y, v; face_t f; begin_f_loop(f,thread) { F_CENTROID(x, f, thread); y = x[1]; If (y<0.003) v= -228.*y+11.6; else v=-10200.*y+41.52 F_PROFILE(f, thread, position)=v; } end_f_loop(f, thread) } |
Very strange. I can't see any error.
But instead of assigning the value of x[1] to the variable y, you could try using x[1] directly in the if-statement and the equation. |
Quote:
I tried that before, did not work. It gave me an error indicating that the undeclared variable in IF statement. Does it underestand the y variable in If statement? |
Hey Amir, I am facing the same problem. My UDF doesn't understand the if statement. How did you fix your problem?
|
All times are GMT -4. The time now is 13:32. |