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

Syntax error while interpreting a simple velocity profile UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 7, 2018, 09:26
Default Syntax error while interpreting a simple velocity profile UDF
  #1
New Member
 
Pavel
Join Date: Aug 2017
Posts: 8
Rep Power: 8
Pavel Mihailovski is on a distinguished road
Hi everyone,

I am trying to interpret a UDF file. I am doing this for the first time, so right before I go with my particular problem, I tried to add this simple UDF (an example which I took from the FLuent library) just to check whether or not FLuent will recognize it.

However, after I put my file in the adequate folder, browsed it and clicked interpret file, I get the following massage:

Error: /home/pmihailovski/velocity_profile.c: line 2: syntax error.

Can you help me with this line 2: syntax error?
I am sending you the well-known example of the code right below:

Looking forward to hearing from you.
Pavel



#include "udf.h"

DEFINE_PROFILE(velocity_profile,t,i)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
face_t f;

begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5;
}
end_f_loop(f,t)
}
Pavel Mihailovski is offline   Reply With Quote

Old   February 8, 2018, 12:13
Default
  #2
Member
 
Join Date: Feb 2015
Posts: 32
Rep Power: 11
fanch33 is on a distinguished road
Hi,

did you try to compile the UDF instead of interpret it? Are you sure you have a compiler on your computer?

Fanch
fanch33 is offline   Reply With Quote

Old   February 8, 2018, 14:12
Default
  #3
New Member
 
Pavel
Join Date: Aug 2017
Posts: 8
Rep Power: 8
Pavel Mihailovski is on a distinguished road
Quote:
Originally Posted by fanch33 View Post
Hi,

did you try to compile the UDF instead of interpret it? Are you sure you have a compiler on your computer?

Fanch
No, I haven't tried, thanks for the advice. Can you suggest any compiler, and give me a brief follow up in case you are familiar with the procedure?

looking forward to hearing from you again, cheers!
Pavel Mihailovski is offline   Reply With Quote

Old   February 8, 2018, 14:17
Default
  #4
Senior Member
 
nm
Join Date: Mar 2013
Posts: 100
Rep Power: 13
nvarma is on a distinguished road
The code is fine. No syntax error.

Was this udf created on the same Linux machine? Seems like a "line ending" error.

If it was on a windows machine Dos2Unix might be of help. Or you could use notepad++ and save it with appropriate encoding.
nvarma is offline   Reply With Quote

Old   February 8, 2018, 14:20
Default
  #5
New Member
 
Pavel
Join Date: Aug 2017
Posts: 8
Rep Power: 8
Pavel Mihailovski is on a distinguished road
Quote:
Originally Posted by nvarma View Post
The code is fine. No syntax error.

Was this udf created on the same Linux machine? Seems like a "line ending" error.

If it was on a windows machine Dos2Unix might be of help. Or you could use notepad++ and save it with appropriate encoding.
I used a simple .tex document file. I am working on Windows. I'm gonna try with notepad++ and come back at you. Can you be a little bit more specific about this Dos2Unix treatment? Is it complex?

Thanks
Pavel Mihailovski is offline   Reply With Quote

Old   February 8, 2018, 14:22
Default
  #6
Senior Member
 
nm
Join Date: Mar 2013
Posts: 100
Rep Power: 13
nvarma is on a distinguished road
Here you go: https://stackoverflow.com/questions/...ion-in-notepad
nvarma is offline   Reply With Quote

Old   February 8, 2018, 14:24
Default
  #7
New Member
 
Pavel
Join Date: Aug 2017
Posts: 8
Rep Power: 8
Pavel Mihailovski is on a distinguished road
Quote:
Originally Posted by nvarma View Post
Thank you, my friend, cheers!
Pavel Mihailovski 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
3D UDF Paraboilc Velocity Profile (Can't Maintain) Sing FLUENT 12 August 7, 2017 06:25
velocity profile in a simple cylindrical flow tube Diger FLUENT 0 December 29, 2016 21:05
UDF syntax error Ratel Fluent UDF and Scheme Programming 4 May 23, 2015 05:15
3D Velocity profile for turbulent flow Kirill Fluent UDF and Scheme Programming 3 July 17, 2014 08:42
udf for velocity profile in a geometry having two inlets shubham208011 Fluent UDF and Scheme Programming 0 April 6, 2009 15:13


All times are GMT -4. The time now is 21:40.