Parse error in UDF
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. |
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. |
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 |
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. |
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. |
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. |
Edit: should have read the answers too...
Apparently, the macros you are using only work in compiled mode |
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. |
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. |
I am having the same error/ It does not seem to be UDF related though
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 |
All times are GMT -4. The time now is 01:38. |