# Questions tagged [fortran]

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

178 questions
Filter by
Sorted by
Tagged with
0 votes
1 answer
186 views

### Parameter identification for first order ODE

I have two arrays $f(z)$ and $z$ both indexed by k and I want to solve $\frac{df}{dz}=\mu(1-f)$ to find $\mu(z)$ What would be the best numerical method to solve this equation?
• 171
6 votes
1 answer
2k views

### Loop optimization with f2py, Cython and Numba

I tried to used f2py, Cython and Numba to make a simple loop structure be faster in python. Python implementation: ...
1 vote
1 answer
272 views

### LAPACK: ZGETRF with INFO greater than zero but ZGETRI does not fail.

I am computing the inverse of a complex matrix. I execute ZGETRF but U(2,2) = 0. When I compute ZGETRI, the inverse is determined. Can I trust this inverse?
• 23
5 votes
1 answer
952 views

### Half precision in Fortran

To improve the time efficiency of my code, I'd like to test a lower precision for real number, using e.g. half precision (2 bytes). However, I'm not sure if I can do that in Fortran. After playing ...
• 76
8 votes
7 answers
7k views

### What is the difference between MATLAB and FORTRAN?

In our university some Ph.D students for computational methods prefer FORTRAN over MATLAB. I can't understand why? What is the difference between them when are used in computational methods like ...
• 167
2 votes
0 answers
570 views

### IDE for Scientific computing using Fortran [closed]

I am looking to learn Fortran for Scientific Computing, which IDE setup for this exists that supports debugging, code completion capabilities and offers granular Running time Analytics. I am ...
• 129
1 vote
0 answers
74 views

### Is MATLAB feasible for app deployment versus lower level languages [duplicate]

MATLAB/Octave is a pretty useful language for prototyping scientific computation use cases, however I would like to know if the sheer nature of being a high level language bottlenecks how fast the ...
1 vote
1 answer
415 views

### Numerical Free Fall Analysis with RK4

I am trying to calculate real speed and time in free fall of a body. I wrote a code in Fortran and I am trying to improve it by using RK4 method x=time y=total free fall Purple line using: ...
• 13
1 vote
0 answers
140 views

### Computing only the $k$ biggest eigenvalues and eigenvectors with Scalapack

Given that there are eigensolvers in Scalapack that use a divide and conquer method, is there any way we can use Scalapack functions to only compute the first $k$ dominant eigenvalues and ...
1 vote
1 answer
110 views

### Declare variable to substitute one calculate only once

