Background and Methods Used in W_PFC

W_PFC was developed to provide a GUI interface to the DIVERTOR_HEAT_FLUX_JEM_V3 code developed by J. Menard (PFCR-MEMO-004), a IDL-based tool which allowed heat fluxes to be computed for single equilibrium (described by GEQDSK files).  To manage default and optional inputs, as well as allow for a series of equilibria to be used to explore strike point sweeps an upgrade and GUI interface was desired.  The underlying heat flux code was modified to add (PFCR-MEMO-007 [in-progress]):
  • ability to use Eich and MAST scaling for heat flux width, or define a specific value (LAMBDA_Q)
  • ability to run equlibria at any DRSEP value, by using a power splitting based on DRSEP/LAMBDA_Q
This material updated on 6/27/2017 for W_PFC version=0.1

Compiling and Running W_PFC

W_PFC is written in IDL, but no IDL knowledge is required to run/use it.  On the nstxpool machines, IDL can launched by:

[mreinke@sunfire62 ~]$ module load idl
[mreinke@sunfire62 ~]$ idl

Once in IDL, the necessary modes can be compiled using: @/u/mreinke/idl/pfcr/w_pfc/wpfc_ini.bat
Note that currently this is being compiled out of the in-development version.  Version control and a stable distributed version will be added shortly.

The widget itself can be launched by typing w_pfc, but command line keywords/optional inputs can be listed via w_pfc,/help

IDL> w_pfc, /help
info     STRING     path to CSV file listing equilibrium
load     STRING     path to IDL saveset which is loaded on launch
save     STRING         path to IDL saveset which is run and saved on launch
home        STRING     default path (/u/<logname>/ is default)
run        KEYWORD  set to auto execute on launch
quit     KEYWORD     set to auto quit after launch (use with SAVE to batch)
IDL> w_pfc

This will launch the W_PFC widget.  Shown below is the what would occur from typing w_pfc,/run which automatically runs the default INFO file:

Layout of W_PFC 

The widget id laid out in three columns, EQUILIBRIUM, PLOTTING and SETUP, the latter two having multiple tabs.  Hovering the cursor over various buttons with generally bring up tooltips indicating their purpose.


This section is relatively straightforward.  The equilibrium defined by the GEQDSK file is plotted with red outlining the separatrix and blue 'X' indicating the strike point locations.  A button allows switching between a single plot of the full cross-section and a double plot (as shown) zooming in on the upper/lower divertor.

If multiple equilibria have been specified (see the CSV format under setup), then these can be flipped through using the '+' and '-' buttons or the slider (not yet enabled).  The dialog box to the left of the slider shows the time in seconds.


This section displays graphical output that has been calculated by DIVERTOR_HEAT_FLUX.  The default is to show light colors on dark backgrounds, but when output is sent to PS files (via the PRINT button), it reverts to dark colors on a white background.

The SPATIAL tab displays a range of calculated outputs to each of the four divertor regions, with the default to display perpendicular heat flux for an axisymmetric surface.  The four windows shows the upper inner (IBDV+CSAS), plotted against Z [m], the upper outer (IBDH+OBD), plotted against R [m] and corresponding lower inner and outer divertors.  Below the plots, the user can select from:
  • qPERP: the heat flux to the surface (this is what we are generally worried about), good for unshaped tiles
  • qPARA: the parallel heat flux, which is the basic piece of information when we worry about shaped tiles
  • Bt/Bp: the ratio of the toroidal to poloidal field, used in some calculations for estimating field line angles
  • THETA_P: the poloidal angle of incidence (WARNING: do not use, presently incorrect)
  • ALPHA: the total field line angle, the other piece of information necessary for computing heat flux for shaped tiles
In each of these windows, the strike point position is identified by a vertical dotted blue line and up to four lines are plotted.
  • SOLID (White/Black): the profile for the current equilibrium
  • DASHED (Green): the time-averaged profile 
  • DASH-DOT (Red): the maximum and minimum values of the profile over the range of the scan (minimum not shown for qPERP and qPARA)
