Paper The following article is Open access

A package to bridge experimental tokamak data to modelling workflows for heating and transport

, , , and

Published 26 March 2024 © 2024 The Author(s). Published by IOP Publishing Ltd on behalf of the IAEA. All rights reserved
, , Citation G. Tardini et al 2024 Nucl. Fusion 64 056014 DOI 10.1088/1741-4326/ad346f

0029-5515/64/5/056014

Abstract

The comprehensive visual tool TRVIEW is presented, a software to read and fit experimental measurements and equilibrium reconstruction in the frame of nuclear fusion research. At the same time, TRVIEW provides a framework to setup physics workflows, especially those related to heating and transport. The TRVIEW package was originally created in order to provide file input to transport codes such as ASTRA and TRANSP. However, having a comprehensive set of python classes for the experimental plasma parameters, it allows direct coupling to several modules, such as the heating and current-drive codes RABBIT and TORBEAM and the equilibrium codes FEQIS and NEMEC. The direct coupling allows also direct visualisation of the input and output parameters and profiles in TRVIEW. The option of storing equilibrium files in the standard gEQDSK format is also enabled in TRVIEW. Special algorithms have been developed or adapted for TRVIEW: a class for fitting the plasma separatrix contour with Fourier moments, a recursive procedure for spline fits of the experimental kinetic profiles. Finally, TRVIEW includes the option to read, visualise and write integrated modelling and analysis system (IMAS) files with a comprehensive set of integrated data structures, covering most of the discharge and plasma parameters and several source profiles, calculated with the TORBEAM and RABBIT codes. This enables users to setup workflows for code validation and physics investigations using the world-wide established IMAS environment. TRVIEW can take the experimental input from the shotfile system of the ASDEX Upgrade tokamak or from IMAS files. Since the algorithms and the coupled codes are device-agnostic, TRVIEW is portable to any other fusion devices.

Export citation and abstract BibTeX RIS

Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 license. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.

1. Introduction

Predicting energy and particle transport in tokamaks is a key to assess the plasma performance and the possible extrapolation to next step devices such as ITER. A variety of physics-based quasilinear transport models have been developed and validated, such as TGLF [1] and QuaLiKiZ [2]. They can be used stand-alone or called within transport solvers such as the ASTRA suite of codes [3] or the TRANSP code [4], widely used for ASDEX-Upgrade (AUG) plasmas. Moreover, to determine the transport properties of the plasma it is necessary to assess the source profiles with some accuracy. Therefore, modules for heating, particle fuelling and current drive (CD) are also coupled in the transport solvers' frameworks, each module having its own input and output formats. Whenever possible, the input and output parameters and profiles are passed directly as subroutine arguments. However, the transport solvers require, of course, initial and boundary conditions. For existing devices, especially if we have to validate the transport models against existing experiments, it is most useful to take them either from the measured parameters and profiles [5] or from some discharge engineering parameters and validated assumptions [6].

The modular tool TRVIEW has been developed to bridge the input collection from the AUG shotfile system or from the integrated modelling and analysis system (IMAS) [7] integrated data structure (IDS) files, the world-wide standard format in fusion research facilitating data sharing, code validation and verification. TRVIEW is a graphic–user-interface (GUI)-based software written in python and accessible on request at the gitlab repository [8]. In this paper we refer to version 1.0.4. The TRVIEW package is intended for reading and manipulating experimental data and plasma equilibria, either reconstructed [9, 10] or calculated [4]. The resulting parameters and plasma profiles can then be stored as ASTRA or TRANSP input files, taking off the users the burden of writing their own routines or patch together single ASCII blocks, with the proper syntax. Having classes for the main plasma parameters, TRVIEW allows also to visualise IMAS IDSs straight-away and to couple directly several Fortran codes which make use of experimental input. Presently four codes are coupled to TRVIEW via f2py [11]: the TORBEAM code [12, 13] for electron cyclotron resonance heating (ECRH); the neutral beam injection (NBI) code RABBIT [14]; the new Grad–Shafranov solver FEQIS [15]; the equilibrium code NEMEC [16]. All coupled codes can be run from the GUI without additional effort, time-dependently; input and output files are written only at user's request, e.g. for debugging or validation purposes. Detailed Wiki-documentation is accessible to all repository members [17].