Frame of the question I am currently editing an add-on module to an ocean/circulation model, which is written in Fortran. The code of the main model is quite optimized with respect to short run time (...
0 votes
1 answer
820 views

### Best books and notes for beginners in the parallel FORTRAN 90 programming

I am a PhD student and my field of study is Quantum Information and Computation in the theoretical aspect. Actually I write the computer codes/program in FORTRAN 90 which are serial codes but now I ...
2 votes
0 answers
191 views

### Mass conservation in atmospheric continuity equation numerical solution

My phd project is heavily related to numerical modeling of planetary atmospheres. In particular now I am dealing with a particular expression of the continuity equation, involving a thermodynamic flux....
• 21
0 votes
1 answer
181 views

### checksum of a distributed variable

Let say I have N computers and 2 N-by-N matrices distributed across them called A and B. Matrix A is row distributed while B is column distributed. Therefore, processor i knows ...
• 103
4 votes
0 answers
386 views

### Algorithm for face based data-structure - CFD

Good morning I'm trying to develop an unstructured CFD code to solve Euler equations in a finite-volume (cell-centered) context (learning purposes). I was able to build from a cgns file some basic ...
• 77
1 vote
2 answers
485 views

### derivative of an array

Hi I am trying to take a derivative of an array but am having trouble. The array is two dimensional, $x$ and $y$ directions. I would like to take a derivative along $x$ and along $y$ using central ...
1 vote
2 answers
436 views

### Using two computers to run one parallelized program with intel fortran [closed]

I have two computers, both with 4-cores and I am running some heavy computational stuff in one of them using Intel Parallel Studio Cluster edition. I am coding in fortran and making extensive use of ...
• 121
3 votes
1 answer
135 views

### Alternative to messy grid node indexing within multiple layers of loops

Recently,I dive into a set of somehow ancient Fortran codes and try to fully understand them. A large fraction of these codes are multiple layers of loops over many state variable dimensions, which ...
• 131
0 votes
1 answer
140 views

### 0 Hz (quite sharp) peak in FFT and division by 0

In a previous question, link, I asked about how I could most effectively do a Fourier Transform of a radial function given at certain values and which we knew the asymptotical behaviour of. The ...
• 175
1 vote
1 answer
399 views

### Does anyone have a driver for fortran DAE solver - COLDAE?

Coldae is a solver writter by U Ascher and R Spiteri, located here http://www.cs.ubc.ca/~ascher/coldae.f . It can solve upto index-2 DAEs using collocation. I am new to Fortran, and having a hard ...
4 votes
2 answers
432 views

### How to calculate efficiently and accurately the Fourier transform of a radial function in Fortran

As my question states, I want to calculate the Fourier transform $F(q)$ of a radial function $f(r)$ (defined on $[0,\infty)$ and which decays like an exponential $\exp(-Ar+b)$ at large $r$) as ...
• 175
1 vote
1 answer
245 views

### A fast I/O file format readable by Fortran, Java, PHP?

I am writing a Fortran program that does fairly light weigt computation on fairly large data files. The output must be readable by some Java-script (that i have no insight in) and preferably also by ...
0 votes
1 answer
895 views

### Fortran round-off error with floating point operations

I have simple code, which flags nodes with in region enclosed by cylinder. On implementing the code, the result is mild tilt of the cylinder observed case with $\theta=90^{\circ}$. The algorithm for ...
• 151
3 votes
1 answer
6k views

### How do I program periodic boundary conditions? [duplicate]

Hi I have a code below that solves non linear coupled PDE's given Dirichlet boundary conditions. However I need to implement periodic boundary conditions. The periodic boundary conditions are ...
• 31
1 vote
0 answers
920 views

### Generating Random Numbers in Fortran for Metropolis method

I am having a really hard time getting any kind of reliable / consistent result from my Metropolis code. I have torn it apart and am now examining just the randomness in my random number generator. I ...
• 131
1 vote
0 answers
1k views

• 201
4 votes
2 answers
3k views

### Efficently invert tiny matrix in Fortran

I have a piece of code in Fortran90 in which I have to solve both a non-linear (with the Newton-Raphson method, for which I have to invert the Jacobian matrix) and a linear system of equations. When I ...
4 votes
1 answer
404 views

### Finite element mesh software

I'm looking for a program to obtain meshes to finite element codes 2D and 3D as complete as possible, preferably in fortran 90 or C/C++. For example, softwares "Triangle" or "TetGen" generate meshes ...
• 515
2 votes
0 answers
590 views

### Molecular dynamics: Lennard-Jones forces in 2D system

As I am new to all these stuff I would like to verify whether my procedure is correct. I need to calculate the Lennard-Jones potential, potential energy of the system and the forces. The procedure ...
18 votes
1 answer
2k views

### How to Run MPI-3.0 in shared memory mode like OpenMP

I am parallelizing code to numerically solve a 5 Dimensional population balance model. Currently I have a very good MPICH2 parallelized code in FORTRAN but as we increase parameter values the arrays ...
2 votes
4 answers
733 views

### Constructing sparsity pattern of the Jacobian of a FORTRAN subroutine

I need to calculate the Jacobian matrix of a subroutine F(U). Both F and U are of size N(=O($10^5$)). Using Tapenade, I differentiated the routine in tangent mode. I cannot calculate the full Jacobian ...
• 531
0 votes
1 answer
450 views

### Efficient method to multiply floating point matrix with binary matrix and get double precision results

I have a matrix A which is of size (n2, n1) and I am multiplying it by a matrix, B, of size <...
• 2,119
2 votes
0 answers
81 views

### Fortran solver for the Sparse LSE problem

I was wondering if there is a Fortran library that contains a solver for the Sparse LSE(linear equality-constrained least squares) problem $$min_{x}\|Cx-d\|^2 \text{ subject to } Ax=b$$ where $A$ ...
• 21
1 vote
0 answers
242 views

### Differences in answers between Python and Fortran [closed]

I am translating a piece of Fortran code into Python and am testing my code with a certain test case. All the results differ with 0.04% compared to the Fortran results. This is a very small ...
• 111
1 vote
1 answer
86 views

### Shifting points in fortran

Hello I am trying to shift points which have been previously generated in the square area. I am having a trouble with some additional conditions how they should have been shifted. ...
1 vote
1 answer
648 views

### How do Fotran77 and Fortran90/95 differ in performance via present-day compilers with array manipulation?

I would like to write the most optimized program for array manipulation in Fortran (e.g. matrix multiplication of large matrices, squaring large matrices, etc.) So, using the fortran compilers on the ...