samiyare
Programmer
- Dec 31, 2011
- 1
when i call the following subroutine , stack over flow error is occured.
i see others, with the help of intent(inout) solve this problem but i cant do it,
please help me
error :
First-chance exception at 0x004ff6e7 in ****.exe: 0xC00000FD: Stack overflow.
First-chance exception at 0x0055e065 in ****.exe: 0xC0000091: Floating-point overflow.
compiler : intel visual fortran 11
subroutine gradient_coefficient(real_cell, vir_cell,esuel,xc, yc, zc,grad_coeff1,grad_coeff2,grad_coeff3)
integer, intent(in) :: real_cell, vir_cell
integer, intent(in), dimension(1:4, 1:real_cell + vir_cell) :: &
esuel
real(kind = dbl), intent(in), dimension(1:real_cell + vir_cell) :: xc, yc, zc
real(kind = dbl), intent(out), dimension(1:4, 1:real_cell) :: &
grad_coeff1,grad_coeff2,grad_coeff3
integer :: j, k
real(kind = dbl) :: sie,alpha1,alpha2,alpha3
real(kind = dbl), dimension(1:4, 1:real_cell) :: &
dx,dy,dz
real(kind = dbl), dimension(1:real_cell) :: &
r11,r12,r13,r22,r23,r33
pause '2'
DO j=1,real_cell
DO k=1,4
DX(k,j)= xc(esuel(k,j))-xc(j)
DY(k,j)= yc(esuel(k,j))-yc(j)
DZ(k,j)= zc(esuel(k,j))-zc(j)
END DO
R11(J) = SQRT( DOT_PRODUCT( DX,J),DX,J) ) )
R12(J) = DOT_PRODUCT( DX,J),DY,J) ) /R11(J)
R13(J) = DOT_PRODUCT( DX,J),DZ,J) ) /R11(J)
R22(J) = SQRT( DOT_PRODUCT( DY,J),DY,J) ) - R12(J)**2 )
R23(J) = ( DOT_PRODUCT( DY,J),DZ,J) ) - R12(J)*R13(J) )/ R22(J)
R33(J) = SQRT( DOT_PRODUCT( DZ,J),DZ,J) ) - R13(J)**2-R23(J)**2 )
SIE= ( R12(J)*R23(J)-R13(J)*R22(J) )/(R11(J)*R22(J))
do k=1,4
alpha1= DX(k,j)/(R11(J)**2)
alpha2=(DY(k,j)-R12(J)*DX(k,j)/R11(J))/(R22(J)**2)
alpha3=(DZ(k,j)-R23(J)*DY(k,j)/R22(J)+SIE*DX(k,j))/(R33(J)**2)
grad_coeff1(k,j)=alpha1-r12(j)*alpha2/r11(j)+sie*alpha3
grad_coeff2(k,j)=alpha2-r23(j)*alpha3/r22(j)
grad_coeff3(k,j)=alpha3
end do
END DO
end subroutine gradient_coefficient
i see others, with the help of intent(inout) solve this problem but i cant do it,
please help me
error :
First-chance exception at 0x004ff6e7 in ****.exe: 0xC00000FD: Stack overflow.
First-chance exception at 0x0055e065 in ****.exe: 0xC0000091: Floating-point overflow.
compiler : intel visual fortran 11
subroutine gradient_coefficient(real_cell, vir_cell,esuel,xc, yc, zc,grad_coeff1,grad_coeff2,grad_coeff3)
integer, intent(in) :: real_cell, vir_cell
integer, intent(in), dimension(1:4, 1:real_cell + vir_cell) :: &
esuel
real(kind = dbl), intent(in), dimension(1:real_cell + vir_cell) :: xc, yc, zc
real(kind = dbl), intent(out), dimension(1:4, 1:real_cell) :: &
grad_coeff1,grad_coeff2,grad_coeff3
integer :: j, k
real(kind = dbl) :: sie,alpha1,alpha2,alpha3
real(kind = dbl), dimension(1:4, 1:real_cell) :: &
dx,dy,dz
real(kind = dbl), dimension(1:real_cell) :: &
r11,r12,r13,r22,r23,r33
pause '2'
DO j=1,real_cell
DO k=1,4
DX(k,j)= xc(esuel(k,j))-xc(j)
DY(k,j)= yc(esuel(k,j))-yc(j)
DZ(k,j)= zc(esuel(k,j))-zc(j)
END DO
R11(J) = SQRT( DOT_PRODUCT( DX,J),DX,J) ) )
R12(J) = DOT_PRODUCT( DX,J),DY,J) ) /R11(J)
R13(J) = DOT_PRODUCT( DX,J),DZ,J) ) /R11(J)
R22(J) = SQRT( DOT_PRODUCT( DY,J),DY,J) ) - R12(J)**2 )
R23(J) = ( DOT_PRODUCT( DY,J),DZ,J) ) - R12(J)*R13(J) )/ R22(J)
R33(J) = SQRT( DOT_PRODUCT( DZ,J),DZ,J) ) - R13(J)**2-R23(J)**2 )
SIE= ( R12(J)*R23(J)-R13(J)*R22(J) )/(R11(J)*R22(J))
do k=1,4
alpha1= DX(k,j)/(R11(J)**2)
alpha2=(DY(k,j)-R12(J)*DX(k,j)/R11(J))/(R22(J)**2)
alpha3=(DZ(k,j)-R23(J)*DY(k,j)/R22(J)+SIE*DX(k,j))/(R33(J)**2)
grad_coeff1(k,j)=alpha1-r12(j)*alpha2/r11(j)+sie*alpha3
grad_coeff2(k,j)=alpha2-r23(j)*alpha3/r22(j)
grad_coeff3(k,j)=alpha3
end do
END DO
end subroutine gradient_coefficient