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/)
-   -   UDF 2D inlet profile (http://www.cfd-online.com/Forums/fluent-udf/111827-udf-2d-inlet-profile.html)

Thomashoffmann January 16, 2013 07:40

UDF 2D inlet profile
 
Hi all.

I'm up to write a UDF inlet profile. The inlet profile should be given by:
v=0.001474*(1-(r/R)^3).

By studying other examples I've come to the code shown here below. But I get an error in line 11 'no function prototype', when I try to interpret it. Can anybody help?
Thanks

__________________
#include "udf.h"
DEFINE_PROFILE(inlet_velocity_x, t, i)
{
real x[ND_ND]; /* this will hold the position vector*/
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y=x[1]
F_PROFILE(f,t,i) = 0.001474*(1-((0.024-y)/0.024)^3)
}
end_f_loop(f,t)
}

Thomashoffmann January 16, 2013 09:40

Ok, I figured it out... I forgot the semicolons in line 10 and 11, and for some reason it is not allowed to use '^3', so I just wrote: ((0.024-y)/0.024)*((0.024-y)/0.024)*((0.024-y)/0.024)...

coglione January 17, 2013 03:47

a more elegant way for x^y: pow(x,y)

cheers

Thomashoffmann January 17, 2013 04:38

I have never worked with C code before, but thanks for the input :)


All times are GMT -4. The time now is 22:52.