CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   How to compile CFX user routine in Linux (https://www.cfd-online.com/Forums/cfx/153768-how-compile-cfx-user-routine-linux.html)

mabna June 3, 2015 07:30

How to compile CFX user routine in Linux
 
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?

Opaque June 3, 2015 08:55

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:


mabna June 3, 2015 08:57

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

Opaque June 3, 2015 09:05

There is no difference.. Follow the same steps.

mabna June 3, 2015 09:52

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 June 3, 2015 10:01

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 June 4, 2015 04:36

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

xyq916 April 24, 2016 22:46

how to compiler user routine
 
Quote:

Originally Posted by mabna (Post 548841)
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!

FAKHREDDINE April 27, 2016 04:28

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

honcho62 April 27, 2016 09:09

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.

xyq916 May 3, 2016 06:19

Quote:

Originally Posted by FAKHREDDINE (Post 596919)
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

Lance May 3, 2016 06:47

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.

FAKHREDDINE May 3, 2016 07:46

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

Lance May 3, 2016 07:49

Sorry, I have never used it. Have you talked to ansys support about your problems?

xyq916 May 3, 2016 08:06

Quote:

Originally Posted by FAKHREDDINE (Post 598326)
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.


All times are GMT -4. The time now is 13:42.