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

colon in Fortran77

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 19, 2015, 16:34
Default colon in Fortran77
  #1
New Member
 
Join Date: Feb 2011
Posts: 29
Rep Power: 7
jollage is on a distinguished road
Hi,

I'm writing a Fortran77 code and it would be complied by gfortran or mpif90 (I have gcc 5.2.0 installed). I sometimes used colon for indicating the interested range of an array, is it a good practice for a Fortran77 code? For example, I have

do i=1,Ny
(some subroutine generates a new solu for every i)
a(i,1:Ny) = solu
end do

where a is a 2D matrix of size (Nx,Ny) and solu is a 1D array of size Ny. I tested it and it seems to work good, but I'm concerned with any bug it might generate. The code is much more complicated than these lines. Do you have any suggestions? Thanks in advance.
jollage is offline   Reply With Quote

Old   December 19, 2015, 18:39
Default
  #2
Senior Member
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 1,309
Rep Power: 22
flotus1 will become famous soon enoughflotus1 will become famous soon enough
That will do. You might as well use
Code:
a(i,:)
instead if you do not want to give the lower and upper limits explicitly.
I guess it is just a typo, but I think the first line should read "do i=1, Nx"

Edit:
However since Fortran is column-major, this part of the code might be quite inefficient and it could be a good idea to have the loops for both dimensions of the array explicitly or change their order.
__________________
Please do not send me CFD-related questions via PM
flotus1 is offline   Reply With Quote

Old   December 20, 2015, 15:46
Default
  #3
New Member
 
Join Date: Feb 2011
Posts: 29
Rep Power: 7
jollage is on a distinguished road
Quote:
Originally Posted by flotus1 View Post
That will do. You might as well use
Code:
a(i,:)
instead if you do not want to give the lower and upper limits explicitly.
I guess it is just a typo, but I think the first line should read "do i=1, Nx"

Edit:
However since Fortran is column-major, this part of the code might be quite inefficient and it could be a good idea to have the loops for both dimensions of the array explicitly or change their order.
Thanks. I see.
jollage is offline   Reply With Quote

Old   December 23, 2015, 05:05
Default
  #4
New Member
 
Join Date: Feb 2011
Posts: 29
Rep Power: 7
jollage is on a distinguished road
Quote:
Originally Posted by flotus1 View Post
That will do. You might as well use
Code:
a(i,:)
instead if you do not want to give the lower and upper limits explicitly.
I guess it is just a typo, but I think the first line should read "do i=1, Nx"

Edit:
However since Fortran is column-major, this part of the code might be quite inefficient and it could be a good idea to have the loops for both dimensions of the array explicitly or change their order.
Hi,

Can I ask another question? I use gfortran for compiling my F77 scripts. But sometimes I do use intrinsic functions which are introduced for F95 or even later. Will this potentially cause any problems? I did experience that it's of no problem, but need someone to confirm that. Thanks.
jollage is offline   Reply With Quote

Old   December 23, 2015, 05:55
Default
  #5
Senior Member
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 1,309
Rep Power: 22
flotus1 will become famous soon enoughflotus1 will become famous soon enough
I guess only few people out there are still sticking to pure FORTRAN 77 standards.
Gfortran is constantly developing and the features of the newer fortran standards are implemented.
So any recent version of gfortran is able to handle features introduced after the FORTRAN 77 standard. For functions not jet implemented you will get compiler warnings and errors.
__________________
Please do not send me CFD-related questions via PM
flotus1 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fortran77 or 90 hosseinhgf CFX 2 November 26, 2010 02:02
Simulation of a stirred miniplant extraction colon PaMuelle OpenFOAM 0 July 14, 2009 09:17
How can I find a free Fortran77 numerical library? Alberto Main CFD Forum 3 January 21, 2008 01:56
fortran77 help khan Main CFD Forum 3 June 12, 2007 00:24
Fortran77 or Fortran 90 Swapnil CFX 2 November 26, 2002 16:16


All times are GMT -4. The time now is 07:56.