I am seeing this error above when trying to call the subroutine SGESV. Can someone explain to me what this means. I have also attached the code below.
Regards
Jason
PROGRAM AXIALFD
implicit none
INTEGER :: LINEAR, IWHICH,I,J
REAL :: PE,peinv
REAL :: DA
REAL :: NGRID
REAL :: NRHS = 1
INTEGER :: LDA,LDB,INFO
REAL :: DX,dx2
REAL :: TOL
REAL :: CHANGE
REAL :: ITER
REAL, DIMENSION( 1:10) :: F,C,C11,X
REAL, DIMENSION(1:10,1:10) :: AA
REAL, DIMENSION(1:2) :: ANS
REAL :: RATERXN
REAL :: DRATE
REAL :: SUM
INTEGER,DIMENSION(1:10) :: ipiv
! filename axialFD.m
! This code solves the equations for a reactor with
! axial dispersion using the finite difference method.
! a = 1, 2, 3 for planar, cylindrical, and spherical geometry
! If the problem is linear, set linear = 1 to avoid a second iteration.
! set linear to 1 if problem is linear - this avoids one unnecessary iteration
linear = 0
! set the type of reaction rate
iwhich = 2
!set ngrid, Peclet (Pe), and Damkohler (Da) before calling
Pe = 10
Da = 10
ngrid = 10
peinv = 1/Pe;
dx = 1/(ngrid-1);
dx2 = dx*dx;
LDA = 10
LDB = 10
! iterate
tol = 1.e-12;
change = 1;
iter=0;
! initial guess
DO i=1,ngrid
c(i) = 0.0;
x(i) = (i-1)/(ngrid-1);
end DO
!if ( change >tol) then
iter=iter+1;
! Set up the matrices
! set the matrices to zero
do i=1,ngrid
f(i) = 0;
do j=1,ngrid
aa(i,j) = 0.;
end do
end do
! set the matrices for the differential equation
do j=2, ngrid-1
ans(1) = c(j)*c(j);
ans(2) = 2*c(j);
raterxn = ans(1);
drate = ans(2);
aa(j,j-1) = peinv + dx/2;
aa(j,j) = -2*peinv - Da*dx2*drate;
aa(j,j+1) = peinv - dx/2;
f(j) = Da*dx2*(raterxn - drate*c(j));
end do
ans(1) = c(1)*c(1);
ans(2) = 2*c(1);
raterxn = ans(1);
drate = ans(2);
aa(1,1) = -2*peinv - 2*dx - Pe*dx2 - Da*dx2*drate;
aa(1,2) = 2*peinv;
f(1) = Da*dx2*(raterxn - drate*c(1)) - 2*dx - dx2*Pe;
ans(1) = c(ngrid)*c(ngrid);
ans(2) = 2*c(ngrid);
raterxn = ans(1);
drate = ans(2);
aa(ngrid,ngrid-1) = 2*peinv;
aa(ngrid,ngrid) = -2*peinv -Da*dx2*drate;
f(ngrid)=Da*dx2*(raterxn - drate*c(ngrid));
do i=1,ngrid
print*,f(i)
end do
print*,''
DO I = 1,ngrid
PRINT * , (aa(I,J), J=1,ngrid)
END DO
! Solve one iteration.
call sgesv( NGRID, NRHS, AA, lda, ipiv, f,ldb, info )
!call sgesv( n, nrhs, a, lda, ipiv, b, ldb, info )
!c11 = aa/f;
! Calculate the criterion to stop the iterations.
sum=0.;
do i=1,ngrid
sum = sum + abs(c11(i) - c(i));
c(i) = c11(i);
end do
if (linear==1) then ;goto 10
change = sum
end if
!END IF
10 print*, iter
print*,''
print*,''
print*,''
do i=1,NGRID
! print*, F(i)
end do
END PROGRAM AXIALFD