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

parse error while interpreting udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 16, 2015, 10:55
Default parse error while interpreting udf
  #1
Member
 
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11
chem engineer is on a distinguished road
hi everyone
I face the following error while interpreting the udf that is written as follows:

cpp -I"C:\Fluent.Inc\fluent6.3.26/src" -I"C:\Fluent.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent.Inc\fluent6.3.26/client/src" -I"C:\Fluent.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<udfconfig.h>" "H:\CO2.c"
Error: H:\CO2.c: line 29: parse error.
Error: H:\CO2.c: line 109: parse error.

the udf is:

/* udf for mass transfer of CO2 in DEA solution */
#include "udf.h"
#undef C_TYPE
#define C_TYPE(c,t) ((int) C_STORAGE(c,t,SV_TYPE,uchar_fl *))
DEFINE_MASS_TRANSFER(CO2_DEA,c,t,from_phase_index, from_species_index,to_phase_index,to_species_index )
{
real m_lg=0;
real xy=0,dxx1=0.000015,dxy1=0.00015,xc0[ND_ND],xc1[ND_ND],k=0,hy=0,ly=0,my=0,ny=0,py=0,ay=0,mc=44.01,mh=34. 08,mch=16.04,mw=18.02,ma=105.14,ml=148.14,mm=1.01, mn=106.15,mp=33.07,area=0,x=0,cg=0,cl=0,hcw=2916.3 2,hnw=3994.42,hnm=5095.5,hna=0,u,kg,kl,yy=0,hsy=0, y,xi=0;
cell_t c0,c1;
Thread *t0,*t1;
int ii=0;
int jj=1;
Thread *gas=THREAD_SUB_THREAD(t,ii);
Thread *liq=THREAD_SUB_THREAD(t,jj);
real xc[ND_ND];
real xf[ND_ND];
C_CENTROID(xc,c,t);
if(C_VOF(c,liq)>0.1 && C_VOF(c,liq)<0.9)
{
face_t f;
Thread *tf;
int n;
c_face_loop(c,t,n)
/*loops over all faces of a cell*/
{
f=C_FACE(c,t,n);
tf=C_FACE_THREAD(c,t,n);
F_CENTROID(xf,f,tf);
if(BOUNDARY_FACE_THREAD_P(tf)) /*return TRUE if Thread *tf is a boundary face thread.*/
{
if(xc[1]>xf[1] && fabs(xc[1]-xf[1])>1e-8)
{
xy=F_YI(f,liq,0);
hy=F_YI(f,liq,1);
ly=F_YI(f,liq,2);
my=F_YI(f,liq,3);
ny=F_YI(f,liq,4);
py=F_YI(f,liq,5);
ay=F_YI(f,liq,6);
dxy1=xf[1]-xc[1];
}
if(xc[1]<xf[1] && fabs(xc[1]-xf[1])>1e-8);
{
yy=F_YI(f,gas,0);
hsy=F_YI(f,gas,1);
}
if(xf[0]<xc[0] && fabs(xc[0]-xf[0])>1e-8)
{
dxx1=xf[0]-xc[0];
}
}
else /* if thread is not a boundary face thread */
{
face_t f;
Thread *tf;
int n;
f=C_FACE(c,t,n);
tf=C_FACE_THREAD(c,t,n);
F_CENTROID(xf,f,tf);
c0=F_C0(f,tf);
c1=F_C1(f,tf);
t0=THREAD_T0(tf);
t1=THREAD_T1(tf);
C_CENTROID(xc0,c0,t0);
C_CENTROID(xc1,c1,t1);
if(xc0[0]<xc[0] && fabs(xc[0]-xf[0])>1e-8)
{
dxx1=xf[0]-xc[0];
}
if(xc0[1]>xc[1] && fabs(xc[1]-xf[1])>1e-8)
{
yy=C_YI(c0,gas,0);
hsy=C_YI(c0,gas,1);
}
if(xc0[1]<xc[1] && fabs(xc[1]-xf[1])>1e-8)
{
xy=C_YI(c0,liq,0);
hy=C_YI(c0,liq,1);
ly=C_YI(c0,liq,2);
my=C_YI(c0,liq,3);
ny=C_YI(c0,liq,4);
py=C_YI(c0,liq,5);
ay=C_YI(c0,liq,6);
dxy1=xf[1]-xc[1];
}
if(xc1[0]<xc[0] && fabs(xc[0]-xf[0])>1e-8)
{
dxx1=xf[0]-xc[0];
}
if(xc1[1]>xc[1] && fabs(xc[1]-xf[1])>1e-8)
{
yy=C_YI(c1,gas,0);
hsy=C_YI(c1,gas,1);
}
if(xc1[1]<xc[1] && fabs(xc[1]-xf[1])>1e-8)
{
xy=C_YI(c1,liq,0);
hy=C_YI(c1,liq,1);
ly=C_YI(c1,liq,2);
my=C_YI(c1,liq,3);
ny=C_YI(c1,liq,4);
py=C_YI(c1,liq,5);
ay=C_YI(c1,liq,6);
dxy1=xf[1]-xc[1];
}a
}
}
/* x & y & delta x & delta y are defined */
k=hnm*hcw*C_R(c,liq)*(C_YI(c,liq,0)/mc+C_YI(c,liq,1)/mh+C_YI(c,liq,2)/ml+C_YI(c,liq,3)/mm+C_YI(c,liq,4)/mn+C_YI(c,liq,5)/mp+C_YI(c,liq,6)/ma+C_YI(c,liq,7)/mw)/(hnw*(101325+C_P(c,gas))/1000);
/* k=equilibrium constant & k=y/x */
area=fabs(NV_MAG(C_VOF_RG(c,liq)));
x=xy/(xy+ay*mc/ma+hy*mc/mh+ly*mc/ml+my*mc/mm+ny*mc/mn+py*mc/mp+(1-xy-ay-hy-ly-my-ny-py)*mc/mw);
y=yy/(yy+hsy*mc/mh+(1-yy-hsy)*mc/mch);
cl=C_R(c,liq)*(C_YI(c,liq,0)/mc+C_YI(c,liq,1)/mh+C_YI(c,liq,2)/ml+C_YI(c,liq,3)/mm+C_YI(c,liq,4)/mn+C_YI(c,liq,5)/mp+C_YI(c,liq,6)/ma+C_YI(c,liq,7)/mw);
cg=C_R(c,gas)*(C_YI(c,gas,0)/mc+C_YI(c,gas,1)/mh+C_YI(c,gas,2)/mch);
u=fabs(C_U(c,t));
kg=2*sqrt(1.410191e-5*u/(3.1416*2*fabs(dxx1)));
kl=2*sqrt(1.3741e-9*u/(3.1416*2*fabs(dxx1)));
xi=(kl*cl*x+kg*cg*y)/(kl*cl*+k*kg*cg)
m_lg=kl*mc*cl*area*(xi-x);
}
}
if(m_lg<20 && m_lg>0)
{return m_lg;}
else
{return 0;}
{

line 29 and 109 are bold with red color
could anyone help me with this error?
chem engineer is offline   Reply With Quote

Old   September 16, 2015, 11:21
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
did you try to compile this udf? maybe this error happens because you are trying to interpreted it.
Bruno Machado is offline   Reply With Quote

Old   September 16, 2015, 11:28
Default
  #3
Member
 
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11
chem engineer is on a distinguished road
while compiling I face this error:



> Deleted old libudf\ntx86\3ddp\libudf.dll
The system cannot find the file specified.
(system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\3ddp\makefile")
1 file(s) copied.
(chdir "libudf")()
(chdir "ntx86\3ddp")()

Done.
"C:/Fluent.Inc/ntbin/ntx86"

Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified.

Error Object: ()
chem engineer is offline   Reply With Quote

Old   September 16, 2015, 11:42
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 chem engineer View Post
while compiling I face this error:



> Deleted old libudf\ntx86\3ddp\libudf.dll
The system cannot find the file specified.
(system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\3ddp\makefile")
1 file(s) copied.
(chdir "libudf")()
(chdir "ntx86\3ddp")()

Done.
"C:/Fluent.Inc/ntbin/ntx86"

Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified.

Error Object: ()
I dont think this error is related with the UDF. It is probably related with your compiler. Try to make a simple udf and see if it compiles. If it doesnt, have a look in other topics how to fix compiler issues.
Bruno Machado is offline   Reply With Quote

Old   September 16, 2015, 13:28
Default
  #5
Member
 
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11
chem engineer is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
I dont think this error is related with the UDF. It is probably related with your compiler. Try to make a simple udf and see if it compiles. If it doesnt, have a look in other topics how to fix compiler issues.
I tried some other udfs. they are compiled and there is no problem. I use microsoft visual studio to compile udf.I don't know what the problem is.
chem engineer is offline   Reply With Quote

Old   September 17, 2015, 05:03
Default udf fluent
  #6
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 11
gzamiri@gmail.com is on a distinguished road
I have problem in compiling UDF in ANSYS FLUENT.

I have installed Visual studio:Microsoft Visual Studio 2013

My ansys fluent is fluent 12.1.2.
I write my code in Microsoft Visual Studio and i don't compile code in Microsoft Visual Studio then i load this code in fluent as follows:
define/user-defined/compiled

The error it is showing while loading is :
'nmake' is not recognized as an internal or external command,operable program or batch file.

Please anyone help me how to get out of this problem.I am using 64-bit system with Windows 8.



gzamiri@gmail.com is offline   Reply With Quote

Old   September 18, 2015, 03:39
Default
  #7
Member
 
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11
chem engineer is on a distinguished road
Quote:
Originally Posted by gzamiri@gmail.com View Post
I have problem in compiling UDF in ANSYS FLUENT.

I have installed Visual studio:Microsoft Visual Studio 2013

My ansys fluent is fluent 12.1.2.
I write my code in Microsoft Visual Studio and i don't compile code in Microsoft Visual Studio then i load this code in fluent as follows:
define/user-defined/compiled

The error it is showing while loading is :
'nmake' is not recognized as an internal or external command,operable program or batch file.

Please anyone help me how to get out of this problem.I am using 64-bit system with Windows 8.



you should'n open fluent directly. you should open it from visual studio in this way:
first open microsoft visual studio. then click on ''tools'' tab and click ''visual studio command prompt'' under this tab. you should write the directory of fluent.exe (using the function cd, as it is used in cmd) then you should type fluent in the command prompt.this way fluent will be open via visual studio and you can compile your udf there.
if you had any problem in this procedure or if something is not clear to you, you can ask
chem engineer is offline   Reply With Quote

Old   September 18, 2015, 06:35
Default
  #8
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 11
gzamiri@gmail.com is on a distinguished road
dear chem
Thank you very much for suggestion. I try your suggestion. I compile my code in visual studio then I try build compiled code in fluent as follows
define-user_defined-functions-compiled

unfortunetly I observed previous error in fluent

Please suggest me if there is any mistakes.

Thank you,
gzamiri@gmail.com is offline   Reply With Quote

Old   September 18, 2015, 07:00
Default
  #9
Member
 
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11
chem engineer is on a distinguished road
how do you compile your cod in visual studio?where do you write your code?
chem engineer is offline   Reply With Quote

Old   September 18, 2015, 07:12
Default
  #10
Member
 
Lida
Join Date: Apr 2015
Posts: 39
Rep Power: 11
chem engineer is on a distinguished road
you should write your code in a notepad then change its format to a .c file.then do the process i explained to open fluent via visual studio.at the end in that fluent compile your udf by the directory: define-userdefined-functions- compile.and add your udf by .c format in source files part.then click build to build your library then click load and your udf is ready to use.
chem engineer is offline   Reply With Quote

Old   September 18, 2015, 10:06
Default
  #11
New Member
 
golriz
Join Date: Sep 2015
Posts: 11
Rep Power: 11
gzamiri@gmail.com is on a distinguished road
dear chem
Thank you very much , your advice solved my problem!
gzamiri@gmail.com 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
Parse Error:- Interpreting UDF on remote terminal moataz.che FLUENT 1 March 7, 2017 15:13
parse error while interpreting udf Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43
parse error with interpreting UDF ivanbuz Fluent UDF and Scheme Programming 2 August 13, 2009 19:29
Parse Error Message While interpreting UDF in FLUENT dhimans Fluent UDF and Scheme Programming 1 July 10, 2009 07:29
PARSE ERROR Message when interpreting UDF in FLUENT dhimans FLUENT 0 May 24, 2009 12:40


All times are GMT -4. The time now is 00:19.