Fortran is a general purpose programming language widely used by the scientific computing community.

learn more… | top users | synonyms

1
vote
2answers
119 views

Newton-Raphson method fails!

I am trying to solve an equation like $R(x) = 0$, using Newton-Raphson method. To obtain the $x$ increment in each iteration I solve $dx = -(A)^{-1}\cdot R$ where $A = dR/dx$. But the convergence ...
3
votes
3answers
143 views

How to solve a Linear Matrix Equation: AX-XA=B efficiently?

recently I have been working on solving some math problems using Fortran. There occurs to me that a linear matrix equation: $$ AX-XA=B $$ where $A$ and $B$ are known $n\times n$ matrices and $X$ is ...
0
votes
0answers
35 views

how to detect planets in resonance

I make this program, i have a 2xN matrix in which the columns are the ID of planets and their period, the rows are the number of planets, for istance something like that: ...
0
votes
1answer
117 views

Parallel 2d heat equation (implicit timestepping) using MPI

I am trying to solve the time dependent heat equation with backward euler timestepping and second order space finite differences. This results in a Poisson system needing to be inverted. In serial ...
2
votes
1answer
117 views

2-body problem with Fortran 95

I am trying to implement the N-body problem using Fortran 95. Before generalizing it to N bodies, I am first trying to calculate the motion of a single orbiting body (body 2 in my code below) around a ...
1
vote
2answers
48 views

How to design a Hessian Algorithm based on Gradient Algorithm?

I have a question which I think should be pretty simple. I have written a subroutine in Fortran which will compute the Gradient at a point of the form ...
1
vote
2answers
111 views

Stop process from continuing until others have finished MPI

I am looping an array using MPI. The problem is, i think that some processes are moving onto their next iteration before other precesses have finished theirs. This is causing me problems because data ...
0
votes
0answers
82 views

How can we visualize the data in polar coordinates using openDx?

Actually I am trying to visualize data in polar coordinates using openDx but openDx always does in Cartesian coordinates i-e in box shape I want circular shape of my data. I want the data ...
1
vote
1answer
186 views

Lid driven cavity flow problem to solve with the help of projection method and use coding in fortran 90 [closed]

I want to solve Lid driven cavity flow with the help of projection method i want to make own fortran program to solve two dimensional unsteady flow. I propose to solve the equations in the following ...
4
votes
1answer
518 views

Fortran, making a more efficient bilinear interpolation

I'm trying to write an efficient bilinear (2D)-interpolation, after reading some recipes, as a fortran-mex for Matlab that is used extensively throughout a long algorithm of solar image processing, ...
2
votes
1answer
152 views

how to use lanczos code from netlib for large sparse symmetric matrix?

I want to use lanczos method to calculate the few lowest eigenvalue and eigen-vector of a large sparse symmetric matrix(~50k x ~50k). In http://www.netlib.org/lanczos/index.html I found the codes ...
5
votes
3answers
189 views

Need Fortran 77 compiler

Does anyone know a compiler for Fortran 77 available as a free download? I have pre-written 77 code from a source published in the early 90's that I just need to compile, build, and run. But I don't ...
1
vote
3answers
237 views

Eigenvectors: Mathematica vs. LAPACK dgeev

I've been using LAPACK dgeev in FORTRAN in the last months spending hours to diagonalize ~4000*4000 matrices. It takes about 2'75 hours to find eigenvalues and ...
0
votes
1answer
246 views

what is difference “DSYEV(LAPACK SUBROUTINE)” and “Lanczos”?

I am working on Fermion and Boson Hubbard Models, in which the dimension of Hilbert Spaces are quite large (~50k). Because the Hamiltonian matrix is ~50k X ~50k, to diagonalize these big sparse ...
6
votes
4answers
519 views

Learning Fortran

I was wondering what is the best way to learn how to program in Fortran ? I've been looking for books, the examples that seemed OK to me were "Fortran 95/2003 Explained" and "Fortran For Scientists ...
6
votes
1answer
305 views

Generalized Singular Value Decomposition: only compute the r largest singular values

I want to compute the Generalized Singular Value Decomposition for sparse matrices with a size of up to 1000000 x 1000000 (not necessarily square). The method is going to be used in machine learning ...
2
votes
2answers
139 views

Programming with Fortran, large eigen value problem

