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

HELP!! parse error in UDF

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 11, 2012, 15:01
Default HELP!! parse error in UDF
  #1
Member
 
Fer Villa
Join Date: Apr 2012
Posts: 35
Rep Power: 5
fevi84 is on a distinguished road
I'm using the VOF model in 3D, with water (ID=2) as primary phase and air (ID=3) as secondary phase. I made a UDF for initializing volume fraction of phase air with the Taylor bubble form (a cylinder with a half sphere at the top).

#include "udf.h"

#define Xc 0.0
#define Yc 0.0
#define Zc 0.045
#define r 0.0085

DEFINE_INIT(gas_fraction_axis,mixture_domain)
{
int phase_domain_index;
cell_t c;
Thread *ct;
Domain *sd;
real X[ND_ND];

sub_domain_loop(sd,mixture_domain,phase_domain_ind ex)
{
if (DOMAIN_ID(sd) == 3)

thread_loop_c(ct,sd)
{
begin_c_loop_all (c,ct)
{
C_CENTROID(X,c,ct);
line 25 if (X[2]<=Zc && sqrt(ND_SUM(pow(X[0]-Xc,2),pow(X[1]-Yc,2)))<r)
C_VOF(c,ct)=1.;
line 27 else if (X[2]<=Zc && sqrt(ND_SUM(pow(X[0]-Xc,2),pow(X[1]-Yc,2),pow(X[2]-Zc,2)))>r)
C_VOF(c,ct)=1.;
line 29 else
C_VOF(c,ct)=0.0;
}
end_c_loop_all (c,ct)
}
}
}

When i interpret my UDF file, it says parse error in line 25, line 27 and line 29.

This UDF is similar to that appear in UDF manual FLUENT 12 page 333, but I don't know why it fails.

Someone knows the problem?

Thank you

Last edited by fevi84; May 11, 2012 at 16:39.
fevi84 is offline   Reply With Quote

Old   May 12, 2012, 10:02
Default
  #2
Senior Member
 
Join Date: Jun 2011
Posts: 108
Rep Power: 6
mali28 is on a distinguished road
You can not have

sqrt(ND_SUM(pow(X[0]-Xc,2),pow(X[1]-Yc,2)))<r)

sqrt and , in it.

If you want to have it as power, then remove this sqrt and use pow.
mali28 is offline   Reply With Quote

Old   May 14, 2012, 12:48
Default
  #3
Member
 
Fer Villa
Join Date: Apr 2012
Posts: 35
Rep Power: 5
fevi84 is on a distinguished road
Thank you mali28.

I found the error. The error is ND_SUM(pow(X[0]-Xc,2),pow(X[1]-Yc,2))), due to ND_SUM is setting for 3D. In the below expression lack the z component.

ND_SUM(x, y, z)
2D: x + y;
3D: x + y + z;

The correct expression in the line 25 is:

sqrt((pow(X[0]-Xc,2) + pow(X[1]-Yc,2)))<r

doing that, it works
fevi84 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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 06:26
UDF parse error at profile function line Wiggy Fluent UDF and Scheme Programming 1 July 27, 2009 15:59
PARSE ERROR Message when interpreting UDF in FLUENT dhimans FLUENT 0 May 24, 2009 11:40
UDF parse error on line 1 ..... (Unusual) Amit Maha FLUENT 4 June 30, 2006 12:15


All times are GMT -4. The time now is 08:41.