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

Compilation Error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 3, 2017, 12:06
Default Compilation Error
  #1
New Member
 
Vignesh Veeresparan
Join Date: Jan 2017
Posts: 6
Rep Power: 9
vizvaz is on a distinguished road
Hi Everyone,

I'm trying to compile an UDF using DEFINE_PROFILE for thermal BC at wall.

My code is as below

HTML Code:
#include "udf.h"

DEFINE_PROFILE(htcTube,t,i)
{
	cell_t c;	
	face_t f;
	
	Thread *ct; 
	
	ct=THREAD_T0(t); 
	c=F_C0(f,t);
	
	real Re, Pr, mu, muw, k, d ;								
	real rho, u, cp, h; 									
					

	begin_f_loop(f,t)
		{
			rho = C_R(c,ct); 							
			mu = C_MU_EFF(c,ct); 							
			muw = C_MU_L(c,ct);							
			k = C_K_L(c,ct); 							
			cp = C_CP(c,ct); 							
			u  = ND_MAG(C_U(c,ct),C_V(c,ct),C_W(c,ct));				
			d  = 10/1000;						             	
			
			Re = rho * u * d /mu ; 							
			Pr = cp * mu/k ;							
			h = (0.023 * pow(Re,0.8) * pow(Pr, 0.4) * pow((mu/muw),0.14))*k/d;

			F_PROFILE(f,t,i) = h ;
		}
	end_f_loop(f,t)
}
Fluent throws an error as below

HTML Code:
(chdir "libudf")(chdir "win64\3ddp")# Generating ud_io1.h
01.c
..\..\src\01.c(50) : error C2275: 'real' : illegal use of this type as an expression
        C:\PROGRA~1\ANSYSI~1\v160\fluent\fluent16.0.0\src\main\global.h(174) : see declaration of 'real'
..\..\src\01.c(50) : error C2146: syntax error : missing ';' before identifier 'Re'
..\..\src\01.c(50) : error C2065: 'Re' : undeclared identifier
..\..\src\01.c(50) : error C2065: 'Pr' : undeclared identifier
..\..\src\01.c(50) : error C2065: 'mu' : undeclared identifier
..\..\src\01.c(50) : error C2065: 'muw' : undeclared identifier
..\..\src\01.c(50) : error C2065: 'k' : undeclared identifier
..\..\src\01.c(50) : error C2065: 'd' : undeclared identifier
..\..\src\01.c(51) : error C2275: 'real' : illegal use of this type as an expression
        C:\PROGRA~1\ANSYSI~1\v160\fluent\fluent16.0.0\src\main\global.h(174) : see declaration of 'real'
..\..\src\01.c(51) : error C2146: syntax error : missing ';' before identifier 'rho'
..\..\src\01.c(51) : error C2065: 'rho' : undeclared identifier
..\..\src\01.c(51) : error C2065: 'u' : undeclared identifier
..\..\src\01.c(51) : error C2065: 'cp' : undeclared identifier
..\..\src\01.c(51) : error C2065: 'h' : undeclared identifier
..\..\src\01.c(56) : error C2065: 'rho' : undeclared identifier
..\..\src\01.c(57) : error C2065: 'mu' : undeclared identifier
..\..\src\01.c(58) : error C2065: 'muw' : undeclared identifier
..\..\src\01.c(59) : error C2065: 'k' : undeclared identifier
..\..\src\01.c(60) : error C2065: 'cp' : undeclared identifier
..\..\src\01.c(61) : error C2065: 'u' : undeclared identifier
..\..\src\01.c(62) : error C2065: 'd' : undeclared identifier
..\..\src\01.c(64) : error C2065: 'Re' : undeclared identifier
..\..\src\01.c(64) : error C2065: 'rho' : undeclared identifier
..\..\src\01.c(64) : error C2065: 'u' : undeclared identifier
..\..\src\01.c(64) : error C2065: 'd' : undeclared identifier
..\..\src\01.c(64) : error C2065: 'mu' : undeclared identifier
..\..\src\01.c(65) : error C2065: 'Pr' : undeclared identifier
..\..\src\01.c(65) : error C2065: 'cp' : undeclared identifier
..\..\src\01.c(65) : error C2065: 'mu' : undeclared identifier
..\..\src\01.c(65) : error C2065: 'k' : undeclared identifier
..\..\src\01.c(66) : error C2065: 'h' : undeclared identifier
..\..\src\01.c(66) : error C2065: 'Re' : undeclared identifier
..\..\src\01.c(66) : error C2065: 'Pr' : undeclared identifier
..\..\src\01.c(66) : error C2065: 'mu' : undeclared identifier
..\..\src\01.c(66) : error C2065: 'muw' : undeclared identifier
..\..\src\01.c(66) : error C2065: 'k' : undeclared identifier
..\..\src\01.c(66) : error C2065: 'd' : undeclared identifier
..\..\src\01.c(68) : error C2065: 'h' : undeclared identifier

Done.
It would be really helpful. If any of you could help solve this issue.

Thanks in Advance.
vizvaz is offline   Reply With Quote

Old   January 4, 2017, 03:55
Default
  #2
Senior Member
 
Kevin
Join Date: Dec 2016
Posts: 138
Rep Power: 9
KevinZ09 is on a distinguished road
My first suggestion would be to try putting your real declarions before the ct and c expressions.
KevinZ09 is offline   Reply With Quote

Old   January 6, 2017, 04:19
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
I completely agree with Kevin.

My second suggestion: the line

Code:
d  = 10/1000;
probably does not do what you expect. d will not be 0.01, because integer division will be used.
Instead, use one of the following:

Code:
d  = 10./1000;
d  = 10/1000.;
d = 0.01;
d = (float)10/1000;
Choose whatever is more easy to understand for you six months from now.
pakk is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] blockMesh with double grading. spwater OpenFOAM Meshing & Mesh Conversion 92 January 12, 2019 09:00
Pressure outlet boundary condition rolando OpenFOAM Running, Solving & CFD 62 September 18, 2017 06:45
DPM udf error haghshenasfard FLUENT 0 April 13, 2016 06:35
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 11:39
Compiling problems with hello worldC fw407 OpenFOAM Installation 21 January 6, 2008 17:38


All times are GMT -4. The time now is 16:39.