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

fluent Udf error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 15, 2014, 10:30
Question fluent Udf error
  #1
New Member
 
Jenifer
Join Date: Oct 2014
Posts: 5
Rep Power: 12
768643480 is on a distinguished road
Hi,

I ran into a problem which I can't seem to find a resolution for. I've been running FLUENT on the Linux environment recently.Now the problem that I am getting is that I can't get my UDF running.I also tried doc2unix, but still there is an error. my udf is,

#include "udf.h"
DEFINE_PROFILE(unsteady_velocity,thread,position)
{
face_t f;
real t_cycle=0.1;
real A=20.0;
real time;
begin_f_loop(f,thread)
{
real t=RP_Get_Real("flow-time")
if(t>=t_cycle)
time=(t/t_cycle-(int)(t/t_cycle))*t_cycle;
else
time=t;
if(time<=t_cycle/2.0)
F_PROFILE(f,thread,position)=A;
else
F_PROFILE(f,thread,position)=0;
}
end_f_loop(f,thread)
}

I am using ansys 14.0 fluent in Linux environment. The udf could be used in window. I had compiled my udf by vi in Linux. The error always:

cpp -I"/ansys_inc/v130/fluent/fluent13.0.0/src" -I"/ansys_inc/v130/fluent/fluent13.0.0/cortex/src" -I"/ansys_inc/v130/fluent/fluent13.0.0/client/src" -I"/ansys_inc/v130/fluent/fluent13.0.0/multiport/src" -I. -DUDFCONFIG_H="<udfconfig.h>" "/fibus/fs3/1a/cin3179/test/dbsfile/test2.c"
Error: /fibus/fs3/1a/cin3179/test/dbsfile/test2.c: line 12: syntax error.
Error: /fibus/fs3/1a/cin3179/test/dbsfile/test2.c: line 14: syntax error.

I could not find a resolution for.
Could you help to check?
Thank you very much!
768643480 is offline   Reply With Quote

Old   October 16, 2014, 05:31
Default
  #2
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27
ghost82 will become famous soon enough
Code:
time=(t/t_cycle-(int)(t/t_cycle))*t_cycle;
What is int?It is not declared.
Operator is missing betwenn (int) and (t/t_cycle).
Use {} in if blocks.
Move real t=RP_Get_Real("flow-time") to before begin_f_loop, where other variables are declared.

PS: the command is dos2unix not doc2unix

Last edited by ghost82; October 16, 2014 at 10:49.
ghost82 is offline   Reply With Quote

Old   October 16, 2014, 06:03
Default my problem has been solved and thank you!
  #3
New Member
 
Jenifer
Join Date: Oct 2014
Posts: 5
Rep Power: 12
768643480 is on a distinguished road
Quote:
Originally Posted by ghost82 View Post
Code:
time=(t/t_cycle-(int)(t/t_cycle))*t_cycle;
What is int?It is not declared.
Operator is missing betwenn (int) and (t/t_cycle).
Use {} in if blocks.
Move real t=RP_Get_Real("flow-time") to before begin_f_loop, where other variables are declared.
Thank you very much! (int) means integrate, round off number. For example, 3.4 could be 3 after int(3.4).
I have changed my program just now according to your suggestion and it passed interprete!
Thank you very much!
768643480 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
[blockMesh] blockMesh with double grading. spwater OpenFOAM Meshing & Mesh Conversion 92 January 12, 2019 10:00
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
UDF: DEFINE_CG_MOTION for vertical jump motion of an electrode! alban Fluent UDF and Scheme Programming 2 June 8, 2010 19:54
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


All times are GMT -4. The time now is 03:45.