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

How to compile CFX user routine in Linux

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 3, 2015, 07:30
Default How to compile CFX user routine in Linux
  #1
New Member
 
Join Date: Apr 2015
Posts: 7
Rep Power: 10
mabna is on a distinguished road
Hello,

I am trying to compile a user routine (pt_erosion.F) on a linux cluster. I have installed intels fortran compiler ifort and gfortran. Right now the fortran script is not modified.

I have added the path to the include folder (installed in <ANSYS install dir>/CFX/include) to $PATH

However, when I am running "ifort pt_erosion.F" it gives the following output
pt_erosion.F(1): #error: can't find include file: cfx5ext.h
pt_erosion.F(37): #error: can't find include file: cfd_sysdep.h
pt_erosion.F(38): #error: can't find include file: cfd_constants.h
pt_erosion.F(114): #error: can't find include file: cfd_sysdep.h
pt_erosion.F(115): #error: can't find include file: cfd_constants.h

Do any of you have any idea how to solve this problem?
mabna is offline   Reply With Quote

Old   June 3, 2015, 08:55
Default
  #2
Senior Member
 
Join Date: Jun 2009
Posts: 1,799
Rep Power: 31
Opaque will become famous soon enough
Have you done the HVAC tutorial provided by ANSYS CFX ?

Have you read the documentation regarding creation of shared libraries ?

Quote:

CFX-Solver Modeling Guide
Chapter 18: User Fortran | 18.3. Shared Libraries |
18.3. Shared Libraries 18.3.2. Compiling User Fortran for ANSYS CFX 16.0 on Windows
Prev Next
18.3.1. Creating the Shared Libraries

A script called cfx5mkext is used to create shared libraries. You can run cfx5mkext -help for information on the arguments accepted by the script. To create the shared libraries, run at the command line:
Opaque is online now   Reply With Quote

Old   June 3, 2015, 08:57
Default
  #3
New Member
 
Join Date: Apr 2015
Posts: 7
Rep Power: 10
mabna is on a distinguished road
I have had a look at it, however, I don't seem to know what to do in the linux environment (new to that). I have successfully compiled a windows version of the user routine
mabna is offline   Reply With Quote

Old   June 3, 2015, 09:05
Default
  #4
Senior Member
 
Join Date: Jun 2009
Posts: 1,799
Rep Power: 31
Opaque will become famous soon enough
There is no difference.. Follow the same steps.
Opaque is online now   Reply With Quote

Old   June 3, 2015, 09:52
Default
  #5
New Member
 
Join Date: Apr 2015
Posts: 7
Rep Power: 10
mabna is on a distinguished road
So on windows when I want to compile the file (after adding all the paths and so on) I first navigate to the intel compiler folder and use "ifortvars.bat intel64"

-first problem: there is no ifortvars.bat (obviously since it is for windows right?) but a .sh and .csh. When I run "ifortvars.sh intel64" for example -bash states ifortvars.sh command is not found. What to do about that?

On windows I compile by saying "cfx5mkext -64bit pt_erosion.F". but again -bash can not find the command, here cfx5mkext. And that makes sense since I haven't started ifortvars.sh intel64 right?

I am very sorry if I ask stupid questions, however, I don't seem to be able to figure out this from the ANSYS help
mabna is offline   Reply With Quote

Old   June 3, 2015, 10:01
Default
  #6
New Member
 
Join Date: Apr 2015
Posts: 7
Rep Power: 10
mabna is on a distinguished road
I have tried running ifortvars.sh by the command "sh ./ifortvars.sh intel64" (right way to execute programs in linux?), but I get the following errors

./ifortvars.sh: line 10: syntax error near unexpected token `newline'
./ifortvars.sh: line 10: `PROD_DIR=<INSTALLDIR>'
mabna is offline   Reply With Quote

Old   June 4, 2015, 04:36
Default
  #7
New Member
 
Join Date: Apr 2015
Posts: 7
Rep Power: 10
mabna is on a distinguished road
Okay, it seams I have gotten this wrong all the time.

First of all pt_erosion.F and cfx5mkext.ccl needs to be in the same directory. With the intel compiler installed, the following command will compile (for 64 bit architecture) the user routine

/<ANSYS instal dir>/CFX/bin/cfx5mkext -64bit pt_erosion.F
mabna is offline   Reply With Quote

Old   April 24, 2016, 22:46
Default how to compiler user routine
  #8
New Member
 
Bruce Xiao
Join Date: Jan 2015
Posts: 26
Rep Power: 11
xyq916 is on a distinguished road
Quote:
Originally Posted by mabna View Post
Okay, it seams I have gotten this wrong all the time.

