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

Parse error in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2016, 16:24
Default Parse error in UDF
  #1
New Member
 
Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 10
pratikddhoot is on a distinguished road
Hello everybody,

I am trying to use UDF for defining turbulence viscosity at a cell as a function of its distance from the wall.

I used syntax

real x[ND_ND];
C_CENTROID(x,c,t)
float d1 = x[0];

to find the x coordinate of every cell in the loop but I get a parse error in the float term. I tried to fix it but I am still struggling.

If anyone can help with this, please comment.

Thanks,
Pratik.
pratikddhoot is offline   Reply With Quote

Old   March 30, 2016, 18:07
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Fluent UDFs follow the ANSI C standard and variables must be declared at the start of a code block. You've called the C_CENTROID macro and then declared the variable d1. Move this declaration further up, for example:

Code:
real x[ND_ND];
float d1 = x[0];
C_CENTROID(x,c,t);
You also need to end the C_CENTROID line with a semicolon.
`e` is offline   Reply With Quote

Old   March 31, 2016, 16:06
Default
  #3
New Member
 
Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 10
pratikddhoot is on a distinguished road
Hi,

Thanks. That was very much useful.
pratikddhoot 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
A Problem of Fluent Interpreted UDF: parse error knight Fluent UDF and Scheme Programming 25 August 16, 2018 10:26
Parse error interpreting UDF mrwts Fluent UDF and Scheme Programming 2 September 14, 2015 16:45
Parse error in UDF, URGENT HELP NEEDED!!! Boris Kloser FLUENT 2 December 12, 2009 03:16
parse error with interpreting UDF ivanbuz Fluent UDF and Scheme Programming 2 August 13, 2009 18:29
udf parse error brusly FLUENT 0 February 4, 2007 22:15


All times are GMT -4. The time now is 01:37.