added modules not previously uploaded in nocommon and gray-jintrac branches

This commit is contained in:
Daniele Micheletti 2015-06-10 13:22:01 +00:00
parent 31ecfb6be4
commit 88d0bffa22
5 changed files with 295 additions and 0 deletions

12
src/graydata_anequil.f90 Normal file
View File

@ -0,0 +1,12 @@
module graydata_anequil
use const_and_precisions, only : wp_
implicit none
real(wp_), save :: dens0,aln1,aln2
real(wp_), save :: te0,dte0,alt1,alt2
real(wp_), save :: rr0,zr0,rpa
real(wp_), save :: b0,rr0m,zr0m,rpam
real(wp_), save :: q0,qa,alq
real(wp_), save :: zeffan
end module graydata_anequil

14
src/graydata_flags.f90 Normal file
View File

@ -0,0 +1,14 @@
module graydata_flags
use const_and_precisions, only : wp_
implicit none
character*255, save :: filenmeqq,filenmprf,filenmbm
real(wp_), save :: sspl, dst
integer, save :: ibeam,iequil,ixp,iprof
integer, save :: iwarm,ilarm,imx,ieccd,ipec,idst
integer, save :: igrad,ipass
integer, save :: ipsinorm,iscal,icocos
integer, save :: nnd,istpr0,istpl0,ipol
integer, save :: neqdsk,nprof
end module graydata_flags

10
src/graydata_par.f90 Normal file
View File

@ -0,0 +1,10 @@
module graydata_par
use const_and_precisions, only : wp_
implicit none
real(wp_), save :: rwmax,rwallm
real(wp_), save :: psipol0,chipol0
real(wp_), save :: factb,factt,factn,psdbnd
real(wp_), save :: sgnbphi,sgniphi
end module graydata_par

153
src/interp_eqprof.f90 Normal file
View File