TRVIEW has the option of storing the AUG experimental data and the codes' simulations results as IDS files, making use of the IMAS functionality.

In this paper, after a brief general overview in section 2, we document the newly developed python tools for shotfile reading and equilibrium manipulation in section 3. Moreover we present in some detail the algorithms used for the fit of the plasma separatrix in section 4 based on Fourier moments. Furthermore we discuss the regularisation fit methods applied to the kinetic profiles (section 5). Such fits are required in order to obtain smooth input profiles for the codes, as the transport equations involve second derivatives of the temperature and density profiles, and most transport models depend strongly on the profiles' gradients.

In section 7 we discuss the TRVIEW output options and the direct coupling of several physics modules, followed by the conclusions.

2. General properties of the TRVIEW package

The TRVIEW package is a collection of python classes. For the sake of user-friendliness, the user can use and navigate the full functionality just using the GUI, shown in figure 1. However, several classes written for TRVIEW can be used outside the package as intermediate layers and coupled into completely different scripts and workflows, either from command-line or within interactive packages, as it is the case e.g. for the estimate of the plasma confinement factors [18]. This can be used for database analysis and automation on a large scale. The python language proves particularly suited for the GUI design (TRVIEW is based on pyqt5 [19], specifically) but also for the algebra, which is taken from standard open source libraries like scipy [20] and not reinvented, e.g. several interpolation methods (linear, bilinear, cubic cpline), calculation of gradients, contouring. Moreover, python is license free and readily available in any environment and operating system, thus making the TRVIEW code easily portable.

Figure 1.

Figure 1. Initial TRVIEW GUI, displaying the experimental settings tab.

Standard image High-resolution image

The graphics allow a high level of user interaction, not only for the entry fields, but also for the time navigation bar, which allows to browse through input and output time frames, or for the manual removal of profile outliers (see section 5).

The TRVIEW code as a whole is available on request from the gitlab repository [8], therefore with version control and trackability ensured. This, together with the limited amount of package dependences and the absence of compiled code, facilitates a straightforward installation on other platforms in different labs, taking advantage of the IMAS input/output capability.

The user can select the desired diagnostics for each kinetic profile, thereby making use of the TRVIEW flexibility, which allows to combine multiple diagnostics at the same time for a given profile. Also, the time grid for the input downsampling and for the frequency of the codes' calls is user-defined, as well as the choice of the input equilibrium to be used (which is then applied consistently in the whole TRVIEW workflow). All GUI options and choices can be stored in json files [21] and loaded at a later time point or even in a new TRVIEW session, at the user's convenience.

The physics codes' settings are available as entries in separate tabs of the TRVIEW GUI. A comprehensive set of plots for the output of the TORBEAM and RABBIT codes is available, in order to evaluate the simulations. Some example are shown in section 7.

3. A new package for handling AUG experimental data

Python-based wrappers around C++/Fortran libraries have been used in the past to read the so-called shotfiles from the AUG system.

Here, a new package called aug_sfutils [22] has been developed for parsing the shotfiles, extracting the experimental data and the parameters' context information, such as the physical units and the associated time and space grids. Moreover, several classes for reading and manipulating plasma equilibria are available as well, enabling the functionality typical required in the tokamak community: profile mapping with different space coordinates, determining the separatrix contour, calculating the components of the magnetic fields. This package is particularly compact and easy to maintain, as well as portable: it is tested with several operating system, including Linux, MacOS, Windows. It is entirely python-native and it uses only standard modules such as scipy [20], numpy [23], matplotlib [24] and pandas [25]. The code is compatible with both python2 and python3, it is gitlab-managed and it is available as package via pypi [26], by executing the command

pip install aug_sfutils.

The aug_sfutils utility is an independent module, therefore it is widely used by the AUG Team also outside TRVIEW. Documentation can be found at [22], with classes description and some common usage examples.

3.1. Reading AUG shotfiles

The current python-native aug_sfutils reading utilities offer some useful features: they allow to decouple the parsing of the (binary) shotfiles from the path-finding. Several metadata of the physical quantities are assigned to the data arrays: the physical unit of the experimental variable; its relations to the space and time grids; its data format and the variable's description text. This is obtained by subclassing the numpy.ndarray class [27].

