CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

udf fluent

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   September 19, 2015, 09:12
Default udf fluent
  #1
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 3
gzamiri@gmail.com is on a distinguished road
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.
gzamiri@gmail.com is offline   Reply With Quote

Old   September 19, 2015, 15:14
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 259
Rep Power: 5
Bruno Machado is on a distinguished road
can you highlight which lines belongs these errors?
Bruno Machado is offline   Reply With Quote

Old   September 20, 2015, 04:08
Default
  #3
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 3
gzamiri@gmail.com is on a distinguished road
there isn't this number line in my code
gzamiri@gmail.com is offline   Reply With Quote

Old   September 20, 2015, 06:23
Default
  #4
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 259
Rep Power: 5
Bruno Machado is on a distinguished road
Quote:
Originally Posted by gzamiri@gmail.com View Post
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.
Bruno Machado is offline   Reply With Quote

Old   September 22, 2015, 04:50
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 943
Rep Power: 13
pakk will become famous soon enough
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?)
pakk is offline   Reply With Quote

Old   September 22, 2015, 11:25
Default
  #6
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 3
gzamiri@gmail.com is on a distinguished road
dear pakk
do you think that this error is for version of fluent?
gzamiri@gmail.com is offline   Reply With Quote

Old   September 23, 2015, 13:26
Default
  #7
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 3
gzamiri@gmail.com is on a distinguished road
I want to do my udf in 2D dimention.how can i specify it in my udf.
gzamiri@gmail.com is offline   Reply With Quote

Old   September 23, 2015, 21:12
Default
  #8
New Member
 
Meng Liu
Join Date: Sep 2015
Posts: 14
Rep Power: 3
sola86 is on a distinguished road
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)
}
sola86 is offline   Reply With Quote

Old   September 24, 2015, 01:54
Default
  #9
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 3
gzamiri@gmail.com is on a distinguished road
dear sola
shoud I add config.h in my udf as follow?
#include "config.h"
gzamiri@gmail.com is offline   Reply With Quote

Old   September 24, 2015, 02:37
Default
  #10
New Member
 
Meng Liu
Join Date: Sep 2015
Posts: 14
Rep Power: 3
sola86 is on a distinguished road
Quote:
Originally Posted by gzamiri@gmail.com View Post
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".
sola86 is offline   Reply With Quote

Old   September 24, 2015, 05:36
Default
  #11
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 3
gzamiri@gmail.com is on a distinguished road
dear sola
I don't know how can i add the path to the system environment "include"
please help me
gzamiri@gmail.com is offline   Reply With Quote

Old   September 27, 2015, 20:53
Default
  #12
New Member
 
Meng Liu
Join Date: Sep 2015
Posts: 14
Rep Power: 3
sola86 is on a distinguished road
Quote:
Originally Posted by gzamiri@gmail.com View Post
dear sola
I don't know how can i add the path to the system environment "include"
please help me
google “Environment variable”
sola86 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for a smart interface matlab fluent chary FLUENT 17 December 2, 2016 21:26
fluent udf, saving data in udf mohsen zendehbad Fluent UDF and Scheme Programming 14 August 3, 2016 07:23
Making wave udf in fluent sunggun1212 Fluent UDF and Scheme Programming 7 October 27, 2015 11:52
Wind turbine rotation through UDF in FLUENT Shamoon Jamshed Fluent UDF and Scheme Programming 7 January 18, 2014 12:06
UDF problem caused by various version of Fluent Yurong FLUENT 3 January 15, 2006 11:57


All times are GMT -4. The time now is 05:37.