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

Syntax error when interpreting UDF file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 19, 2018, 04:10
Question Syntax error when interpreting UDF file
  #1
New Member
 
hanis izzati
Join Date: Oct 2018
Posts: 6
Rep Power: 8
hanis_iz is on a distinguished road
Hello,
I'm using UDF in my simulation to achieve the actual velocity profile at the inlet (3D case). When I tried to interpret my UDF file in FLUENT, an error as below occurred.

Error: /home/m_shinohara/UDF2.c: line 4: syntax error.

I don't know how to fix the error since this is my very first time using UDF.
Here is my UDF file:

PHP Code:
#include "udf.h"
#define Q 3.3e-5  //unit m3/sec
#define Diameter 4.9e-3  //unit m
DEFINE_PROFILE(axialVelocity,t,i)
{
    
real x[ND_ND];
    
real r,Area;
    
face_t f;
    
Area=(M_PI/4.0)*pow(Diameter,2);
    
begin_f_loop(f,t)
    {
        
F_CENTROID(x,f,t);
        
r=sqrt(pow(x[0],2)+pow(x[1],2));
        
F_PROFILE(f,t,i)=(2.0*Q/Area)*(1-pow(2.0*r/Diameter,2));
    }
    
end_f_loop(f,t)

I'm very glad if someone could help me to solve his problem.
Thank you in advance.
hanis_iz is offline   Reply With Quote

Old   October 20, 2018, 13:55
Default
  #2
Member
 
mohamed
Join Date: Apr 2016
Posts: 34
Rep Power: 10
moh_zain is on a distinguished road
sheck line 4


Area=(M_PI/4.0)*pow(Diameter,2);
M_PI and pow(diameter,2)

M_PI AND DIAMETER define them
moh_zain is offline   Reply With Quote

Old   October 21, 2018, 01:30
Default
  #3
New Member
 
hanis izzati
Join Date: Oct 2018
Posts: 6
Rep Power: 8
hanis_iz is on a distinguished road
Thank you for your suggestion, mohamed. I'll be sure to try it.
hanis_iz is offline   Reply With Quote

Old   October 21, 2018, 02:07
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
The "//" is C++ comment syntax. You should use c comment syntax "/* */".
blackmask is offline   Reply With Quote

Old   October 21, 2018, 02:12
Default
  #5
New Member
 
hanis izzati
Join Date: Oct 2018
Posts: 6
Rep Power: 8
hanis_iz is on a distinguished road
Hi, blackmask. Thank you for the information.
I'll fix my UDF file
hanis_iz 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
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 19:13
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 07:47
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


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