Moreover, the data reading is over five times faster than the fastest predecessor package, which is a significant improvement when reading big shotfiles with highly-resolved diagnostic information, as are usually equilibria or signals used for Fourier analysis of magnetohydrodynamic (MHD) modes.

Concerning high-level functionality, a method for time-downsampling highly-resolved signals is available, as well as a function for removing time-frames close to edge-localised modes (ELMs) crash times as recorded in the AUG ELM diagnostic. There, the ELM events occurrence times are determined by a peak detection algorithm applied to the time trace of the divertor shunt currents, an evolution of the algorithm described in [28] based on the Dα light signal. Database searching functionality for the whole AUG shotfile system is also part of the package.

3.2. Equilibrium manipulation

A collection of python classes to read and handle AUG equilibria is available, based on the aug_sfutils reading classes presented in section 3.1 and profiting from their fast reading time. Alternatively, the equilibrium object can be read from IMAS input too. A conversion to the IMAS equilibrium IDS is also provided. A comprehensive set of methods allows to perform the typical transformations and calculations required in tokamak research for data analysis or modelling workflows. Here a list of the most relevant functions:

  • mapping from real geometry ($R, z$) into flux coordinates
  • mapping experimental data from any radial coordinate into any other (all is done within just one compact method, the user has to prescribe the input and output coordinate label)
  • computing the components of the magnetic field at an arbitrary ($R, z$)
  • finding the poloidal cross-section contours at a given flux level for an arbitrary flux coordinate
  • finding the intercepts between a line-of-sight and a magnetic surface in the poloidal cross-section
  • detecting the coordinate convention (COCO) [29] of an equilibrium object
  • converting an equilibrium object from any COCO to any other COCO
  • downsampling an equilibrium object with respect to time
  • storing a gEQDSK file for the desired time point

4. Fitting the separatrix contour

Most equilibrium and transport codes require the last-closed flux surface contour as boundary condition for the equilibrium solver. In several codes such as TRANSP [4] or TORIC [30] the boundary is passed in a Fourier moments representation. Just doing a Fourier transform proves insufficient for the strict continuity and derivability requirement of plasma equilibria. The DESCUR code [31], developed at the Princeton Plasma Physics Laboratory, provides an optimised fit for any 3D closed toroidal surface, with the necessary continuity. The DESCUR code uses a steepest descent algorithm to find a least-squares approximation to an arbitrary 3D space curve. The code can be used for tokamaks or stellarator likewise; for tokamaks, the toroidal symmetry allows to reduce the calculation to 2D. Note that DESCUR does not calculate any Fourier analysis, it rather fits the spatial coordinates R (Major radius) and z (vertical position) of a given magnetic surface by varying their Fourier moments and expanding them back to real space R, z contours, until they are optimised. The expansion formula for the Fourier moments reads:

Equation (1)

where θ is the poloidal angle in the poloidal cross-section of the tokamak, ρ is any normalised magnetic flux label. For the separatrix, it is ρ = 1. For TRVIEW, a fully-pythonic 2D version of DESCUR is developed for tokamaks, slower than its Fortran counterpart, but significantly more compact and straightforward to maintain. A comparison of the outcome of several fits method with six Fourier moments is shown in figure 2 for the full contour (a) and zoomed near the X-point (b). The excellent agreement between DESCUR and pyDESCUR is always observed to the extent exhibited by the case in figure 2, providing a robust validation for the newly developed python version. The fit based on the fast Fourier transform (magenta line in figure 2) does not only return a quantitatively worse fit—which can be improved increasing the amount of Fourier coefficients. The qualitative issue, there, is the non-convexity of the fit contour, with as many inflection points as Fourier coefficients, as figure 2(b) highlights. This is incompatible with the requirements for the Jacobian of the equilibrium metrics.

Figure 2.

Figure 2. Comparison of different Fourier moments fitting algorithms in a poloidal cross-section: scatter-points from equilibrium reconstruction (black crosses), fast Fourier transform (magenta), DESCUR (blue) and py-DESCUR (green). Full contour (a) and zoom near the X-point (b). The blue contours are the vessel's plasma facing components.

