Bus error/ segmentation fault--help?
- From: a.e.pace@xxxxxxxxx
- Date: 30 Oct 2006 18:49:37 -0800
All:
I have a code that successfully compiles on my machine, but does
not run properly. When I compile with the intel fortran compiler, I
get the following error:
forrtl: severe (180): SIGBUS, bus error occurred
Stack trace terminated abnormally.
When I compile with gfortran, I get the following error:
"Bus error"
I believe that the error lies somewhere in how I allocate the array "Y"
and pass it to various subroutines. I will attach my code after this
message. Any thoughts or assistance on the matter would be greatly
appreciated.
My warmest thanks,
Alexander Pace
Georgia Institute of Technology
School of Aerospace Engineering.
Code:
program visc
c use global
allocatable Y(:,:)
c.... enter number of subdivisions from n=0->4.8
numsubs= 100
c.... step size
dn=4.8/numsubs
c... define upper and lower bounds for y3(0) (xu and xl)
xl=0
xu=2
c.... Start bisection method
do while (xu-xl .gt. 0.000001)
xm=(xu-xl)/2
c.... Perform Runge-Kutta Integrations to get values of y2(4.8) at top,
c.... lower, and midpoint
c allocate (Y(3,1000))
call runge(Y,xu,numsubs,dn)
gu = Y(2,numsubs) - 1
call runge(Y,xl,numsubs,dn)
gl = Y(2,numsubs) - 1
call runge(Y,xm,numsubs,dn)
gm = Y(2,numsubs) - 1
c.... Check for location of root, change bounds
if (gl*gm .lt. 0) then
xu = xm
else if (gl*gm .gt. 0) then
xl = xm
else if (gl*gm .eq. 0) then
xl = xu
endif
end do
print *, "y3(0)=", Y(3,1)
end
c.... This subroutine integrates the function y3 up one step, dn
subroutine integratey3(y1i,y2i,y3i,y3n,dn)
implicit double precision (a-h, o-z)
g1= y2i**2-y1i*y3i-1
g2= (y2i+.5*g1)**2-(y1i+.5*g1)*(y3i+.5*g1)-1
g3= (y2i+.5*g2)**2-(y1i+.5*g2)*(y3i+.5*g2)-1
g4= (y2i+g3)**2-(y1i+g3)*(y3i+g3)-1
y3n= y3i+dn*(g1+2*g2+2*g3+g4)/6
return
end
c.... This subroutine integrates y2 up one step, dn
subroutine integratey2(y2i,y3i,y2n,dn)
implicit double precision (a-h, o-z)
g1=y3i
g2=y3i+.5*g1
g3=y3i+.5*g2
g4=y3i+g3
y2n= y2i+dn*(g1+2*g2+2*g3+g4)/6
return
end
c.... This subroutine integrates y1 up one step, dn
subroutine integratey1(y1i,y2i,y1n,dn)
implicit double precision (a-h, o-z)
g1=y2i
g2=y2i+.5*g1
g3=y2i+.5*g2
g4=y2i+g3
y1n= y1i+dn*(g1+2*g2+2*g3+g4)/6
return
end
c.... This subroutine inputs the matrix Y and an initial value for
c.... y3(0) and performs the runge kutta integration from n=0->4.8
subroutine runge(Y,y3init,numsubs,dn)
c use global
real Y(:,:)
c.... define initial conditions
Y(1,1)=0
Y(2,1)=0
Y(3,1)=y3init
y1n=0
y2n=0
y3n=0
c.... let 'er rip
do i=2, numsubs-1
y1i=Y(1,i)
y2i=Y(2,i)
y3i=Y(3,i)
call integratey3(y1i,y2i,y3i,y3n,dn)
Y(3,i+1)=y3n
call integratey2(y2i,y3i,y2n,dn)
Y(2,i+1)=y2n
call integratey1(y1i,y2i,y1n,dn)
Y(1,i+1)=y1n
end do
return
end
.
- Follow-Ups:
- Re: Bus error/ segmentation fault--help?
- From: *** Hendrickson
- Re: Bus error/ segmentation fault--help?
- Prev by Date: Re: READ-statement and a segmentation fault
- Next by Date: Re: READ-statement and a segmentation fault
- Previous by thread: completely static runtime environment
- Next by thread: Re: Bus error/ segmentation fault--help?
- Index(es):