Obtaining clock time using Fortran

to get the current time in Fortran, we can use “system_clock” built-in function. To do this, take a look at the code below.

integer::count_0,count_rate,count_max, walltime, tstart,tend
call system_clock(count_0,count_rate,count_max)
tstart=count_0/count_rate
write(*,*) ‘begin (system_clock)’,tstart

To find out how long your program has run, add a similar line and save the time to, for example “t_end” variable, and get the difference. It will [...]

Debugging OpenMP fortran code

As the code becomes parallel, the complexity increases. One of the common problem in parallel code is data race. To debug this problem, I encounter that Intel’s Thread Checker to be a good software. You can download from the Intel’s website for evaluation. I found about this when I read this article
When I run [...]

VTK error reading ascii data! when writing using Fortran

I write a fortran code and save the data in VTK legacy format with structured points. However, for certain data somehow Paraview and Mayavi are unable to read the VTK file. It gives a “Generic Warning”, and says that
Error reading ascii data!
After days of debugging, it turns out that the cause is my precision, I [...]

How to embed fonts when using pdflatex and gnuplot

IEEE require that PDF documents are created with embedded fonts. To do this, run

$ updmap –setoption pdftexDownloadBase14 true

And then run pdflatex again. To check whether it is embedded, run pdffonts on to the newly created pdf. You will see something like this.

$ pdffonts draft_isic2009_1.pdf
name [...]

Installing Octave 3.2.3 in Kubuntu Hardy

Octave has released a major version 3.2 and now the latest bug fix release is 3.2.3. I decided to install it. What I did was to download the tarball from www.octave.org and then unzip it. After that, I run the configure:

./configure –prefix=$HOME/Programs/Octave-3.2.3

where the prefix defines the location where to install the new version of octave. [...]

Debugger for Fortran in Linux

I have been trying to search for a good debugger for Fortran code in Linux. But it is very hard to find. I know that GDB is supposed to be able to do it. But when I debug Fortran 95 code compiled using GFortran, I simply don’t know how to display the dynamic size array. [...]

2D plot of filled contour with Plplot libraries using plshades

In the previous post, we show how to plot 2D data with plcont. It plots the line contour. Now, how about if we want something more colorful? we can use a filled contour plot with the command plshade. The syntax is similar. But first, let’s look at the complete program.

program simple
use plplot
implicit none
real(plflt),dimension(6) :: x,y
real(plflt),dimension(6,6)::z,x2d,y2d,z2
real(plflt)::xmin,xmax,ymin,ymax,zmin,zmax
real(plflt),dimension(10)::clevel
real::step
integer::nlevel
integer::i,j
character*1 [...]

2D Contour plot using plplot function “plcont”

In the previous post, we describe how to do a simple line plot. In this post, I will describe how to plot contour using Plplot libraries, particularly using the “plcont” function. Let’s look at the code first.

program simple
use plplot
implicit none
real(plflt),dimension(6) :: x,y
real(plflt),dimension(6,6)::z,x2d,y2d
real(plflt)::xmin,xmax,ymin,ymax,zmin,zmax
real(plflt),dimension(10)::clevel
real::step
integer::nlevel
integer::i,j
x=(/1,2,3,4,5,6/)
y=x
do i=1,6
do j=1,6
z(i,j)=x(i)*2*y(j)
x2d(i,j)=x(i)
[...]

Wiki for Corporate

my presentation during presentation skills workshop with the topic: Wiki for Corporate

Using Plplot from fortran in Kubuntu 8.04

I installed libplplot from Kubuntu Adept package manager, and chose “libplplot-fortran9″ package.
To test the code, I created the following fortran program:

program testplplot2d
use plplot
implicit none
real(plflt),dimension(6) :: x,y
real(plflt)::xmin,xmax,ymin,ymax
x=(/1,2,3,4,5,6/)
y=x**2
write(*,*) y
call plinit()
xmin=1.0
xmax=6.0
ymin=1.0
ymax=40.0
call plcol0(1)
[...]