Hi John
According to the code it should write out a matrix (grid), the file is opened to write to and values added but it does not complete:
!read input gravity data
open(5,file=fin)
read(5,*) ((ba(i,j),i=1,n),j=1,m) ! in mgal
close(5)
z0=dabs(z0)
delh=z0+zb
delg=tpig*rho*delh
ba=ba+delg
call fftdata(ba,data0,n,m,n2,n3,nn)
data0=flt*data0*exp(wd*z0)/tpig/rho
do kitr=1,itr
print*,' '
print*,'iteration ', kitr
print*,' '
tdata=data0
dep0=dep
if(kitr.eq.1) goto10
do io=2,nmax
ba=dep**io
call fftdata(ba,data,n,m,n2,n3,nn)
data=data*wd**(io-1)/fac(io) *flt
tdata=tdata-data
big=0.d0
do k=1,n3,2
tt=data(k)**2+data(k+1)**2
if(tt.gt.big) big=tt
end do
if(io.eq.2) then
big2=big
else
bign=big
print*,big2,bign
r=bign/big2
write(*,'(a4,i2,a16,e8.3)')'n=',io,' Sn/S2 ratio =',dsqrt(r)
if(r.lt.small2) goto 10
endif
end do
end do
!10 continue
call fftinv(dep,tdata,n,m,n2,n3,nn)
dep=dep/dnm
call deprms(dep-dep0,n,m,rms2)
if(rms2.gt.rms1) then
print*,' rms1=',rms1
print*,' rms2=',rms2
stop ' diverge !!! and stop '
elseif(rms2.lt.rms) then
goto 20
elseif(kitr.ge.itr) then
print*,' rms1=',rms1
print*,' rms2=',rms2
stop ' too slow converging.. please check it again !'
else
rms1=rms2
print*,' rms=',rms2
endif
enddo
20 write(*,100) kitr,rms2
100 format(1x,' inversed after ',i2,' iteration !!!',/, &
' RMS is expected to be ',f6.2,'(in meter)')
dep=dep-z0
open(5,file=fdep)
write(5,'(256f10.3)') ((dep(i,j),i=1,n),j=1,1) ! in km <---- output grid starts to fill and then stops
close(5)
This is a program, published through Computers & Geosciences, and so it is almost certain to have issues. That aside, the basic code compiles but clearly errors are creeping in at run-time. What I am not sure about is why the output grid would start to fill in and then not complete? Really annoying that I cannot upload the whole code to show the lnkages (it is not very big !)
Cheers
Lester