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

parse error in transient udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2010, 11:32
Default parse error in transient udf
  #1
Member
 
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16
spring is on a distinguished road
Hey guys,

when I try to interprete the following transient udf, I always get two parse errors.

Here is my UDF:


#include "udf.h" /* must be at the beginning of every UDF */

/* constants: */
#define R 8. /* inlet radius [mm] (with actual scaling in Fluent applied!) */
#define VFLOW 15. /* effective volume flow [l/min] */
#define POWER 1./7. /* 1/7 power law defining turbulent profile */
#define f 15. /* breathing frequency */
#define tidal 0.5 /* tidal volume */


DEFINE_PROFILE(unsteady_velocity,thread,index)
{
double PI;
real Umax; /* maximal inlet velocity */
real x[ND_ND]; /* this will hold the position vector every single face centroid */
real r;
real U;
real breath;
face_t f;

real t = CURRENT_TIME;

PI = acos(-1.);
Umax = pow(10.,3.)*VFLOW/PI/pow((R),2.)/49.;
breath = tidal/PI/f*sin(2*PI*f*t);

begin_f_loop(f,thread) /* loops over all faces in the thread passed
in the DEFINE macro argument */
{
F_CENTROID(x,f,thread);
r = sqrt(pow((1000*x[0]),2.)+pow((1000*x[2]),2.));
U = Umax*pow((1.-r/R),POWER);

if (breath > 0.0)
{F_PROFILE(f,thread,index) = U*breath;}
else
{F_PROFILE(f,thread,index) = 0.0;}
}
end_f_loop(f,thread)
}


The errors are in the red lines.

Errors:

Error: \UDFprofile3D_tansient.c: line 26: parse error.
Error: \UDFprofile3D_tansient.c: line 28: parse error.
Error: \UDFprofile3D_tansient.c: line 32: t: undeclared variable


I dont't know how to remove this errors, because I can't find any fault in my udf. But maybe your eyes are better than mine, and you can help me and tell me where my fault is
And I dont' think that's a problem caused be interpreting the UDF, because I've made the right steps:
1. activate "transient" under General
2. and interprete the udf as usual; Define->User Defined->Functions->Interpreted

Thank you very much in advance!

spring
spring is offline   Reply With Quote

Old   July 6, 2010, 07:26
Default
  #2
Member
 
Sarah
Join Date: Apr 2010
Location: Munich
Posts: 30
Rep Power: 16
spring is on a distinguished road
Hi,

I've found my errors. I used the variable f twice: once as a frequence and the second time in the expression face_t f. That's once too much, hehe.
I also forgot to ad an f in the expression F_CENTROID(x,thread) ...

Bye!
spring 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 11:26
parse error while interpreting udf Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43
parse error with interpreting UDF ivanbuz Fluent UDF and Scheme Programming 2 August 13, 2009 19:29
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 18:27.