Standard image High-resolution image

The pure DESCUR calculation takes 5 ms, while the pythonic DESCUR used in TRVIEW requires 70 ms for the computation of the Fourier moments. The python version has been optimised, but ultimately the inherent code structure, based on a recursive iteration of the Fourier moments fit, does not allow to entirely avoid loops. Each time frame of the equilibrium is mathematically independent from the previous or the next one, so the evaluation of the Fourier moments fit is parallelised along the time coordinate by using the standard multiprocess python package. In this way, the total computational time for ∼10k fits (typical for 10 s of plasma discharge duration, 1 ms time sampling) is of the order of 2 s on the AUG linux cluster.

5. Fitting the kinetic profiles

The measured profiles of the electron ($T_\mathrm{e}$) and ion temperature ($T_\mathrm{i}$), as well as the electron density $n_\mathrm{e}$ and the ion toroidal angular frequency $\Omega_\mathrm{i}$ are important for any transport simulation. $\Omega_\mathrm{i}$ is the ratio between the ion toroidal velocity and the local value of the major radius; it is a better flux-surface quantity compared to the toroidal velocity itself. For the interpretive runs the kinetic profiles are crucial for transport analysis and for the estimate of heating and particle deposition profiles. In predictive mode, they are again important to determine sources and sinks, and as reference for the predicted profiles—moreover they provide a realistic boundary condition, as well as a good initial guess for the simulation. The raw data from the diagnostics, however, are not smooth enough for these purposes, because the profiles' gradients have a much stronger scattering than the profiles themselves. Moreover, outliers occur. Therefore TRVIEW provides three methods to fit the experimental raw profiles with user-defined level of smoothing, so that one can set the desired trade-off between smoothness and accuracy in matching the experimental data, in a robust and reproducible way, since the user can store the settings in a json file, and the fitting method and setting parameters are recorded in the output IMAS or ASCII files. All fitting methods allow to combine several diagnostics for the same measured profile, therefore merging core and edge profiles. All profiles are mapped onto a common user-defined time grid, regular in time. Whenever there are several time frames in a time bin, the time reduction is done with a moving average, i.e. an unweighted average of the measured data within the time bin. Otherwise it is just an interpolation in time. The profiles are then regularised with one of three fitting methods available (user choice). In the following we describe such methods in TRVIEW in some detail. All three methods are python native, no wrappers around external code. For the two 1D fits, i.e. the recursive-constrained spline and the Gaussian fit, the user can manipulate each time frame by manually removing obvious outliers which occasionally force the fit to unphysical profiles. This is done interacting with the graphics in the relevant GUI table TRVIEW automatically recomputes the fit ignoring the deleted points. Also entire time frames can be discarded if the measured profile at a given time point is unusable. However, the option of deleting outliers manually is nowadays often redundant, given the improved quality of the AUG profiles' diagnostics over the last years, when the enhancement of the charge exchange (CX) system and the introduction of the Bayesian-based IDA [32] have significantly improved the measurement of the experimental profiles. The manual outliers' rejection can, however, still be important if a user needs smooth and accurate gradients, especially in the pedestal region. An example is shown in figure 3.

Figure 3.

Figure 3. Example of the impact of outliers removal on the $T_\mathrm{i}$ gradient in the pedestal region for the AUG discharge #34954 at 3.28 s. In the left plot, the recursive spline was applied. Red dots are the points discarded by the recursive spline—they are always displayed in the graphics for the user's convenience. In the right plot, two outliers were removed manually (blue dots). Note that the fit tolerance is small (0.01) compared to the one in figure 4 (0.3), to see a significant difference.

Standard image High-resolution image

5.1. Recursive constrained cubic spline

