| 本帖最后由 lihu8918 于 2017-3-8 15:52 编辑 
 以以下示例程序为例,为什么A和B数组shape不一样,但却可以在一块整体相加。
 
 [Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode module sub
  implicit none
  integer :: nx, ny
  real, allocatable :: B(:, :)
contains
  subroutine cal_u
    real :: A(0:nx+1, 0:ny+1)
    A = 1
    Call advect(A)
  end subroutine
  subroutine advect(AA)
    !real :: AA(:, :)
    real :: AA(0:nx+1, 0:ny+1)
    B = AA+1
  end subroutine
end module
program main
use sub
  nx=3
  ny=4
  allocate(B(nx, ny))
  B=1.0
  call cal_u
  write(*, *) B
end program
 |