CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Parse error in udf

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2004, 03:22
Default Parse error in udf
  #1
Karthick
Guest
 
Posts: n/a
Hello all

I am repeatedly getting Line 1: Parse error when I try to execute my udf in interpreted mode.

Is anybody having any idea about it?

How can I get rid off?

Regards Karthick
  Reply With Quote

Old   March 30, 2004, 04:41
Default Re: Parse error in udf
  #2
thomas
Guest
 
Posts: n/a
post your udf !
  Reply With Quote

Old   March 30, 2004, 05:41
Default Re: Parse error in udf
  #3
Karthick
Guest
 
Posts: n/a
This is my udf. I am trying to add the velocity values of each cell with values given in the datafilenew.dat file

#include "udf.h" DEFINE_ADJUST(my_adjust,d) {

Thread *t;

cell_t c;

FILE *fp=NULL;

real uturb=0.;

float arr[500];

int i=0;

fp=fopen("datafilenew.dat","r");

while (!feof(fp))

{

fscanf(fp,"%f",&arr[i]);

i++;

}

fclose(fp);

i=0;

thread_loop_c(t,d)

{

begin_c_loop(c,t)

{

C_U(c,t)=C_U(c,t)+arr[i];

i++;

}

end_c_loop(c,t)

} } Regards Karthick
  Reply With Quote

Old   March 30, 2004, 07:00
Default Re: Parse error in udf
  #4
Andrew Garrard
Guest
 
Posts: n/a
I am not an very experinced in these funcitons, but I almost always find a Parse error is due to a forgotten ; somewhere, although I coudn't see any in your UDF. Is there a problem with this line?

while (!feof(fp))

What is it's funcitons. Should a while not contain a conditioal statement, like < or ==?

Sorry I coudn't be more help.
  Reply With Quote

Old   March 30, 2004, 07:02
Default Re: Parse error in udf
  #5
Andrew Garrard
Guest
 
Posts: n/a
Another thought? do you need this header file at the top of your UDF to access the file functions?

#include "fstream.h"
  Reply With Quote

Old   March 30, 2004, 07:42
Default Re: Parse error in udf
  #6
Karthick
Guest
 
Posts: n/a
Hello

I've tried the udf after including fstream.h file. But again the error is coming. Also while(!feof(fp)) is correct i.e., the loop will go into the file till the eof is reached(end of file).

The thing is I am having a dat file which contains some numbers. I have to take each number and store it in a array till eof is reached. Is anyothe way of doing it?

Regards Karthick
  Reply With Quote

Old   March 30, 2004, 12:35
Default Re: Parse error in udf
  #7
Fluenter
Guest
 
Posts: n/a
Sure the path of your udf file is right. I suggest you use full path.
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


All times are GMT -4. The time now is 05:10.