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

Problem About Running Fluent In Linux

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

Reply
 
LinkBack Thread Tools Display Modes
Old   February 21, 2010, 02:37
Default Problem About Running Fluent In Linux
  #1
New Member
 
Mitra Karami
Join Date: Feb 2010
Posts: 4
Rep Power: 8
mitra 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 windows console for a while but began running it on the LINUX environment recently. Now the problem that I am getting is that I can't get my UDF running.

It ran on the windows box smoothly but the moment I switched to the LINUX box, it gives me the following error.

Error: (The directory is long so I won't copy it)/s1.cpp: line 2: syntax error
The udf I coded is extremely short and is the following:

#include "udf.h"
DEFINE_PROFILE(velocity_profile,t,i)
{
real x[ND_ND];
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];

if (y<=(0.1*0.035))
F_PROFILE(f,t,i)=1435.750179*y;
else
F_PROFILE(f,t,i)=(0.01758793970)/y;
}
end_f_loop(f,t)
}

I ran it for all my other UDFs that worked in the windows environment and still get the same error that I have a syntax error at the beginning of my code while interpreting in linux.

Has anyone experienced it?
mitra is offline   Reply With Quote

Old   March 24, 2010, 12:59
Default
  #2
New Member
 
Dimitrios Mylonas
Join Date: Apr 2009
Location: Glasgow, Scotland
Posts: 15
Rep Power: 9
Dimo is on a distinguished road
Hello,

Do you have a Compiler in Linux? If you use the same UDF from Windows to Linux, it will not be compatible.

I experienced a similar problem but I copied my UDF, opened it in the Linux Compiler/text editor (in my case it was Emacs) then saved the UDF under the same name as a .c file. After this, I set up the simulation, then when it came to interpreting ther UDF, I had no problems.

Also make sure there's no extra character appearing in the UDF when you paste it into the Linux compiler. If you see text appearing in the top, delete it and make your UDF start with # include udf.h etc...

Hope it helps!

Dimo
Dimo is offline   Reply With Quote

Old   March 26, 2010, 04:51
Default
  #3
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9
isabel is on a distinguished road
Hello,


So far I have succesfully worked in WINDOWS and now I am begining to work in LINUX. I want to interpret this simple code:




#include "udf.h"


DEFINE_PROPERTY(conductivity,c,t)
{
real k;
if (C_T(c,t) > 848.)
k = 90;
else
k = 180;
return k;
}



I opened this UDF with the text editor “Geany” and I saved it under the same name as a .c file, but when I try to interpret it in Fluent, I have the following error in the first line:


cpp -I”/home/isabel/Fluent.Inc/fluent6.3.26/src' -I”home/isabel/Fluent.Inc/fluent6.3.26/cortex/src” -I”home/isabel/Fluent.Inc/fluent6.3.26/client/src” -I”
Error: /home/isabel/Escritorio/conveccion6082linux.c: line 1: syntax error.


Do you think I need to instale other compiler. Which do you recommend me?
isabel is offline   Reply With Quote

Old   March 26, 2010, 06:49
Default
  #4
New Member
 
Dimitrios Mylonas
Join Date: Apr 2009
Location: Glasgow, Scotland
Posts: 15
Rep Power: 9
Dimo is on a distinguished road
Using another compiler might not necessary solve the problem. It could be that you have a space or some symbol somewhere in line 1 which gives you this error (in my case it was a square that was appearing when I copied the UDF from Windows to Linux, and I did not notice it until spending a few times the UDF!).

Clear all you don't need from the UDF, start with #include 'udf.h' and make sure there's no space or sign or symbol anywhere that should not be there.

It worked for me. I then opened Fluent and immediately interpreted the UDF before setting up the simulation and it worked. I hope it'll be the same for you. Let me know how it goes.

Dimo
Dimo is offline   Reply With Quote

Old   March 26, 2010, 09:45
Default
  #5
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9
isabel is on a distinguished road
I have cleared all I don't need from the UDF. Now my UDF is this:

#include "udf.h"
DEFINE_PROPERTY(conductivity,c,t)
{
real k;
if (C_T(c,t) > 848.)
k = 90;
else
k = 180;
return k;
}



and now OpenFOAM gives error in line 2

cpp -I”/home/isabel/Fluent.Inc/fluent6.3.26/src' -I”home/isabel/Fluent.Inc/fluent6.3.26/cortex/src” -I”home/isabel/Fluent.Inc/fluent6.3.26/client/src” -I”
Error: /home/isabel/Escritorio/conveccion6082linux.c: line 2: syntax error.
isabel is offline   Reply With Quote

Old   March 26, 2010, 14:12
Default
  #6
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 11
DoHander is on a distinguished road
This is a problem with end of line Windows versus Linux. A simple remedy is to use dos2unix command to transform your text, or use some advanced text editor as Editra. Example:

dos2unix your_program.c

Explanation:

On Windows any end of line is made by characters CR CL, on Unix, Linux and new Macs the end of line is composed only by CL.

Hope this will help,

Do
DoHander is offline   Reply With Quote

Old   March 31, 2010, 13:26
Default
  #7
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9
isabel is on a distinguished road
Thank you very much, DoHander. Now I can succesfully interpret my UDF using dos2unix.


Only one more question. Does anybody know what I have to do to compile my UDFs? In Windows I need a Visual C++ compiler, but in LINUX I do not know what compiler to install.

At this moment, If I try to compile a udf, I have the following error:


for d in lnx86/[23]*; do \
( \
cd $d; \
for f in ../../src/*.[ch] ../../src/makefile; do \
if [ ! -f `basename $f` ]; then \
echo "# linking to" $f "in" $d; \
ln -s $f .; \
fi; \
done; \
echo ""; \
echo "# building library in" $d; \
if [ "" = "1" ]; then \
echo "# using gcc64"; \
make ARCHC=gcc64 -k>makelog 2>&1; \
else \
if [ "" = "1" ]; then \
echo "# using gcc"; \
make ARCHC=gcc -k>makelog 2>&1; \
else \
make -k>makelog 2>&1; \
fi; \
fi;\
cat makelog; \
) \
done
# linking to ../../src/conveccion6082propiedadesvariables.c in lnx86/3d
# linking to ../../src/makefile in lnx86/3d

# building library in lnx86/3d
make[1]: se ingresa al directorio `/home/isabel/Escritorio/z/libudf/lnx86/3d'
# Generating udf_names.c because of makefile conveccion6082propiedadesvariables.c
make[2]: se ingresa al directorio `/home/isabel/Escritorio/z/libudf/lnx86/3d'
make libudf.so "CFLAGS=-fpic -shared -ansi -Wall -m32 -O " "LDFLAGS=-shared -lm -m elf_i386"
make[3]: se ingresa al directorio `/home/isabel/Escritorio/z/libudf/lnx86/3d'
# Compiling udf_names.o because of udf_names.c
cc -fpic -shared -ansi -Wall -m32 -O -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/cortex/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/client/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/tgrid/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/multiport/src -I. -c udf_names.c
# Compiling conveccion6082propiedadesvariables.o because of conveccion6082propiedadesvariables.c
cc -fpic -shared -ansi -Wall -m32 -O -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/cortex/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/client/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/tgrid/src -I/home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/multiport/src -I. -c conveccion6082propiedadesvariables.c
conveccion6082propiedadesvariables.c:1: error: expected identifier or ‘(’ before ‘/’ token
In file included from /usr/include/stdio.h:75,
from /home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/src/global.h:18,
from /home/isabel/Escritorio/Fluent.Inc/fluent6.3.26/src/udf.h:23,
from conveccion6082propiedadesvariables.c:12:
/usr/include/libio.h:332: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:364: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:373: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:493: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
isabel is offline   Reply With Quote

Old   March 31, 2010, 22:55
Default
  #8
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 11
DoHander is on a distinguished road
You need to install gcc on Linux, this is the standard C compiler on Linux. Fluent will pick this by default.

Do
DoHander is offline   Reply With Quote

Old   April 30, 2010, 08:52
Default
  #9
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9
isabel is on a distinguished road
Thank you DoHander. I have instaled gcc with the command:
sudo apt-get install gcc


I have typed dos2unix function.c before compiling but when I try to compile with fluent, I have the following error.




for d in lnx86/[23]*; do \
( \
cd $d; \
for f in ../../src/*.[ch] ../../src/makefile; do \
if [ ! -f `basename $f` ]; then \
echo "# linking to" $f "in" $d; \
ln -s $f .; \
fi; \
done; \
echo ""; \
echo "# building library in" $d; \
if [ "" = "1" ]; then \
echo "# using gcc64"; \
make ARCHC=gcc64 -k>makelog 2>&1; \
else \
if [ "" = "1" ]; then \
echo "# using gcc"; \
make ARCHC=gcc -k>makelog 2>&1; \
else \
make -k>makelog 2>&1; \
fi; \
fi;\
cat makelog; \
) \
done
# linking to ../../src/linux.c in lnx86/2d
# linking to ../../src/makefile in lnx86/2d

# building library in lnx86/2d
make[1]: se ingresa al directorio `/home/isabel/Escritorio/borrar/libudfxx/lnx86/2d'
# Generating udf_names.c because of makefile linux.c
make[2]: se ingresa al directorio `/home/isabel/Escritorio/borrar/libudfxx/lnx86/2d'
make libudf.so "CFLAGS=-fpic -shared -ansi -Wall -m32 -O " "LDFLAGS=-shared -lm -m elf_i386"
make[3]: se ingresa al directorio `/home/isabel/Escritorio/borrar/libudfxx/lnx86/2d'
# Compiling udf_names.o because of udf_names.c
cc -fpic -shared -ansi -Wall -m32 -O -I/home/isabel/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/home/isabel/Fluent.Inc/fluent6.3.26/src -I/home/isabel/Fluent.Inc/fluent6.3.26/cortex/src -I/home/isabel/Fluent.Inc/fluent6.3.26/client/src -I/home/isabel/Fluent.Inc/fluent6.3.26/tgrid/src -I/home/isabel/Fluent.Inc/fluent6.3.26/multiport/src -I. -c udf_names.c
# Compiling linux.o because of linux.c
cc -fpic -shared -ansi -Wall -m32 -O -I/home/isabel/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/home/isabel/Fluent.Inc/fluent6.3.26/src -I/home/isabel/Fluent.Inc/fluent6.3.26/cortex/src -I/home/isabel/Fluent.Inc/fluent6.3.26/client/src -I/home/isabel/Fluent.Inc/fluent6.3.26/tgrid/src -I/home/isabel/Fluent.Inc/fluent6.3.26/multiport/src -I. -c linux.c
linux.c: En la función ‘moving_arc’:
linux.c:7: error: expected expression before ‘/’ token
linux.c:8: error: expected expression before ‘/’ token
linux.c:9: error: expected expression before ‘/’ token
linux.c:10: error: expected expression before ‘/’ token
linux.c:11: error: expected expression before ‘/’ token
linux.c:16: error: expected expression before ‘/’ token
linux.c:18: error: expected expression before ‘/’ token
linux.c:19: error: expected expression before ‘/’ token
linux.c:32: error: expected expression before ‘/’ token
linux.c:33: error: expected expression before ‘/’ token
linux.c:41: error: expected expression before ‘/’ token
linux.c:42: error: expected expression before ‘/’ token
linux.c:42: error: expected expression before ‘/’ token
linux.c:43: error: expected expression before ‘/’ token
linux.c:57: error: ‘x’ no se declaró aquí (primer uso en esta función)
linux.c:57: error: (Cada identificador no declarado solamente se reporta una vez
linux.c:57: error: para cada funcion en la que aparece.)
linux.c:58: error: expected expression before ‘/’ token
linux.c:58: error: expected expression before ‘/’ token
linux.c:59: error: expected expression before ‘/’ token
linux.c:60: error: expected expression before ‘/’ token
linux.c:60: error: expected expression before ‘/’ token
linux.c:64: error: ‘b’ no se declaró aquí (primer uso en esta función)
linux.c:67: error: ‘w’ no se declaró aquí (primer uso en esta función)
linux.c:67: error: ‘L’ no se declaró aquí (primer uso en esta función)
linux.c:102: error: expected expression before ‘/’ token
linux.c:105: error: ‘tramo’ no se declaró aquí (primer uso en esta función)
linux.c:116: error: expected expression before ‘/’ token
linux.c:21: aviso: variable ‘x0’ sin usar
linux.c:19: aviso: variable ‘theta3’ sin usar
linux.c:18: aviso: variable ‘theta2’ sin usar
make[3]: *** [linux.o] Error 1
make[3]: Debido a los errores, el objetivo `libudf.so' no se reconstruyó.
make[3]: se sale del directorio `/home/isabel/Escritorio/borrar/libudfxx/lnx86/2d'
make[2]: *** [lnx86] Error 2
make[2]: se sale del directorio `/home/isabel/Escritorio/borrar/libudfxx/lnx86/2d'
make[1]: *** [default] Error 2
make[1]: se sale del directorio `/home/isabel/Escritorio/borrar/libudfxx/lnx86/2d'
isabel is offline   Reply With Quote

Old   May 3, 2010, 02:55
Default
  #10
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9
isabel is on a distinguished road
Hello everybody,

I have succesfully compiled my UDF. I followed the instructions given in the udf manual and it runs Ok. Thank you very much.
isabel is offline   Reply With Quote

Old   March 2, 2011, 06:54
Default
  #11
New Member
 
anonymous
Join Date: Jan 2011
Posts: 12
Rep Power: 7
calvin is on a distinguished road
i am facing a similar problem
m tryin to run fluent 13 on redhat lnamd64 arch
i am getting this on erroe only
make[3]: *** [udf_names.o] Error 1
can u please help me out
many thanks and best regards
calvin is offline   Reply With Quote

Old   March 2, 2011, 07:26
Default
  #12
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 9
isabel is on a distinguished road
Hello calvin,

Have you read the instructions of the udf manual? It helped me to successfully compile my udf's
isabel is offline   Reply With Quote

Old   October 15, 2014, 09:27
Default
  #13
New Member
 
Jenifer
Join Date: Oct 2014
Posts: 5
Rep Power: 3
768643480 is on a distinguished road
Quote:
Originally Posted by isabel View Post
Hello calvin,

Have you read the instructions of the udf manual? It helped me to successfully compile my udf's
Hi, I have meet the same problem as you. 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   September 1, 2015, 08:33
Default question of parallel udf
  #14
New Member
 
YUNONG
Join Date: Aug 2015
Posts: 1
Rep Power: 0
YUNONG is on a distinguished road
8.30.c
line 2 : syntax error . my udf has nothing wrong when it runs in my computer. But fluent says syntax error when the udf runs in another computer . hope get some helps .thanks
YUNONG is offline   Reply With Quote

Old   February 16, 2016, 13:07
Default convergence issue when running udf on linux
  #15
New Member
 
Quebec
Join Date: Jan 2016
Posts: 2
Rep Power: 0
syed_alizeb@live.com is on a distinguished road
hello,
1)i compiled the udf locally on linux (super-computer), the solution is converging perfectly till 0.05s (flow-time). after that solution is non-converged.

2)the exact same case is run on windows environment (personal-computer), it is converging perfecting through out the simulation.

The different between 1 and 2 is two different computers (but same number of core).

Any possible solution?
syed_alizeb@live.com 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
fluent UDF on linux machine Min-Hua Wang Fluent UDF and Scheme Programming 6 June 29, 2013 08:41
Problem running Fluent on amd64 Manfred FLUENT 10 March 23, 2013 07:47
script file for running fluent on linux cluster Worth FLUENT 2 February 9, 2012 12:31
Fluent - Linux vs Windows derick FLUENT 1 October 19, 2005 12:50
Problem using parallel Fluent Gustavo FLUENT 0 June 27, 2004 23:12


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