I use matlab/fortran to deal with some large eigenvalue problem (FEM type). For example, I use spalloc and eigs to declare and solve the problem in Matlab, could anyone give some advice on how can I ...
2
votes
2answers
98 views

MPI_Send/Recv not transmitting initial entries

Problem I'm building a simple MPI Send/Recv hello world in Fortran and am running into an odd error. I want to make sure I'm not missing anything trivial before blaming OpenMPI or gfortran. In the ...
8
votes
2answers
329 views

An Octree Code in Fortran

I am new to scientific computing. I am looking for a Fortran ( preferably f90) implementation of an Octree. My problem requires an Octree which divides my domain until there aren't more than some N ...
4
votes
2answers
126 views

How does longer simulation time affect simulation results?

I have a transient flow and solute transport simulation running using a fortran code. The final solution time is 1 day. I need the output of hydraulic head for the output time of 0.5 day. I want to ...
4
votes
2answers
1k views

F2Py with allocatable and assumed shape arrays

I would like to use f2py with modern Fortran. In particular I'm trying to get the following basic example to work. This is the smallest useful example I could ...
3
votes
1answer
329 views

Effecient CFD programming techniques

I'm trying to make highly efficient CFD programming complex for solving combustion problems. I've finished writing core which realises mathematical model, and now I'm concerned about code performance. ...
9
votes
3answers
377 views

Fortran: Best way to time sections of your code?

Sometimes while optimizing code it is required to time certain portions of the code, I have been using the following for years but was wondering if there is a simpler/better way to do it? ...
2
votes
1answer
201 views

Memory management in time-domain simulation

I develop a parallel time-domain DAE simulation software using OpenMP and Fortran 2003. The main algorithm is: ...
6
votes
5answers
228 views

Evaluate the sum

I want to evaluate the sum $$\sum_{k=1}^\infty \left(\frac{i+1}{\sqrt{2}}\right)^k\cdot k^{-\alpha}$$ where $i=\sqrt{-1}$ and $\alpha\in[\frac{3}{4},1]$ with 8 digits accuracy. If I am willing to ...
3
votes
0answers
114 views

How to accurately decompose positive semidefinite matrix and use the lower triangular part in linear equations

I have $n$ arbitrary $p\times 1$ vectors $x_i$, and $p\times k$ matrices $A_i$, and $n$ $p \times p$ positive semidefinite matrices $S_i$, where some (often most) of the $S_i$'s are same (for example ...
4
votes
1answer
357 views

Grid mapping from an unstructured triangular mesh to a regular rectangular mesh

I am modeling fracture propagation using a 2-D dynamic unstructured grid. As the fracture propagates over time, the elements move accordingly. For a given time step, I would like to interpolate the ...
10
votes
2answers
1k views

Row major versus Column major layout of matrices

In programming dense matrix computations, is there any reason to choose a row-major layout of the over the column-major layout? I know that depending on the layout of the matrix chosen, we need to ...
7
votes
2answers
1k views

Memory usage in fortran when using an array of derived type with pointer

In this sample program I'm doing the same thing (at least I think so) in two different ways. I'm running this on my Linux pc and monitoring the memory usage with top. Using gfortran I find that in the ...
4
votes
1answer
419 views

How to get sparse complex matrices from my code to PETSc efficiently

What is the most efficient way to get a complex sparse matrix from my Fortran code to PETSc? I understand that this is problem dependent, so I tried to give as many relevant details as possible below. ...
2
votes
1answer
677 views

Where is the bug in my fourth order Runge-Kutta method implementation?

I am trying to build a Runge-Kutta code to integrate the equations of motion for a simple harmonic oscillator. However, when I run the code, I only see first order improvement in the error as I ...
6
votes
3answers
603 views

How do I know if my code is being vectorized by the compiler?

As exemplified by Jed Brown's answer to Costs of lookups versus calculations, using vectorized vs non-vectorized floating point operations results in much faster code. Many modern compilers claim ...
14
votes
5answers
1k views

Parallel Scientific Computation Software Development Language?

I want to develop a parallel scientific computation software from scratch. I want some thoughts on which language to start. The program involves reading/writing data to txt files and doing heavy ...
19
votes
3answers
12k views

How should I install a Fortran compiler on a Mac? (OS X 10.x, x >= 4)

