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

Facing Parse Error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2016, 04:07
Unhappy Facing Parse Error
  #1
New Member
 
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10
kasrakrd is on a distinguished road
Hi guys,may i have your help on this code ? :/
I faced this error ---> line 47: parse error
and this is my code :
#include "udf.h"

DEFINE_PROPERTY(cell_viscositynano,c,t)
{
double mu;
double h = C_T(c,t);

//mu = exp(3.003- 0.04203*h - 0.5445*1 + 0.0002553*pow(h,2) + 0.0524*pow(1,2) - (1.622/1))/1000;
mu = (-0.155 -19.582/h +0.794*1 +2094.47/pow(h,2) -0.192*pow(1,2) -8.11*1/h -27463.863/pow(h,3) +0.0127*pow(1,3) +1.6044*pow(1,2)/h +2.1754*1/pow(h,2))/1000;


real mu;
}

DEFINE_PROPERTY(thermal,c,t)
{
double mu_lam , k ,Pr ,Re ;
double z = C_T(c,t)- 273;
double a , b , c , d , f ,aa ,bb, cc, dd ,ee;
//double mu_lam;
double t = z + 273;

// u water
a = 98.75*log(z);
b = (-45.23)*log(z)*log(z);
c = (9.71)*log(z)*log(z)*log(z);
d = (-0.946)*log(z)*log(z)*log(z)*log(z);
f = (0.03)*log(z)*log(z)*log(z)*log(z)*log(z);
mu_lam = (-81.1+a+b+c+d+f)/1000;


Re = (997.1*1.3807*pow(10,-23)*t)/(3*3.14* mu_lam * mu_lam * 0.17 * pow(10,-9)) ;
Pr = mu_lam / (997.1 * 1.47*pow(10,-7));


aa = pow(1,0.7640); // volume fraction
bb = pow((0.384/47),0.369);
cc = pow((0.613/25),0.7476) ;
dd = pow(Pr,0.9955);
ee = pow(Re,1.2321);


k = ( 1 + 64.7*aa*bb*cc*dd*ee)*0.613;



real k:
}
Mesh location : C:\Fluent.Inc\ntbin\ntx86\LD0.8-2121
UDF location : C:\Fluent.Inc\ntbin\ntx86\properties-phi9
kasrakrd is offline   Reply With Quote

Old   June 13, 2016, 04:45
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
What is on line 47? And what is that line supposed to do according to you?
pakk is offline   Reply With Quote

Old   June 13, 2016, 07:00
Default
  #3
New Member
 
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10
kasrakrd is on a distinguished road
real k; and it defines type of variable "k" as real number
kasrakrd is offline   Reply With Quote

Old   June 13, 2016, 07:04
Default
  #4
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by kasrakrd View Post
real k; and it defines type of variable "k" as real number
you defined it as a double first and now you are defining it as real (this does not make any sense).

you should " return k; ", not REAL k.
Bruno Machado is offline   Reply With Quote

Old   June 13, 2016, 07:06
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
(edit: in response to kasrakrd, not to Bruno Machado): No and mwah.

No: read carefully, your code does not say "real k;", but "real k:".

Mwah: if it would say "real k;", it would still a warning and probably also an error. The warning is because you already defined k as a double. And the error that I expect is because you can not define a variable after you use it.

And your UDF currently returns nothing. I guess that the value you want to use in your simulations is k, so probably you should add "return k" at the end.
pakk is offline   Reply With Quote

Old   June 13, 2016, 07:07
Default
  #6
New Member
 
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10
kasrakrd is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
you define it as a double first and now you are defining it as real (this does not make any sense).

you should " return k; ", not REAL k.
I changed it and i faced this :
line 47: function returning float returns double.
kasrakrd is offline   Reply With Quote

Old   June 13, 2016, 07:10
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
You can get rid of that warning by letting it return a float.
There are multiple ways for that, one of them:
Code:
return (float)k;
pakk is offline   Reply With Quote

Old   June 13, 2016, 07:43
Default
  #8
New Member
 
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10
kasrakrd is on a distinguished road
Thank you Bruno Machado and pakk
problem solved
kasrakrd 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
DPM udf error haghshenasfard FLUENT 0 April 13, 2016 07:35
error compiling modified applications yvyan OpenFOAM Programming & Development 21 March 1, 2016 05:53
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 12:39
Errors in UDF shashank312 Fluent UDF and Scheme Programming 6 May 30, 2013 21:30
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 08:24


All times are GMT -4. The time now is 13:50.