PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
Code outputs

This page describes the various outputs that PB3D and POST can produce.

On the one hand, there are various text output files, which are discussed in section Output Files.

Furthermore, a multitude of plots can be produced. This is the topic of section Output Plots.

Output Files

Some of these files are opened in open_output(), but others are opened afterwards.

Log file

Both PB3D and POST produce a log file, in addition to what is produced on the screen.

These log files are called PB3D_out.txt and POST_out.txt and they contain the same information as the output on the screen, but without the special formatting provided by the foul library (see Introduction).

Shell commands file

Some output routines make use of use_execute_command_line() in order to execute shell commands. This can be, for example, the creation of a plot by calling GnuPlot, among other things.

However, this often does not work well by default (see 30 in Input variables). In PB3D and POST, therefore, by default, these commands are not executed, but written to an output file. After execution of PB3D and POST has finished, this file can be made executed.

This behavior can be changed using the –do_execute_command_line flag (see Input variables).

HDF5 output file

PB3D writes variables to an HDF5 output file during execution, as shown in table 1. Note that there is a difference between the equilibrium styles because of the way how the equilibrium codes provide output:

  • VMEC (eq_style = 1) produces double Fourier series:
    • This can be evaluated at arbitrary angular points.
    • In PB3D, the equilibrium and perturbation variables are therefore already calculated on the field-aligned grid.
    • Parallel integration can then be done directly.
  • HELENA (eq_style = 2) produces 2-D tables for the poloidal cross-section.
    • This needs to be interpolated along the magnetic field lines before parallel integration.
    • The equilibrium and perturbation variables are calculated first in the HELENA grid.
Table 1. HDF5 output file
variable type VMEC (eq_style = 1) HELENA (eq_style = 2)
inputs in preliminary phase
grids of grid_vars.grid_type equilibrium
field-aligned-grid at every Richardson level
also output HELENA grid at first Richardson level
used later for interpolation to field-aligned grid
perturbation
field-aligned-grid at every Richardson level
also output HELENA grid at first Richardson level
used later for interpolation to field-aligned grid
solution
only at first Richardson level
flux equilibria of eq_vars.eq_1_type only at first Richardson level
metric equilibria of eq_vars.eq_2_type only at first Richardson level
also output HELENA grid at first Richardson level
used later for interpolation to field-aligned grid
vacuums of vac_vars.vac_type at every Richardson level only at first Richardson level
solutions of sol_vars.sol_type at every Richardson level

This data is used for Richardson restart (see variable rich_restart_lvl in Input variables).

In the post-processing phase, POST reads this data as well.

Eigenvalue summary file

In each Richardson extrapolation level, after the solution of the eigenvalue system of equations, eigenvalues are stored in PB3D.

  • For SLEPC, the results are saved in the procedure store_results():
    • If normalization is used, the normalization time scale is also stored.
    • If an unphysical complex eigenvalue is detected, this is indicated. See option retain_all_sol in Input file.

Energy reconstruction file

If energy reconstruction is performed by POST (see plot_E_rec in Input variables), the individual terms that make up the perturbed potential energy as well as the kinetic energy of the perturbation are calculated and plot. (3) Furthermore, the integration of these quantities over the whole volume, is returned in an output file.

In table 2, an overview is given of the different terms. Here, \(\rho\) is the density, \(\sigma = \frac{\vec{B}\cdot\vec{J}}{B^2}\) is the parallel current and \(\kappa = \frac{\vec{B}}{B} \cdot \nabla \frac{\vec{B}}{B}\) is the magnetic curvature. See calc_e().

