• Jhedy Amores asked a question:
    Why do I get an array error in TopoIndex (TRIGRS), and how do I solve it?

    I am currently trying to create a landslide susceptibility map of an area using TRIGRS (a Fortran program for slope stability analysis), and running the elevation grid file along with a flow direction grid in TopoIndex (a sister program) is the first step to it. However, when TopoIndex starts to read the flow direction grid file that I provided, it shows an error message before exiting the program without producing any result. The error message goes like this:

    ? FORTRAN Runtime Error:

    ? Subscript is out of range for dimension 1 for array

    ? adr with bounds 1:255

    File ./mpfldr.f; Line 20

    This error does not show in the log file either, and I was only able to see this error message by trying to catch a screenshot of the window right before it closes. Attached is the image of the window showing the error message.

    Is there anything wrong with the flow direction grid that I made, and if so, what corrections can I do to solve the error?

  • Simon Schröder added an answer:
    Why does a code have error in Fortran Power Station 4.0 but doesn't have error in some other compilers?


    I have a code that have error in "Fortran Power Station 4.0" but it works correctly in some other compilers! However I want somebody expert in fortran to help me.


    Simon Schröder · Fraunhofer Institute for Industrial Mathematics ITWM

    I can see at least one place where there is a devision by zero.

    Have a look at line 133. Here you set phinewj to 0 (because every entry in phioldj is 0). Then in line 135 you have the devision by zero. My guess is that 0 is a bad initialization. In each iteration you start with the same values (namely 0) for phioldj. In this way your Jacobi method cannot converge (and your error will always be NaN).

    Furthermore, you should know that you are using phinewg in your function gaussidel uninitialized! This will also give random results. (BTW the method is called Gauss Seidel.)

  • Sadeem Fadhil added an answer:
    How can i link the abaqus(64-bit) and fortran ?

    I've tried all the solutions proposed but i did not succeed.
    I've used all versions of Abaqus.

    Is there a special case that I do not do?

    abaqus versions is : 6.12-3 , 6.13-1 , 6.13-4 , 6.14-1

    Fortran : intel fortran composer XE 2013

    Microsoft Visual studio 2012

    Sadeem Fadhil · Al-Nahrain University

    Dear Ehsan 

    Are you having another version of Abaqus installed in your PC even if student version?

    If so then you need to stick with one of them, even if you install student version after configuring the commercial version the subroutine test will give error after it passes previously.

    Best regards

  • How development Global Gravity Field Models like EGM96?

    I have some questions about Global Gravity Field Models (ICGFM).
    Where How to Calculate Coefficients of this model? I.e. I need the program to compute spherical harmonic analysis of EGM model.

    Dr. P. Vaníček

    Thank you very much for helping me

  • Zied Kammoun added an answer:
    How can I install GFortran from synaptic package of linux?
    Can I download it freely?

    you can also install gfortran directly from synaptic:  it is a synaptic package

  • Sarkar Noor-E-Khuda added an answer:
    How do I link Forces 2.0 Fortran complier (or Visual Studio 2013) to ABAQUS?

    I need to link Forces 2.0 Fortran complier (or Visual Studio 2013) to ABAQUS. I have only access to download these two compliers for free. Can anyone tell me how to link them to ABAQUS,


    Sarkar Noor-E-Khuda · Queensland University of Technology

    Hi Ba,

    I always used command though, I hope you can link your subroutine in CAE as well. Follow the steps, in CAE Create Job->Continue->General->User Subroutine File.

    Give it a go.


    Sarkar Noor-E-Khuda 

  • How can I run the program “ harmonic_synth_v02”?

    During compilation it generates a number of warning messages that causes compilation to fail at the position indicated below.

    error messages from compilation

    abd@abd-HP-Compaq-dc7900-Convertible-Minitower:~$ cd /home/abd/synth
    abd@abd-HP-Compaq-dc7900-Convertible-Minitower:~/synth$ gfortran harmonic_synth_v02.f

    call dhcsin(0,iuhi,kmin,kmax,0,cz,1.d0,1.d0,0,cnm,snm,egm_tf,
    Warning: Type mismatch in argument 'dc20' at (1); passed INTEGER(4) to REAL(8)

    call dhcsin(0,iuci,jmin,jmax,0,cz,1.d0,1.d0,0,cnm,snm,egm_tf,
    Warning: Type mismatch in argument 'dc20' at (1); passed INTEGER(4) to REAL(8)

    call dhcsin(0,iuhi,kmin,kmax,0,cz,1.d0,1.d0,0,cnm,snm,egm_tf,
    Warning: Type mismatch in argument 'dc20' at (1); passed INTEGER(4) to REAL(8)

    call dhcsin(0,iuci,jmin,jmax,0,cz,1.d0,1.d0,0,cnm,snm,egm_tf,
    Warning: Type mismatch in argument 'dc20' at (1); passed INTEGER(4) to REAL(8)

    I sent a Message to Dr Josef Sebera about This problem
    And he sent me a modified version of harmonic_synth_v02 that export results to ASCII. The modification is between lines 677 and 992

  • Hamidreza Radaei added an answer:
    Why LT (less than) operator in the Fortran code does not work properly?

     I have a problem in my CFD code, it doesn't work correctly.

    As can be seen in Fig, Yi (m) is equal to Yv (j+1), but when I apply:

    If (Yi (m).LT. Yv (j+1)) then


    end if

    The program gives wrong output !!!

    Hamidreza Radaei · Khaje Nasir Toosi University of Technology

    @Guillaume Ducrozet & Farzad Mohebbi

    Thanks for your answer, floating point formats are the same (single precision), but your suggestion was too valuable, I've used it useful, As you mentioned, there is a very little difference between these two variables.


  • Arthur Chapman added an answer:
    Which part of my FORTRAN program is wrong?


    I have wrote a program in FORTRAN 95 but it has an error.I do not  Which part of my program is wrong.

    Could you help me? Thanks.

    Arthur Chapman · Independent Consulting Hydrologist

    Have you tried increasing the declared integer size - integer(kind=8), or kind=16, or kind=32 or kind=64?  You might have to use "selected_int_kind(r)" to work out the size of the integer or where it is going out of bounds. 

  • Shams Joha added an answer:
    How might one fix an error with Abaqus subroutine?

    Hi everybody,

    I am working on composite material damage and its criteria so that I have to compare some of them which are not included in Ababaqus. I have chosen a simple bar damage example from a book and have tried to run it, but have faced to an error, which has been attached. I also have attached the window which demonstrates that Abaqus and Fortran are linked.

    It would be appreciated if you let me know how to fix the error.



    Shams Joha · University of Virginia

    Hi Hadi,

               How did you solve your problem? I'm kinda having similar problem. When I'm checking if Abaqus is linked with fortan compiler in the  Abaqus command window, it shows "pass" ( please see the screenshot). However, when I'm trying to run a subroutine it is showing the following error : "Problem during linking". 

    Any help will be appreciated. 



  • Negar Kamali added an answer:
    System error code 1073740940 when using UEL ?

    I'm trying to run an analysis with a simple UEL subroutine that I wrote and after compiling, linking, analyzing the input file and the subroutine suddenly it crashes with this error:

    Abaqus Error: The executable standard.exe
    aborted with system error code 1073740940.
    Please check the .dat, .msg, and .sta files for error messages if the files

    has anyone encountered this before? I can not find a bug in my code (I write out all the matrices and they're all correct) I also checked everything else that comes to my mind.

    P.S: I can run other subroutines to the completed stage

    Negar Kamali · University of Illinois at Chicago

    Thank you very much for your help. Actually when I print out my matrices and vectors, all of them are correct. I also tested it with a program in Fortran. Works fine. It seems that Abaqus can not go to the next increment, I mean the subroutine cannot return the values.  

    So for my linear static analysis, I define AMATRX,RHS and SVARS. at the end of zeroth step, these values seem fine.  I don't request any output. Yes as you stated, this error is very vague. 

    could you explain a little more about your last paragraph? I appreciate it.

  • Shawn M. Freeman added an answer:
    How can I create a Graphical User Interface for FORTRAN code?

    Hi all,

    I have developed a code using Fortan included in the Microsoft Visual Studio 2010. I would like to create a graphical user interface GUI for this code but I don`t know how to do that in easier manner.

    Could anyone please share his experience on such coding development ? is the Microsoft Visual Studio 2010 can do that or should I use other programming languages such Visual Basic, or Delphi or ... to do that ? I`m really confusing on how to start doing this and I would appreciate any suggestion and help.



    Shawn M. Freeman · Northrop Grumman

    As others have mentioned, the most practical way would be to use a language like python/Java/C#/C++/etc. to provide the GUI and either link or call your Fortran application. Those languages all provide ways to call native code and provide extensive support for GUI development.

  • Reza Barati added an answer:
    How can I develop a fast MATLAB code?


    I know that FORTAN is fast, whereas one of disadvantages of MATLAB is the problem of speed. Matlab code is interpreted during runtime. Languages like C and Fortran are faster because they are first compiled into the computer's native language.
    How can I develop a fast MATLAB code?

    Thanks for taking a look.

    Reza Barati · Tarbiat Modares University

    Other useful links:

  • Nuno Pereira added an answer:
    Am using fortran to open champ satellite data cdf files. can I get help?

    when I build the programme, I get the following errors;

    1. error 87-missing left bracket after OPEN

    2. error 431- unexpected ',' in assignment

    the programme is expected to open a cdf file with champ satellite data. I have attached the whole programme I have written for anybody who can help identify the problem

    Nuno Pereira · Polytechnic Institute of Beja

    I'm sorry...I missed the code. Only now I took a look. That's not even non-standard fortran. It looks more like a basic dialect.

  • Mohsen Mohammadi added an answer:
    Hello , how can i link Fortran and Visual Studio with Abaqus?

    I want to write a subrotine for a non-uniform heat source .

    (Abaqus version 6.13)

    thank you

    Mohsen Mohammadi · City University of Hong Kong

    I did this today for somebody and it works very nice:

    1-      Install Visual Studio

    2-      Install Intel Fortran

    3-      We must edit the “abq6101.bat” in directory of C:\SIMULIA\Abaqus\Commands as follows:

    Right click on the “abq6101.bat”edit From this :

    @echo off

    "C:\SIMULIA\Abaqus\6.10-1\exec\abq6101.exe" %*

    Edit to :

    @call "C:\Program Files (x86)\Intel\Compiler\11.1\060\bin\intel64\ifortvars_intel64.bat"

    @echo off

    "C:\SIMULIA\Abaqus\6.10-1\exec\abq6101.exe" %*

  • Behzad Ghafarizadeh added an answer:
    How can I reformat a VUMAT Subroutine for using in Abaqus?


    I plan to use a VUMAT subroutine for modeling the material damage for a fiber reinforced composite material (the notepad file is attached). I copied it in the visual Microsoft studio but it showed several errors . I appreciate if you can help me to reformatting this subroutine (pleases see the attached FORTRAN file) . 

    Thank you for your time. 

    Behzad Ghafarizadeh · École de Technologie Supérieure

    Thank you Mariusz. I used Notepad++ . It is very helpful. 

  • Hamed Sharghi added an answer:
    How can I understand FDTD code for determining of band structure of photonic crystal?

    In fact I can understand the physics of the problem.I have problem with the loops and the converting to computer programming. I use c and fortran.

    Hamed Sharghi · Payame Noor University

    Dear Felipe

    Thank you very much.



  • Alexander Nozik added an answer:
    Best way to call Fortran from Java or Python?

    I am wondering if anyone has called Fortran models from Python or Java. We are currently using a fortran scientific model that we need to call from a workflow. The native Fortran is very difficult to interface with, I thought I would ask if anyone has done it in the past. Thanks!

    Alexander Nozik · Russian Academy of Sciences

    The best way to use your fortran code from Java is to compile Fortran code into a library (depending on system architecture) and then use JNA (http://en.wikipedia.org/wiki/Java_Native_Access) framework to access it. JNA has a slight performance overhead over JNI, but it is much easier to implement.

    The direct system calls from java is possible but discouraged due to memory and security issues.

  • Waldemar W Koczkodaj added an answer:
    Does anyone have a fortran code for melting with natural convection by using lattice Boltzmann method?

    I'm trying to simulate meltig with natural convection

  • Gerard Tromp added an answer:
    Does anyone know about pedsys?

    I am going to enter pedigree data into pedsys to create a pedigree data base, I have downloaded the program and installed it, but when I try to run the program the following error is shown:

    ERROR: The environment variable PEDSYS is missing

    ? FORTRAN Runtime Error:? Format string missing opening (? WRITE(UNIT=6,...

    what should I do to solve the problem? is it about me not having Fortran? or it is because of my windows version?

    Gerard Tromp · Geisinger Health System

    That is a fortran IO error. Curiously, the program is trying  to write to STDOUT (the screen; IO unit 6) and the  format string is incorrect. Speculating that this might be a compatibility problem (very old 16-bit version to 64-bit?).

    You do not need to have fortran installed if, as on windows, you are using a compiled executable binary file. 

  • Setyawan Widyarto added an answer:
    Which is the best alternative to Matlab?
    Matlab is an excellent software, but it is commercial and its price is very high. Other alternatives are available (Octave, Scilab, Freemat, ...) but each one has pros and cons. Is there a real competitor of Matlab?
    Setyawan Widyarto · UNISEL | Universiti Selangor

    If we focus on mathematical operations there are Mathematica, Maple. If we focus on any function/toolboxes alike C++ or Java would be better. If we focus on efficiency in programming and stress on objectives of the programming, I can say Matlab is the most suitable. We may develop our own functions and also create our own toolboxes, and we may convert our scripts in executable application. More over Matlab also has Simulink.

  • Penny Rowe added an answer:
    Why are physicists stuck with Fortran and not willing to move to Python with NumPy and Scipy?

    Nowadays all of the major Fortran related numerical calculus have exactly mapped equivalent libraries in more modern language framework like Numerical Python (NumPy) and Scientific Python (SciPy). 

    What keeps physicists stuck with Fortran?



    Scientific evidence?

    Penny Rowe · NorthWest Research Associates

    There is no need to convert old code into Python because you can call fortran code directly from Python using f2py.

  • Hanifa Taher added an answer:
    Does anyone have REFPROP FORTRAN source code for calculating the properties of Carbon dioxide?

    For the stability analysis of supercritical natural circulation loop i require the REFPROP FORTRAN source code for getting the properties of carbon dioxide. If anyone is having the code pl share it.

    Hanifa Taher · United Arab Emirates University

    You can get the fluud propeetues from NIST chemistry webbook.

  • Mohamed El Naschie added an answer:
    Does anyone have a fortran code for the locally conservative Galerkin method?

    The locally conservative method with time step or with out for heat and fluid flow in one dimension (for example water is passing through a circular pipe).

    Mohamed El Naschie · Alexandria University Alexanderia Egypt

    it is Ritz method which can not be applied to noncoservative systems. Galerkin is applicable to concervative and nonconcervative alike.

  • Salah U. Hamim added an answer:
    How its write fortran code in abaqus on machining of composite? can any one suggest the which books to refer?

    I am 3D modeling machining of composite in Abaqus. But it is not working I don't know anything about how I can run.

    Salah U. Hamim · Oklahoma State University - Stillwater

    Can you elaborate the problem?

  • Samuel Bignardi added an answer:
    Does anyone know where I can find some MATLAB, Fortran, or C (free) implementation of the Thomson-Haskell Method?

    It is my goal to compare a novel seismic surface waves solver to the classic Thomson-Haskell Method. Unfortunately, I do not have the time to code the method myself.

    Does anyone know where I can find some MATLAB, Fortran, or C (free) implementation of the Thomson-Haskell Method?

    Thank you.

    Samuel Bignardi · University of Ferrara

    Dear all

    Thank You very much for all the suggestions. In the end I solved the problem extracting the needed fortran code from Herrman's routines.

  • James J Coyle added an answer:
    How can I compile a Fortran code without navigating to the source code folder?
    I have installed CYGWIN interface with a GNU fortran 77 compiler on my system.
    When I want to compile a file with this compiler I have to navigate to the folder that the source file is. The question is that how I can compile an arbitrary Fortran code from any where simply refering to its location. For more details please follow these commands that I quote from my cygwin command windows:
    farzi@farzi-PC /cygdrive/c/a
    $ dir

    farzi@farzi-PC /cygdrive/c/a
    $ g77 mytest1.f -o mytest1

    farzi@farzi-PC /cygdrive/c/a
    $ ./mytest1
    Enter number of equations (up to 1000): 5
    exact = 0.0666666667
    Max. difference was 0.000000000000% of the exact in eq. No. 1
    Solution of the linear system of 5 equations took 0.00 seconds
    Want to run again (y/n) ? : n
    The compile is successful(after navigation to the source folder in c:\a).
    However, note the following alternative:
    farzi@farzi-PC /cygdrive/c
    $ /cygdrive/c/a/g77 mytest1.f
    -bash: /cygdrive/c/a/g77: No such file or directory

    farzi@farzi-PC /cygdrive/c
    $ g77 /cygdrive/c/a/mytest1.f
    g77.exe: /cygdrive/c/a/mytest1.f: No such file or directory

    This time the g77 fails to compile the sample code.
    How I can resolve this problem?
    James J Coyle · Iowa State University

      Your example works for me,

    $ pwd

    jjc@hpc03 /home
    $ ls /cygdrive/c/cygwin/home/jjc/hello.f

    jjc@hpc03 /home
    $ g77 /cygdrive/c/cygwin/home/jjc/hello.f

    jjc@hpc03 /home
    $ ./a.exe

    The directory structure for cygwin looks

    strange, though.  I always see


    as the directory in which user's home directories are under.

      In your last command, change g77  to ls

    My guess is that you still get No such file or directory, since I believe that

    this has nothing to do with the compiler, but has something to do with the Cygwin install.

  • Ahmed Torky added an answer:
    Does Swift + Metal have potential as a scientific programming language?
    I have lots of experience using Java, C and FORTRAN for scientific programming. In Java I make heavy use of abstract classes, interfaces and generics to make my code as re-usable as possible. This has really cut down my development overhead without having too much impact on runtime. I have yet to experiment with hardware acceleration such as that offered by Cuda, which other use to good advantage, in my scientific programming (quantum dynamics of open/stochastic systems). Working mainly on Mac's the emergence of Swift and Metal provide new opportunities for scientific programming in a modern environment with fast execution.

    I have started to play with Swift and it seems promising - with the playground looking like a potentially good teaching too for my students.

    Especially from those who have experience using hardware acceleration and have benchmarked some relevant simple Swift+Metal code (e.g. matrix multiplication). I would be grateful for information of your experience or opinions on the future potential of Swift+Metal for high performance scientific simulation.
    Ahmed Torky · The British University in Egypt

    Hello Dr Mark

    I would like to point out that CUDA Fortran is available on MAC with a free license through PGI. I have used PGI's CUDA Fortran with several accelerating online libraries for a solving linear systems of equations (dense and sparse) and in some cases where there were huge clusters of data, the solution time dramatically dropped from 3 hours to a mere 10 seconds on a cheap NVIDIA GPU. It is also possible through PGI to simultaneously use C and Fortran for different parts of a larger program through the known ISO_C_Binding technique in the case you would like to call on Fortran. I suggest you give it a try. 

    I have tried making a couple of device (GPU) codes that compute certain coefficients in my scope of computational mechanics ... and I must say that altering a nested loops to parallel process is a hefty process but extremely beneficial in GFLOPs intensity once you have reached a satisfactory code meanwhile producing the exact same results you would have attained from a serial CPU code.


  • Hamidreza Moazzami added an answer:
    Where can I find kalman filter fortran code?

    I need data assimilation fortran code for wave data and specially, I want to use Kalman filter scheme.
    Here (http://enkf.nersc.no/) I found an ensemble Kalman filter code by its subroutines but I want a standard Kalman filter fortran code.

    Hamidreza Moazzami · Iran University of Science and Technology

     I have other question.

    could you please tell me about the simulation of model error in KF in the equation related to time evolution of the error covariance matrix of forecast. I mean the error in the time step. mostly it is written by Q. I dont know how to calculate it.

About Fortran

Sharing FORTRAN knowledge

Topic Followers (311) See all