|
[Sponsors] | |||||
|
|
|
#1 |
|
Senior Member
|
Hi,
I would love to have your suggestions to eliminate the "parse error" on line 4 of the below program. I have no clue what this error means. I just need to run this code once to get the cell informations. If someone can suggest a way to correct this or if there are other ways to collect the cell information, i would be really thankful.. I am using fluent 13 on windows 7. #include "udf.h" DEFINE_ON_DEMAND(fonction_retour) Domain *domain; { FILE *fp; cell_t c; Thread *tc; domain=Get_Domain(ID); real xc[ND_ND],x,y,z,tempe,mass_w_i; int i; fp=fopen("cell_info.txt","w"); thread_loop_c(tc, domain) { begin_c_loop(c, tc) { C_CENTROID(xc,c,tc); x=xc[0]; y=xc[1]; z=xc[2]; tempe= C_T(c,tc); mass_w_i = C_YI(c,tc,i); fprintf(fp,"%r %r %r %d\n",x,y,z,i); } end_c_loop(c, tc) } fclose(fp); } |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Aug 2011
Posts: 117
Rep Power: 6 ![]() |
Exchange the 3rd and 4th line.
|
|
|
|
|
|
|
|
|
#3 |
|
Senior Member
|
Hi,
thanks, I did that and the parse error got shifted as below line 10: parse error. line 11: parse error. line 17: xc: undeclared variable
|
|
|
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Aug 2011
Posts: 117
Rep Power: 6 ![]() |
Try this one.
#include "udf.h" #define ID 1 DEFINE_ON_DEMAND(fonction_retour) { FILE *fp; Domain *domain; cell_t c; Thread *tc; real xc[ND_ND],x,y,z,tempe,mass_w_i; int i; domain=Get_Domain(ID); if(! Data_Valid_P()) return; fp=fopen("cell_info.txt","w"); thread_loop_c(tc, domain) { begin_c_loop(c, tc) { C_CENTROID(xc,c,tc); x=xc[0]; y=xc[1]; z=xc[2]; tempe= C_T(c,tc); mass_w_i = C_YI(c,tc,i); fprintf(fp,"%r %r %r %d\n",x,y,z,i); } end_c_loop(c, tc) } fclose(fp); } Last edited by blackmask; May 4, 2013 at 08:49. Reason: Add one line of code |
|
|
|
|
|
|
|
|
#5 |
|
Senior Member
|
Hey,
thanks a lot..it got compiled.. But when when i execute it using "execute on demand" , it gives the following error FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Any clue, Thanks a lot!! |
|
|
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Aug 2011
Posts: 117
Rep Power: 6 ![]() |
Please try the modified version in my last post.
|
|
|
|
|
|
|
|
|
#7 |
|
Senior Member
|
Thanks,
It still says the same error.. But i found this out regarding this error http://cape-forum.com/index.php?topic=1108.0 Apart from this i have another doubt? How do you decide the domain id to be 1? I think even that may be the problem as it may search for the data in a domain where its not present |
|
|
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Aug 2011
Posts: 117
Rep Power: 6 ![]() |
I want to help you eliminate the syntax error only and nothing else. That is why I never asked what is the UDF supposed to do. The ID is assigned to be 1 because it is always valid but may be not you wanted.
|
|
|
|
|
|
|
|
|
#9 |
|
Senior Member
|
Okie..It has worked perfectly. The syntax error is not occuring anymore.
I think now i just have to find the correct domain id where my information is present.. Thanks a lot for your help!! |
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 8 | March 6, 2013 11:41 |
| BlockMeshmergePatchPairs | hjasak | OpenFOAM Native Meshers: blockMesh | 11 | August 15, 2008 07:36 |
| BlockMeshmergePatchPairs polyTopoChanger | benru | OpenFOAM Native Meshers: blockMesh | 3 | June 29, 2008 21:24 |
| errors | Fahad | Main CFD Forum | 0 | March 23, 2004 13:20 |
| Problems of Duns Codes! | Martin J | Main CFD Forum | 8 | August 14, 2003 23:19 |