updated to multi-beam and improved array bounds checks
This commit is contained in:
parent
b5355e2fd0
commit
7a14671b2a
File diff suppressed because it is too large
Load Diff
58
src/gray.f
58
src/gray.f
@ -1,15 +1,18 @@
|
|||||||
subroutine gray(ijetto, mr, mz, mrd, r, z, psin, psiax, psibnd,
|
subroutine gray(ijetto, mr, mz, mrd, r, z, psin, psiax, psibnd,
|
||||||
. rax, zax, nbnd, rbnd, zbnd, nrho, psijet, f, te, dne,
|
. rax, zax, nbnd, rbnd, zbnd, nrho, psijet, f, te, dne, zeff,
|
||||||
. zeff, qsf, powin, dpdv, jcd, pec, icd, ierr)
|
. qsf, nbeam, powin, alphin, betain, dpdv, jcd, pec, icd, ierr)
|
||||||
c input arguments
|
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 r(mr), z(mz), psin(mrd,mz)
|
||||||
real*8 psiax, psibnd, rax, zax
|
real*8 psiax, psibnd, rax, zax
|
||||||
real*8 rbnd(nbnd), zbnd(nbnd)
|
real*8 rbnd(nbnd), zbnd(nbnd)
|
||||||
real*8 psijet(nrho), f(nrho), qsf(nrho), te(nrho), dne(nrho)
|
real*8 psijet(nrho), f(nrho), qsf(nrho), te(nrho), dne(nrho)
|
||||||
real*8 zeff(nrho)
|
real*8 zeff(nrho)
|
||||||
|
real*8 powin(nbeam), alphin(nbeam), betain(nbeam)
|
||||||
c output arguments
|
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
|
integer ierr
|
||||||
c local variables
|
c local variables
|
||||||
c real*8 fgray(nrho), qgray(nrho), jcdgry(nrho), icdgry
|
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 zeff Effective nuclear charge Zeff on JETTO radial grid
|
||||||
c qsf Safety factor on JETTO radial grid
|
c qsf Safety factor on JETTO radial grid
|
||||||
c
|
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
|
||||||
c output arguments
|
c output arguments
|
||||||
c
|
c
|
||||||
@ -61,23 +67,43 @@ c
|
|||||||
c JETTO coordinate system assumes toroidal angle increasing CW
|
c JETTO coordinate system assumes toroidal angle increasing CW
|
||||||
c in GRAY toroidal angle increases CCW --> adapt signs on input data
|
c in GRAY toroidal angle increases CCW --> adapt signs on input data
|
||||||
c
|
c
|
||||||
do i=1,nrho
|
c do i=1,nrho
|
||||||
f(i)=-f(i)
|
c f(i)=-f(i)
|
||||||
qsf(i)=-qsf(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
|
end do
|
||||||
c
|
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 adapt output data to JETTO convention on toroidal angle
|
||||||
c
|
c
|
||||||
do i=1,nrho
|
do i=1,nrho
|
||||||
jcd(i)=-jcd(i)
|
jcd(i)=-jcd(i)
|
||||||
f(i)=-f(i)
|
c f(i)=-f(i)
|
||||||
qsf(i)=-qsf(i)
|
c qsf(i)=-qsf(i)
|
||||||
end do
|
end do
|
||||||
icd=-icd
|
icd=-icd
|
||||||
c
|
c
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
subroutine gray_main(ijetto, mr, mz, r, z, psin, psiax, psibnd, &
|
subroutine gray_main(ijetto, mr, mz, r, z, psin, psiax, psibnd, &
|
||||||
rax, zax, nbnd, rbnd, zbnd, nrho, psijet, f, te, dne, zeff, qsf, &
|
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
|
use const_and_precisions, only : r8
|
||||||
implicit none
|
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) :: r(mr), z(mz), psin(mr,mz)
|
||||||
real(r8), intent(in) :: psiax, psibnd, rax, zax
|
real(r8), intent(in) :: psiax, psibnd, rax, zax
|
||||||
real(r8), intent(in), dimension(nbnd) :: rbnd, zbnd
|
real(r8), intent(in), dimension(nbnd) :: rbnd, zbnd
|
||||||
real(r8), intent(in), dimension(nrho) :: psijet, f, qsf, te, dne, zeff
|
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), dimension(nrho) :: dpdv, jcd
|
||||||
real(r8), intent(out) :: pec, icd
|
real(r8), intent(out) :: pec, icd
|
||||||
integer, intent(out) :: ierr
|
integer, intent(out) :: ierr
|
||||||
@ -36,7 +36,8 @@ subroutine gray_main(ijetto, mr, mz, r, z, psin, psiax, psibnd, &
|
|||||||
call prfile
|
call prfile
|
||||||
call paraminit
|
call paraminit
|
||||||
call read_data(ijetto, mr, mz, r, z, psin, psiax, psibnd, rax, zax, &
|
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
|
call vectinit
|
||||||
if(iercom.eq.0) then
|
if(iercom.eq.0) then
|
||||||
if(igrad.eq.0) call ic_rt
|
if(igrad.eq.0) call ic_rt
|
||||||
|
Loading…
Reference in New Issue
Block a user