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/)
-   -   Sos!!! Udf code (https://www.cfd-online.com/Forums/fluent-udf/105751-sos-udf-code.html)

Jo_vivian_lee August 8, 2012 08:53

Sos!!! Udf code
 
Hi there,
I am working on a UDF CODE which is as below, but it doesn`t work for me, could you please check what mistakes I have made? Thank you in advance.
I think the problem is the function what I used, I want to describe that power 1/6 of (0.003125-fabs(x)), how? and also, x should be an absolute value

#include "udf.h"
DEFINE_PROFILE(unsteady_velocity,thread,index)
{
real pos[ND_ND];
real x, t;
face_t f;
begin_f_loop(f, thread)
{
F_CENTROID(pos, f, thread);
x=pos[0];
t=CURRENT_TIME;
F_PROFILE(f,thread,index) =pow((0.003125-fabs(x)),(1/6))*39.75287884+0.3*15.2*sin(1600*3.1415926*t);
}
end_f_loop(f, thread)
}

blackmask August 16, 2012 00:09

Use 1.0/6 instead of 1/6, the latter is 0 which may not what you expected. Also make sure that abs(x) does not exceed 0.003125


All times are GMT -4. The time now is 20:41.