Equilibrium Reconstruction
Contents
LTX-β Equilibria
Typical/Nominal Equilibrium Parameters (w/o neutral beam):
- Major radius (R0): 35cm
- Minor radius (a): 21cm
- Ellipticity (κ): 1.55
- Triangularity (δ): 0.2
- Toroidal field at R0 (BT): <3.0kG
- Plasma current (Ip): 80-100kA
- Plasma lifetime (Tp): ~50ms
- Poloidal beta (βp): 4%
- Electron temperature (Te): 100eV
- Ion temperature (Ti): 40-90eV
- Electron density (ne): 1-5 x 1018 m-3
PSI-Tri
A 2.5D code which uses the known dominant 3D eddy current eigenmodes of the LTX vessel and shells to project the quasi-axisymmetric effects of non-axisymmetric geometry into the 2D poloidal plane. Eddy currents are projected as axisymmetric toroidal currents and scaled to reflect toroidal gaps.
Performing reconstructions
Note: A Significant update was implemented on 6/1/2021. If you run into any issues please report them to Chris Hansen.
A driver script to perform reconstructions for a specified shot is located on Portal at /u/chansen/LTX_PSI-Tri_interface/LTX_beta/run_ltx_shot_wrapper.sh. When run on Portal this script will automatically setup the correct environment, pull data from the tree, perform the desired reconstructions and generate a summary output file. By default, this script creates a new directory (recon_run) in the current working directory and submits a job to SLURM to perform the reconstructions. Various options are available to control the operation of this script (see below). Upon completion, a JSON data file is created (recon_output.json) that contains information about the reconstructions and paths to log files and generated plots for each case.
Examples
To generate a set of eight evenly spaced reconstructions throughout shot 100979 the following command can be used, where --start_pad and --end_pad define the reconstruction time range relative to breakdown and disruption respectively.
/u/chansen/LTX_PSI-Tri_interface/LTX_beta/run_ltx_shot_wrapper.sh --shotnum=100979 --start_pad=4.E-3 --end_pad=2.E-3 --nfits=8
To generate a set of reconstructions throughout shot 100979 at specific times the following command can be used.
/u/chansen/LTX_PSI-Tri_interface/LTX_beta/run_ltx_shot_wrapper.sh --shotnum=100979 --times 0.464 0.465 0.466
To generate a set of reconstructions throughout shot 100979 with a specific spacing between two times the following command can be used.
/u/chansen/LTX_PSI-Tri_interface/LTX_beta/run_ltx_shot_wrapper.sh --shotnum=100979 --start_time=0.464 --end_time=0.466 --dt=0.001
To generate a reconstructions of shot 100979 at specific times without up-down symmetry the following command can be used.
/u/chansen/LTX_PSI-Tri_interface/LTX_beta/run_ltx_shot_wrapper.sh --shotnum=100979 --times 0.464 0.465 0.466 --V0_adjust --asymmetric_shell
Script Options
Perform automated reconstructions for LTX-beta.
optional arguments:
-h, --help show this help message and exit
--shotnum SHOTNUM Shot number
--calshot CALSHOT Calibration shot number
--debug Print debug information? (default: False)
--time_limit TIME_LIMIT
Time limit for batch job [minutes] (default: 10)
timing:
Reconstruction timing options
--start_pad START_PAD
Padding at start of discharge [s] (default: 1.E-2)
--start_time START_TIME
Starting time for reconstructions [s]
--end_pad END_PAD Padding at end of discharge [s] (default: 2.E-3)
--end_time END_TIME End time for reconstructions [s]
--nfits NFITS Number of reconstructions (default: 4, min: 2, max: 25)
--dt DT Spacing of reconstructions
--times TIMES [TIMES ...]
Specific times for reconstructions [s]
magnetics:
Magnetic diagnostic options
--skip_re Skip REENTRANT probes? (default: False)
--skip_shell_eddy Skip shell eddy sensors? (default: False)
--include_cs Include center stack loops? (default: False)
--smooth_freq SMOOTH_FREQ
Smoothing frequency (default: 5E3)
--corr_t0 CORR_T0 Offset-drift correction t0 (default: 0.05)
--corr_t1 CORR_T1 Offset-drift correction t1 (default: 0.10)
--pol_scale POL_SCALE
Scaling to apply to PF coils and signals (default: 1.0)
--tor_scale TOR_SCALE
Scaling to apply to TF field (default: 1.0)
optical:
Optical diagnostic options
--thomson_file THOMSON_FILE
File containing Thomson data
--thomson_tratio THOMSON_TRATIO
Ti/Te for Thomson pressure constraints (default: 0.3)
--thomson_skips THOMSON_SKIPS [THOMSON_SKIPS ...]
Thomson channels to skip (0-based)
--thomson_axis_pe THOMSON_AXIS_PE
Pe for "fake" axis constraint (default: disabled; negative value)
equilibrium:
Equilibrium options
--V0_target V0_TARGET
Target vertical position for magnetic axis [m]. (default: 0.0)
--V0_adjust Allow vertically shifted magnetic axis? (default: False)
--asymmetric_shell Allow asymmetric shell currents? (default: False)
launch:
Launch and run options
--setup_only Perform setup but do not launch job (default: False)
--recon_dir RECON_DIR
Name of working directory (created/cleaned)
--use_debug_queue Use debug queue? (default: False)
analysis:
Post-Reconstruction analysis options
--plot_berror Make eddy current error field plots? (default: False)
configuration:
Reconstruction configuration options
--conf_dir CONF_DIR Use specified configuration directory
--cal_dir CAL_DIR Use specified calibration directory
--psi_tri_path PSI_TRI_PATH
Path to PSI-Tri src directory
--legacy_mesh Use legacy (pre 5/21) mesh? (default: False)
Example JSON summary file
{
"shot_num": 101269,
"conf_dir": "/u/chansen/LTX_beta/reconstruction/conf_5_19",
"cal_shot": 101268,
"times_plot": "/u/chansen/tmp/recon_run/LTX_101269_reconTimes.pdf",
"reconstructions": [
{
"recon_info": {
"equil": {
"W_MHD": 40.35,
"TRIANG": 0.29,
"Q_95": 22.72,
"R_ICEN": 0.354,
"BETA_TOR": 0.16,
"BETA_POL": 43.13,
"R_HFS": 0.15048,
"ELONGATION": 1.92,
"Z_ICEN": 0.0,
"VOLUME": 0.52,
"R_AXIS": 0.411,
"Q_A": 24.44,
"Q_0": 10.14,
"DFLUX": 5.534e-05,
"I_P": 24970.0,
"Z_AXIS": 0.0,
"R_LFS": 0.59803
},
"chi_rms": {
"Iplasma": 2.5597908637208726,
"Dia": 1.5930884382916235,
"Thomson": 2.0770761467272094,
"FLoops": 0.8597557537791097,
"Mirnovs": 1.2365369469438878,
"Total": 1.1587471711477868
},
"chi_sq": {
"Iplasma": 2.5597908637208726,
"Dia": 1.5930884382916235,
"Thomson": 4.314245319303152,
"FLoops": 11.826879298500563,
"Mirnovs": 42.81266139240471,
"Total": 63.106665312220926
}
},
"flux_plot": "/u/chansen/tmp/recon_run/run_1/LTX_101269_01_psi.pdf",
"errcode": 0,
"file_prefix": "LTX_101269_01",
"field_plot": "/u/chansen/tmp/recon_run/run_1/LTX_101269_01_fields.pdf",
"eqdsk_file": "/u/chansen/tmp/recon_run/run_1/LTX_101269_01.eqdsk",
"time": 0.455,
"log_file": "/u/chansen/tmp/recon_run/run_1/run.log",
"dir": "/u/chansen/tmp/recon_run/run_1"
}
],
"cal_dir": "/u/chansen/LTX_beta/calibration/cal_7_19"
}
Performing kinetic reconstructions
Note: Kinetic reconstructions rely on Thomson scattering data. Please consult with Dennis and Chris before you perform and use these reconstructions for any analysis.
Kinetic reconstructions require a data file (see below) containing the Thomson scattering information to constrain the pressure profile. Additionally, "Ne*L" for the median shot of the sequence used to create the Thomson data must be identified. Using this information a reconstruction is performed using an iterative method, which uses a few iterations (generally 3) to match the line integral of the Thomson density profile to "Ne*L" measured by interferometry in the median shot. Magnetics and other constraints are chosen from the shot given by --shotnum, however in general this should also be the identified "median shot".
Examples
To generate a kinetic reconstructions in shot 102338 at 0.463 seconds, using data in "TS21463.json" and skipping Thomson points 6-10, the following command can be used.
/u/chansen/LTX_PSI-Tri_interface/LTX_beta/run_ltx_shot_wrapper.sh --shotnum=102338 --thomson_file=TS21463.json --thomson_skips 6 7 8 9 10 --times 0.463
/u/chansen/LTX_PSI-Tri_interface/LTX_beta/run_ltx_shot_wrapper.sh --recon_dir=scan_test --shotnum=103216 --times 0.465 0.467 0.469 0.471 0.473 0.475 0.477 --thomson_file=TS615fsm.json
Example Thomson data files
Thomson data can be presented in one of two formats, JSON or text, with JSON being the preferred format as it can better handle format changes/additions in the future. Text files generated by Dennis's scripts can be converted to JSON using the following command (with update filenames).
python /u/chansen/LTX_PSI-Tri_interface/LTX_beta/convert_thomson_legacy.py --filename_in="TS_data.txt" --filename_out="TS_data.json"
JSON format (preferred)
{
"R": [0.4, 0.43, ... 0.6, 0.62],
"Z": [0.0, 0.0, ... 0.0, 0.0],
"Ne": [34.65, 41.77, ... 1.2, 0.63],
"Ne_err": [0.62, 1.12, ... 0.2, 0.55],
"Te": [110.5, 98.0, ... 275.7, 60.6],
"Te_err": [4.0, 5.5, ... 95.2, 95.8],
"shots": [
{
"Ip": 60.5,
"NeL": 7.23e+18,
"shot_number": 102335,
"Time": 463.0
},
...
{
"Ip": 48.0,
"NeL": 7.15e+18,
"shot_number": 102341,
"Time": 463.0
}
],
"median_shot": {
"Ip": 55.3,
"NeL": 7.31e+18,
"shot_number": 102338,
"Time": 463.0
}
}
Text format (legacy)
R [cm], Te[eV], eTe[eV], ne[um-3], ene[um-3]
40.0 110.5 4.0 34.65 0.62
43.0 98.0 5.5 41.77 1.12
46.0 94.5 3.7 26.78 0.51
49.0 75.4 5.1 16.66 0.50
52.0 70.7 8.8 6.33 0.35
54.0 57.1 8.3 5.20 0.35
56.0 31.0 5.4 5.18 0.70
58.0 141.3 25.0 2.82 0.20
59.0 146.9 64.3 0.97 0.17
60.0 275.7 95.2 1.20 0.20
62.0 60.6 95.8 0.63 0.55
Shots(6), neL[1e18 m-2], Ip[kA], t_TS[ms] ; Median shot, StdDev, Min, Max, All
102338 7.31 55.3 463.0
2 0.79 5.4 0.0
102335 6.10 48.0 463.0
102341 8.31 60.5 463.0
102335 7.23 60.5 463.0
102336 6.10 60.5 463.0
102337 8.31 58.6 463.0
102338 7.31 55.3 463.0
102339 8.10 49.8 463.0
102341 7.15 48.0 463.0
Creating flux plots
Flux surface plots can be generated for a given equilibrium using PSI-Tri's included plotting script plot_psi.py. This requires the anaconda3 mode to be loaded.
Examples
The following examples illustrate how to use various options to generate different flux surface plots based on the results from equilibrium fitting. These examples assume that the working directory is the same as the reconstruction directory for given time point (ie. recon_run/run_1 for the first time point with default settings for the reconstruction driver).
To view a new flux plot interactively with a customized number of vacuum and plasma surfaces the following command can be used
python3 /u/chansen/psi_fit/src/utilities/plot_psi.py --no_color --rstfile="psi_fit.rst" --nplevels=10 --nvlevels=20
To create the same as above but as a PDF figure with the filename new_flux.pdf the following command can be used
python3 /u/chansen/psi_fit/src/utilities/plot_psi.py --no_color --rstfile="psi_fit.rst" --nplevels=10 --nvlevels=20 --filename="new_flux" --pdf_fig
To view a new flux plot interactively for a vacuum shot with a customized number of surfaces the following command can be used
python3 /u/chansen/psi_fit/src/utilities/plot_psi.py --no_color --rstfile="psi_fit.rst" --nvlevels=20
Script Options
Flux contour plotting script for PSI-Tri optional arguments: -h, --help show this help message and exit --rstfile RSTFILE Name of PSI-Tri data file (default: "psi_gs.rst") --nplevels NPLEVELS Number of levels for plasma region contour plot --nvlevels NVLEVELS Number of levels for vacuum region contour plot --title TITLE Title for contour plot --filename FILENAME Filename to save plot (without extension, saved as PNG) --press_color Use pressure to shade interior --no_color Do not shade interior --pdf_fig Create PDF figure instead of PNG
Creating error field plots
With the new version of the scripts and PSI-Tri, plots of the 3D eddy current-induced error field can now be made from a PSI-Tri equilibrium. This can either be done during fitting using the --plot_berror option or after reconstruction using the PSI-Tri's plot_eddy_berror.py script. Note that the second option requires that the anaconda3 mode to be loaded and an equilibrium created after 6/1/2021.
Examples
The following examples illustrate how to use various options to generate different flux surface plots based on the results from equilibrium fitting. These examples assume that the working directory is the same as the reconstruction directory for given time point (ie. recon_run/run_1 for the first time point with default settings for the reconstruction driver).
To view a new error field plot interactively with a customized number of shading levels, and a "standard" zoom in on LTX-β midplane, the following command can be used
python3 /u/chansen/psi_fit/src/utilities/plot_eddy_berror.py --rstfile="psi_fit.rst" --nlevels=20 --zoom_rmin=0.1 --zoom_rmax=0.6 --zoom_nr=40 --zoom_zmin=-0.03 --zoom_zmax=0.03 --zoom_nz=21
The example below, adds a single contour at the |B| = 10 mT and save the plots as PDFs with the prefix "test_error".
python3 /u/chansen/psi_fit/src/utilities/plot_eddy_berror.py --rstfile="psi_fit.rst" --nlevels=20 --zoom_rmin=0.1 --zoom_rmax=0.6 --zoom_nr=40 --zoom_zmin=-0.03 --zoom_zmax=0.03 --zoom_nz=21 --filename="test_error" --pdf_fig --contour_level=1.E-2
Script Options
Eddy current-induced error field plotting script for PSI-Tri
optional arguments:
-h, --help show this help message and exit
--rstfile RSTFILE Name of PSI-Tri data file (default: "psi_gs.rst")
--nlevels NLEVELS Number of levels for contour plots (default: 40)
--contour_level CONTOUR_LEVEL
Marker contour for plots (default: None)
--no_contour_label Label marker contour? (default: True)
--filename_prefix FILENAME_PREFIX
Prefix for saving plots (saved as PNG)
--zoom_rmin ZOOM_RMIN
R_min for zoomed plots
--zoom_rmax ZOOM_RMAX
R_max for zoomed plots
--zoom_nr ZOOM_NR # of R points for zoomed plots (default: 100)
--zoom_zmin ZOOM_ZMIN
Z_min for zoomed plots
--zoom_zmax ZOOM_ZMAX
Z_max for zoomed plots
--zoom_nz ZOOM_NZ # of Z points for zoomed plots (default: 6)
--pdf_fig Create PDF figure instead of PNG
Old method (DPB script)
Run from a version of the Chris Hansen's wrapper script (e.g. /p/ltxdata/reconstructions/run_ltx_shot_wrapper_dpb.sh), PSI-Tri creates a recon_run directory within the working directory. Inside recon_run can be found a combination of files for each time point, and files for the entire run. Below, {N} represents numbers from 1 up to the number of time points reconstructed and {NN} is the same but forcing two digits with a leading zero; {shot} represents the shot number; {jobnumber} is the ID number of the cluster job.
- go_recon:
- LTX_{shot}_{NN}.eqdsk: The EQDSK (standard reconstruction output) file for each reconstructed time point.
- LTX_{shot}_{NN}_fields.png:
- LTX_{shot}_{NN}_psi.png: The flux surface plot for the {NN}th reconstructed time point.
- LTX_{shot}_reconTimes.png: A trace of the plasma current overplotted with the neutral beam current and vertical lines marking the times at which reconstructions have been performed.
- LTX_coils_eddy.xml:
- LTX_coils.xml:
- recon_setup.json:
- recon_output.json: A human-readable, easily-parsed version of the output.
- slurm-{jobnumber}.out:
- run_{N} (directory)
- bc_mat.dat:
- dump.dat:
- fit_cofs.out:
- fit.err:
- fit.in:
- fit.prof:
- f_prof.in:
- f_prof.out:
- gs_psi_in.rst:
- gs_psi.rst:
- LTX_{shot}_{NN}.eqdsk: Same as above.
- LTX_{shot}_{NN}_fields.png: Same as above.
- LTX_{shot}_{NN}_psi.png: Same as above.
- LTX_coils_eddy.xml:
- LTX_coils.xml:
- LTX_coil_template.xml:
- LTX_cs_red.g:
- LTX.limiter:
- mesh.h5:
- p_prof.in:
- p_prof.out:
- psi_fit.rst:
- psin:
- psin_eddy:
- psin_template:
- Psitri.eqdsk:
- recon_info.json:
- run.log: Logged record of the PSI-TRI run.
- safety_factor.dat:
- scalar_dump.h5:
- vector_dump.h5:
- wall_eig.rst:
Automated reconstructions
The directory for scripts and archived outputs from automated (at end-of-cycle) reconstructions is in /p/ltxdata/reconstructions. A python wrapper ("LTXB_auto_recon_wrapper.py") lives here, which launches a shell script PSI-TRI wrapper provided by Chris Hansen, waits for the output file /recon_run/recon_output.json, reads it, parses data into time-resolved arrays, and puts them into the tree as signal nodes (or otherwise, as appropriate). In automated operation, LTXB_auto_recon_wrapper.py is launched by "/runltx/action_scripts/LTXB_do_auto_scripts.py" on Bender, which is launched by the run VI.
LTX Equilibria
Typical/Nominal Equilibrium Parameters (w/o neutral beam):
- Major radius (R0): 35cm
- Minor radius (a): 21cm
- Ellipticity (κ): 1.55
- Triangularity (δ): 0.2
- Toroidal field at R0 (BT): <1.7kG
- Plasma current (Ip): <100kA
- Plasma lifetime (Tp): ~50ms
- Poloidal beta (βp): 0.4
- Electron temperature (Te): 100-250eV
- Ion temperature (Ti): 40-90eV
- Electron density (ne): 2-12 x 1018 m-3
Related Pages
Analysis codes - A list of data analysis scripts with a brief description of their function and purpose, including those used for post-shot automation.