The default method is a recursive fit based on the CSAPS utility [33]. The latter is a package for n-dimensional grid data approximation using a piece-wise cubic smoothing splines. This module is available via pypi, TRVIEW uses version 1.1.0. On top, we enforce a zero-derivative constraint in the centre, as the tokamak topology requires, by duplicating and mirroring the raw-data array around the magnetic axis. The user can set a 'fit tolerance' parameter, which is the degree of smoothness of the spline fit. It corresponds to $1 - p$ of the CSAPS package, described in [34]. A recursive algorithm rejects outliers, taking into account the experimental uncertainties and a user-defined threshold for the deviation. If any experimental point is discarded, the CSAPS spline-fit is repeated, as long as there are further outliers. For typical measurements of the kinetic profiles, the iteration converges quickly and there are enough points left for a useful fit.

The recursive algorithm works reliably concerning outliers removal, making a manual deletion redundant in almost all time frames. The example in figure 4 is a representative case for a CX measurement of the plasma ion temperature $T_\mathrm{i}$, the red dots being the experimental points automatically discarded by the recursive algorithm. The fit is very fast, moreover it is boosted by the python multiprocess utility, providing fits of ∼1 K profiles within 10 s.

Figure 4.

Figure 4. Recursive spline it of the $T_\mathrm{i}$ experimental profile for the AUG discharge #34954 at 2.82 s. The fit tolerance is set 0.3, sigma for outliers removal is 1. In red the points discarded by the recursive spline procedure. The red area reflects the experimental uncertainty multiplied by sigma. In the right plot, the contour plot depending on time and $\rho_\mathrm{pol}$.

Standard image High-resolution image

5.2. Gaussian fit

This method is based on Gaussian-kernels and it is described in detail in [35]. The algorithm is well validated and accurate, with slight tendency to flatten steep gradients at the plasma boundary/pedestal. It returns also confidence intervals ('fit error-bars') which are convenient to estimate the expected accuracy. The method is slower than the recursive fit but it can be parallelised via multiprocess, so that it can perform ∼1 K fits in less than 1 min. An example is shown in figure 5, fitting the same time frame as in figure 4.

Figure 5.

Figure 5. Gaussian-kernels fit of the $T_\mathrm{i}$ experimental profile for the AUG discharge #34954 at 2.82 s. The red region represents the confidence interval of the fit.

Standard image High-resolution image

5.3. QuickFit

QuickFit [36] is an interactive tool for fitting kinetics profiles from profile diagnostics in tokamaks. Profiles are fitted by 2D Gaussian processes, in time and space. Other than the previous methods, here the time frames are not independent from each other, so the parallelisation of time frames is not possible. However by convenient loop-vectorisation the method is as fast as the recursive spline. This algorithm is regularly available in the OMFIT suite [37] and is thoroughly validated. The outcome of the three fitting methods for the same experimental profile can be compared looking at figures 46. Note that for the recursive spline and QuickFit the red shaded are represents the experimental uncertainty, whereas for the Gaussian-kernl fit it is the confidence interval. Note that this method is constructed as to provide more regularity in time, discarding outliers and exhibiting a higher regularity (compare the contour plot in figure 6 with those in figures 4 and 5). Some care has to be taken when a true periodic time-dependence is present, e.g. due to power modulation.

Figure 6.

Figure 6. QuickFit fit of the $T_\mathrm{i}$ experimental profile for the AUG discharge #34954 at 2.82 s, with parameters η = 1, λ = 3. η is associated with smoothness in time, λ in space. The red region represents the experimental uncertainty. The contour plot on the right shows more regularity in time than figures 4 and 5.

Standard image High-resolution image

6. Basic algorithms for physics assumptions

6.1. Effective charge

The effective charge ($Z_\mathrm{eff}$) is a very important parameter in magnetic nuclear fusion, because it is a proxy of the impurity concentration (if there is a known impurity species), and because it affects basic parameters such as the electrical resistivity and the plasma collisionality. Unfortunately there is no direct measurement of $Z_\mathrm{eff}$. One can derive it from a CX measurement of an impurity density, assuming there is no other significant impurity in the plasma. The latter assumption is not always fulfilled, but moreover the impurity density profiles is measured only with high uncertainties, unfortunately. Therefore, for TRVIEW a scalar (i.e. constant in space) assumption is made, and the $Z_\mathrm{eff}$ estimation is then based on passive bremsstrahlung CX measurements, as derived in [38], section 4. A typical time trace is displayed in figure 7.

Figure 7.

