CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

fortran error for g77 compiler

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2006, 22:27
Default fortran error for g77 compiler
  #1
vishwas
Guest
 
Posts: n/a
This queston is related to fortran coding I am running a fortran coode in Linux using g77 I get the following error when I compile the error. This error is related to the symbol (ampers and) & which I use as continuation of statement on next line. the error is read(11,*) (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)),^

& (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), ^ Expression at (^) has incorrect data type or rank for its context (This is the error for first line) Statement at (^) begins with invalid token [info -f g77 M LEX] (This the error for second line) Can somebody tell me how to remove it

Thank you
  Reply With Quote

Old   January 26, 2006, 22:42
Default Re: fortran error for g77 compiler
  #2
ag
Guest
 
Posts: n/a
Make sure the ampersand is in column 6.
  Reply With Quote

Old   January 26, 2006, 22:44
Default Re: fortran error for g77 compiler
  #3
Renato.
Guest
 
Posts: n/a
I've got lost when trying to understand your read statement. This problem can be due your implicit loops in the read statement (unbalanced parentheses or arrays with wrong rank). Why don't you try to rewrite this sentence with explicit loops? It would be easier to understand where is your problem...

Cheers

Renato
  Reply With Quote

Old   January 26, 2006, 22:47
Default Re: fortran error for g77 compiler
  #4
Renato.
Guest
 
Posts: n/a
Yeah Ag,

it's the first think Vishwas must check ;-)
  Reply With Quote

Old   January 26, 2006, 23:20
Default Re: fortran error for g77 compiler
  #5
vishwas
Guest
 
Posts: n/a
This queston is related to fortran coding. I am running a fortran code in Linux using g77. I get the following error when I compile the error. This error is related to the symbol (ampers and) & which I use as continuation of statement on next line. The ampersand is in column 6.

read(11,*) (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)),^

&(((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)) ,

^

Expression at ^ has incorrect data type or rank for its context (This is the error for first line) Statement at (^) begins with invalid token [info -f g77 M LEX] (This the error for second line) Can somebody tell me how to remove it.

Thank you

  Reply With Quote

Old   January 27, 2006, 06:47
Default Re: fortran error for g77 compiler
  #6
andy
Guest
 
Posts: n/a
Assuming the third line you have not shown is something like:

& n=1,4)

you have missed a bracket at the beginning for the index n.

  Reply With Quote

Old   January 27, 2006, 13:11
Default Re: fortran error for g77 compiler
  #7
m. malik
Guest
 
Posts: n/a
Consider using explit loops: do i = 1, ii(n) do j = 1, jj(n) do k = 1, kk(n)

read (11,*) x(i,j,k,n), y(i,j, k,n) end do end do endo
  Reply With Quote

Old   January 27, 2006, 13:29
Default Re: fortran error for g77 compiler
  #8
m. malik
Guest
 
Posts: n/a
I hope it's obvious that in what I suggested in previous mail, there are seven (7) lines.
  Reply With Quote

Old   January 29, 2006, 21:35
Default Re: fortran error for g77 compiler
  #9
AnotherCFDUser
Guest
 
Posts: n/a
Malik's suggestion will lead to slightly different behaviour from the original code (which will read the data from a single line rather than from ii(n)*jj(n)*kk(n) separate lines). This could be fixed by using a format statement in the read.

  Reply With Quote

Old   January 29, 2006, 21:44
Default Re: fortran error for g77 compiler
  #10
AnotherCFDUser
Guest
 
Posts: n/a
As mentioned previously for FORTRAN 77 the code should read something like this:

123456 READ(11,*) 12345& (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), 12345& (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), 12345& (((z(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n))

where 12345 should be replaced with spaces.

You may also like to use a different character.

If the compiler is actually expecting f90 or f95 you may like to try:

READ(11,*) & (((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), & (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)), & (((z(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n))

If neither of these work perhaps you could post some more details of the code (which looks like a pretty standard PLOT3D reader).

  Reply With Quote

Old   January 30, 2006, 18:16
Default Re: fortran error for g77 compiler
  #11
vm
Guest
 
Posts: n/a
this works with my compiler:

read(11,*)((((x(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1 ,kk(n)), & (((y(i,j,k,n),i=1,ii(n)),j=1,jj(n)),k=1,kk(n)),n=1 ,4)

& is in column 6

  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Intel Fortran Compiler & Tutorial 17 Young CFX 1 March 30, 2011 02:39
Fortran Compiler and example Young CFX 1 March 22, 2011 23:26
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 14:43
Fortran compiler Erik Siemens 2 November 28, 2008 21:05
Fortran compiler Arnab Siemens 5 September 14, 2004 04:59


All times are GMT -4. The time now is 14:50.