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-on line containing Domain *domain

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 4, 2013, 06:12
Default Parse error-on line containing Domain *domain
  #1
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
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);
}
Ananthakrishnan is offline   Reply With Quote

Old   May 4, 2013, 06:51
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
Exchange the 3rd and 4th line.
blackmask is offline   Reply With Quote

Old   May 4, 2013, 06:56
Default
  #3
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
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

Ananthakrishnan is offline   Reply With Quote

Old   May 4, 2013, 07:22
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
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 09:49. Reason: Add one line of code
blackmask is offline   Reply With Quote

Old   May 4, 2013, 07:29
Default
  #5
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
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!!
Ananthakrishnan is offline   Reply With Quote

Old   May 4, 2013, 09:51
Default
  #6
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
Please try the modified version in my last post.
blackmask is offline   Reply With Quote

Old   May 4, 2013, 10:10
Default
  #7
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
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
Ananthakrishnan is offline   Reply With Quote

Old   May 4, 2013, 10:22
Default
  #8
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
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.
blackmask is offline   Reply With Quote

Old   May 4, 2013, 10:31
Default
  #9
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
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!!
Ananthakrishnan 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
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 08:15
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
[blockMesh] BlockMeshmergePatchPairs polyTopoChanger benru OpenFOAM Meshing & Mesh Conversion 3 June 29, 2008 22:24
errors Fahad Main CFD Forum 0 March 23, 2004 14:20
Problems of Duns Codes! Martin J Main CFD Forum 8 August 15, 2003 00:19


All times are GMT -4. The time now is 20:52.