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/)
-   -   Syntax error when interpreting UDF file (https://www.cfd-online.com/Forums/fluent-udf/208540-syntax-error-when-interpreting-udf-file.html)

hanis_iz October 19, 2018 03:10

Syntax error when interpreting UDF file
 
Hello,
I'm using UDF in my simulation to achieve the actual velocity profile at the inlet (3D case). When I tried to interpret my UDF file in FLUENT, an error as below occurred.

Error: /home/m_shinohara/UDF2.c: line 4: syntax error.

I don't know how to fix the error since this is my very first time using UDF.
Here is my UDF file:

PHP Code:

#include "udf.h"
#define Q 3.3e-5  //unit m3/sec
#define Diameter 4.9e-3  //unit m
DEFINE_PROFILE(axialVelocity,t,i)
{
    
real x[ND_ND];
    
real r,Area;
    
face_t f;
    
Area=(M_PI/4.0)*pow(Diameter,2);
    
begin_f_loop(f,t)
    {
        
F_CENTROID(x,f,t);
        
r=sqrt(pow(x[0],2)+pow(x[1],2));
        
F_PROFILE(f,t,i)=(2.0*Q/Area)*(1-pow(2.0*r/Diameter,2));
    }
    
end_f_loop(f,t)


I'm very glad if someone could help me to solve his problem.
Thank you in advance.

moh_zain October 20, 2018 12:55

sheck line 4


Area=(M_PI/4.0)*pow(Diameter,2);
M_PI and pow(diameter,2)

M_PI AND DIAMETER define them

hanis_iz October 21, 2018 00:30

Thank you for your suggestion, mohamed. I'll be sure to try it.

blackmask October 21, 2018 01:07

The "//" is C++ comment syntax. You should use c comment syntax "/* */".

hanis_iz October 21, 2018 01:12

Hi, blackmask. Thank you for the information.
I'll fix my UDF file:)


All times are GMT -4. The time now is 18:46.