forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fortan program for harmonic synthesis

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
arctica



Joined: 10 Sep 2006
Posts: 105
Location: United Kingdom

PostPosted: Tue Sep 12, 2006 8:03 am    Post subject: Fortan program for harmonic synthesis Reply with quote

Hello

I am having some problems getting this code which is available on the internet to compile properly as availably fom here:

[url="http://www.igfs.net/"]http://www.igfs.net/[/url]

During compilation it generates a number of warning messages and one fatal error that causes compilation to fail at the position indicated below where I have put "compilation fails here" I have included a small section of the program code where the error is occurring--- the full code can be downloaded from the website link

c
c-----------------------------------------------------------------------
c
parameter(iglob = 1-(int(((deast-dwest)/360.d0) + 1.d-5)),
& ncols = nint((deast-dwest)/dlon)
& +(1-icell)*(1-iflag)*iglob,
& nrows = nint((dnorth-dsouth)/dlat)
& +(1-icell)*(1-iflag),
& mmax0 = max(lmax,kmax),
& nmax0 = max(mmax0,jmax),
& nmax01 = nmax0+1,
& nmax02 = nmax0+2,
& jcol = nint(360.d0/dlon),
& jfft = max(jcol,nmax01)) -------- compilation fails here
c
c-----------------------------------------------------------------------

error messages from compilation

Compiling file: harmonic_synth_v02.f
D:gmtUserharmonic_synth_v02.F(136) : error 922 - INT with REAL(KIND=2) arguments is not permitted in an initialisation expression
.... plus a lot of warning messgages

The program is stated as being written in Fortran 77, but I would not have thought that would be a big issue. I am just starting out on Fortran programming so need some advice as to what is causing the fatal error at compilation. I have contacted the program code distributors and was told that the reason the program fails to compile is because it may depend on the compiler used, which sounds odd if it is standard F77 code. Thanks

Lester

"Imagination is more important than knowledge" - Albert Einstein (1879 - 1955)
_________________
"Imagination is more important than knowledge" Albert Einstein 1879-1955
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Tue Sep 12, 2006 10:06 am    Post subject: Fortan program for harmonic synthesis Reply with quote

Lester

FTN95 does not allow you to use NINT in a PARAMETER statement.
This is probably standard conforming and the code was written for a compiler that allowed this as an extension.

All you have to do is move the assignment out of a PARAMETER statement.
Back to top
View user's profile Send private message AIM Address
arctica



Joined: 10 Sep 2006
Posts: 105
Location: United Kingdom

PostPosted: Tue Sep 12, 2006 3:30 pm    Post subject: Fortan program for harmonic synthesis Reply with quote

Hi Paul

Thanks for the explanation. Sorry for a very basic question, but how do you move the assignment out of the PARAMETER statement as you put it?

parameter(iglob = 1-(int(((deast-dwest)/360.d0) + 1.d-5)),
& ncols = nint((deast-dwest)/dlon)
& +(1-icell)*(1-iflag)*iglob,
& nrows = nint((dnorth-dsouth)/dlat)
& +(1-icell)*(1-iflag),
& mmax0 = max(lmax,kmax),
& nmax0 = max(mmax0,jmax),
& nmax01 = nmax0+1,
& nmax02 = nmax0+2,
& jcol = nint(360.d0/dlon),
& jfft = max(jcol,nmax01))
c
c-----------------------------------------------------------------------
c
real*8 zonals(10),cz(20),da(5)
real*8 batch(ncols*maxr),grsv(15)
real*8 cnm(nmax01,nmax01),snm(nmax01,nmax01)
real*8 scrd(ncols,2),statd(22),ddlon(ncols)
real*8 flat(maxr),flon(maxr),dist(maxr),pt(maxr)
real*8 pt_a(maxpt),ga(maxpt),zeta(maxpt),corr(maxpt)
real*8 flat_a(maxpt),flon_a(maxpt),dist_a(maxpt),horth_a(maxpt)
c
real*8 uc(maxr),tc(maxr),uic(maxr),uic2(maxr)
real*8 cotc(maxr),thet2(maxr),thet1(maxr),thetc(maxr)
c
real*8 pmm_a(nmax01,maxr+1),pmm_b(nmax01,maxr),f_n(maxr),f_s(maxr)
real*8 p(nmax02,maxr),p1(nmax02,maxr),p2(nmax02,maxr)
real*8 c_ev(nmax01,maxr),s_ev(nmax01,maxr),kk(nmax01,maxr)
real*8 c_od(nmax01,maxr),s_od(nmax01,maxr)
real*8 cr1(jfft),sr1(jfft),cr2(jfft),sr2(jfft)
real*8 aux(2*jcol),wrkfft(2*jcol),factn(nmax01),k(nmax01)
real*8 cml(nmax01),sml(nmax01)
c
real*4 data(ncols,nrows)
integer*4 it(maxr),it_a(maxpt),iex(maxr),zero(maxr+1)

Thanks

Lester

"Imagination is more important than knowledge" - Albert Einstein (1879 - 1955)
_________________
"Imagination is more important than knowledge" Albert Einstein 1879-1955
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Wed Sep 13, 2006 12:38 am    Post subject: Fortan program for harmonic synthesis Reply with quote

Lester

A PARAMETER statement takes the form

INTEGER,PARAMETER::MAX_PATH = 260

or its equivalent under Fortran 77.

The alternative assignment is

INTEGER MAX_PATH
MAX_PATH = 260

In the first case the assignment has already been applied when the program is loaded and MAX_PATH cannot be changed at runtime.
In the second case the assignment is carried out at runtime (when the statement is executed) and the compiler will not complain if you change MAX_PATH at runtime.
The Fortran standard limits the kind of assignments that you are allowed to make in a PARAMETER statement because the result has to be expanded at compile time.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group