The average, minimum and maximum plots can be be turned on/off with the buttons to the right of the data selection, below the four plotting window.

The TEMPORAL tab is not yet enabled, but this will show contour plots of the time and space evolving profiles.

The DRSEP tab, shown above is used to enter and display the coefficients used to break down the power split between the different divertors.  This is described more in PFCR-MEMO-007.  The a0, a1 and a2 values are computed based on the given information for f_INF, f_ZERO and (x_N, f_N).  The thicker white line shows the sum of all four curves, ideally adding to 1.0 to ensure power balance, while the vertical dashed white line represents the present value of DRSEP/LAMBDA_Q.  A proper legend will be added soon.

The WALL ELEMENT interaction is not yet enabled, with the intention of allowing the use to interrogate various regions of the  PFCs more closely.


At the top of this column is a range of I/O options.  Clicking on the '?' button next to the paths will launch a dialog window that allows you to browse to select a file.  Typing in the window and pressing enter will also register a new file path.  The row of buttons perform the following tasks:

  • LOAD: will load the IDL save file (LOAD PATH) and display the contents
  • SAVE: will save the present contents to an IDL save file (SAVE PATH)
  • QUIT:  I would hope this one is obvious...
  • PRINT: outputs a one or more PS files to PS PATH
  • STOP: will stop the IDL code, allowing terminal access to underlying data (most used for debugging)
  • WRITE: will output the data to an ASCII file (ASCII PATH)

Below a message window are a series of tabs windows that help setup the heat flux calculations, specify the equilibrium to load and configure the plotting windows.  Their usage is outlined further in the sections below.

Defining and Selection Input Magnetic Equilibria

The first step in the heat flux calculations is defining an equilibrium or a set of equilibria, in the case that sweeping is of interest.  There are three ways presently envisioned to do this, selecting an NSTX-U shot/time window, selecting a single GEQDSK file and selecting a list of GEQDSK files.  The use of EFIT data is not presently implemented.

To select a single GEQDSK, click on the GFILE button and type (and press enter) or select the path to the file.  The default path is to the series of GEQDSK files that J. Menard put together for the initial heat flux study (PFCR-MEMO-004), that influenced the first draft of the new PFC Requirements.

A series of GEQDSK files can be combined to form a pseudo time evolving discharge for the purposes of developing and scoping sweeping.  A simple CSV format is used, shown below for /p/nstxusr/nstx-users/sgerhard/PFCs/NSTXU_Recovery_Requirements/PFCGUIInput/DivSol_8-01.info.  The formatting is such that the top line defines the number of GEQDSK files to be used and then provides a label, the suffix INFO is not needed as merely an organizational tool.  Subsequent lines are then TIME, FILEPATH.  The time base is used when computing the time-averaged heat flux, so one could set the time base to model dwell and sweeps if desired.  S. Gerhardt has begun turning the TSG requests into INFO files, listed in: /p/nstxusr/nstx-users/sgerhard/PFCs/NSTXU_Recovery_Requirements/PFCGUIInput/

5,TSG DivSol Case 8-01

Once an equilibrium method is selected, click on 'LOAD EQUILIBRIUM DATA' which will not only load the equilibrium, but also run through the heat flux calculation and display the data.

Modifying Assumptions for Heat Flux Calculations

