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-on line containing Domain *domain (https://www.cfd-online.com/Forums/fluent-udf/117191-parse-error-line-containing-domain-domain.html)

Ananthakrishnan May 4, 2013 05:12

Parse error-on line containing Domain *domain
 
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);
}

blackmask May 4, 2013 05:51

Exchange the 3rd and 4th line.

Ananthakrishnan May 4, 2013 05:56

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

:(

blackmask May 4, 2013 06:22

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);
}

Ananthakrishnan May 4, 2013 06:29

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!!

blackmask May 4, 2013 08:51

Please try the modified version in my last post.

Ananthakrishnan May 4, 2013 09:10

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

blackmask May 4, 2013 09:22

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.

Ananthakrishnan May 4, 2013 09:31

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!!


All times are GMT -4. The time now is 22:23.