Fortran FUNCTION attribute conflicts with SUBROUTINE attribute

Click For Summary
The discussion centers on troubleshooting issues with implementing the Runge-Kutta method with adaptive step size from Numerical Recipes. The user encountered failure messages when running their rewritten code, which resolved when the problematic subroutine was removed. The key issue identified was a misdeclaration in the code; specifically, the declaration of 'derivs' as a double precision external function was incorrect since it was intended to be a subroutine. The correct declaration should simply state 'external :: derivs'. Following this correction, the user confirmed that the problem was resolved.
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

  • screen.png
    screen.png
    18.4 KB · Views: 609
  • screen1.png
    screen1.png
    26.7 KB · Views: 433
Technology 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
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
38K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K