我试图在每次运行后保存并重用一个2D变量但我得到一些错误,如自动对象无法保存等.这是子程序:
subroutine dust_sum_test(ngrid,count,dust_in,dust_out)
!Subroutine to accumulate and release dust in timely manner
implicit none
integer,intent(in)::ngrid
integer,intent(in)::count
real,intent(in)::dust_in(ngrid)
real,intent(out)::dust_out(ngrid)
real,save::dmsdust(ngrid,99999) ! dummy local variable
integer::i
if (count.gt.1) then
dmsdust(:,count)=dmsdust(:,count-1)+dust_in
dust_out=dmsdust(:,count)
else
dust_out=dust_in
dmsdust(:,count)=0.0
endif
write(*,*)'The current count is = ', count
end subroutine dust_sum_test
Run Code Online (Sandbox Code Playgroud)
我需要使用以前的dmsdust值添加当前值.请让我知道如何解决这个问题.