@ -0,0 +1,153 @@
module interp_eqprof
use const_and_precisions, only : wp_
implicit none
! equidata
INTEGER, SAVE :: nlim,nr,nz,nbbbs,nsrt,nszt,nsft
REAL(wp_), SAVE :: psia,psiant,psinop,btrcen,rcen
REAL(wp_), SAVE :: btaxis,rmaxis,zmaxis,rmnm,rmxm,zmnm,zmxm,dr,dz
REAL(wp_), SAVE :: zbmin,zbmax,fpolas,phitedge,rrtor,rup,zup,rlw,zlw !rrtor non usato, solo in equidata
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: tr,tz,tfp
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: cceq,cfp
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: cceq01,cceq10,cceq20,cceq02,cceq11
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: psinr,qpsi,rv,zv
REAL(wp_), DIMENSION(:,:), ALLOCATABLE, SAVE :: psin,psi,btotal,crhot,cq
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: rlim,zlim,rbbbs,zbbbs
! profdata
INTEGER, SAVE :: npp,nsfd
REAL(wp_), SAVE :: psnpp,aa,bb,cc
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: psrad,derad,terad,zfc,tfn,cfn
REAL(wp_), DIMENSION(:,:), ALLOCATABLE, SAVE :: ct,cz
contains
subroutine alloc_equilvec(ier)
implicit none
integer, intent(out) :: ier
integer :: nrest,nzest,lw10,lw01,lw20,lw02,lw11
if(nr.le.0.or.nz.le.0) then
ier = -1
return
end if
nrest=nr+4
nzest=nz+4
lw10=nr*3+nz*4+nr*nz
lw01=nr*4+nz*3+nr*nz
lw20=nr*2+nz*4+nr*nz
lw02=nr*4+nz*2+nr*nz
lw11=nr*3+nz*3+nr*nz
call dealloc_equilvec
allocate(rv(nr),zv(nz),tr(nrest),tz(nzest),tfp(nrest),cfp(nrest), &
btotal(nr,nz),cceq(nr*nz),cceq01(lw01),cceq10(lw10),cceq02(lw02), &
cceq20(lw20),cceq11(lw11),psi(nr,nz),psin(nr,nz),psinr(nr),qpsi(nr), &
stat=ier)
if (ier/=0) call dealloc_equilvec
end subroutine alloc_equilvec
subroutine dealloc_equilvec
implicit none
if(allocated(rv)) deallocate(rv)
if(allocated(zv)) deallocate(zv)
if(allocated(tr)) deallocate(tr)
if(allocated(tz)) deallocate(tz)
if(allocated(tfp)) deallocate(tfp)
if(allocated(cfp)) deallocate(cfp)
if(allocated(btotal)) deallocate(btotal)
if(allocated(cceq)) deallocate(cceq)
if(allocated(cceq01)) deallocate(cceq01)
if(allocated(cceq10)) deallocate(cceq10)
if(allocated(cceq02)) deallocate(cceq02)
if(allocated(cceq20)) deallocate(cceq20)
if(allocated(cceq11)) deallocate(cceq11)
if(allocated(psi)) deallocate(psi)
if(allocated(psin)) deallocate(psin)
if(allocated(psinr)) deallocate(psinr)
if(allocated(qpsi)) deallocate(qpsi)
end subroutine dealloc_equilvec
subroutine alloc_bnd(ier)
implicit none
integer, intent(out) :: ier
if(nlim.lt.0.or.nbbbs.lt.0) then
ier = -1
return
end if
call dealloc_bnd
allocate(rlim(nlim),zlim(nlim),rbbbs(nbbbs),zbbbs(nbbbs), &
stat=ier)
if (ier/=0) call dealloc_bnd
end subroutine alloc_bnd
subroutine dealloc_bnd
implicit none
if(allocated(rlim)) deallocate(rlim)
if(allocated(zlim)) deallocate(zlim)
if(allocated(rbbbs)) deallocate(rbbbs)
if(allocated(zbbbs)) deallocate(zbbbs)
end subroutine dealloc_bnd
subroutine alloc_lim(ier)
implicit none
integer, intent(out) :: ier
if(nlim.lt.0) then
ier = -1
return
end if
call dealloc_lim
allocate(rlim(nlim),zlim(nlim), &
stat=ier)
if (ier/=0) call dealloc_lim
end subroutine alloc_lim
subroutine dealloc_lim
implicit none
if(allocated(rlim)) deallocate(rlim)
if(allocated(zlim)) deallocate(zlim)
end subroutine dealloc_lim
subroutine alloc_profvec(ier)
implicit none
integer, intent(out) :: ier
integer :: npest
ier=0
if(npp.le.0) then
ier = -1
return
end if
npest=npp+4
call dealloc_profvec
allocate(psrad(npp),terad(npp),derad(npp),zfc(npp),ct(npp,4), &
cz(npp,4),tfn(npest),cfn(npest), &
stat=ier)
if (ier/=0) call dealloc_profvec
end subroutine alloc_profvec
subroutine dealloc_profvec
implicit none
if(allocated(psrad)) deallocate(psrad)
if(allocated(terad)) deallocate(terad)
if(allocated(derad)) deallocate(derad)
if(allocated(zfc)) deallocate(zfc)
if(allocated(ct)) deallocate(ct)
if(allocated(cz)) deallocate(cz)
if(allocated(tfn)) deallocate(tfn)
if(allocated(cfn)) deallocate(cfn)
end subroutine dealloc_profvec
end module interp_eqprof

106
src/magsurf_data.f90 Normal file
View File

