|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
他的x,y,z的维数是x(jdim,kdim,idim),y(jdim,kdim,idim),z(jdim,kdim,idim)
却用到了
t(izz,1) = x(izz+1,1,i)-x(izz,2,i)
t(izz,2) = y(izz+1,1,i)-y(izz,2,i)
t(izz,3) = z(izz+1,1,i)-z(izz,2,i)
t(izz,4) = x(izz+1,2,i)-x(izz,1,i)
t(izz,5) = y(izz+1,2,i)-y(izz,1,i)
t(izz,6) = z(izz+1,2,i)-z(izz,1,i)
其中izz最大值居然到了jdim*kdim-jdim,明显会数组越界,visual fortran编译通过了,运行的时候报错数组越界。但用linux下的intel fortran编译器编译通过计算了,实在是搞不懂。
附上下面一段程序:
parameter(nn=maxbl)
c
character*80 bcfilei,bcfilej,
. bcfilek
c
dimension x(jdim,kdim,idim),y(jdim,kdim,idim),z(jdim,kdim,idim)
dimension sj(jdim*kdim,idim-1,5),sk(jdim*kdim,idim-1,5),
. si(jdim*kdim,idim,5)
dimension t(jdim*kdim,6),t1(jdim*kdim,idim,5)
c
common /sklton/ isklton
common /bcnew/ bcvali(nn,maxseg,5,2),
. bcvalj(nn,maxseg,5,2),bcvalk(nn,maxseg,5,2),
. nbci0(nn),nbcidim(nn),nbcj0(nn),nbcjdim(nn),
. nbck0(nn),nbckdim(nn),ibcinfo(nn,maxseg,7,2),
. jbcinfo(nn,maxseg,7,2),kbcinfo(nn,maxseg,7,2)
common /bcnew2/ bcfilei(nn,maxseg,2),bcfilej(nn,maxseg,2),
. bcfilek(nn,maxseg,2)
common /twod/ i2d
common /zero/iexp
c
c***********************************************************************
c metrics:
c si(1-3)...components of unit normal to i-face (directed area)
c si( 4 )...area of i-face
c si( 5 ).. speed of i-face
c
c sj(1-3)...components of unit normal to j-face (directed area)
c sj( 4 )...area of j-face
c sj( 5 ).. speed of j-face
c
c sk(1-3)...components of unit normal to k-face (directed area)
c sk( 4 )...area of k-face
c sk( 5 ).. speed of k-face
c
c notes:
c 1) the normal to a cell face is determined via the cross product
c of two diagonal vectors connecting oposite corners of the cell
c face.
c 2) a unit normal is obtained by dividing by the magnitude
c of the inner product.
c 3) The area of the cell face is given by one-half the magnitude
c of the cross product of the two diagonal vectors
c 4) in a jdim*kdim*idim grid there are really only
c idim*(jdim-1)*(kdim-1) i-faces
c jdim*(idim-1)*(kdim-1) j-faces
c kdim*(idim-1)*(jdim-1) k-faces
c however the metric arrays are dimensioned larger than this -
c for efficient vectorization, loops throughout the code run
c over these fictitious faces. thus, for safety, the metrics
c for these fictitious faces are set to the corresponding metrics
c for the neighboring face.
c
c 5) unsteady metric terms si(5), sj(5), sk(5) are set to zero
c here, and must be reset elsewhere if the mesh is actually
c in motion
c
c 6) tolerance to automatically detect collapsed (singular) metrics
c is set by atol
c
c***********************************************************************
c
c tolerance for collapsed metrics (10.**(-iexp) is machine zero)
c
atol = max(1.e-07,10.**(-iexp+1))
c
jdim1 = jdim-1
kdim1 = kdim-1
idim1 = idim-1
c
c***********************************************************************
c
c metrics for i=constant surfaces
c
c***********************************************************************
c
c *** interior faces ***
c
n = jdim*kdim-jdim
c do 8211 izz=1,n
c write(8211,*) x(izz+1,1,1)
c8211 continue
c continue
c
do 1040 i=2,idim1
cdir$ ivdep
do 1050 izz=1,n
c
c components of vectors connecting opposite corners of cell j,k
t(izz,1) = x(izz+1,1,i)-x(izz,2,i)
t(izz,2) = y(izz+1,1,i)-y(izz,2,i)
t(izz,3) = z(izz+1,1,i)-z(izz,2,i)
t(izz,4) = x(izz+1,2,i)-x(izz,1,i)
t(izz,5) = y(izz+1,2,i)-y(izz,1,i)
t(izz,6) = z(izz+1,2,i)-z(izz,1,i)
c
c cross product of vectors
si(izz,i,1) = t(izz,2)*t(izz,6)-t(izz,3)*t(izz,5)
si(izz,i,2) = -t(izz,1)*t(izz,6)+t(izz,3)*t(izz,4)
si(izz,i,3) = t(izz,1)*t(izz,5)-t(izz,2)*t(izz,4)
c
c magnitude of cross product
si(izz,i,4) = si(izz,i,1)*si(izz,i,1)+si(izz,i,2)*si(izz,i,2)+
. si(izz,i,3)*si(izz,i,3)
1050 continue
|
|