Related question: State of the Mac OS in Scientific Computing and HPC A significant number of software packages in computational science are written in Fortran, and Fortran isn't going away. A ...
12
votes
5answers
786 views

Are there open-source scientific libraries which use modern Fortran with OOP?

I've spent the last couple of months on coding a Fortran program for solving a particular PDE system (describes fluid flow/combustion). I tryed to use latest-standard Fortran and the new OOP ...
14
votes
5answers
942 views

Which package should I use to wrap Modern Fortran Code with Python?

I know of, and have used f2py2e to wrap some old Fortran 77 code, but my understanding is that it does not work with newer Fortran 95 code. I've researched what I should use, and have come across ...
12
votes
4answers
969 views

Is C slower than Fortran on the spectral norm shootout (using gcc, intel and other compilers)?

The conclusion here: How much better are Fortran compilers really? is that gfortran and gcc are as fast for simple code. So I wanted try something more complicated. I took the spectral norm shootout ...
6
votes
4answers
996 views

Are DAXPY, DCOPY, DSCAL overkills?

I have implemented CG in FORTRAN by linking it to Intel MKL. When there are statements like: (Refer Wikipedia) p=r; x=x+alpha*p r=r-alpha*Ap; or similar ...
14
votes
4answers
530 views

How do I write dimensionally agnostic code?

I often find myself writing very similar code for one, two, and three dimensional versions of a given operation/algorithm. Maintaining all of these versions can become tedious. Simple code ...
12
votes
0answers
201 views

Is there a tool out there that can generate interval extensions of Fortran (or C) functions by parsing Fortran (or C) code?

Case studies in my PhD thesis require that I have interval extensions of Fortran subroutines in CHEMKIN-II (apologies for the link; it's the best one I could find for a package no longer distributed ...
10
votes
3answers
785 views

Matrix exponential of a real asymmetric matrix with Fortran 95 and LAPACK

I recently asked a question along the same lines for skew-Hermitian matrices. Inspired by the success of that question, and after banging my head against a wall for a couple of hours, I'm looking at ...
9
votes
3answers
603 views

Matrix exponential of a skew-Hermitian matrix with fortran 95 and LAPACK

I'm just getting tucked into fortran 95 for some quantum mechanics simulations. Honestly, I've been spoiled by Octave so I've taken matrix exponentiation for granted. Given a (small, $n\leq 36$) ...
45
votes
5answers
6k views

How much better are Fortran compilers really?

This question is an extension of two discussions that came up recently in the replies to "C++ vs Fortran for HPC". And it is a bit more of a challenge than a question... One of the most often-heard ...
6
votes
2answers
267 views

Filtering a dataset to get a more uniform distribution for neural network training

I'm looking into using artificial neural networks (ANN) to predict the reaction rates in my fluid instead of solving the full system of stiff ODEs. Some people from my lab have already done some work ...
5
votes
2answers
2k views

How to set double precision values in Fortran

Recently, I've encountered a bizarre problem with FORTRAN95. I initialized variables X and Y as follows: X=1.0 Y=0.1 Later I add them together and print the ...
3
votes
2answers
441 views

How do I compile a program that contains both MPI and OPENMP

I have a fortran 90 code that distributes blocks of computations (from a matrix) to multiple nodes in a cluster using MPI, but in each node, the for loops are executed in parallel using openmp. I ...
25
votes
11answers
8k views

C++ vs Fortran for HPC

In my computational science PhD program, we are working almost exclusively in C++ and Fortran. It seems like some professors prefer one over the other. I am wondering which one is 'better' or if one ...
10
votes
2answers
2k views

How to work with function pointers in Fortran in scientific programs

Here is a typical usage of function pointers in C. I would like to do something similar in Fortran. I have some ideas, but I would like to know if there is some canonical way to do so. The function ...
8
votes
3answers
5k views

Intel Fortran Compiler: tips on optimization at compilation

I will start with my personal experience in our lab. Back in the ifort 9 and 10 days, we used to be quite aggressive with the optimizations, compiling with -O3 and processor specific flags (-xW ...
20
votes
4answers
4k views

What makes Fortran fast?

Fortran has a special place in numerical programming. You can certainly make good and fast software in other languages, but Fortran keeps performing very well despite its age. Moreover, it's easier to ...