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/)
-   -   UDF compiling and Interpreting error (https://www.cfd-online.com/Forums/fluent-udf/169838-udf-compiling-interpreting-error.html)

aduramolasode95 April 18, 2016 12:16

UDF compiling and Interpreting error
 
This is my first time writing and using fluent udf in ANSYS. My code executed on a windows machine, but due to restricted license I had to switch to a linux workstation and my UDF stopped working.

Within ANSYS fluent v16.1, I got a syntax error when I tried to compile and interpret. I am not sure what the problem is; I might be missing something. I would appreciate any help, because this is holding up a very important project I need to complete for graduation. Below is my code:

#include "udf.h"

/*define constants*/

#define UMEAN 1.0
/*#define 0.0*/
#define Re 1
#define VISC 2/Re
#define Symmetry 180
#define Phi 0.0

/*pass in thread associated with boundary zone; the udf will need to do the looping over all faces*/

DEFINE_PROFILE(x_velocity, thread, index)
{
real r, theta, ulocal, y, x[3]; /*radius, theta, local velocity, x array for coordinates*/
face_t f; /*f is face thread index*/


begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
y = x[1];

F_PROFILE(f, thread, index)= (-r*sin(theta)*UMEAN*sin(theta))+(cos(theta)*-UMEAN*cos(theta));

}
end_f_loop(f,thread)
}

DEFINE_PROFILE(y_velocity, thread, index)
{
real r, theta, ulocal, y, x[3]; /*radius, theta, local velocity, x array for coordinates*/
face_t f; /*f is face thread index*/


begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
y = x[1];

F_PROFILE(f, thread, index)= (r*cos(theta)*cos(Phi)*UMEAN*sin(theta))+(sin(thet a)*cos(Phi)*-UMEAN*cos(theta));

}
end_f_loop(f,thread)
}

DEFINE_PROFILE(z_velocity, thread, index)
{
real r, theta, ulocal, y, x[3]; /*radius, theta, local velocity, x array for coordinates*/
face_t f; /*f is face thread index*/


begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
y = x[1];

F_PROFILE(f, thread, index)= (r*cos(theta)*sin(Phi)*UMEAN*sin(theta))+(sin(thet a)*sin(Phi)*-UMEAN*cos(theta));

}
end_f_loop(f,thread)
}

`e` April 18, 2016 18:20

What was the compilation error? Try removing all comments or replace them with the one-line comment syntax (I've had similar issues with Linux compilers):

Code:

// comment here

aduramolasode95 April 18, 2016 23:00

When I take care of the comments, I get this error on my DEFINE_PROFILE() line:

"error: expected constructor, destructor, or type conversion before '(' token"

Any ideas on how to deal with this one?

`e` April 19, 2016 21:09

What is your updated code and have you identified at which line this error occurs?


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