CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Parse Error while Interpreting UDF (https://www.cfd-online.com/Forums/fluent-udf/207136-parse-error-while-interpreting-udf.html)

zh_cfd September 25, 2018 05:47

Parse Error while Interpreting UDF
 
Hello,

I am doing UDF for the first time. After going through the udf manual and forum posts, I have written this code that calculates effective conductivity for fluid phase and particle phase based on volume fraction of each phase in FLUENT EULERIAN MULTIPHASE model.

I tried compiling the code but it says
"'xcopy' is not recognized as an internal or external command, operable program or batch file fluent".

before this 'xcopy' error, i managed to solve the 'nmake' error problem using different Visual Studios, Setting Environment Variable (as mentioned in some forum posts).

Now, I am trying to interpret the code and getting : Parse Error & undeclared variable msg. Also, it says "WARNING: automatically switched to run in parallel -t1 mode ..." although if I am using serial solver.

Here is the error message:
.................................................. .................................................. .................................................. .................................................. ......

************************************************** **************************
************************************************** **************************
** WARNING: Automatically switched to run in parallel -t1 mode. **
** Detected non-parallelized UDF usage, enabling parallel usage. **
** If you encounter any issues, please re-run with -t0 flag. **
************************************************** **************************
************************************************** **************************
cpp -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/multiport/src" -I. -DUSE_UDF_HOST_DUMMY -DUDFCONFIG_H="<udfconfig-host.h>" "C:/FYP ZHS/Nanofluid_Design1_files/dp0/FFF/Fluent/Nanofluid_Conductivity.c"
Error: C:/FYP ZHS/Nanofluid_Design1_files/dp0/FFF/Fluent/Nanofluid_Conductivity.c: line 11: parse error.
Error: C:/FYP ZHS/Nanofluid_Design1_files/dp0/FFF/Fluent/Nanofluid_Conductivity.c: line 12: parse error.
Error: C:/FYP ZHS/Nanofluid_Design1_files/dp0/FFF/Fluent/Nanofluid_Conductivity.c: line 13: parse error.
Error: C:/FYP ZHS/Nanofluid_Design1_files/dp0/FFF/Fluent/Nanofluid_Conductivity.c: line 14: k_f: undeclared variable

cpp -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v182\fluent\fluent18.2.0/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/Student/AppData/Local/Temp/udfconfig-5700-node0.h>" "C:/Users/Student/AppData/Local/Temp/Nanofluid_Conductivity.c.5700.0.c"
Error: C:/Users/Student/AppData/Local/Temp/Nanofluid_Conductivity.c.5700.0.c: line 11: parse error.
Error: C:/Users/Student/AppData/Local/Temp/Nanofluid_Conductivity.c.5700.0.c: line 12: parse error.
Error: C:/Users/Student/AppData/Local/Temp/Nanofluid_Conductivity.c.5700.0.c: line 13: parse error.
Error: C:/Users/Student/AppData/Local/Temp/Nanofluid_Conductivity.c.5700.0.c: line 14: k_f: undeclared variable

.................................................. .................................................. .................................................. .........................................


I think i'm missing out some basics or some steps .
I hope someone can guide me through this . :)

here is the code i've written:

#include"udf.h"
#define kp 3000 /**thermal conductivity for nanoparticle RGO******/
#define kl 0.6 /**thermal conductivity for fluid******/
#define omega 0.00726 /************omega***************/


DEFINE_PROPERTY(keff_fluid_Conductivity,c,t)
{
Thread *tsf;
tsf = THREAD_SUB_THREAD(t,0);
real k_f; /***thermal conductivity for fluid(water)***********/
real k_eff_l; /******effective thermal conductivity for fluid*********/
real phi_l = C_VOF(c,tsf); /****volume fraction primary phase******/
k_f=(1-sqrt(1-phi_l))*kl; /***Thermal Conductivity of water**/
k_eff_l = k_f/phi_l;
return k_eff_l;
}


DEFINE_PROPERTY(keff_particle_Conductivity,c,t)
{
Thread *tsf;
Thread *tsp;
tsf = THREAD_SUB_THREAD(t,0);
tsp = THREAD_SUB_THREAD(t,1);
real phi_l = C_VOF(c,tsf); /****volume fraction primary phase******/
real phi_p = C_VOF(c,tsp); /****volume fraction secondary phase******/
real A;
real B;
A= kp/kl;
B= 1.25*(pow(((1-phi_l)/phi_l),(10/9)));

real k_p; /******thermal conductivity for particle***********/
real k_eff_p; /* effective thermal conductivity for nano particle***/

real lambda;
real gamma;
lambda =(B(A-1)/(A*pow((1-B/A),2)))*log(A/B)-((B-1)/(1-B/A))-((B+1)/2);

gamma =2/(1-B/A)*lambda;

k_p= sqrt(1-phi_l)*(omega*A+(1-omega)*gamma)*kl;/***Thermal Conductivity of water at ***/
k_eff_p = k_p/phi_p;
return k_eff_p;
}


All times are GMT -4. The time now is 21:34.