@ -0,0 +1,106 @@
module magsurf_data
use const_and_precisions, only : wp_
implicit none
INTEGER, SAVE :: npsi, npoints !# sup mag, # punti per sup
INTEGER, SAVE :: njpt, nlmt
REAL(wp_), SAVE :: rarea
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: psicon,pstab,rhot_eq, &
rhotqv,bav,varea,vcurrp,vajphiav,qqv,ffc,vratja,vratjb
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: rpstab
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: vvol,rri,rbav,bmxpsi,bmnpsi
REAL(wp_), DIMENSION(:), ALLOCATABLE, SAVE :: tjp,tlm,ch,ch01
REAL(wp_), DIMENSION(:,:), ALLOCATABLE, SAVE :: rcon,zcon
REAL(wp_), DIMENSION(:,:), ALLOCATABLE, SAVE :: cdadrhot,cdvdrhot
REAL(wp_), DIMENSION(:,:), ALLOCATABLE, SAVE :: cvol,crri,crbav,cbmx,cbmn,carea,cfc
REAL(wp_), DIMENSION(:,:), ALLOCATABLE, SAVE :: crhotq
REAL(wp_), DIMENSION(:,:), ALLOCATABLE, SAVE :: cratja,cratjb,cratjpl
contains
subroutine alloc_surf_anal(ierr)
implicit none
integer, intent(out) :: ierr
if(npsi.le.0.or.npoints.le.0) then
ierr = -1
return
end if
call dealloc_surf_anal
allocate(psicon(npsi),rcon(npsi,npoints), &
zcon(npsi,npoints),stat=ierr)
if (ierr/=0) call dealloc_surf_anal
end subroutine alloc_surf_anal
subroutine dealloc_surf_anal
implicit none
if(allocated(psicon)) deallocate(psicon)
if(allocated(rcon)) deallocate(rcon)
if(allocated(zcon)) deallocate(zcon)
end subroutine dealloc_surf_anal
subroutine alloc_surfvec(ierr)
implicit none
integer, intent(out) :: ierr
if(npsi.le.0.or.npoints.le.0) then
ierr = -1
return
end if
call dealloc_surfvec
allocate(psicon(npsi),rcon(npsi,npoints),zcon(npsi,npoints),pstab(npsi), &
rhot_eq(npsi),rhotqv(npsi),bav(npsi),bmxpsi(npsi),bmnpsi(npsi),varea(npsi), &
vvol(npsi),vcurrp(npsi),vajphiav(npsi),qqv(npsi),ffc(npsi),vratja(npsi), &
vratjb(npsi),rpstab(npsi),rri(npsi),rbav(npsi),cdadrhot(npsi,4), &
cdvdrhot(npsi,4),cbmx(npsi,4),cbmn(npsi,4),crbav(npsi,4),cvol(npsi,4), &
crri(npsi,4),carea(npsi,4),cfc(npsi,4),crhotq(npsi,4),cratjpl(npsi,4), &
cratja(npsi,4),cratjb(npsi,4),stat=ierr)
if (ierr/=0) call dealloc_surf_anal
end subroutine alloc_surfvec
subroutine dealloc_surfvec
implicit none
if(allocated(psicon)) deallocate(psicon)
if(allocated(rcon)) deallocate(rcon)
if(allocated(zcon)) deallocate(zcon)
if(allocated(pstab)) deallocate(pstab)
if(allocated(rhot_eq)) deallocate(rhot_eq)
if(allocated(rhotqv)) deallocate(rhotqv)
if(allocated(bav)) deallocate(bav)
if(allocated(bmxpsi)) deallocate(bmxpsi)
if(allocated(bmnpsi)) deallocate(bmnpsi)
if(allocated(varea)) deallocate(varea)
if(allocated(vvol)) deallocate(vvol)
if(allocated(vcurrp)) deallocate(vcurrp)
if(allocated(vajphiav)) deallocate(vajphiav)
if(allocated(qqv)) deallocate(qqv)
if(allocated(ffc)) deallocate(ffc)
if(allocated(vratja)) deallocate(vratja)
if(allocated(vratjb)) deallocate(vratjb)
if(allocated(rpstab)) deallocate(rpstab)
if(allocated(rri)) deallocate(rri)
if(allocated(rbav)) deallocate(rbav)
if(allocated(cdadrhot)) deallocate(cdadrhot)
if(allocated(cdvdrhot)) deallocate(cdvdrhot)
if(allocated(cbmx)) deallocate(cbmx)
if(allocated(cbmn)) deallocate(cbmn)
if(allocated(crbav)) deallocate(crbav)
if(allocated(cvol)) deallocate(cvol)
if(allocated(crri)) deallocate(crri)
if(allocated(carea)) deallocate(carea)
if(allocated(cfc)) deallocate(cfc)
if(allocated(crhotq)) deallocate(crhotq)
if(allocated(cratjpl)) deallocate(cratjpl)
if(allocated(cratja)) deallocate(cratja)
if(allocated(cratjb)) deallocate(cratjb)
end subroutine dealloc_surfvec
end module magsurf_data