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 fluent (https://www.cfd-online.com/Forums/fluent-udf/159630-udf-fluent.html)

gzamiri@gmail.com September 19, 2015 09:12

udf fluent
 
dear all
I have written a program and compile it in fluent but getting the errors while building in fluent.
the program looks like this. please help me.

/* UDF for determination of inlet and outlet */
#include "udf.h"
#include "sg.h"
DEFINE_EXECUTE_AT_END(determination_boun)
{
Domain *d;
face_t f;
Thread *t;
real velocity_vector[2], mag_velocity, normal_vec, mag_normal_vec;
real A[ND_ND], ds, es[ND_ND], A_by_es, dr0[ND_ND];
real X_component,Y_component, Guage_Pressure;
d=Get_Domain(1);
int ID=12; /*Zone ID for farfield zone from boundary condition task page*/
t=Lookup_Thread(d,ID);
begin_f_loop(f,t)
{
/* find velocities*/
velocity_vector[0]=F_U(f,t);
velocity_vector[1]=F_V(f,t);

/* magnitude of velocity vector*/
mag_velocity=NV_MAG(velocity_vector);
/* magnitude of normal vector*/
BOUNDARY_FACE_GEOMETRY(f,t,A,ds,es,A_by_es,dr0);
mag_normal_vec=NV_MAG(A);
/* attack angle*/
double teta=0;
if((mag_velocity* mag_normal_vec*cos(teta))<0)
{
/*inlet boundary*/
X_component=F_U(f,t);
Y_component=F_V(f,t);
}
else
Guage_Pressure=F_P(f,t); /*outlet boundary*/
}
end_f_loop(f,t)
}

1 file(s) copied.
1 file(s) copied.
(system "copy "c:\PROGRA~1\ANSYSI~1\v121\fluent"\fluent12.1.2\sr c\makefile_nt.udf libudf\win64\2ddp\makefile")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\2ddp")()
# Generating ud_io1.h
determination_boun.c
c:\program files\ansys inc\v121\fluent\fluent12.1.2\src\config.h(110) : error C2143: syntax error : missing '{' before ':'
c:\program files\ansys inc\v121\fluent\fluent12.1.2\src\config.h(110) : error C2059: syntax error : ':'

Done.

Bruno Machado September 19, 2015 15:14

can you highlight which lines belongs these errors?

gzamiri@gmail.com September 20, 2015 04:08

there isn't this number line in my code

Bruno Machado September 20, 2015 06:23

Quote:

Originally Posted by gzamiri@gmail.com (Post 564793)
there isn't this number line in my code

the error says the problem is in the line 110. This piece of code does not have this much lines, so check which line in your code is the 110th. can't help much with the information you provided so far.

pakk September 22, 2015 04:50

The compiler complains about line 110 of a different file, not the file that gzamiri is showing.

In my copy of Fluent 12.1.4, lines 109-111 of config.h are:

Code:

#if !(RP_2D || RP_3D)
 Error: both RP_2D and RP_3D are undefined
#endif

So, if this is the same in Fluent 12.1.2, it looks like Fluent does not know if it is in 2D or 3D. For me it is clear that you want to do it in 2D. This is very strange for me.

The problem is probably not in your UDF code, but in your system settings. Are you able to compile other UDFs? (From the manual?)

gzamiri@gmail.com September 22, 2015 11:25

dear pakk
do you think that this error is for version of fluent?

gzamiri@gmail.com September 23, 2015 13:26

I want to do my udf in 2D dimention.how can i specify it in my udf.

sola86 September 23, 2015 21:12

1.add the path of “config.h” to the system environment “include”.
2.you need declare the variable before you use it.

Code:

/* UDF for determination of inlet and outlet */
#include "udf.h"
#include "sg.h"
DEFINE_EXECUTE_AT_END(determination_boun)
{
        Domain *d;
        face_t f;
        Thread *t;
        real velocity_vector[2], mag_velocity, normal_vec, mag_normal_vec;
        real A[ND_ND], ds, es[ND_ND], A_by_es, dr0[ND_ND];
        real X_component,Y_component, Guage_Pressure;
        int ID;
        double teta;
        d=Get_Domain(1);
        ID=12; /*Zone ID for farfield zone from boundary condition task page*/
        t=Lookup_Thread(d,ID);
        begin_f_loop(f,t)
        {
                /* find velocities*/
                velocity_vector[0]=F_U(f,t);
                velocity_vector[1]=F_V(f,t);

                /* magnitude of velocity vector*/
                mag_velocity=NV_MAG(velocity_vector);
                /* magnitude of normal vector*/
                BOUNDARY_FACE_GEOMETRY(f,t,A,ds,es,A_by_es,dr0);
                mag_normal_vec=NV_MAG(A);
                /* attack angle*/
                teta=0;
                if((mag_velocity* mag_normal_vec*cos(teta))<0)
                        {
                        /*inlet boundary*/
                        X_component=F_U(f,t);
                        Y_component=F_V(f,t);
                        }
                else
                        Guage_Pressure=F_P(f,t); /*outlet boundary*/
        }
        end_f_loop(f,t)
}


gzamiri@gmail.com September 24, 2015 01:54

dear sola
shoud I add config.h in my udf as follow?
#include "config.h"

sola86 September 24, 2015 02:37

Quote:

Originally Posted by gzamiri@gmail.com (Post 565380)
dear sola
shoud I add config.h in my udf as follow?
#include "config.h"

no,just add the path to the system environment "include".

gzamiri@gmail.com September 24, 2015 05:36

dear sola
I don't know how can i add the path to the system environment "include"
please help me

sola86 September 27, 2015 20:53

Quote:

Originally Posted by gzamiri@gmail.com (Post 565399)
dear sola
I don't know how can i add the path to the system environment "include"
please help me

google “Environment variable”


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