PB3D
[2.45]
Ideal linear high-n MHD stability in 3-D
|
Operations on HELENA variables. More...
Functions/Subroutines | |
integer function, public | read_hel (n_r_in, use_pol_flux_H) |
Reads the HELENA equilibrium data. More... | |
integer function | get_ang_interp_data_hel (grid_in, grid_out, theta_i, fund_theta_int_displ, tb_sym, use_E) |
Calculate interpolation factors for angular interpolation in grid_out of quantities defined on grid_in . More... | |
integer function, public | interp_hel_on_grid (grid_in, grid_out, eq_2, X_1, X_2, eq_2_out, X_1_out, X_2_out, eq_1, grid_name) |
Interpolate variables resulting from HELENA equilibria to another grid (angularly). More... | |
integer function, public | test_metrics_h () |
Checks whether the metric elements provided by HELENA are consistent with a direct calculation using the coordinate transformations [17]. More... | |
integer function, public | test_harm_cont_h () |
Investaige harmonic content of the HELENA variables. More... | |
Operations on HELENA variables.
integer function helena_ops::get_ang_interp_data_hel | ( | type(grid_type), intent(in) | grid_in, |
type(grid_type), intent(in) | grid_out, | ||
real(dp), dimension(:,:,:), intent(inout), allocatable | theta_i, | ||
integer, dimension(:,:,:), intent(inout), allocatable | fund_theta_int_displ, | ||
logical, intent(in), optional | tb_sym, | ||
logical, intent(in), optional | use_E | ||
) |
Calculate interpolation factors for angular interpolation in grid_out
of quantities defined on grid_in
.
This version is specific for an input grid corresponding to axisymmetric variables with optional top-down symmetry, as is the case for variables resulting from HELENA equilibria.
The output of a 3-D array of real values for the poloidal angle \(\theta\) where the floored integer of each value indicates the base index of the interpolated value in the output grid and the modulus is the the fraction towards the next integer.
The flag tb_sym
indicates optionally that there is top-bottom symmetry as well as axisymmetry. When there is top-down symmetry, the variables in the lower half (i.e. \(-\pi < \theta < 0\)) are calculated from the variables in the upper half using the symmetry properties of the variables. To indicate this, the sign of the interpolation factor is inverted to a negative value.
The displacement of the theta interval towards the fundamental theta interval is also outputted. For asymmetric variables this is for example:
etc.
For symmetric variables, this is for example:
By default, the variables in the Flux coord. system are used, but this can be changed optionally with the flag "use_E
.
[in] | grid_in | input grid |
[in] | grid_out | output grid |
[in,out] | theta_i | interpolation index |
[in,out] | fund_theta_int_displ | displacement of fundamental theta interval |
[in] | tb_sym | top-bottom symmetry |
[in] | use_e | whether E is used instead of F |
Definition at line 413 of file HELENA_ops.f90.
integer function, public helena_ops::interp_hel_on_grid | ( | type(grid_type), intent(in) | grid_in, |
type(grid_type), intent(in) | grid_out, | ||
type(eq_2_type), intent(inout), optional | eq_2, | ||
type(x_1_type), intent(inout), optional | X_1, | ||
type(x_2_type), intent(inout), optional | X_2, | ||
type(eq_2_type), intent(inout), optional | eq_2_out, | ||
type(x_1_type), intent(inout), optional | X_1_out, | ||
type(x_2_type), intent(inout), optional | X_2_out, | ||
type(eq_1_type), intent(in), optional | eq_1, | ||
character(len=*), intent(in), optional | grid_name | ||
) |
Interpolate variables resulting from HELENA equilibria to another grid (angularly).
The input and output grid to be provided depend on the quantities to be interpolated:
Also, a message can be printed if a grid name is passed.
[in] | grid_in | input grid |
[in] | grid_out | output grid |
[in,out] | eq_2 | general metric equilibrium variables |
[in,out] | x_1 | general vectorial perturbation variables |
[in,out] | x_2 | general tensorial perturbation variables |
[in,out] | eq_2_out | field-aligned metric equilibrium variables |
[in,out] | x_1_out | field-aligned vectorial perturbation variables |
[in,out] | x_2_out | field-aligned tensorial perturbation variables |
[in] | eq_1 | general flux equilibrium variables for metric interpolation |
[in] | grid_name | name of grid to which to adapt quantities |
Definition at line 550 of file HELENA_ops.f90.
integer function, public helena_ops::read_hel | ( | integer, intent(inout) | n_r_in, |
logical, intent(inout) | use_pol_flux_H | ||
) |
Reads the HELENA equilibrium data.
Adapted from HELENA routine IODSK
.
The variales in the HELENA mapping file are globalized in two ways:
R_vac
and toroidal field at the geometric axis B_vac
. R[m] = R_vac[m] (1 + eps X[])
, Z[m] = R_vac[m] eps Y[]
.The covariant toroidal field F_H
, pres_H
and poloidal flux are normalized w.r.t magnetic axis R_m
and total toroidal field at magnetic axis B_m:
RBphi[Tm] = F_H[] R_m[m] B_m[T]
, pres[N/m^2] = pres_H[] (B_m[T])^2/mu_0[N/A^2]
, flux_p[Tm^2] = 2pi (s[])^2 cpsurf[] B_m[T] (R_m[m])^2
.The first normalization type is the HELENA normalization, whereas the second is the MISHKA normalization.
Everything is translated to MISHKA normalization to make comparison with MISHKA simple. This is done using the factors:
radius[] = a[m] / R_m[m]
, eps[] = a[m] / R_vac[m]
, so that the expressions become: R[m] = radius[] (1/eps[] + X[]) R_m[m]
, Z[m] = radius[] Y[] R_m[m]
, RBphi[Tm] = F_H[] B_m[T] R_m[m]
, pres[N/m^2] = pres_H[] B_m[T]^2 mu_0[N/A^2]^-1
, flux_p[Tm^2] = 2pi (s[])^2 cpsurf[] B_m[T] R_m[T]^2
.Finally, in HELENA, the total current I
, the poloidal beta and the density at the geometric axis can be prescribed through:
XIAB = mu_0 I / (a_vac B_vac)
, BETAP = 8 pi S <p> / (I^2 mu_0)
, ZN
,where a_vac = eps R_vac
and B_vac
are vacuum quantities, S
is the 2-D cross-sectional area and <p> is the 2-D averaged pressure.
R_m = (eps/radius) R_vac
, B_m = B_vac / B0
,radius
is in the mapping file (12), as well as in the HELENA output (20).eps
is in the mapping file (12), as well as in the HELENA input (10) and output (20).B0
is in the mapping file (12), as well as in the HELENA output (20). ZN0
from HELENA input (10). [in,out] | n_r_in | nr. of normal points in input grid |
[in,out] | use_pol_flux_h | .true. if HELENA equilibrium is based on pol. flux |
Definition at line 84 of file HELENA_ops.f90.
integer function, public helena_ops::test_harm_cont_h |
Investaige harmonic content of the HELENA variables.
Definition at line 1485 of file HELENA_ops.f90.
integer function, public helena_ops::test_metrics_h |
Checks whether the metric elements provided by HELENA are consistent with a direct calculation using the coordinate transformations [17].
Direct calculations used:
\[\begin{aligned} \left|\nabla \psi\right|^2 &= \frac{1}{\mathcal{J}^2} \left(\left(\frac{\partial Z}{\partial \chi}\right)^2 + \left(\frac{\partial R}{\partial \chi}\right)^2\right) \\ \left|\nabla \psi \cdot \nabla \chi\right| &= \frac{1}{\mathcal{J}^2} \left( \frac{\partial Z}{\partial \chi} \frac{\partial Z}{\partial \psi} - \frac{\partial R}{\partial \chi} \frac{\partial R}{\partial \psi} \right) \\ \left|\nabla \chi\right|^2 &= \frac{1}{\mathcal{J}^2} \left(\left(\frac{\partial Z}{\partial \psi}\right)^2 + \left(\frac{\partial R}{\partial \psi}\right)^2\right) \\ \left|\nabla \phi\right|^2 &= \frac{1}{R^2} \end{aligned}\]
with
\[\mathcal{J} = \frac{\partial Z}{\partial \psi} \frac{\partial R}{\partial \chi} - \frac{\partial R}{\partial \psi} \frac{\partial Z}{\partial \chi}\]
Also, test whether the pressure balance \(\nabla p = \vec{J}\times\vec{B} \) is satisfied.
Definition at line 1289 of file HELENA_ops.f90.