Figure 7. Time trace of $Z_\mathrm{eff}$ for the AUG discharge #40 498 from passive CX bremsstrahlung measurements.

Standard image High-resolution image

If the CX bremsstrahlung measurements are not available or unusable, a back-up option is to use the empirical parametrisation derived for AUG plasmas [39]. However, this formula is constructed on a database of discharges performed when the AUG wall was still made of carbon. Therefore, for plasma discharges following the transition to a tungsten wall [40], this formula should not be used; a rule-of-thumb constant value of 1.4 can be assumed in such a case.

6.2. Pellet ablation

In some discharges deuterium pellets are injected into the plasma at a prescribed repetition rate. The particle source term associated with the pellet ablation is significant, in the plasma core it is even dominant. Since the particle deposition profile cannot be measured directly, it has to be estimated. For this purpose we make use of a parametrisation study for the pellet penetration depth, derived in [41]. The fit exponents are summarised in table 3 therein. Since the pellet injection geometry is known, the penetration length translates into a deposition point, described by its Cartesian coordinates R, z. Thanks to the equilibrium manipulation package described in section 3.2 TRVIEW maps the deposition point onto a magnetic flux label (radial coordinate).

The pellet ablation time is just assumed to be the ratio between the penetration depth and the pellet velocity when it enters the plasma. The experimental measurements contain the information of the exact timing of the injected pellets, including a monitor for failed pellets: this information is stored into a u-file [42], which is then used in case of predictive transport modelling workflows. The deposition radius, the ablation duration and the pellet trigger monitor time traces are shown in figure 8. The threshold level in the bottom plot determines which event has to be considered a proper pellet. Its level can be set by the user in the TRVIEW GUI in the Settings table

Figure 8.

Figure 8. Time traces of the pellet injection for the AUG discharge #40498. Above: deposition radius; middle: ablation duration; bottom: pellet trigger monitor, with a signal threshold (orange line) to identify the successful pellet triggering.

Standard image High-resolution image

7. Binding physics modules

TRVIEW can be used also as a visualisation tool for the most relevant experimental data of an AUG plasma discharge, but of course it is designed and optimised to provide input for several kind of workflows. Specifically, it provides input for the transport suites of codes TRANSP [4] and ASTRA [3], in form of u-files [42] for the experimental input and ASCII namelists for the code switches and workflow choices. Note that TRVIEW writes TRANSP input namelists only for interpretive simulations. For the ASTRA code TRVIEW represents the first interactive tool for full input generation, to our knowledge.

Moreover, TRVIEW can store gEQDSK files from reconstructed CLISTE [9] equilibria for any time frame. This is the most common input format for plasma equilibria, whether for transport, turbulence or MHD codes.

TRVIEW is interfaced to the IMAS [7] environment and it can store comprehensive IDS. This is a world-wide well-established format containing the plasma state of tokamak discharges. Thanks to this option, TRVIEW is used also for other workflows, such as fast-particles studies [43]. A list of the IDS entries stored by TRVIEW is documented in table 1. A recent development of TRVIEW consists in wrapping four external physics modules, the TORBEAM and RABBIT codes for heating and CD, and the equilibrium codes FEQIS and NEMEC. The codes are written in Fortran and interfaced to TRVIEW via f2py [11], with a lightweight wrapper Fortran module. Note that all four codes can be run with pure IMAS input instead of AUG shotfiles, thus making their usage automatically exportable for collaborations with any other tokamak. The plasma parameters and profiles computed with the TORBEAM and RABBIT codes are important as source terms for transport analysis, and they can be stored in the IDS files (see table 1), thus making AUG's IDSs usable for a wider set of workflows, beside providing a handy overview of the auxiliary heating and CD as well as particle and torque source terms for a given plasma discharge.

Table 1. List of IDS entries filled with TRVIEW. ICRF stands for ion cyclotron range of frequencies. $\beta_\mathrm{pol}$ is the poloidal β, $I_\mathrm{pl}$ the total plasma current, $U_\mathrm{loop}$ the loop voltage, li the plasma inductance, $W_\mathrm{MHD}$ the plasma stored energy, $P_\mathrm{rad}$ the total radiated power.