Table 2. energy reconstruction
potential energy \(E_\text{pot}\) kinetic energy \(E_\text{kin}\)
  • normal line bending term \(\frac{1}{\left|\nabla\psi\right|^2 }\left(\frac{\nabla \psi}{\left|\nabla \psi\right|^2}\cdot \vec{Q}\right)^2\)
  • gedesic line bending term \(\mathcal{J}^2\frac{\left|\nabla \psi\right|^2}{B^2} \left( \frac{\nabla \psi \times \vec{B}}{B^2}\cdot \vec{Q} \right)^2\)
  • normal ballooning term \(-2 p' \left(\nabla \psi \cdot \vec{\xi}\right)^2 \left(\nabla \psi \cdot \vec{\kappa}\right)\)
  • geodesic ballooning term \(-2 p' \left( \nabla \psi \cdot \vec{\xi} \right) \left( \frac{\nabla \psi \times \vec{B}}{\left|\nabla \psi \right|^2} \cdot \vec{\xi}\right)^* \left(\frac{\nabla \psi \times \vec{B}}{\left|\nabla \psi \right|^2} \cdot \vec{\kappa}\right)\)
  • normal kink term \(-2 \sigma \left(\nabla \psi \cdot \vec{\xi}\right)^* \left(\frac{\nabla \psi \times \vec{B}}{B^2}\cdot \vec{Q} \right)\)
  • geodesic kink term \( 2 \sigma \left(\frac{\nabla \psi \times \vec{B}}{B^2} \cdot \vec{\xi}\right)^* \left(\nabla \psi\cdot \vec{Q} \right)\)
  • normal kinetic term \(\frac{1}{\left|\nabla\psi\right|^2 }\left(\frac{\nabla \psi}{\left|\nabla \psi\right|^2}\cdot \vec{\xi}\right)^2\)
  • gedesic kinetic term \(\mathcal{J}^2\frac{\left|\nabla \psi\right|^2}{B^2} \left( \frac{\nabla \psi \times \vec{B}}{B^2}\cdot \vec{\xi} \right)^2\)

Memory usage file

The memory usage of PB3D and POST can be monitored using the optional input argument –mem_info (see Command-line inputs).

This is a rather crude implementation and more advance profiling methods should be used, such as Scalasca on top of Score-P.

Note
Debug version only

Output Plots

A multitude of plots can be produced by PB3D and POST.

POST can produce all the plots that PB3D can, and some more.

The plots themselves fall in two categories:

  • Plots using an external program.
  • Data files that can be used to produce plots with visualization software:
    • The software used here was VisIt, based on personal preference, but ParaView or other VTK-based solutions should work equally well.
    • Every plot creates two output files: one heavy-data HDF5 file and one XDMF file that contains specifics about the HDF5 file.
    • This is necessary, as HDF5 itself is too general a format for general visualization tools to interpret easily.
    • The XDMF file that accompanies each HDF5 file basically contains information about the saved variables, such as whether they are vectors or scalars, and on which grid type they are defined.
    • This is the file that should be opened by the visualzation software.
    • The dimensions of these plots can be 2-D or 3-D, depending on eq_style. See 19 and 20 in Input variables.

An overview of possible plots is now given in table 3. The name of the respective input parameter is provided as well. See Input variables.

Table 3. possible plots
plot type external plot HDF5 plot
flux quantities (plot_flux_q)
  • pressure \(p\)
  • poloidal flux \(\Psi_\text{pol}\)
  • toroidal flux \(\Psi_\text{tor}\)
  • safety factor \(q\)
  • rotational transform \(\iota\)
  • pressure \(p\)
  • poloidal flux \(\Psi_\text{pol}\)
  • toroidal flux \(\Psi_\text{tor}\)
resonance (plot_resonance) safety factor \(q\) (poloidal flux) or rotational transform \(\iota\) (toroidal flux) with the indication of the resonant flux surfaces (1) surfaces of resonant values for safety factor \(q\) (poloidal flux) or rotational transform \(\iota\) (toroidal flux) (1)
magnetic grid (plot_magn_grid) magnetic grid lines in the magnetic flux surfaces, as a time collection
magnetic field \(\vec{B}\) (plot_B) co- and contravariant components of magnetic field, as well as magnitude and vector plot
current density \(\vec{J}\) (plot_J) co- and contravariant components of current density, as well as magnitude and vector plot
magnetic curvature \(\vec{\kappa}\) (plot_kappa) co- and contravariant components of magnetic curvature, as well as magnitude and vector plot
solution normal mode \(\vec{\xi}\) (plot_sol_xi) real and imaginary part and phase of perturbation of position, as well as vector plot
perturbated magnetic field due to solution normal mode \(\vec{Q}\) (plot_sol_Q) real and imaginary part and phase of perturbation of magnetic field, as well as vector plot
energy reconstruction (plot_E_rec) different components of energy reconstruction, integrated as well as profiles (2)
Note
  1. See use_pol_flux_F in Input variables.
  2. The integrated energy reconstruction terms are also output to a file. See Energy reconstruction file.
  3. Energy reconstruction only works well when POST_style = 2 is used, i.e. when the same grid is used as for PB3D.