A quasi-optical beam-tracing code for electron cyclotron waves absorption and current drive in tokamaks
Go to file
Michele Guerini Rocco 127d574be7
rework the analytical model
This change modifies the analytical equilibrium in order to simplify the
computation of the poloidal flux normalization and the derivatives.

In the power law parametrisation of the safety factor, ρ_t is replaced
with ρ_p and, similarly, the normalised poloidal radius is now
identified with ρ_p, instead of ρ_t.
With the same parameters (q₀,q₁,α...), this choice slightly changes the
plasma current distribution, but enables us to obtain a closed form for
ψ_a = ψ(r=a) and the relation ρ_t(ρ_p). In fact, both expressions are
now obtained by integrating the q(ρ_p), instead of 1/q(ρ_t), which has
no elementary antiderivative.

As the normalisation is now computed exactly, the values of the
normalised flux ψ_n = ψ/ψ_a and the gradient ∇ψ (entering the raytracing
equations in X and ∇X, respectively) are computed to the same precision.
Previously, ψ_n was computed to a lower precision due to the use of a
simple trapezoid integration of 1/q(ρ_p) for ψ_a, while ∇ψ was computed
up to machine precision using an exact formula.

This error effectively caused a very slight decoupling between X=ω_p²/ω²
and ∇X that introduced a systematic error in the numerical solution of
the raytracing equations.
The error manifests itself as a bias with a weak dependency on X in the
values taken by the dispersion function Λ(r̅, n̅) on the phase-space
points generated by the integrator. More specifically,

  lim h→0 Λ(r̅_i, n̅_i) = -kX(r̅_i)

where h is the integrator step size;
      r̅_i is the position at the i-th step;
      k ≈ -3.258⋅10⁻⁵ and depends only on the number of points used to
        perform the trapedoid integral for ψ_a (as ~ 1/n²).

After this change Λ behaves consistently with being a conserved quantity
(zero) up to the cumulative integration error of the 4° order
Runge-Kutta method. In fact we now have that:

  Λ(r̅_i, n̅_i) ∝ - h⁴ ‖∂⁴X(r̅_i)/∂r̅⁴‖

It must be said that within this model the relation ρ_p(ρ_t) can't be
computed analytically (inverting ρ_t(ρ_p) produces a trascendental
equation of the form b = x + c x^α). However, this relation is not
necessary for raytracing and is easily solved, up to machine
precision, using minpack.

In addition, this change also makes the model consistetly use the
cocos=3 and fully implements the ability to force the signs of I_p, B_φ
(via equilibrium.sgni,sgnb) and rescaling the field (via
equilibrium.factb).
2023-12-12 23:37:43 +01:00
doc Improve documentation build 2022-11-17 19:31:58 +01:00
input rework the analytical model 2023-12-12 23:37:43 +01:00
scripts Add first draft of Python plotting script 2022-11-13 01:57:09 +01:00
src rework the analytical model 2023-12-12 23:37:43 +01:00
srcjetto fixed incompatibilities with allocatable arrays (pgf90 compiler, JETTO); fixed input/output scaling (gray/jetto interface); fixed error in read_beams2 for small beam tables 2016-06-01 13:49:35 +00:00
.gitignore add option to set parameters from the command-line 2022-05-11 01:15:07 +02:00
configure add documentation 2021-12-15 02:30:58 +01:00
default.nix default.nix: update to Nixpkgs 21.11 2023-03-29 21:52:21 +02:00
depend depend: fix typo 2023-03-30 11:06:33 +02:00
LICENSE.md Update license 2022-11-18 19:47:50 +01:00
Makefile Fix debug/optimization flags 2023-10-20 13:42:06 +02:00
minpack-LICENSE.txt Add License files 2022-11-17 19:42:44 +01:00