Questions tagged [fortran]
Fortran is a general purpose programming language widely used by the scientific computing community.
165
questions
0
votes
0answers
59 views
Sparse linear solver in fortran working with REAL16
I need some (direct) sparse linear solver for fortran, which works with REAL16 data type. Any suggestions? Both Pardiso and MUMPS support only REAL8. (identical question: https://math.stackexchange....
0
votes
0answers
80 views
Fortran compiles for legacy Finite Element Fortran program (1980)
The version of Fortran used come from Montreal Ecole Polytechical in 1980.
I need a compiler for Fortran for Windows 7 or Windows 8.
0
votes
0answers
20 views
How to convert this code to scan random datas instead of binned datas?
I am new to Fortran and I am trying to write a code using random data instead of binned data in x, y, z as shown in my sample code.
...
2
votes
1answer
87 views
Best practice for ADTs in computational science with Fortran
I have been writing a software package in Fortran for solution of the Vlasov-Poisson system in 2D2V. I want this software to be useful beyond its current application (e.g. systems with different ...
1
vote
1answer
99 views
Trouble Making 3rd-Order Sympletic Integrator for Planitary N-Body Problem (A Hamiltonian System)
I am doing a solar-system simulation. I am using Ruth's 3rd order sympletic integrator to avoid the problem of Energy Drift (which I had with RK4), but the the planets quickly leave orbit, and energy ...
3
votes
1answer
52 views
Shall I use global, heap allocated array or local, stack allocated one if references to its elements are made too many times?
I actually have this data locality as a possible problem for why my fortran program runs somewhat slow. In one part of this program, I have nested loops and throughout these loops, a given section of ...
2
votes
1answer
87 views
ifort: everithing ok, but with gfortran: segmentation fault [closed]
In the following code, if I compile using ifort runs ok, but if I run it with gfortran appears the error: "Program received signal SIGSEGV: Segmentation fault - invalid memory reference."
...
1
vote
0answers
79 views
Fortune algorithm for voronoi diagram
Although there are many algorithms to construct Voronoi diagram, some of them are faster than others. Based on my knowledge Fortune algorithm is fastest for construct Voronoi diagram either in two ...
1
vote
1answer
104 views
How to debug segmentation faults in large problems?
I am sorry if this question seems like off topic or opinion based, but I was not sure how to go about it.
I am currently working on a 100k x 100k positive definite linear system and trying to solve it ...
1
vote
2answers
137 views
How to begin writing scientific codes in C++ in Trilinos or PETSC style?
My background: I have taken some courses on numerical analysis during my PhD and read a few books on the topic as well. I mostly work on low Reynolds number fluid mechanics and use boundary element ...
0
votes
1answer
100 views
Two RK4 method in one program
I want to solve this integral using RK4 by coding in Fortran:
$$R=∫1/a(t) dt → dR/dt=1/a(t) =f(t)$$
Initial point: t=0 (or a=0.001) and R=0
And I have to get a(t) by solving another ...
0
votes
0answers
51 views
Create random number generator from a top hat distribution
How would I use a random number generator to give random numbers from a top hat distribution in Fortran?
I've seen lots of information about how to make a Gaussian random number generator, but not one ...
4
votes
2answers
152 views
More stable method of back substitution?
I've been tinkering a little in Fortran (2008) and wrote the following to solve
$Rx=b$ for $R\in\mathbb{R}^{n\times n}$ upper-triangular, $x,b\in\mathbb{R}^n$.
My code looks like this:
...
-1
votes
1answer
39 views
Why does this line of code give a flat distribution?
I'm struggling to understand a line of FORTRAN code and was hoping someone on here would be able to help me out. These lines of code are meant to generate a flat distribution - I understand that GRNDM(...
0
votes
1answer
69 views
Library to solve dense linear system with GMRES
I have a fortran 90 code and I want to solve a dense linear system with GMRES. I would prefer the restarted GMRES with preconditioning. Is there some library that you know of that I could use? Now I ...
0
votes
3answers
286 views
Parallel output in ASCII-format with MPI
After some parallel computations, I need to write the results in a file and for plotting reasons, I want them in ASCII format. Because of performance issues, I want to avoid to ...
-1
votes
3answers
209 views
Solving coupled ODEs using Runge-Kutta method
I want to solve the following sets of $n$ coupled equations. Initial values of $x_{n}(t)$ and $p_{n}(t)$ are specified.
The problem is, I have an 1D lattice where every particle is bound with ...
2
votes
0answers
58 views
Processing time steps in chunks with Fortran [closed]
My PDE simulation program written in Fortran has to make about 2 million variable time steps. But with each time step it slows down more and more, so that if it initially makes 1000 time steps per ...
2
votes
1answer
200 views
Testing a block tridiagonal system of equations
In 1D problems, tridiagonal systems of equations are obtained when we use finite-difference or finite-volumes in a structured mesh. A wide solver is the TDMA algorithm here. In two-dimensional ...
2
votes
1answer
239 views
What is good practice for protecting parent scope variables in Fortran?
So I just picked up a project that is written in fortran90. I am used to coding in python and C.
What is really troubling for me is the use of subroutines in fortran90. In fortran people use ...
0
votes
1answer
227 views
How to use LAPACK function (DGELSY) in Fortran
I am trying to use Least Squares Minimization to solve a the matrix problem: b = A*x for x. The system is overdetermined, and A is a dense matrix.
In the LAPACK library, I believe the routine DGELSY ...
1
vote
2answers
208 views
Second derivative using Fornberg finite difference method
I have some discrete data, non-equispaced in $x$, $y=f(x)$.
I want to use a numerical finite difference method to calculate the second derivatives of $y$, at some point.
I am using the Fornberg ...
1
vote
1answer
198 views
Gaussian Elimination Using Fortran [closed]
I developed the code below for performing gaussian elimination in order to evaluate the determinant of a matrix:
...
0
votes
1answer
97 views
Access PETSc data in totalview?
Is it possible to view the data stored in the various PETSc data types from within totalview?
Ordinarily, PETSc types are integers which act as pointers to the actual data (obviously my understanding ...
1
vote
1answer
594 views
LAPACK equivalent on c++ , which is the best one? [duplicate]
I am following a course of computational material physics. The professor uses fortran to code and uses lapack to solve eigenvalue problems.
So far I just know c++. There is an equivalent library that ...
2
votes
1answer
617 views
A robust algorithm to sort a non-convex polygon vertices
Let v_{0},...,v_{N-1} be N points in a Cartesian xy plane defining the vertices of closed polygon (i.e. v_{N} = v_{0}).
Let P_{0}...
0
votes
1answer
119 views
Compute outward normal and surface area for 8 noded brick element in FEA
I have a cube which is divided into 8 small cubes by bisecting each edge, I am trying to find out the surface area of each of the faces and the corresponding outward normals for them. This operation ...
1
vote
1answer
370 views
How write a integration loop in fortran, leapfrog scheme to solvind PDE (advection)?
I want to resolve numerically this equation using of difference finite method with Leapfrog Scheme
$$\frac{\partial{u}}{\partial t}+ v \frac{\partial{u}}{\partial x}= 0 $$
I'm trying to write a code ...
4
votes
2answers
115 views
Analytical testing/quality control for scientific software in professional setting
I am charged with maintaining a buildserver on Teamcity which is meant to test our in house FE software. Currently our test suite consists of a list of benchmarks which run every time a commit is made ...
4
votes
1answer
173 views
Compute bilinear form with LAPACK
I need to compute a bilinear form for a set of left and right vectors
$$ w_k = \sum_{i,j} V_{ik}^*A_{ij}U_{jk},$$
where $A_{ij}\in\mathbb{R}$ and $U_{jk}, V_{ik} \in \mathbb{C}$ (Assume that all the ...
2
votes
0answers
64 views
Parallel compact schemes using the Parallal Diagonal Dominant (PDD) algorithm
I would like to use the PDD algorithm developed by Sun to solve tridiagonal matrices in parallel for the following compact finite difference scheme:
$
\begin{align}
\dfrac{1}{4}f^{'}_{i-1} + f^{'}_i +...
5
votes
2answers
276 views
Recommended language/environment for large scale semi-continuous biological models
We have a fairly large (maybe 1000 equations) differential-algebraic equation model written in ACSLX, an obsolete modelling environment similar to Modelica. The model represents the evolution of a ...
1
vote
2answers
1k views
implementation of a simple SPH example
I am currently learning the Smoothed Particle Hydrodynamics method that I need to use later in my thesis. I have studied the mathematics behind the method and I want to code a simple example to show ...
1
vote
0answers
83 views
Dealing with non-physical negative ODE solutions using ODEPACK
Hi and thank you all again. I am solving the reaction-diffusion-advection equation as follows
$ \partial_{t} n\left(t,z\right) = -\partial_{z}\left(\Phi\left(t,z\right)\right) + p\left(t,z\right) -n\...
0
votes
3answers
603 views
Why there are people that still prefer fortran 77 over new versions?
I am reading some notes from a course in numerical analysis for physical sciences and it is my impression that there are still people that prefer Fortran 77 over new version due to the implicit ...
1
vote
1answer
262 views
Bulirsch-Stoer algorithm to solve simple chemistry. Spanning long time intervals after stationarity
Hi all and thank you in advance.
I am working on a time-dependent transport-chemistry model to study the composition of planetary atmospheres.
The equations are the following
$$\frac{\partial n(z,t)}...
0
votes
1answer
177 views
implicit method (crank-Nicolson) I not understand the procedure [closed]
I'm trying to understand the passage through this equation can be written for easily solved with the fortran alghorithm in particular i don't understood the meaning of L_x and L_xx ... what (-1,0,1) ...
0
votes
1answer
145 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?
5
votes
1answer
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
1answer
206 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?
5
votes
1answer
612 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 ...
5
votes
6answers
4k 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 ...
1
vote
0answers
553 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 ...
1
vote
0answers
68 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
1answer
303 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:
...
1
vote
0answers
118 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
1answer
92 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
1answer
718 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
0answers
184 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....
0
votes
1answer
162 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
...