gray/doc/3.io-files.md

567 lines
29 KiB
Markdown
Raw Normal View History

2021-12-15 02:30:58 +01:00
# Input and output files {#sec:io-files}
This section describes the input data required by GRAY and the output
files that are saved and stored for the GRT-161 analysis. In [@tbl:io]
the assigned unit numbers used for various input and output files in GRAY are
listed. Shell scripts allow to run the code for various input data that are
varied by means of suitable loops.
---------------------------------------------------------------------------------------------------------------------------
Unit Number I/O Content Filename
------------- -------- ---------------------------------------------- -----------------------------------------------------
2 I Input data `gray_params.data`
99 I Equilibrium file EQDSK `filenmeqq.eqdsk`
98 I Kinetic profiles `filenmeprf.prf`
97 I Beam data `filenmebm.txt`
4 O Data for central ray None
7 O Global data and results None / assigned by shell script
48 O ECRH&CD profiles None / assigned by shell script
33 O Data for outmost rays None
8 O Beam cross section shape None
9 O Rays distribution at the end None
of the integration path
12 O Beam transverse sizes None
17 O Beam tracing error on Hamiltonian None
55 O Kinetic profiles None
56 O Flux averaged quantities None
70 O EC resonance surface at relevant harmonics None
71 O Flux surface contours at None
$\sqrt{\psi}=\text{const}$
78 O Record of input parameters `headers.txt` / attached to output by shell script
---------------------------------------------------------------------------------------------------------------------------
Table: GRAY I/O Unit Numbers {#tbl:io}
## Input Files {#sec:input-files}
To run GRAY, the user must supply a `gray_params.data` file and two
files, containing information about the MHD equilibrium and the kinetic
profiles, respectively.
The variables and quantities in `gray_params.data` are listed in
[@tbl:input1;@tbl:input2;@tbl:input3], suitably grouped together.
The equilibrium information is provided via a G-EQDSK file (with extension
`.eqdsk`), with conventions specified as in [@cocos].
The kinetic profiles are provided in an ASCII file (with extension `.prf`).
The format of the G-EQDSK file is described in [@sec:eqdisk], while the format
of the `.prf` file for the profiles is the following quantities defined in
[@tbl:profiles1]:
```fortran
read (98,*) npp
do i=1,npp
read(98,*) psin(i),Te(i),ne(i),Zeff(i)
end do
```
The beam parameters are read either from the `gray_params.data` file, or
from an ASCII file (with extension `.txt`), depending on the value of the
`ibeam` parameter as specified in [@tbl:input1]. If the ASCII file
is used, the user can supply multiple launching conditions, and/or use a
general astigmatic Gaussian beam. The format of the `.txt` file is the
following, for `ibeam`=1 and `ibeam`=2 respectively (quantities defined
in [@tbl:profiles2]):
```fortran
! +++ IBEAM=1 +++
read(97,*) nsteer
do i=1,nsteer
read(97,*) gamma(i),alpha0(i),beta0(i),x0mm(i),y0mm(i),z0mm(i), &
w0xi(i),d0eta(i),w0xi(i),d0eta(i),phiw(i)
end do
! +++ IBEAM=2 +++
read(97,*) nsteer
do i=1,nisteer
read(97,*) gamma(i),alpha0(i),beta0(i),x0mm(i),y0mm(i),z0mm(i), &
wxi(i),weta(i),rcixi(i),rcieta(i),phiw(i),phir(i)
end do
```
## G-EQDSK format {#sec:eqdisk}
The G EQDSK file provides information on:
1. pressure,
2. poloidal current function,
3. $q$ profile,
4. plasma boundary,
5. limiter contour
All quantities are defined on a uniform flux grid from the magnetic axis to the
plasma boundary and the poloidal flux function on the rectangular computation
grid. A right-handed cylindrical coordinate system $(R, φ, Ζ)$ is used.
### Variables
In order of appearance in the file:
-------- --------- -------------------------------------
Name Type Description
--------- --------- -------------------------------------
`case` String(6) Identification string
`nw` Integer Number of horizontal $R$ grid points
`nh` Integer Number of vertical $Z$ grid points
---------------------------------------------------------
Table: **Miscellanea** {#tbl:eqdisk-misc}
--------- --------- --------------- -----------------------------------------------
Name Type Unit Description
--------- --------- --------------- -----------------------------------------------
`rdim` Real m Horizontal dimension of the computational box
`zdim` Real m Vertical dimension of the computational box
`rleft` Real m Minimum R of the rectangular computational box
`zmid` Real m Z of center of the computational box
`rmaxis` Real m R of the magnetic axis
`zmaxis` Real m $Z$ of the magnetic axis
-----------------------------------------------------------------------------
Table: **Geometry** {#tbl:eqdisk-geom}
--------- --------- --------------- -------------------------------------------------------
Name Type Unit Description
--------- --------- --------------- -------------------------------------------------------
`simag` Real Wb/rad Poloidal flux at the magnetic axis
`sibry` Real Wb/rad Poloidal flux at the plasma boundary
`rcentr` Real m $R$ of vacuum toroidal magnetic field `bcentr`
`bcentr` Real T Vacuum toroidal magnetic field at `rcentr`
`current` Real A Plasma current
`fpol` Real mT Poloidal current function, $F = RB_T$ on the flux grid
`pres` Real Pa Plasma pressure on a uniform flux grid
`ffprim` Real (mT²)/(Wb/rad) $FF'(ψ)$ on a uniform flux grid
`pprime` Real Pa/(Wb/rad) $P'(ψ)$ on a uniform flux grid
`psizr` Real Wb/rad Poloidal flux on the rectangular grid points
`qpsi` Real 1 $q$ values on uniform flux grid from axis to boundary
-------------------------------------------------------------------------------------------
Table: **Magnetic equilibrium** {#tbl:eqdisk-eq}
--------- --------- --------------- -------------------------------------------------------
Name Type Unit Description
--------- --------- --------------- -------------------------------------------------------
`nbbbs` Integer 1 Number of boundary points
`limitr` Integer 1 Number of limiter points
`rbbbs` Real m $R$ of boundary points
`zbbbs` Real m $Z$ of boundary points
`rlim` Real m $R$ of surrounding limiter contour
`zlim` Real m $Z$ of surrounding limiter contour
--------------------------------------------------------------
Table: **Plasma boundary** {#tbl:eqdisk-bound}
### Toroidal Current Density
The toroidal current $J_T$ (A/m²) is related to $P'(ψ)$ and $FF'(ψ)$ through
$$
J_T = R P'(ψ) + FF'(ψ) / R
$$
### Example Fortran 77 code
The following snippet can be used to load a G-EQDSK file:
```fortran
character*10 case(6)
dimension psirz(nw,nh),fpol(1),pres(1),ffprim(1),
. pprime(1),qpsi(1),rbbbs(1),zbbbs(1),
. rlim(1),zlim(1)
c
read (neqdsk,2000) (case(i),i=1,6),idum,nw,nh
read (neqdsk,2020) rdim,zdim,rcentr,rleft,zmid
read (neqdsk,2020) rmaxis,zmaxis,simag,sibry,bcentr
read (neqdsk,2020) current,simag,xdum,rmaxis,xdum
read (neqdsk,2020) zmaxis,xdum,sibry,xdum,xdum
read (neqdsk,2020) (fpol(i),i=1,nw)
read (neqdsk,2020) (pres(i),i=1,nw)
read (neqdsk,2020) (ffprim(i),i=1,nw)
read (neqdsk,2020) (pprime(i),i=1,nw)
read (neqdsk,2020) ((psirz(i,j),i=1,nw),j=1,nh)
read (neqdsk,2020) (qpsi(i),i=1,nw)
read (neqdsk,2022) nbbbs,limitr
read (neqdsk,2020) (rbbbs(i),zbbbs(i),i=1,nbbbs)
read (neqdsk,2020) (rlim(i),zlim(i),i=1,limitr)
c
2000 format (6a8,3i4)
2020 format (5e16.9)
2022 format (2i5)
```
## Output Files
GRAY outputs are given in ASCII files at each GRAY execution.
[@tbl:output7;@tbl:output48] describe the outputs reported in units 7 and 48,
respectively.
----------------------------------------------------------------------------------------------------------------------------
Variable Type Units Valid range Definition
---------------- ----------- --------- ----------------------- ------------------------------------------------------------
`alpha0` Real deg $-180 < x 180$ Poloidal injection angle $α$, defined in [@eq:albt].
`beta0` Real deg $-90 < x 90$ Toroidal injection angle $β$, defined in [@eq:albt].
`fghz` Real GHz $x>0$ EC frequency.
`P0` Real MW $x>0$ EC injected power.
`Nrayr` Integer 1 $1 ≤ n ≤ 31$ Number of rays $N_r$ in radial direction + 1 in
the center, ${\tt Nrayr} = N_r +1$.
`Nrayth` Integer 1 $1 ≤ n ≤ 36$ Number of rays $N_{\theta}$ in angular direction.
`rwmax` Real $x > 0$ "cut-off" size $\tilde ρ_{max}$ of the gaussian beam.
(typical $1 ≤ {\tt rwmax} ≤ 1.5$), defined at page.
`x0` Real cm $X$ coordinate of the launching point.
`y0` Real cm $Y$ coordinate of the launching point.
`z0` Real cm $Z$ coordinate of the launching point.
`w0xi` Real cm $x > 0$ Beam waist $w_{0,\xi}$ in beam reference system.
along $\xi$, defined in [@eq:rciw].
`w0eta` Real cm $x > 0$ Beam waist $w_{0,\eta}$ in beam reference system.
along $\eta$, defined in [@eq:rciw].
`d0xi` Real cm $\bar{z}$ coordinate of beam waist $w_{0,\xi}$,.
defined in [@eq:rciw].
`d0eta` Real cm $\bar{z}$ coordinate of beam waist $w_{0,\eta}$,.
defined in [@eq:rciw].
`phiw` Real deg $-90 < x 90$ Rotation angle $φ_w=φ_R$ of local beam coordinate.
system, defined in [@eq:phiwr].
`ibeam` Integer 0, 1, 2 Input source for beam data:.
0=simple astigmatic beam with parameters as above,.
1=simple astigmatic beam from `filenmbm`,.
2=general astigmatic beam from `filenmbm`.
`filenmbm` String len$(s)≤ 24$ Name of file (extension `.txt` appended) with beam.
parameters, used if ${\tt ibeam} >0$.
`iox` Integer 1, 2 1=Ordinary mode (OM), 2=Extraordinary (XM) mode.
`psipol0` Real deg $-90 < x 90$ Wave polarisation angle $\psi_p$ at the launching point.
`chipol0` Real deg $-45 ≤ x ≤ 45$ Wave polarisation angle $\chi_p$ at the launching point.
----------------------------------------------------------------------------------------------------------------------------
Table: GRAY input data `gray_params.data` - EC wave {#tbl:input1}
----------------------------------------------------------------------------------------------------------------------------
Variable Type Units Valid range Definition
---------------- ----------- --------- ----------------------- ------------------------------------------------------------
`iequil` Integer 0, 1, 2 Magnetic equilibrium model:
0=vacuum (no plasma at all),
1=analytical
2=G-EQDSK.
`ixp` Integer -1, 0, 1 X point occurrence:
-1=bottom,
0=none,
+1=top.
`iprof` Integer 0, 1 Kinetic profiles:
0=analytical
1=numerical.
`filenmeqq` String len$(s)≤ 24$ Name of EQDSK file (extension `.eqdsk` appended).
`ipsinorm` Integer 0, 1 0=dimensional (default),
1=normalized (obsolete, for some old files
psi$(R,z)$ in `filenmeqq`.
`sspl` Real 1 $x > 0$ Tension of spline fit for psi (${\tt sspl} \ll 1$ typical),
0=interpolation.
`factb` Real 1 $x > 0$ Numerical factor to rescale the magnetic field
$B \rightarrow B \cdot {\tt factb}$.
`factt` Real 1 $x > 0$ Numerical factor to rescale the electron temperature
$T_e \rightarrow T_e \cdot {\tt factt}
\cdot {\tt factb}^{\tt ab}$.
`factn` Real 1 $x > 0$ Numerical factor to rescale the electron density
$n_e \rightarrow n_e \cdot {\tt factn}
\cdot {\tt factb}^{\tt ab}$.
`iscal` Int 1, 2 Model for $n_e$, $T_e$ scaling with $B$:
1=constant $n_{Greenwald}$ (`ab`=1),
2=none (`ab`=0).
`filenmprf` String len$(s) ≤ 24$ Name of file for kinetic profiles
(extension `.prf` appended).
`psdbnd` Real 1 $x > 0$ Normalized psi value at the plasma boundary where
$n_e$ is set to zero (typ. $1 ≤ {\tt psdbnd} ≤ 1.1$).
`sgnbphi` Real 1 -1, +1 Signum of toroidal B, used if `icocos`=0.
`sgniphi` Real 1 -1, +1 Signum of toroidal plasma current $I$, used if `icocos`=0.
`icocos` Int 0-8, 10-18 COCOS index used in `filenmeqq` as defined in [@cocos]:
0=no COCOS convention and psi in Wb/rad,
10=means no convention and psi in Wb.
----------------------------------------------------------------------------------------------------------------------------
Table: GRAY input data `gray_params.data` - plasma data {#tbl:input2}
----------------------------------------------------------------------------------------------------------------------------
Variable Type Units Valid range Definition
---------------- ----------- --------- ----------------------- ------------------------------------------------------------
`iwarm` Integer 0, 1, 2, 3 Absorption model:
0=none (α=0),
1=weakly relativistic,
2=fully relativistic (fast),
3=fully relativistic (slow).
`ilarm` Integer 1 $n ≥ 1$ Order of Larmor radius expansion for absorption
computation ${\tt ilarm}>$ local EC harmonic number.
`ieccd` Integer 0, 1, 11 Current drive model:
0=none,
1=Cohen,
11=Marushchenko.
`igrad` Integer 0, 1 Ray-tracing model:
0=optical,
1=quasi-optical (requires ${\tt nrayr} \ge 5$).
`idst` Integer 0, 1, 2 Ray-tracing integration variable:
0=$s$,
e1=$c \cdot t$,
2=$S_R$,
(default=0).
`dst` Real cm $x > 0$ Spatial integration step.
`nstep` Integer 1 $0 ≤ n ≤ 8000$ Maximum number of integration steps.
`istprj` Integer 1 $1 ≤ n ≤ {\tt nstep}$ Subsampling factor for beam cross section
data output (units 8, 12).
`istpl` Integer 1 $1 ≤ n ≤ {\tt nstep}$ Subsampling factor for outmost rays
data output (unit 33).
`ipec` Integer 0, 1 Grid spacing for ECRH&CD profiles:
0=equispaced in $\psi$ (obsolete),
1=equispaced in $\sqrt{\psi}$.
`nnd` Integer 1 $2 ≤ n ≤ 5001$ Number of points in the ECRH&CD profile grid.
`ipass` Integer $-2,1, 2$ $\vert{\tt ipass}\vert$=number of passes into plasma:
-2=reflection at `rwallm`,
+2=reflection at limiter.
Surface given in EQDSK.
`rwallm` Real m $x > 0$ Inner wall radius for 2nd pass calculations,
used only for `ipass`=$-2$.
----------------------------------------------------------------------------------------------------------------------------
Table: GRAY input data `gray_params.data` - ECRH&CD models and code parameters {#tbl:input3}
----------------------------------------------------------------------------------------------------------------------------
Variable Type Units Valid range Definition
---------------- ----------- --------- ----------------------- ------------------------------------------------------------
`npp` Integer 1 $2 ≤ n ≤ 250$ Number of points in `psin` table
`psin` real 1 $0 ≤ x ≤$ `psdbnd` Poloidal flux $\psi$ normalized over the value at the LCS
`Te` real keV $x ≥ 0$ Electron temperature
`ne` real 10¹⁹m⁻³ $x ≥ 0$ Electron density
`Zeff` real 1 $x ≥ 0$ Effective charge, $Z_{\rm eff}$
----------------------------------------------------------------------------------------------------------------------------
Table: GRAY input data `filenmprf.prf` - plasma profiles {#tbl:profiles1}
----------------------------------------------------------------------------------------------------------------------------
Variable Type Units Valid range Definition
---------------- ----------- --------- ----------------------- ------------------------------------------------------------
`nsteer` Integer 1 $n ≤ 50$ Number launching conditions in table.
`gamma` Real deg Steering angle w.r.t. a reference position (unused).
`alpha0` Real deg $-180 < x 180$ Poloidal injection angle $α$.
`beta0` Real deg $-90 ≤ x ≤ 90$ Toroidal injection angle $β$.
`x0mm` Real mm $X$ coordinate of the launching point.
`y0mm` Real mm $Y$ coordinate of the launching point.
`z0mm` Real mm $Z$ coordinate of the launching point.
`w0xi` Real mm $x > 0$ Beam waist $w_{0,\xi}$ along $\xi$.
`w0eta` Real mm $x > 0$ Beam waist $w_{0,\eta}$ along $\eta$.
`d0xi` Real mm $\bar z$ coordinate of beam waist $w_{0,\xi}$,
$\bar z=0$ at launching point.
`d0eta` Real mm $\bar z$ coordinate of beam waist $w_{0,\eta}$,
$\bar z=0$ at launching point.
`wxi` Real mm $x > 0$ Beam width $w_{\xi}$ at the launching point.
`weta` Real mm $x > 0$ Beam width $w_{\eta}$ at the launching point.
`rcixi` Real mm⁻¹ Inverse of phase front curvature radius $1/R_{\xi}$
at the launching point.
`rcieta` Real mm⁻¹ Inverse of phase front curvature radius $1/R_{\eta}$
at the launching point.
`phiw` Real deg Rotation angle $φ_w$ of the $(\xi_w,\eta_w)$ reference
system, defined in [@eq:phiwr].
`phir` Real deg Rotation angle $φ_R$ of the $(\xi_R,\eta_R)$ reference
system, defined in [@eq:phiwr].
----------------------------------------------------------------------------------------------------------------------------
Table: GRAY input data `filenmbm.prf` - launched beam parameters {#tbl:profiles2}
---------------------------------------------------------------------------------------------------
Variable Type Units Definition
---------------- ----------- --------- ------------------------------------------------------------
`Icd` Real kA EC total driven current $I_{cd}$.
`Pa` Real MW EC total absorbed power $P_{abs}$.
`Jphimx` Real MA⋅m⁻² EC peak current density $J_{φ}= dI_{cd}/dA$.
`dPdVmx` Real MW⋅m⁻³ EC peak power density $dP/dV$.
`rhotj` Real 1 $ρ$ value corresponding to `Jphimx`.
`rhotp` Real 1 $ρ$ value corresponding to `dPdVmx`.
`drhotj` Real 1 Full width at $1/e$ of driven current density profile.
`drhotp` Real 1 Full width at $1/e$ of power density profile.
`Jphip` Real MA⋅m⁻² EC peak current density $J_{φ 0}$ from Gaussian profile,
defined in [@eq:pjgauss].
`dPdVp` Real MW⋅m⁻³ EC peak power density $p_0$ from Gaussian profile,
defined in [@eq:pjgauss].
`rhotjava` Real 1 $ρ$ value averaged over current density profile,
defined in [@eq:rav].
`rhotpav` Real 1 $ρ$ value averaged over power density profile,
defined in [@eq:rav].
`drhotjava` Real 1 Full width of the driven current density profile,
defined in [@eq:drav].
`drhotpav` Real 1 Full width of the driven power density profile,
defined in [@eq:drav].
`ratjbmx` Real 1 Ratio $J_{cd}/J_{φ}$ at $ρ=$`rhotjava`,
with $J_{cd}=\langle \bold{J}\cdot \bold{B} \rangle
/\langle \mathbf{B} \rangle$.
`ratjamx` Real 1 Ratio $J_{cd}/J_{φ}$ at $ρ=$`rhotjava`,
with $J_{cd}=\langle \bold{J}\cdot \bold{B} \rangle/B_0$
`stmx` Real cm Path from the launching point and peak $dP/dV$
for the central ray.
`psipol` Real ?? $\psi$ polarisation angle at vacuum-plasma boundary.
`chipol` Real ?? $\chi$ polarisation angle at vacuum-plasma boundary.
`index_rt` Integer Index encoding mode and pass number, see [@sec:index_rt].
---------------------------------------------------------------------------------------------------
Table: GRAY output data - unit 7 {#tbl:output7}
---------------------------------------------------------------------------------------------------
Variable Type Units Definition
---------------- ----------- --------- ------------------------------------------------------------
`psin ` Real 1 Normalized poloidal flux.
`rhot` Real 1 Normalized minor radius $ρ$.
`Jphi` Real MA⋅m⁻² EC current density $J_{φ}= dI_{cd}/dA$,
with $A$ the area of the poloidal section labelled by $ρ$.
`Jcdb` Real MA⋅m⁻² EC current density
$J_{cd}=\langle \bold{J}\cdot\bold{B} \rangle
/\langle \mathbf{B} \rangle$.
`dPdV` Real MW⋅m⁻³ EC power density $p(ρ)=dP/dV$.
`Icdins` Real kA EC current driven inside surface of radius $ρ$,
$I_{ins}(ρ)=\int_0^{ρ} J_{cd} dA$.
`Pins` Real MW EC power absorbed inside surface of radius $ρ$,
$P_{ins}(ρ)=\int_0^{ρ}p dV$.
`P%` Real 1 Fraction of power deposited inside radius $ρ$,
`P%`$(ρ)=P_{ins}/P_{abs}$.
`index_rt` Integer Index encoding mode and pass number, see [@sec:index_rt].
---------------------------------------------------------------------------------------------------
Table: GRAY output data - unit 48 {#tbl:output48}