Questions tagged [fortran]

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

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?
Goods's user avatar
  • 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: ...
Erik Kjellgren's user avatar
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?
N Luis's user avatar
  • 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 ...
Matthieu's user avatar
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 ...
MohammadSh's user avatar
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 ...
anuvaramban's user avatar
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 ...
fibonachoceres's user avatar
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: ...
Eray Xx's user avatar
  • 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 ...
Yacine E.Faris's user avatar
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 (...
daniel.heydebreck's user avatar
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 ...
pranay barkataki's user avatar
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....
Juanlu's user avatar
  • 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 ...
user1824346's user avatar
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 ...
LM_O's user avatar
  • 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 ...
AppleblueberryCrumb's user avatar
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 ...
phdstudent's user avatar
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 ...
zlqs1985's user avatar
  • 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 ...
mwoua's user avatar
  • 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 ...
Chintan Pathak's user avatar
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 ...
mwoua's user avatar
  • 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 ...
Jonatan Öström's user avatar
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 ...
SKPS's user avatar
  • 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 ...
Jeff's user avatar
  • 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 ...
Joseph's user avatar
  • 131
1 vote
0 answers
1k views

Heat equation from implicit scheme with Neumann B.C

To solve the heat equation from implicit scheme subject to Neumann boundary condition we can write: $$ T_i^{j+1}-T_i^{j}=\alpha (T_{i+1}^{j+1}-2T_{i}^{j+1}+T_{i-1}^{j+1}) $$ $$ \textbf{A} T^{n+1} = T^...
Abolfazl's user avatar
  • 111
6 votes
1 answer
183 views

How to compare runtimes of two algorithms in a reproducible way

I am solving one relatively simple problem with two different algorithm: one which uses brute force while the other is optimized. For a variety of reasons I actually cannot show the codes here but I ...
solalito's user avatar
  • 337
0 votes
2 answers
498 views

efficient MPI collective non-blocking communication

I am facing a problem with MPI (Fortran). I have a really big matrix at each node and they differ at different nodes. At some point of my calculations, each node needs the matrix from all other nodes, ...
Katuru's user avatar
  • 19
2 votes
2 answers
184 views

what is the best way to code a formula to reduce roundoff error

I have an expression like the following (anyway to input latex?), $$ z^{m}\left( \ln\left(\frac{z}{z-1}\right)-\sum_{k=1}^m \frac{z^{-k}}{k} \right)$$ for m integer, z complex It seems if I code it ...
bsmile's user avatar
  • 21
2 votes
2 answers
664 views

Solve $AX=B$ where $A$ is a skyline matrix

Solve a matrix equation of the type $AX=B$, where $A$ is an $n \times n$ symmetric matrix stored in the form of symmetric skyline matrix. With the solution given by Bill and some more research on ...
Chaitanya Krishna's user avatar
1 vote
1 answer
1k views

Skyline solver for AX=B where A is symmetric skyline matrix

I am looking for a simple subroutine in Fortran 90 (GNU Compiler) to solve linear equation of the type $AX=B$, where $A$ is an $n\times n$ symmetric matrix stored in the form of symmetric skyline ...
Chaitanya Krishna's user avatar
5 votes
3 answers
1k views

What do C, C++ and Java have that Fortran 2003 don't? [closed]

As you may know, Fortran is widely and longly (?) used in science. I've heard a lot of people saying that we natural scientists should all migrate to C++ or Java. I've seen people increasingly ...
Leonardo Castro's user avatar
2 votes
1 answer
77 views

Is it common or to use objects for calculation of pair interactions in physics and chemistry simulations?

When simulation atoms, molecules, colloids, autc., are there programs that define each interacting unity as an object in the OOP sense? In my own case, I've been simulating magnetic nanoparticles in ...
Leonardo Castro's user avatar
9 votes
2 answers
1k views

Library with polylogarithm function [duplicate]

I am looking for a reliable library where I can find polylogarithm function and newton/secant method for solving non-linear equations. Basically I have something like this: ...
Bociek's user avatar
  • 191
7 votes
1 answer
4k views

computing turbulent energy spectrum from isotropic turbulence flow field in a box

I have my 3 dimensional velocity flow-field u, v and w at a given instant of time from DNS using pseudo-spectral method. I need to calculate the energy spectrum ( in Fourier space ) as a function of ...
user4557934's user avatar
6 votes
1 answer
1k views

Meshing options to generate number of the sides of and element (tetgen-triangle)

I wrote a finite element code in fortran 90. This code is really fast, except the meshing process. I used triangle and tetgen for meshing in 2D and 3D, respectively, so this process is fast, of ...
yemino's user avatar
  • 515
7 votes
2 answers
14k views

Linear interpolation in Fortran

Is there a Fortran subroutine which performs linear interpolation in one-dimenional data? I need something similar to MATLAB function interp1.
kyperros's user avatar
  • 139
1 vote
0 answers
194 views

ARPACK- Reverse Communication Interface [closed]

I am trying to use ARPACK to diagonalize a sparse Hermitian matrix. My program is executing without error but returning incorrect eigenvalues. I have tried to trace the problem back. The work is ...
user1234's user avatar
7 votes
2 answers
2k views

Finite element library in fortran

I want to create a finite element code in fortran. There are many libraries out there on internet. Can someone suggest me a good finite element library in fortran? I am looking for Ease of use (...
343_458's user avatar
  • 171
0 votes
1 answer
662 views

Comm argument on MPI_Reduce in FORTRAN giving unusual results

I'm putting together a very simple integration program in FORTRAN using MPI. I have done this with C and all was well. However, in my "MAP_REDUCE" call, the comm argument seems problematic. I have ...
user1544953's user avatar
7 votes
4 answers
3k views

Fortran code for Ewald summation

I am trying to write a code to calculate the potential and forces, for the same using ewald summation.For this purpose, the formula for potential and force I have used is : $$ U = U^{(r)} + U^{(k)} +...
user35952's user avatar
  • 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 ...
user2078621's user avatar
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 ...
yemino's user avatar
  • 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 ...
Beginner in fort's user avatar
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 ...
Franklin Betten's user avatar
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 ...
0b1100001's user avatar
  • 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 <...
drjrm3's user avatar
  • 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$ ...
Patrick's user avatar
  • 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 ...
Jonny's user avatar
  • 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. ...
Beginner in fort's user avatar
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 ...
ShanZhengYang's user avatar