First of all pt_erosion.F and cfx5mkext.ccl needs to be in the same directory. With the intel compiler installed, the following command will compile (for 64 bit architecture) the user routine

/<ANSYS instal dir>/CFX/bin/cfx5mkext -64bit pt_erosion.F
Hi, mabna, Are you resolve this problem? I am trying to compile a user routine (Tutorial Chapter 19 Air Conditioning Simulation TStat_Control.F) on a linux cluster. I have installed intels fortran compiler ifort and gfortran. I use the follow command to compiler: cfx5mkext TStat_Control.F
A folder named "linux-amd64" was created. There have two files named "libTStat_Control.so" and "libTStat_Control.o" in the folder. But when I run HVAC.def I get a dialog box and the follow error. For details of my problem:
http://www.cfd-online.com/Forums/cfx...ubroutine.html
Please forgive me for a stupid questions I want to ask. What is the step to compiler a user Fortran routine in Linux. Can you help me? Thanks!
xyq916 is offline   Reply With Quote

Old   April 27, 2016, 04:28
Default
  #9
Member
 
Yuva
Join Date: Oct 2015
Location: Korea Rep of
Posts: 33
Rep Power: 10
FAKHREDDINE is on a distinguished road
Hello
I hope you can answer me on this
I have a problem I do not know how to install FORTRAN on Linux
Thank you very mush
FAKHREDDINE is offline   Reply With Quote

Old   April 27, 2016, 09:09
Default
  #10
Member
 
Join Date: Jan 2016
Posts: 34
Rep Power: 10
honcho62 is on a distinguished road
you should have fortran installed, check by typing 'gfortran --version' in your terminal. If you have none, there are plenty of ways you can find online on how to install it. Be sure to check out the tutorials in CFX manual though, as shown here you need cfx5mkext to compile it, aliases can be useful here.
honcho62 is offline   Reply With Quote

Old   May 3, 2016, 06:19
Smile
  #11
New Member
 
Bruce Xiao
Join Date: Jan 2015
Posts: 26
Rep Power: 11
xyq916 is on a distinguished road
Quote:
Originally Posted by FAKHREDDINE View Post
Hello
I hope you can answer me on this
I have a problem I do not know how to install FORTRAN on Linux
Thank you very mush
Thanks everyone!
This problem have been solved by myself. I unstall Intel Fortran Compiler (or you can also delete the environment varibles of Intel Fortran Compiler). Then,
I copy the file "cfx5mkext.ccl" to the working directory. And then add the Portland Group compiler flag "-Bstatic_pgi" to every line which starts with "ext link ldflags =" in cfx5mkext.ccl. See CFX tutorials "Compiling User Fortran for use on Linux Machines Without a Compiler Installation" for more details
xyq916 is offline   Reply With Quote

Old   May 3, 2016, 06:47
Default
  #12
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Note that Ansys dropped support for all Fortran compilers except Intel with release 17. I believe that Intel Fortran v15.0.2 is the current supported version.
Lance is offline   Reply With Quote

Old   May 3, 2016, 07:46
Default
  #13
Member
 
Yuva
Join Date: Oct 2015
Location: Korea Rep of
Posts: 33
Rep Power: 10
FAKHREDDINE is on a distinguished road
Thank you very much for your answer
Do you have any idea about the Real Gas Property table model ?
I am using it but the Ansys CFX can not read it On Linux
FAKHREDDINE is offline   Reply With Quote

Old   May 3, 2016, 07:49
Default
  #14
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Sorry, I have never used it. Have you talked to ansys support about your problems?
Lance is offline   Reply With Quote

Old   May 3, 2016, 08:06
Default
  #15
New Member
 
Bruce Xiao
Join Date: Jan 2015
Posts: 26
Rep Power: 11
xyq916 is on a distinguished road
Quote:
Originally Posted by FAKHREDDINE View Post
Thank you very much for your answer
Do you have any idea about the Real Gas Property table model ?
I am using it but the Ansys CFX can not read it On Linux
Sorry, I do not know about the "Real Gas Property table model ". I suggest you search "Real Gas Property" in CFX tutorial. Maybe you can get some usefull infortmation about this problem.
xyq916 is offline   Reply With Quote

Reply

Tags
compile, fortran, linux, pt_erosion, user routine

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
User Fortran with CFX 14.5.7 on winnt_amd64 HLo CFX 22 December 13, 2015 08:26
How to get vertex(node) number in CFX user Fortran.. flyply CFX 4 February 4, 2014 19:51
CFX in linux red hat does wrok timguo CFX 3 January 28, 2014 02:51
CFD Short Course & CFX User Day Chris Reeves CFX 0 September 11, 2000 08:53
CFX User Subroutine Archive David Creech Main CFD Forum 0 March 17, 1999 12:41


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