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

Call FORTRAN files as UDF in a Linux system

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

Like Tree3Likes
  • 1 Post By pakk
  • 1 Post By AlexanderZ
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2021, 05:58
Default Call FORTRAN files as UDF in a Linux system
  #1
New Member
 
Beatriz
Join Date: Jun 2021
Posts: 11
Rep Power: 2
azores is on a distinguished road
I'm sorry my vocabulary, but I'm new at this topics.
I have some FORTRAN files and I like to use them as source UDF files in FLUENT. The FORTRAN files calculate source terms for some equations in FLUENT and need to receive some variables from the simulation.
I am following the procedure of "ANSYS Fluent UDF Manual", section 5.4. Link Precompiled Object Files From Non-ANSYS Fluent Sources. First I tried to do a similar case of the given example (section 5.4.3), and for the "make "FLUENT_ARCH=lnamd64"" some error messages appeared, like:

"makefile: No such file or directory";
"*** No rule to make target 'makefile'";
"Failed to remake makefile 'makefile'";
"*** No targets specified and no makefile found"


If you have any idea of what might be causing this error or if you have any special documents please share with me.

Thank you,
Beatriz
azores is offline   Reply With Quote

Old   June 2, 2021, 09:29
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,915
Rep Power: 23
pakk will become famous soon enough
No answer, but if the Fortran file are not too big, it might be easier to just rewrite it in c.
azores likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   June 2, 2021, 21:17
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,762
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
looks like you don't have file called makefile in your directory

also you can try to add environment variable

Code:
make FLUENT_INC=/apps/ansys_inc/v192/fluent FLUENT_ARCH=lnamd64 -f makefile
FLUENT_INC contains the path to fluent src folder
makefile is the name of makefile (which contains the list of directives for compiler)

the file to be executed with make command looks something like this (depends on fluent version):
Code:
##
## Copyright 1987-2018 ANSYS, Inc. All Rights Reserved. 
## All Rights Reserved  
##

#----------------------------------------------------------------------#
# Makefile to call user's makfile for user defined functions.  
# Do not modify this Makefile.
#
# Usage: make "FLUENT_ARCH=arch"
# were arch is ultra, hp700, irix6r8, etc.
#
# sccs id: %W% %G%
#----------------------------------------------------------------------#
SHELL= /bin/sh
FLUENT_ARCH= unknown_arch
DIR= $(FLUENT_ARCH)/[23]*
SRC= ../../src/*.{c,h,cpp,hpp} ../../src/makefile ../../src/user.udf

all:
	for d in $(DIR); do \
	  ( \
	    cd $$d; \
		rm -rf *.{c,h,cpp,hpp}; \
	    for f in $(SRC); do \
	      if [ -f $$f -a ! -f `basename $$f` ]; then \
	        echo "# linking to" $$f "in" $$d; \
	        ln -s $$f .; \
	      fi; \
	    done; \
	    echo ""; \
	    echo "# building library in" $$d; \
	    if [ "$(USE_GCC64)" = "1" ]; then \
		echo "# using gcc64"; \
		make ARCHC=gcc64 -k>makelog 2>&1; \
	    else \
		if [ "$(USE_GCC)" = "1" ]; then \
			echo "# using gcc"; \
			make ARCHC=gcc -k>makelog 2>&1; \
		else \
			make -k>makelog 2>&1; \
		fi; \
	    fi;\
	    cat makelog; \
	  ) \
	done

clean:
	for d in $(DIR); do \
	  ( \
            if [ -f "$$d/makefile" ]; then \
	       cd $$d; \
	       make clean; \
	    fi;\
	  ) \
	done
azores likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 3, 2021, 07:25
Default ld: i386 architecture of input file is incompatible with i386:x86-64 output
  #4
New Member
 
Beatriz
Join Date: Jun 2021
Posts: 11
Rep Power: 2
azores is on a distinguished road
Thanks for your replies Pakk and AlexanderZ!

The makefile in the source directory (/libudf/src) needs to be written with low case ("makefile" and no "Makefile"). It was a stupid mistake.

But now, when I execute the command "make "FLUENT_ARCH=lnamd64"", in the libudf directory created, another error message appears. The message is the following:

"
# Linking libudf.so because of makefile user.udf udf_names.c udf_names.o test_use.o
ld -shared -lm udf_names.o test_use.o test.o -o libudf.so
ld: i386 architecture of input file `test.o' is incompatible with i386:x86-64 output
make[3]: *** [makefile:123: libudf.so] Error 1
make[3]: Leaving directory '/home/zirtaeb/Code/Coupling_Code_Fluent/test_mass_source_2D_simple/test_mass_source_2D_simple_files/dp0/FFF/Fluent/libudf/lnamd64/2ddp_node'
make[2]: *** [makefile:194: lnamd64] Error 2
make[2]: Leaving directory '/home/zirtaeb/Code/Coupling_Code_Fluent/test_mass_source_2D_simple/test_mass_source_2D_simple_files/dp0/FFF/Fluent/libudf/lnamd64/2ddp_node'
make[1]: *** [makefile:119: default] Error 2
make[1]: Leaving directory '/home/zirtaeb/Code/Coupling_Code_Fluent/test_mass_source_2D_simple/test_mass_source_2D_simple_files/dp0/FFF/Fluent/libudf/lnamd64/2ddp_node'

"

Any advice or help is greatly appreciated!
Thank you,
Beatriz
azores is offline   Reply With Quote

Old   June 3, 2021, 22:40
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 1,762
Rep Power: 28
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
is test.o your FORTRAN precompiled file?
lokks like it was compiled in other system, may be with x32 operation system, but fluent compiler uses x64 or vice versa

don't have other ideas
azores likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 4, 2021, 03:51
Default
  #6
New Member
 
Beatriz
Join Date: Jun 2021
Posts: 11
Rep Power: 2
azores is on a distinguished road
Hello again Alexander,

Yes, my fortran compiled object is test.o. I compiled the fortran code in the same machine, but using, for example, the flag "-m32". I tried to remove this flag and now no error messages appear while executing the Makefile on the libudf directory.
Thanks for your reply!
azores is offline   Reply With Quote

Reply

Tags
fluent, fortran, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem loading UDF in Linux environment hjan23 FLUENT 0 December 15, 2017 04:09
How to call FORTRAN files as UDF? Ehsan-F Fluent UDF and Scheme Programming 6 September 11, 2012 11:03
Problem of UDF using fortran programs hlsky FLUENT 0 October 12, 2011 11:07
Comparison between C/C++ and Fortran? rick Main CFD Forum 45 September 6, 2011 00:52
Dual Boot Windows and Linux and Go Open Source andyj Main CFD Forum 2 October 21, 2010 16:49


All times are GMT -4. The time now is 18:09.