Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

abnormal value change

$
0
0

Hi,

I am using the intel fortran compiler for mac os x to calculate a computational fluid dynamic problems. Here is a very simple subroutine to generate the mesh.

subroutine make_grid()
 use global_parameters
 use flow_parameters
 use grid_arrays
implicit none
! local variable
 integer :: i,j
! --- x direction ---
 if (xgrid_unif == 1) then
 dx1 = (xOut-xOrigin)/real(nx-1,KIND=CGREAL)
 do i=1,nx
 x(i) = xOrigin + real(i-1,KIND=CGREAL)*dx1
 enddo
 else
endif
 x(0) = xOrigin*2.0_CGREAL - x(2)
 x(nx+1) = x(nx)*2.0_CGREAL-x(nx-1)
! --- y direction ---
 if (ygrid_unif == 1) then 
 dy1 = (yOut-yOrigin)/real(ny-1,KIND=CGREAL)
 do i=1,ny
 y(i) = yOrigin + real(i-1,KIND=CGREAL)*dy1
 enddo
 else
endif
 !debug
 do i=12,17
 write(*,*) i,x(i)
 end do
 y(0) = yOrigin*2.0_CGREAL - y(2)
 y(nx+1) = y(ny)*2.0_CGREAL-y(ny-1)
 write(*,*) '-------------------------------------'
 !debug
 do i=12,17
 write(*,*) i,x(i)
 end do
 stop
do i=0,nx
 xc(i) = 0.5_CGREAL*(x(i+1)+x(i))
 end do
do i=0,ny
 yc(i) = 0.5_CGREAL*(y(i+1)+y(i))
 end do
! --- write grid file for tecplot ---
 open(unit=14,file='grid_plot.plt')
 write(14,*)'variables="x","y"'
 write(14,*)'zone f=point, i=',nx+1,', j=',ny+1
 do j=0,ny
 do i=0,nx
 write(14,'(2(2x,e14.7))') xc(i),yc(j)
 enddo
 enddo
 close(14)
return
end subroutine make_grid

In line 26 and 33, I output the value of the same variables twice. But the value of x(16) changes out of no reason, since the operation between these two outputs has nothing to do with x.

12 -0.225000000000000 
 13 -0.200000000000000 
 14 -0.175000000000000 
 15 -0.150000000000000 
 16 -0.125000000000000 
 17 -0.100000000000000 
 -------------------------------------
 12 -0.225000000000000 
 13 -0.200000000000000 
 14 -0.175000000000000 
 15 -0.150000000000000 
 16 0.525000000000000 
 17 -0.100000000000000

However, the same program works fine on ubuntu+intel fortran compiler.

Can someone help me with this?

I really appreciate your help.


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>