CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   fluent Udf error (https://www.cfd-online.com/Forums/fluent-udf/143052-fluent-udf-error.html)

768643480 October 15, 2014 09:30

fluent Udf error
 
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!

ghost82 October 16, 2014 04:31

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

768643480 October 16, 2014 05:03

my problem has been solved and thank you!
 
Quote:

Originally Posted by ghost82 (Post 514595)
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!


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