|
[Sponsors] |
March 9, 2013, 12:14 |
Parse error in UDF
|
#1 |
New Member
taha khademi
Join Date: Mar 2013
Posts: 4
Rep Power: 13 |
hey guys,
i am trying to write a code for trapping particles in a cross flow over a cylinder. but i get parse error in line 17 and it doesn't matter what is in line 17! even it may be an "Enter" or other routine loops. my code is as follow: //#include "udf.h" #include "dpm.h" DEFINE_DPM_BC(trap,p,t,f,f_normal,dim) { real normal[2]; real ds=0.01; #if RP_2D if (rp_axi) { real dp=P_DIAM(p); real x=P_POS(p)[0]; real y=P_POS(p)[1]; R=sqrt(x*x+y*y); normal[0]=-f_normal[0]; normal[1]=-f_normal[1]; if(R<=0.5*(ds+dp)) { P_VEL(p)[0]=P_VEL(p)[0]*normal[0]; P_VEL(p)[1]=P_VEL(p)[1]*normal[1]; } } else #endif }//end of define it is noticeable that when i activate the #include "udf.h" header, i get "P_POS: undeclared variable" error! my code is also where my case and data files are. and also the folder doesn't contain "space" in it. thanks in advance. |
|
March 13, 2013, 06:29 |
|
#2 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23 |
Did compiling or did you interpret the code?
I tried compiling your code and nothing seems to be wrong with it. The fluent manual suggest that UDF with DEFINE_DPM_BC works only after compiling. |
|
March 14, 2013, 03:53 |
|
#3 |
New Member
taha khademi
Join Date: Mar 2013
Posts: 4
Rep Power: 13 |
hey vasava
i tried to interpret the code, but i repeatedly get the parse error could you please give me some tips about compiling the code tanx in advance |
|
March 14, 2013, 04:16 |
|
#4 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23 |
What is the exact error? Can you copy the text here.
Also try to compile some other code and verify that there is no problem with the compiler. I am no expert myself but lets try to fix it. |
|
March 14, 2013, 04:22 |
|
#5 |
New Member
taha khademi
Join Date: Mar 2013
Posts: 4
Rep Power: 13 |
this the exact error:
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>" "C:\Users\Taha\Desktop\trap.c" Error: C:\Fluent.Inc\fluent6.3.26/src/dpm.h: line 17: parse error. |
|
March 14, 2013, 04:58 |
|
#6 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23 |
1. Put UDF in the same folder as the case. It seems that your udf is on your desktop.
2. Remove the comment on line-1. I think you will need udf.h file. 3. The macros you are using will give you real numbers so you dont have to declare them as real 4. You can try ‘double R=sqrt(x*x+y*y);’ instead of just ‘R=sqrt(x*x+y*y);’ 5. To me ‘R=sqrt(x*x+y*y);’ does not make sense. You are not using R for anything. You can try after removing that line. That’s the only help I can do now. |
|
March 14, 2013, 05:05 |
|
#7 |
Super Moderator
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,428
Rep Power: 49 |
Edit: should have read the answers too...
Apparently, the macros you are using only work in compiled mode Last edited by flotus1; March 14, 2013 at 05:32. |
|
March 14, 2013, 05:18 |
|
#8 |
New Member
taha khademi
Join Date: Mar 2013
Posts: 4
Rep Power: 13 |
well thank you vasava
i declared R variable as Double, and moved my .C file into the case folder, but still getting the same parse error! and about udf.h, when i remove comment from udf.h, i get the "line 16: P_POS: undeclared variable" error. |
|
March 14, 2013, 06:10 |
|
#9 |
Senior Member
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23 |
I am no expert with DPM but may be studying this (http://jullio.pe.kr/fluent6.1/help/html/udf/node90.htm) would/might help you.
All the best. |
|
November 2, 2016, 17:06 |
I am having the same error/ It does not seem to be UDF related though
|
#10 | |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 18 |
Quote:
I am having the same error as you are having. It seems that the UDF is not wrong. The origin of the error has to be something else. I was wondering if you could ever solve this issue? Your help is much appreciated. Thanks, Ali |
||
Tags |
parse error, trapping, udf error |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A Problem of Fluent Interpreted UDF: parse error | knight | Fluent UDF and Scheme Programming | 25 | August 16, 2018 11:26 |
parse error while interpreting udf | Kristin | Fluent UDF and Scheme Programming | 3 | March 15, 2012 07:43 |
parse error in transient udf | spring | FLUENT | 1 | July 6, 2010 07:26 |
UDF parse error at profile function line | Wiggy | Fluent UDF and Scheme Programming | 1 | July 27, 2009 16:59 |
UDF parse error on line 1 ..... (Unusual) | Amit Maha | FLUENT | 4 | June 30, 2006 13:15 |