IDS nameExtended nameContent
pulse_scheduleOverview parametersHeating parameters (NBI, ECRH, ICRF)
dataset_descriptionIDS documentationGenerating software, user, date
summaryScalar quantities $\beta_\mathrm{pol}$, $I_\mathrm{pl}$, $U_\mathrm{loop}$, li, $W_\mathrm{MHD}$, $P_\mathrm{rad}$, neutron rate
wallWallPlasma facing components, limiter contour
tfToroidal fieldGeometrical R0, vacuum magnetic field
nbiNBINBI geometry, species mix, voltage, injected power
ec_launchersECRHECRH geometry, frequency, mode, injected power
ic_antennasICRFICRF geometry, frequency, mode, launched power
pelletsPellet injectionPellet geometry, gas, mass, velocity, ablation time
core_profilesKinetic profilesRegularised fits of $T_\mathrm{e}, T_\mathrm{i}, n_\mathrm{e}$, $\Omega_\mathrm{i}$.
equilibriumPlasma equilibriumPlasma equilibrium parameters (COCO = 11)
wavesECRH depositionECRH source profiles from TORBEAM
distributionsNBI depositionNBI source profiles from RABBIT

7.1. RABBIT simulations

RABBIT is a Fortran code for the simulation of the NBI deposition [14]. It takes as input the kinetic profiles and several NBI parameters, such as geometry, beam voltage, species mix. All settings are passed to RABBIT via a Fortran namelist, which includes also the path to files containing the tokamak limiter and the physics data, such as the cross-sections of the charge-exchange reactions. In TRVIEW one can edit the namelist directly, as shown in figure 9, which also illustrates a few user options for the radial grid and output file formats. The simulations can then be submitted, with the proper time grid. Typically, a few seconds are enough on a single CPU even for several hundreds of time frames.

Figure 9.

Figure 9. RABBIT input setting in the TRVIEW GUI.

Standard image High-resolution image

The output is displayed in figure 10 for the time traces. The output profiles are displayed in figure 11: ion and electron heating, fast ions density, torque terms, fast ions energy density, neutron rate, driven current density.

Figure 10.

Figure 10. NBI time traces for the AUG discharge #38384 computed with the RABBIT code. The time-dependence is as expected, since the heating and CD are full only after several slowing-down times.

Standard image High-resolution image
Figure 11.

Figure 11. NBI output profiles for the AUG discharge #38384 at t = 3 s computed with the RABBIT code as a function fo the normalised square root of the toroidal flux ($\rho_\mathrm{tor}$). The navigation bar in the GUI bottom allows to browse the time frames.

Standard image High-resolution image

7.2. TORBEAM simulations

The TORBEAM code is a package for the calculation of propagation and absorption of injected electron cyclotron waves [12, 13]. The beam trajectories for an AUG discharge are shown in figure 12, displaying the wave propagation, the beam focussing and defocussing and its absorption location. The output electron power density profiles are displayed in figure 13, separately for each gyrotron. A very similar plot is available in the TRVIEW GUI for the current density driven by each gyrotron.

Figure 12.

Figure 12. Output of the time-dependent ECRH beam-tracing trajectories with the TORBEAM code for the AUG discharge #38384 at t = 3 s. Poloidal cross-section (left) and view from above (right). Each colour corresponds to a different gyrotron.

Standard image High-resolution image
Figure 13.

Figure 13. Electron heat deposition by gyrotron for the AUG discharge #38 384 at t = 3 s, computed with the TORBEAM code. Gyrotrons #2, 3, 6 and 8 were switched on. The GUI frame contains the buttons for time navigation.

Standard image High-resolution image

7.3. Coupling the FEQIS equilibrium code

