|
[Sponsors] |
June 13, 2016, 04:07 |
Facing Parse Error
|
#1 |
New Member
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10 |
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 |
|
June 13, 2016, 04:45 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
What is on line 47? And what is that line supposed to do according to you?
|
|
June 13, 2016, 07:00 |
|
#3 |
New Member
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10 |
real k; and it defines type of variable "k" as real number
|
|
June 13, 2016, 07:04 |
|
#4 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
||
June 13, 2016, 07:06 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
(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. |
|
June 13, 2016, 07:07 |
|
#6 |
New Member
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10 |
||
June 13, 2016, 07:10 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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; |
|
June 13, 2016, 07:43 |
|
#8 |
New Member
KasrA
Join Date: Jun 2016
Posts: 5
Rep Power: 10 |
Thank you Bruno Machado and pakk
problem solved |
|
|
|
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 |