PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
Functions/Subroutines
driver_post Module Reference

Main driver of PostProcessing of program Peeling Ballooning in 3D. More...

Functions/Subroutines

integer function, public init_post ()
 Initializes the POST driver. More...
 
integer function, public run_driver_post ()
 The main driver routine for postprocessing. More...
 
subroutine, public stop_post ()
 Cleans up main driver for postprocessing. More...
 
integer function open_decomp_log ()
 Opens the decomposition log file. More...
 
integer function write_decomp_log (X_id, E_pot_int, E_kin_int)
 Write to decomposition log file. More...
 
subroutine find_stab_ranges (sol, min_id, max_id, last_unstable_id)
 finds the plot ranges min_id and max_id. More...
 
subroutine plot_sol_val_comp (sol_val_comp)
 Plots difference between Eigenvalues and energy fraction. More...
 
integer function setup_out_grids (grids_out, XYZ_eq, XYZ_sol)
 Sets up the output grids for a particular parallel job. More...
 

Detailed Description

Main driver of PostProcessing of program Peeling Ballooning in 3D.

Function/Subroutine Documentation

◆ find_stab_ranges()

subroutine driver_post::find_stab_ranges ( type(sol_type), intent(in)  sol,
integer, dimension(3), intent(inout)  min_id,
integer, dimension(3), intent(inout)  max_id,
integer, intent(inout)  last_unstable_id 
)

finds the plot ranges min_id and max_id.

There are three ranges, calculated using n_sol_plotted, which indicates:

  1. how many of the first EV's in the unstable range
  2. how many of the last EV's in the unstable range
  3. how many of the first EV's in the stable range
  4. how many of the last EV's in the stable range

have to be plotted.

This yields maximally three different ranges: One starting at the first unstable EV, one centered around the zero of the EV's and one ending at the last EV. These ranges can be disjoint but do not have to be.
Also, it is possible that a range does not exist, for example if there are no unstable EV's.

Note
A negative value for the elements in n_sol_plotted means "all values in range":
  1. or 2. full unstable range
  2. or 4. full stable range
Parameters
[in]solsolution variables
[in,out]min_idmin. index of range 1, 2 and 3
[in,out]max_idmax. index of range 1, 2 and 3
[in,out]last_unstable_idindex of last unstable EV

Definition at line 1037 of file driver_POST.f90.

+ Here is the caller graph for this function:

◆ init_post()

integer function, public driver_post::init_post

Initializes the POST driver.

  • set up preliminary variables
    • global variables
    • read grids (full)
    • eq_1 (full) and n & m (full)
  • set up output grids:
    • POST_style = 1: extended grid
    • POST_style = 2: field-aligned grid
  • clean up
  • set up final variables
    • normal limits
    • read grids (divided), eq_1 (divided) and sol (divided) variables
  • 1-D output plots
    • resonance plot
    • flux quantities plot
    • magnetic grid plot
  • prepare Eigenvalue plots
    • calculates resonant surfaces
    • plots Eigenvalues
    • finds stability ranges for all Eigenvalues to be plot
    • plots harmonics for every Eigenvalue
    • calculates the parallel ranges of the equilibrium jobs
  • clean up

In the actual driver, more detailed plots are possibly made for all requested Eigenvalues if full_output.

Returns
ierr

Definition at line 77 of file driver_POST.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ open_decomp_log()

integer function driver_post::open_decomp_log

Opens the decomposition log file.

Returns
ierr

Definition at line 841 of file driver_POST.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plot_sol_val_comp()

subroutine driver_post::plot_sol_val_comp ( complex(dp), dimension(:,:,:), intent(inout)  sol_val_comp)

Plots difference between Eigenvalues and energy fraction.

Parameters
[in,out]sol_val_compfraction between total \(E_{\text{pot}}\) and \(E_{\text{kin}}\), compared with EV

Definition at line 1113 of file driver_POST.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run_driver_post()

integer function, public driver_post::run_driver_post

The main driver routine for postprocessing.

Note
The PB3D output is given on different grids for different styles of the equilibrium model:
  • VMEC: field-aligned grid on which EV problem has been solved.
  • HELENA: output grid on which equilibrium and metric variables are tabulated.

Furthermore, if Richardson extrapolation is used, the VMEC grids and variables are contained in multiple HDF5 variables. These variables are needed here both in a field-aligned and a plot grid.

A consequence of the above is that for VMEC the field-aligned output is already given, but the output on the plot grid has to be calculated from scratch, while for HELENA both outputs have to be interpolated from the output tables.

The general workflow is as follows:

  • take a subset of the output grids for the current equilibrium job.
  • for POST_style = 1 (extended grid):
    • VMEC: recalculate variables
    • HEL: interpolate variables for POST_style = 2 (B-aligned grid):
    • VMEC: read subset of variables
    • HEL: interpolate variables
  • create helper variables
  • create plots and outputs
Returns
ierr

Definition at line 542 of file driver_POST.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setup_out_grids()

integer function driver_post::setup_out_grids ( type(grid_type), dimension(3), intent(inout)  grids_out,
real(dp), dimension(:,:,:,:), intent(inout), allocatable  XYZ_eq,
real(dp), dimension(:,:,:,:), intent(inout), allocatable  XYZ_sol 
)

Sets up the output grids for a particular parallel job.

Three grids are returned:

  • eq
  • X
  • sol

The normal coordinates of these grids correspond to the one used in PB3D. For X this is determined by x_grid_style.

The angular components of the eq and X grids is determined by post_style:

  • 1: extended grid with min_theta_plot, max_theta_plot, min_zeta_plot and max_zeta_plot.
  • 2: PB3D grid.
Returns
ierr
Parameters
[in,out]grids_outeq, X and sol output grids (full parallel and normal range)
[in,out]xyz_eqX, Y and Z on output equilibrium grid
[in,out]xyz_solX, Y and Z on output solution grid

Definition at line 1186 of file driver_POST.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop_post()

subroutine, public driver_post::stop_post

Cleans up main driver for postprocessing.

Definition at line 816 of file driver_POST.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_decomp_log()

integer function driver_post::write_decomp_log ( integer, intent(in)  X_id,
complex(dp), dimension(7), intent(in)  E_pot_int,
complex(dp), dimension(2), intent(in)  E_kin_int 
)

Write to decomposition log file.

Returns
ierr
Parameters
[in]x_idnr. of Eigenvalue
[in]e_pot_intE_pot integrated for requested solutions
[in]e_kin_intE_kin integrated for requested solutions

Definition at line 922 of file driver_POST.f90.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: