changed a few dynamic allocations into automatic

This commit is contained in:
Lorenzo Figini 2015-06-15 16:25:00 +00:00
parent e31949e5ae
commit 9a64cc5e59

View File

@ -2105,7 +2105,7 @@ c arguments
c local variables
integer iopt,ier,k
real(wp_) dx,drhot
real(wp_), dimension(:), allocatable :: rhotnr
real(wp_), dimension(nr) :: rhotnr
c common/external functions/variables
real(wp_) rhotsx
c
@ -2113,7 +2113,7 @@ c
c
if(allocated(cq)) deallocate(cq)
if(allocated(crhot)) deallocate(crhot)
allocate(rhotnr(nr),cq(nr,4),crhot(nr,4))
allocate(cq(nr,4),crhot(nr,4))
c
c normalized toroidal rho : ~ Integral q(psi) dpsi
c
@ -2136,8 +2136,6 @@ c spline interpolation of rhotor
c
iopt=0
call difcsn(psinr,rhotnr,nr,nnr,iopt,crhot,ier)
c
deallocate(rhotnr)
c
return
end
@ -2331,12 +2329,9 @@ c local variables
integer, dimension(3,2) :: ja
integer, dimension(1000) :: lx
real(wp_) :: drgrd,dzgrd,ah,adn,px,x,y
real(wp_), dimension(:), allocatable :: a
real(wp_), dimension(nr*nz) :: a
c
data px/0.5d0/
c
if(allocated(a)) deallocate(a)
allocate(a(nr*nz))
c
if(ichoi.eq.0) then
do j=1,nz
@ -2505,8 +2500,6 @@ c
npts(ncon) = icount - iclast
iclast = icount
50 continue
c
deallocate(a)
c
return
end
@ -2531,11 +2524,9 @@ c local variables
integer :: np,info,ic,ier,ii,iopt,m
real(wp_) :: ra,rb,za,zb,th,zc,val
real(wp_), dimension(mest) :: zeroc
real(wp_), dimension(:), allocatable :: czc
real(wp_), dimension(nr+4) :: czc
c
np=(npoints-1)/2
if(allocated(czc)) deallocate(czc)
allocate(czc(nr+4))
c
ra=rup
rb=rlw
@ -2577,8 +2568,6 @@ c
write(71,*)
write(71,*)
end if
c
deallocate(czc)
c
return
111 format(i6,12(1x,e12.5))
@ -2628,9 +2617,8 @@ c
if(allocated(tjp)) deallocate(tjp)
if(allocated(tlm)) deallocate(tlm)
if(allocated(ch)) deallocate(ch)
if(allocated(ch01)) deallocate(ch01)
allocate(tjp(njest),tlm(nlest),ch((njest-4)*(nlest-4)),
. ch01(lw01),rctemp(npoints),zctemp(npoints),stat=ierr)
. rctemp(npoints),zctemp(npoints),stat=ierr)
if (ierr.ne.0) return
c computation of flux surface averaged quantities
@ -2938,9 +2926,6 @@ c spline interpolation of H(lambda,rhop) and dH/dlambda
njpt=njp
nlmt=nlm
call coeff_parder(tjp,njp,tlm,nlm,ch,ksp,ksp,0,1,
. ch01,lw01,ier)
c
return
99 format(20(1x,e12.5))
end
@ -4813,10 +4798,7 @@ c local variables
integer :: iopt,ier,m
real(wp_) :: zc,val
real(wp_), dimension(mest) :: zeroc
real(wp_), dimension(:), allocatable :: czc
c
if(allocated(czc)) deallocate(czc)
allocate(czc(nr+4))
real(wp_), dimension(nr+4) :: czc
c
iopt=1
zc=zmaxis
@ -4826,8 +4808,6 @@ c
call sproota(val,tr,nsr,czc,zeroc,mest,m,ier)
r1=zeroc(1)
r2=zeroc(2)
c
deallocate(czc)
c
return
end