The recently developed code FEQIS [15], a fast 2D equilibrium-solver for tokamaks constructed for the ASTRA suite of codes [3], is coupled from TRVIEW with the usual f2py paradigm, in its prescribed-boundary version. The input required by FEQIS includes the outermost flux surface, which is derived from the CLISTE [9] reconstruction and the fit described in section 4, as well as the pressure gradient and FF' profiles, which can be checked in TRVIEW by looking at the overview plots in figure 14. Thereby, $F : = R B_{\phi}$ and $F^{\prime} = \mathrm{d}F/\mathrm{d}\Psi$, where R is the local major radius, Bφ the toroidal field and Ψ is the poloidal flux. The Grad–Shafranov solver FEQIS then returns flux surfaces on a 2D grid, in therms of the flux (radial) coordinate label and the poloidal angle. The code output is shown in left-hand plot of figure 15, with the typical structure of nested magnetic surfaces, well-known for ideal tokamak equilibria. Note that the magnetic axis location is not prescribed, it is also an output of the FEQIS code.

Figure 14.

Figure 14. Input profiles for the FEQIS equilibrium, the pressure gradient (left) and FF' (right) as functions of the normalised poloidal flux $\Psi_N$.

Standard image High-resolution image
Figure 15.

Figure 15. Flux surfaces contours as output of the FEQIS (left) and NEMEC (right) equilibrium codes. The outermost surface is imposed as boundary condition (prescribed boundary). Note that the contours are associated to different flux-label grids in both codes: irregular Ψ for FEQIS, regular toroidal flux (Φ) grid for NEMEC.

Standard image High-resolution image

7.4. Coupling the NEMEC equilibrium code

The equilibrium code NEMEC [16], a variational moments equilibrium code, is also directly coupled in the TRVIEW framework, quite similarly to the FEQIS coupling described in section 7.3. The input profiles from the equilibrium are the same as those in figure 14.

The NEMEC code computes the Fourier moments for each flux surface; there are 4 kinds of them, 2 (sin, cos) are related to the spatial variable R (major radius), 2 (sin, cos) to the vertical height (Z variable). The choice of the amount of Fourier moments is up to the user, a trade-off between accuracy and computation time. A typical result for the output Fourier moments is shown in figure 16. The moments can then be expanded according to the formula (1). The resulting $R, Z$ contours are shown in the right-hand plot of figure 15.

Figure 16.

Figure 16. Output Fourier moments for several Fourier coefficient types (rows) and momentum orders (columns), as a function of the normalised toroidal flux $\Phi_N$.

Standard image High-resolution image

8. Conclusions

The TRVIEW package has been developed, a comprehensive tool to collect experimental data from the AUG shotfile system or from IMAS and setup modelling workflows in a variety of research frameworks. Due to its IMAS-reading capability, it can be used also as a rather comprehensive tool for visualising IDSs, although it is not designed for this, lacking some flexibility. Some new python-native algorithms for separatrix fitting and profile splining have been developed making use of conventional modules, such as scipy, making the tool easy to port due to the the few dependences.

TRVIEW is the first integrated full-input generator for the ASTRA code, while providing the relevant input files also for interpretive TRANSP simulations.

The heating modules TORBEAM (ECRH) and RABBIT (NBI) are coupled via f2py and can be run interactively, writing NetCDF output only if desired. The equilibrium codes FEQIS and NEMEC are coupled to TRVIEW via f2py too. The coupled codes can be executed in a straightforward way, with input and output visualisation, useful for debugging and validation purposes; interestingly, they can be run also with pure IMAS input, thus enabling their usage also for other tokamaks.

The TRVIEW package is also the most comprehensive and flexible tool to convert AUG discharge and plasma parameters into IMAS IDSs, allowing to bridge between experimental data and physics workflows even beyond the usual framework of heating and transport modelling, and ensuring compatibility to transport codes in the near future.

Future developments of TRVEW include the coupling of the TORIC code [30], to simulate the ICRF deposition, and the capability of reading diagnostics IDSs in order to read raw experimental data from any IMAS-based storage system. Moreover, the model for $Z_\mathrm{eff}$ can be extended to include profile measurements (when available) or indirect estimates associated with the inferred plasma resistivity or the measured loop voltage.

Acknowledgments

Fruitful discussions with Orso Meneghini are acknowledged.

This work has been performed within the EUROfusion TSVV11 activities. Fruitful discussions with the members of the TSVV11 group are gratefully acknowledged.

This work has been carried out within the framework of the EUROfusion Consortium, funded by the European Union via the Euratom Research and Training Programme (Grant Agreement No. 101052200 EUROfusion). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them.

Please wait… references are loading.