adjust VELEST in Ubuntu

VELEST is a inversion software to resolve the 1-D model of a region. Someone also call it “Kissling" because of it’s author It can be found here.

http://www.orfeus-eu.org/Software/softwarelib.html

or the original ftp://www.orfeus-eu.org/pub/software/mirror/thurber/VELEST/

To compile it, you can use g77

f77 velest.f -o velest

It will appear that:

/tmp/cchX84r1.o: In function `cputimer_':
velest.f:(.text+0x2c64d): undefined reference to `clock_'
/tmp/cchX84r1.o: In function `datetime_':
velest.f:(.text+0x2c6ae): undefined reference to `sprintf_'
collect2: ld returned 1 exit status


it’s because of having no function clock() and sprintf() in g77

in the source code, it should be modified from

subroutine CPUTIMER(cpusec) ! Urs Kradolfer, 16.9.91

implicit none
integer icpu, clock
real cpusec
external clock !$pragma C(clock)
c
icpu=clock()
cpusec=float(icpu)/1000000.
c
end ! of subroutine cputimer
c
subroutine DATETIME(dattim) ! Urs Kradolfer, 16.9.91

implicit none
character datum*26, dattim*20
integer it, itime, ctime, time
external ctime !$pragma C(ctime)
external sprintf !$pragma C(sprintf)
external time !$pragma C(time)
c
it=time(itime)
it=ctime(itime)
call sprintf(datum,'%s',%val(it))
dattim=datum(5:24)
c
end ! of subroutine datetime

to

subroutine CPUTIMER(cpusec) ! Urs Kradolfer, 16.9.91
implicit none
real cpusec, icpu

call cpu_time(icpu)
cpusec=icpu

end ! of subroutine cputimer

subroutine DATETIME(dattim) ! Urs Kradolfer, 16.9.91

implicit none
character datum*26, dattim*20
character ctime
integer(KIND=2) it
external ctime !$pragma C(ctime)

it=time8()
datum=ctime(it)
dattim=datum(5:24)

end ! of subroutine datetime

g77 time8

http://gcc.gnu.org/onlinedocs/gcc-3.3.6/g77/Time8-Intrinsic.html#Time8-Intrinsic

gfortran cpu_time

http://www.cse.yorku.ca/tdb/_doc.php/userg/man_g/file/gfortran/node/CPU_TIME

gfortran ctime

http://gcc.gnu.org/onlinedocs/gfortran/CTIME.html

相關文章

  1. ubuntu 10.10 安裝 sac
  2. 夢想。賈伯斯
  3. quickwin in wine
  4. fortran。unix。xwindow
  5. Knowledge is Power