udf fluent

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 19, 2015, 09:12 udf fluent #1 New Member   golriz Join Date: Sep 2015 Posts: 11 Rep Power: 3 Sponsored Links 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.

 September 19, 2015, 15:14 #2 Senior Member   Bruno Machado Join Date: May 2014 Posts: 271 Rep Power: 6 can you highlight which lines belongs these errors?

 September 20, 2015, 04:08 #3 New Member   golriz Join Date: Sep 2015 Posts: 11 Rep Power: 3 there isn't this number line in my code

September 20, 2015, 06:23
#4
Senior Member

Join Date: May 2014
Posts: 271
Rep Power: 6
Quote:
 Originally Posted by gzamiri@gmail.com 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.

 September 22, 2015, 04:50 #5 Senior Member   Join Date: Nov 2013 Posts: 1,074 Rep Power: 14 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?)

 September 22, 2015, 11:25 #6 New Member   golriz Join Date: Sep 2015 Posts: 11 Rep Power: 3 dear pakk do you think that this error is for version of fluent?

 September 23, 2015, 13:26 #7 New Member   golriz Join Date: Sep 2015 Posts: 11 Rep Power: 3 I want to do my udf in 2D dimention.how can i specify it in my udf.

 September 23, 2015, 21:12 #8 New Member   Meng Liu Join Date: Sep 2015 Posts: 14 Rep Power: 3 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) }```

 September 24, 2015, 01:54 #9 New Member   golriz Join Date: Sep 2015 Posts: 11 Rep Power: 3 dear sola shoud I add config.h in my udf as follow? #include "config.h"

September 24, 2015, 02:37
#10
New Member

Meng Liu
Join Date: Sep 2015
Posts: 14
Rep Power: 3
Quote:
 Originally Posted by gzamiri@gmail.com 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".

 September 24, 2015, 05:36 #11 New Member   golriz Join Date: Sep 2015 Posts: 11 Rep Power: 3 dear sola I don't know how can i add the path to the system environment "include" please help me

September 27, 2015, 20:53
#12
New Member

Meng Liu
Join Date: Sep 2015
Posts: 14
Rep Power: 3
Quote:
 Originally Posted by gzamiri@gmail.com dear sola I don't know how can i add the path to the system environment "include" please help me

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post mohsen zendehbad Fluent UDF and Scheme Programming 15 June 13, 2017 23:23 sunggun1212 Fluent UDF and Scheme Programming 9 April 14, 2017 17:03 chary FLUENT 18 March 24, 2017 09:34 Shamoon Jamshed Fluent UDF and Scheme Programming 7 January 18, 2014 12:06 Yurong FLUENT 3 January 15, 2006 11:57