After loading the equiilibria, it's recommended to save the output to reduce future load times.  The heat flux calculations can be explored which is less time consuming and the HEAT FLUX tab shows a number of user configurable/selectable options.  The heat flux is automatically recalculated and re-displayed upon any change.
  • PHEAT and fRAD can be set which have the effect of simply scaling the heat flux up/down.
  • The outboard midplane heat flux width (LAMBDA_Q) can either be input directly by pressing the VAL button and entering a value or by selecting between one of the published scalings
    • GOLD:  Heurestic Drift scaling, equations (7), (9-10) in  [T. Eich, et al. Phys. Rev. Lett. 107, 215001 (2011)]
    • EICH:  Uses the multi-machine scaling, regression #15 in  [T. Eich NF 53 093031 (2013)]
    • MAST: Uses a scaling derived from MAST, equation (3) in  [A. Thornton, et al.  PPCF 56 055006 (2014)]
  • The private flux region diffusion (S) can be input directly by pressing the VAL button and entering a value or by selecting, a fixed ratio to LAMBDA_Q by pressing RATIO  and entering a value.  Alternatively the scaling derived in Figure 6 in [M. Makowski, et al.  Physics of Plasmas 19, 056122 (2012)] can be selected by pressing MM.
  • The sharing between the different divertor zones can be specified to be specific values by pressing the VAL.  It is up to the user to ensure these approximately add up to 100%.  Entering values may be useful to specify an upper null power splitting for a LSN equilibrium to help save time.  The DRSEP based power splitting is calculated automatically as discussed above.

Managing Outputs

There are multiple ways to output results from W_PFC.  The creation of IDL save files allows the underlying data to be archived and graphical or ASCII output to be generated.  ***WARNING** since the feature set is still under development, there is assurance of backward compatibility of savesets at this time.

Graphical Output

The PLOTTING tab on the right column can be used to modify plotting ranges.  Note that if the ranges are set to the same value, the result will be to autoscale the plots over the full x-axis or y-axis range.

The PRINT button at the top of the column will write a postscript file, and the buttons/input below at the bottom of the PLOTTING tab can be used to configure what goes into this PS file.  The equilibrium can be turned on/off with EQPLOT button and use can select printing the currently selected profile (YPLOT) or all of the possible profile outputs (ALL YPLOT).  Inclusion of the DRSEP plot will be added soon!

ASCII Output for Thermo-Mechanical Simulations

In order for the data computed to be used in heat flux simulations, an ASCII output file can be created using the PRINT button.  This file includes a header which describes the input data and selections used for the simulations, followed by a series of parallel heat flux and angles of incidence as a function of (R,Z) around the divertor surfaces.  Results are tab separated (Note this format will be in flux as the PFCR-WG iterates with engineers running ANSYS).

USER    mreinke
DATE    Tue Jun 27 09:45:55 2017
VERSION    0.1
NGFILES           5
NTAU              37
FRAD         0.300000
PHEAT          10.0000
FGW         0.300000
USN           1
LSN           1
USE_LAMQV           0
USE_LAMQE           0
USE_LAMQG           1
USE_LAMQM           0
USE_SV           0
USE_SMM           1
USE_SRAT           0
USE_FVV           0
USE_FDR           1
AVE_LAMQ_MM          1.92699
AVE_S_MM         0.422780
AVE_FUI       0.00243445
AVE_FUO        0.0260420
AVE_FLI         0.291649
AVE_FLO         0.677604
# R [M]    Z[M]    Q|| [MW]    ANG [DEG]
      0.00000          4004.00
     0.315000          1.05000     -3.45385e-05         -2.44411

The USE_XX indicates what parameters where used and average values of physics parameters are given, as ultimately the results are in the data.  NTAU: gives the number of expected time points included in the file.  This is greater than the number of input equilibria, with the heat flux interpolated between to make a smooth(er) time-evolving heat flux profile.  For each time point the time [sec] and the number of spatial points is given: so for t=0.0 there are 4004 (R,Z) locations which are listed.  At each data point the (R,Z) location, parallel heat flux and input angle to the surface (assuming axisymmetry) is given.

Scripting W_PFC

The W_PFC code can be scripted to run a range of INFO files and produce IDL save files for later processing in the GUI.  This can be done using the INFO and SAVE optional inputs and the /run and /quit keyword parameters.  This way a list of INFO files can be turned into a list of SAVE files and loaded for later processing for graphical or ASCII output.  This requires some basic IDL knowledge to program.


W_PFC was created and is presently maintained by M.L. Reinke.  Please