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 with interpreting UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2009, 18:40
Default parse error with interpreting UDF
  #1
Member
 
Ivan
Join Date: May 2009
Posts: 85
Rep Power: 17
ivanbuz is on a distinguished road
This is my first UDF, and I am having trouble to interpret it into Fluent. Fluent shows the following error, but I don't know what is wrong.

Error: H:\airfoil_flow\setup_test9_UDF\time_average_press ure_coeff.c: line 23: parse error.
Error: H:\airfoil_flow\setup_test9_UDF\time_average_press ure_coeff.c: line 23: f_loop_last: undeclared variable

See below for the UDF. I am doing unsteady flow around a 3D airfoil, and want to use this UDF to calculate the time-averaged pressure coefficient on the airfoil surface.

/************************************************** **************************/
/* UDF to compute time-averaged pressure coefficient */
/************************************************** **************************/

/* be sure to allocate at least two UDM*/

#include "udf.h"

int n=0; /* number of time-step */
int zone_ID=5; /* zone ID of airfoil surface */

DEFINE_EXECUTE_AT_END(time_avr_PC)
{

Domain *domain = Get_Domain(1);
Thread *t = Lookup_Thread(domain, zone_ID);
real p_ref=0, den_ref=1.225, u_ref=21.911; /* reference pressue, reference density and reference velocity */
real q_ref=1/2*den_ref*u_ref*u_ref; /* reference dynamic pressure */
face_t f;

n++

begin_f_loop(f,t)
{
F_UMDI(f,t,0)+= F_P(f,t);
F_UDMI(f,t,1)=(F_UMDI(f,t,0)/n - p_ref)/(q_ref);
}
end_f_loop(f,t)
}




Thanks for any suggestion!
ivanbuz is offline   Reply With Quote

Old   August 13, 2009, 18:53
Default
  #2
Member
 
Ivan
Join Date: May 2009
Posts: 85
Rep Power: 17
ivanbuz is on a distinguished road
I got it. I miss the ; behind n++.

and I also fix the typo in line 25 and 26: F_UMDI to F_UDMI.

This is the new version of it.


/************************************************** **************************/
/* UDF to compute time-averaged pressure coefficient */
/************************************************** **************************/

/* be sure to allocate at least two UDM*/

#include "udf.h"

int n=0; /* number of time-step */
int zone_ID=5; /* zone ID of airfoil surface */

DEFINE_EXECUTE_AT_END(time_avr_PC)
{

Domain *domain = Get_Domain(1);
Thread *t = Lookup_Thread(domain, zone_ID);
real p_ref=0, den_ref=1.225, u_ref=21.911; /* reference pressue, reference density and reference velocity */
real q_ref=1/2*den_ref*u_ref*u_ref; /* reference dynamic pressure */
face_t f;

n++;

begin_f_loop(f, t)
{
F_UDMI(f,t,0) += F_P(f,t);
F_UDMI(f,t,1) = (F_UDMI(f,t,0)/n - p_ref)/(q_ref);
}
end_f_loop(f, t)
}


But I still have problem. Fluent shows error as following while interpreting. Anyone knows what it means?

Error: Set_Thread_Variables: wta(real)
Error Object: ((constant . 1) (profile "" ""))
ivanbuz is offline   Reply With Quote

Old   August 13, 2009, 19:29
Default
  #3
Member
 
Ivan
Join Date: May 2009
Posts: 85
Rep Power: 17
ivanbuz is on a distinguished road
I got it. it is bacause I read the case and data files into older version of fluent.
ivanbuz is offline   Reply With Quote

Reply

Tags
time average


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
Parse Error:- Interpreting UDF on remote terminal moataz.che FLUENT 1 March 7, 2017 15:13
parse error while interpreting udf Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43
UDF parse error at profile function line Wiggy Fluent UDF and Scheme Programming 1 July 27, 2009 16:59
Parse Error Message While interpreting UDF in FLUENT dhimans Fluent UDF and Scheme Programming 1 July 10, 2009 07:29
PARSE ERROR Message when interpreting UDF in FLUENT dhimans FLUENT 0 May 24, 2009 12:40


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