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

UDF error

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 26, 2014, 17:38
Default UDF error
  #1
New Member
 
Peter
Join Date: May 2012
Location: New York
Posts: 18
Rep Power: 6
chinaduck is on a distinguished road
Hello Everyone,
I am trying to use UDF of the Fluent to generate the wave, I have compliled the UDF file, but the following error happened:

Error: E:\wave.c: line 41: parse error.
Error: E:\wave.c: line 77: parse error.
Error: E:\wave.c: line 82: parse error.



Could anyone give me some suggestions:

/************************************************** *********************/
/* Solitary Wave.c */
/* UDF for specifying a transient velocity profile boundary condition */
/* for a transitional water depth linear wave theory wave */
/************************************************** *********************/
#include "udf.h"
#define GRAV 9.81
#define H 0.2
#define D 1.0
DEFINE_PROFILE(x_velocity, thread, position)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
real ELE;
real C;
real ratio;
real XX;
real xc;
real AA,BB,CC,DD,LL; /* y=position vector, AA,BB,etc are temporary stores */
face_t f;
begin_f_loop(f, thread)
{
real t = RP_Get_Real("flow-time");
F_CENTROID(x,f,thread);
y = x[1];
ratio = H/D;
xc = 200.;
C = pow( GRAV * D,0.5) * pow( ( 1. + ratio -1./20.* pow(ratio,2) -3./70.* pow(ratio,3.) ), 0.5 );
XX = xc - C * t;
ELE = H * pow ((1./cosh(pow(3./4.*ratio,0.5) * XX/D)),2.);
LL = ELE + D;
if (y <= LL)
AA = ratio + 3. * pow (ratio,3) *( 1./6. - 0.5*pow (y/D,2.));
BB = AA * ELE/H;
CC = pow(ratio,2.) * (7./4. - 9./4.* pow(y/D,2.)) * pow(ELE/H,2.);
DD = (BB - CC) * pow(GRAV * D, 0.5);
F_PROFILE(f,thread,position) = DD;
else
F_PROFILE(f, thread, position) = 0;
}
end_f_loop(f, thread)
}

DEFINE_PROFILE(y_velocity, thread, position)
{
{
real x[ND_ND]; /* this will hold the position vector */
real y;
real ELE;
real C;
real ratio;
real XX;
real xc;
real AA,BB,DD,LL; /* y=position vector, AA,BB,etc are temporary stores */
face_t f;
begin_f_loop(f, thread)
{
real t = RP_Get_Real("flow-time");
F_CENTROID(x,f,thread);
y = x[1];
ratio = H/D;
xc = 200.;
C = pow( GRAV * D,0.5) * pow( ( 1. + ratio -1./20.* pow(ratio,2.) -3./70.* pow(ratio,3.) ), 0.5 );
XX = xc - C * t;
ELE = H * pow ((1./cosh(pow(3./4.*ratio,0.5) * XX/D)),2.);
LL = ELE + D;
if (y <= LL)
AA = pow(3.*ratio,0.5) * y/D * ELE/D * tanh(pow(3.*ratio/4.,0.5) * XX/D);
BB = 1. + 0.5 * ratio* (1. - 7.*ELE/H - pow(y/D,2.)*(1.-3.*ELE/H));
DD = AA * BB * pow( GRAV * D, 0.5);
F_PROFILE(f,thread,position) = DD;
else
F_PROFILE(f, thread, position) = 0;
}
end_f_loop(f, thread)
}
chinaduck is offline   Reply With Quote

Old   June 26, 2014, 17:40
Default Addition:
  #2
New Member
 
Peter
Join Date: May 2012
Location: New York
Posts: 18
Rep Power: 6
chinaduck is on a distinguished road
The code file only contain 81 lines, while the error shows that 82 line also. This is strange to me.

ChinaDuck
chinaduck is offline   Reply With Quote

Old   June 27, 2014, 05:55
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 943
Rep Power: 13
pakk will become famous soon enough
You say you are compiling, but it looks like you are interpreting...
pakk is offline   Reply With Quote

Old   June 27, 2014, 08:26
Default
  #4
New Member
 
Peter
Join Date: May 2012
Location: New York
Posts: 18
Rep Power: 6
chinaduck is on a distinguished road
Quote:
Originally Posted by pakk View Post
You say you are compiling, but it looks like you are interpreting...
Yes, You are right, I interpreted it. The errors locate at the two "else". I don't know how to correct this. Thanks for your reply.

ChinaDuck.
chinaduck is offline   Reply With Quote

Old   June 27, 2014, 08:29
Default
  #5
New Member
 
Peter
Join Date: May 2012
Location: New York
Posts: 18
Rep Power: 6
chinaduck is on a distinguished road
Quote:
Originally Posted by pakk View Post
You say you are compiling, but it looks like you are interpreting...
I have corrected this code and it can be run now. Thanks again!


ChinaDuck
chinaduck 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
Undeclared Identifier Errof UDF SteveGoat Fluent UDF and Scheme Programming 7 October 15, 2014 07:11
an error in Calculator's equation immortality OpenFOAM Paraview & paraFoam 11 September 3, 2013 16:18
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 02:32
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


All times are GMT -4. The time now is 14:07.