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

8 thoughts on “adjust VELEST in Ubuntu”

  1. First of all thank you.
    Second, after the correction I tried to compile it with gfortran but it gives me this message:
    /tmp/ccrtwTbq.o: In function `datetime_’:
    velestcorrr.f:(.text+0x45834): undefined reference to `ctime_’
    collect2: ld returned 1 exit status

  2. I have two problem s, velest.f:4535.25:

    call RAYPATH(1,1,1,1.,1.,1.,1.,nl,thk,h,v,vsq,
    1
    Warning: Rank mismatch in argument ‘x’ at (1) (rank-1 and scalar),and when i run the examples,it shows:STOP INPUTPARAM>>> control-file not correct!

    1. Hi, I have the same errors about RAYPATH when I try to compile with this:
      f77 velest.f -o velest

      Since this is just compilation and not dependent on the .cmn file, I wonder what<s wrong? Have you found a solution?

      cheers

  3. Hi, for those who still have issues, follow the blog and also

    delete the line:
    > external ctime !$pragma C(ctime)

    modify the line by deleting a comma:

    > 10165 | write(ifil,'(”North rotate= ”,f6.1,)’) rotate

    into

    > 10165 | write(ifil,'(”North rotate= ”,f6.1)’) rotate

    If you can’t get F77 compiler to run on your distro (e.g. the compat package is not in your package manager)m the following worked for me:

    > gcc -x f77 velest.f -o velest -std=legacy -lm -lgfortran

    The code should compile!

Genevieve 發表迴響 取消回覆

你的電子郵件位址並不會被公開。 必要欄位標記為 *