bus_wrecker

03-28-2006, 10:08 PM

wasn't too sure under which topic to post.

i thought i'll catch the attention of those who do fortran programming with nr.

similar post is in chapter 16/17 section

regards

hi there,

i'm getting segmentation faults in my fortran program after succesfully compiling it.

here's the code

PROGRAM EGFR

USE nrtype; USE nrutil; USE nr

IMPLICIT NONE

REAL(SP)::x1,x2,eps,h1,hmin

REAL(SP),DIMENSION(2)::ystart

INTERFACE

SUBROUTINE derivs(x,y,dydx)

USE nrtype

IMPLICIT NONE

REAL(SP)::x

REAL(SP),DIMENSION(::y

REAL(SP),DIMENSION(::dydx

END SUBROUTINE

END INTERFACE

ystart(1)=0.1_sp

ystart(2)=1.1_sp

x1=0.0_sp

x2=1.0_sp

eps=10e-6

h1=1.0_sp

hmin=1.0_sp

CALL odeint(ystart,x1,x2,eps,h1,hmin,derivs,rkqs)

END PROGRAM

and my derivs subroutine

SUBROUTINE derivs(x,y,dydx)

USE nrtype

IMPLICIT NONE

REAL(SP)::x

REAL(SP),DIMENSION(4)::k

REAL(SP),DIMENSION(2)::y

REAL(SP),DIMENSION(2)::dydx

k(1)=0.2

k(2)=3

k(3)=2

k(4)=1

dydx(1)=k(1)*y(1)-k(2)*y(2)

dydx(2)=-k(3)*y(1)+k(4)*y(2)

END SUBROUTINE derivs

I'm currently using all the subroutines used to solve ODES listed in the book, which are odeint, rkqs, and rkck. I compiled it with the header files too, nr.f90, nrutil.f90, and nrtype.f90.

Is there a problem in the usage of the odeint function? have i declared something wrongly? I just want to get the program working to solve a small system of ODEs before i move on to a bigger problem.

regards

Julian Lee

ps- Compiler is g95 - from http://g95.sourceforge.net/

Edit/Delete Message

i thought i'll catch the attention of those who do fortran programming with nr.

similar post is in chapter 16/17 section

regards

hi there,

i'm getting segmentation faults in my fortran program after succesfully compiling it.

here's the code

PROGRAM EGFR

USE nrtype; USE nrutil; USE nr

IMPLICIT NONE

REAL(SP)::x1,x2,eps,h1,hmin

REAL(SP),DIMENSION(2)::ystart

INTERFACE

SUBROUTINE derivs(x,y,dydx)

USE nrtype

IMPLICIT NONE

REAL(SP)::x

REAL(SP),DIMENSION(::y

REAL(SP),DIMENSION(::dydx

END SUBROUTINE

END INTERFACE

ystart(1)=0.1_sp

ystart(2)=1.1_sp

x1=0.0_sp

x2=1.0_sp

eps=10e-6

h1=1.0_sp

hmin=1.0_sp

CALL odeint(ystart,x1,x2,eps,h1,hmin,derivs,rkqs)

END PROGRAM

and my derivs subroutine

SUBROUTINE derivs(x,y,dydx)

USE nrtype

IMPLICIT NONE

REAL(SP)::x

REAL(SP),DIMENSION(4)::k

REAL(SP),DIMENSION(2)::y

REAL(SP),DIMENSION(2)::dydx

k(1)=0.2

k(2)=3

k(3)=2

k(4)=1

dydx(1)=k(1)*y(1)-k(2)*y(2)

dydx(2)=-k(3)*y(1)+k(4)*y(2)

END SUBROUTINE derivs

I'm currently using all the subroutines used to solve ODES listed in the book, which are odeint, rkqs, and rkck. I compiled it with the header files too, nr.f90, nrutil.f90, and nrtype.f90.

Is there a problem in the usage of the odeint function? have i declared something wrongly? I just want to get the program working to solve a small system of ODEs before i move on to a bigger problem.

regards

Julian Lee

ps- Compiler is g95 - from http://g95.sourceforge.net/

Edit/Delete Message