updated to multi-beam and improved array bounds checks

This commit is contained in:
Lorenzo Figini 2015-02-09 17:43:37 +00:00
parent b5355e2fd0
commit 7a14671b2a
3 changed files with 890 additions and 175 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,18 @@
subroutine gray(ijetto, mr, mz, mrd, r, z, psin, psiax, psibnd,
. rax, zax, nbnd, rbnd, zbnd, nrho, psijet, f, te, dne,
. zeff, qsf, powin, dpdv, jcd, pec, icd, ierr)
. rax, zax, nbnd, rbnd, zbnd, nrho, psijet, f, te, dne, zeff,
. qsf, nbeam, powin, alphin, betain, dpdv, jcd, pec, icd, ierr)
c input arguments
integer ijetto, mr, mz, nbnd, nrho
integer ijetto, mr, mz, nbnd, nrho, nbeam
real*8 r(mr), z(mz), psin(mrd,mz)
real*8 psiax, psibnd, rax, zax
real*8 rbnd(nbnd), zbnd(nbnd)
real*8 psijet(nrho), f(nrho), qsf(nrho), te(nrho), dne(nrho)
real*8 zeff(nrho)
real*8 powin(nbeam), alphin(nbeam), betain(nbeam)
c output arguments
real*8 dpdv(nrho), jcd(nrho), powin, pec, icd
real*8 dpdv(nrho), jcd(nrho), pec, icd
c gray_main output arguments
real*8 dpdvloop(nrho), jcdloop(nrho), pecloop, icdloop
integer ierr
c local variables
c real*8 fgray(nrho), qgray(nrho), jcdgry(nrho), icdgry
@ -43,7 +46,10 @@ c dne Electron density on JETTO radial grid [m-3]
c zeff Effective nuclear charge Zeff on JETTO radial grid
c qsf Safety factor on JETTO radial grid
c
c powin Input ECRH power [W]
c nbeam Total number of injected beams
c powin Input ECRH power array [W] (powin(i) =< 0 means i-th beam is unused)
c alphin Beams poloidal injection angles array [rad]
c betain Beams toroidal injection angles array [rad]
c
c output arguments
c
@ -61,23 +67,43 @@ c
c JETTO coordinate system assumes toroidal angle increasing CW
c in GRAY toroidal angle increases CCW --> adapt signs on input data
c
do i=1,nrho
f(i)=-f(i)
qsf(i)=-qsf(i)
c do i=1,nrho
c f(i)=-f(i)
c qsf(i)=-qsf(i)
c end do
c
c set output variables to 0
c
dpdv = 0.d0
jcd = 0.d0
pec = 0.d0
icd = 0.d0
do j=1,nbeam
c
c call main subroutine for the j-th beam
c
if (powin(j).gt.0.0d0) then
call gray_main(ijetto, mr, mz, r, z, psin(1:mr,:), psiax,
. psibnd, rax, zax, nbnd, rbnd, zbnd, nrho, psijet, -f, te,
. dne, zeff, -qsf, j, powin(j), alphin(j), betain(j),
. dpdvloop, jcdloop, pecloop, icdloop, ierr)
c
c add contribution of j-th beam to the total
c
dpdv = dpdv + dpdvloop
jcd = jcd + jcdloop
pec = pec + pecloop
icd = icd + icdloop
end if
end do
c
c call main subroutine
c
call gray_main(ijetto, mr, mz, r, z, psin(1:mr,:), psiax, psibnd,
. rax, zax, nbnd, rbnd, zbnd, nrho, psijet, f, te, dne,
. zeff, qsf, powin, dpdv, jcd, pec, icd, ierr)
c
c adapt output data to JETTO convention on toroidal angle
c
do i=1,nrho
jcd(i)=-jcd(i)
f(i)=-f(i)
qsf(i)=-qsf(i)
c f(i)=-f(i)
c qsf(i)=-qsf(i)
end do
icd=-icd
c

View File

@ -1,16 +1,16 @@
subroutine gray_main(ijetto, mr, mz, r, z, psin, psiax, psibnd, &
rax, zax, nbnd, rbnd, zbnd, nrho, psijet, f, te, dne, zeff, qsf, &
powin, dpdv, jcd, pec, icd, ierr)
beamid, powin, alphain, betain, dpdv, jcd, pec, icd, ierr)
use const_and_precisions, only : r8
implicit none
integer, intent(in) :: ijetto, mr, mz, nrho, nbnd
integer, intent(in) :: ijetto, mr, mz, nrho, nbnd, beamid
real(r8), intent(in) :: r(mr), z(mz), psin(mr,mz)
real(r8), intent(in) :: psiax, psibnd, rax, zax
real(r8), intent(in), dimension(nbnd) :: rbnd, zbnd
real(r8), intent(in), dimension(nrho) :: psijet, f, qsf, te, dne, zeff
real(r8), intent(in) :: powin
real(r8), intent(in) :: powin, alphain, betain
real(r8), intent(out), dimension(nrho) :: dpdv, jcd
real(r8), intent(out) :: pec, icd
integer, intent(out) :: ierr
@ -36,7 +36,8 @@ subroutine gray_main(ijetto, mr, mz, r, z, psin, psiax, psibnd, &
call prfile
call paraminit
call read_data(ijetto, mr, mz, r, z, psin, psiax, psibnd, rax, zax, &
nbnd, rbnd, zbnd, nrho, psijet, f, te, dne, zeff, qsf, powin)
nbnd, rbnd, zbnd, nrho, psijet, f, te, dne, zeff, qsf, powin, alphain, betain, &
beamid)
call vectinit
if(iercom.eq.0) then
if(igrad.eq.0) call ic_rt