LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-03-2020, 03:31 PM   #1
Fpaul8
LQ Newbie
 
Registered: Jul 2019
Posts: 16

Rep: Reputation: Disabled
The argument of statement function must be scalar - fortran


Hello,

I have a code:

30 COMMON /COR1/ RLI
31 C
32 DIMENSION ALR(360),DQ(180),XI1(180),XI12(180),B2(180),
33 1 T12(180),X12(180)
34 C
35 EXTERNAL CAPPA
36 VM(VA,E,LAMBDA,ALR)=(VA/E)*(1.+((E-1.)/2.)*(1.+1./LAMBDA-
37 1 COS(ALR)-(1./LAMBDA)+SQRT(1.-LAMBDA**2*SIN(ALR)*SIN(ALR/A))))

And errors:

Vibe_analysis.f:32.20:

DIMENSION ALR(360),DQ(180),XI1(180),XI12(180),B2(180),
1
Error: Argument 'alr' of statement function at (1) must be scalar
Vibe_analysis.f:36.9:

VM(VA,E,LAMBDA,ALR)=(VA/E)*(1.+((E-1.)/2.)*(1.+1./LAMBDA-
1
Error: Incompatible ranks 0 and 1 in assignment at (1)


How I can fix it?

Thank you
 
Old 05-04-2020, 03:07 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
I don't know Fortran, but if it says the argument to the COS function must be scalar then it cannot be an array. And probably the same for SIN, too.

Update. Just looked it up for you: COS, SIN.

Last edited by shruggy; 05-04-2020 at 03:17 AM.
 
1 members found this post helpful.
Old 05-04-2020, 05:12 AM   #3
mknirsch
Member
 
Registered: Feb 2003
Location: Germany
Distribution: SLES, SuSe, Ubuntu, HPUX
Posts: 44

Rep: Reputation: 21
Hello
You declared an array of 360 Elements
DIMENSION ALR(360)
Thus you have to specify the Element of the array
... cos(alr(I))..

wehre i is the Index of the array Element

Regards

Martin
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Passing double pointer to function to return value from function as argument srinietrx Programming 2 10-06-2019 12:55 AM
[SOLVED] Argument disparity in function declaration in Fortran's ScaLAPACK ejspeiro Programming 5 03-20-2013 04:12 PM
[SOLVED] case function for no-argument - default function for script? Batistuta_g_2000 Linux - Newbie 3 03-13-2013 10:00 AM
Bash array Add function example using indirect array reference as function argument bobywelsh Programming 10 07-05-2010 04:44 AM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration