FUNCTION attribute conflicts with SUBROUTINE attribute

  • Topic: Fortran 
  • Thread starter Thread starter Vrbic
  • Start date Start date
  • Tags Tags
    Function Subroutine
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 3K views · last reply
Vrbic
Messages
400
Reaction score
18
Hello, I'm trying to use Runge Kutta with adaptive stepsize from numerical recipes(page 742, https://websites.pmc.ucsc.edu/~fnimmo/eart290c_17/NumericalRecipesinF77.pdf ). I rewrote code but I have got failure messages both in an attachment. If I cut this subroutine everything is fine also this failure are independent on a definition of function 'derivs' which is causing the problem in calling.
Thank you for any advice.
 
Attachments
  • Terminal window showing make output: repeated Fortran errors reading 'derivs' at (1) has a type, which is not consistent with the CALL at (2), with SUBROUTINE rkck(y,dydx,n,x,h,yout,yerr,derivs) lines and call derivs(x+a2*h,ytemp,ak2) lines.
    screen.png
    18.4 KB · Views: 649
  • Fortran source code in a text editor showing SUBROUTINE rkck with DOUBLE PRECISION declarations, Cash-Karp Runge-Kutta coefficients and DO loops computing yout and yerr.
    screen1.png
    26.7 KB · Views: 468
Physics news on Phys.org
Your first image is too small to read. Looking at the second one, in rkck the declaration
Fortran:
double precision, external :: derivs
would be valid for a function, not a subroutine. it should be simply
Fortran:
external :: derivs
 
DrClaude said:
Your first image is too small to read. Looking at the second one, in rkck the declaration
Fortran:
double precision, external :: derivs
would be valid for a function, not a subroutine. it should be simply
Fortran:
external :: derivs
Good to know,
Thank you! SOLVED