Newsletter #2, August 2023

It took a while longer than I would have prefered, but finally the second edition of the DREAM newsletter is here! It’s packed to the brim with changes to the code. A number of new features are also in the making, and so the autumn term promises lots of new and exciting runaway electron simulations!

// Mathias

I. New features

i. Initialization with coronal equilibrium

by Mathias Hoppe

Until now, initialization of ion densities has been limmited to either placing all ions in a specified charge state, or manually prescribing the charge state density completely. In the latest version of DREAM, it is now possible to launch a simulation with one or more ion species distributed according to coronal equilibrium. Coronal equilibrium means that the ions are distributed among the charge states such that ionization and recombination exactly balance at each charge state transition.

To launch an ion species in coronal equilibrium, add it as follows:

ds.eqsys.n_i.addIon(name='Ne', Z=10, iontype=Ions.IONS_DYNAMIC,
        n=1e19, init_equil=True)

A handy graphical tool has also been developed to quickly evaluate the equilibrium charge state distribution of an ion species without running DREAM. The tool can be run via the script tools/charge_states/, and requires Python 3 and the pyQT GUI library. Its main view is shown in the image below.

DREAM charge state solver

ii. Frozen current mode

by Mathias Hoppe

When modelling experimental discharges, radial transport is one of the least constrained unknowns. The frozen current mode has been developed for and implemented in LUKE to constrain the radial transport based on the measured value of the plasma current, and is now also available in DREAM.

The frozen current mode assumes that a uniform diffusive radial transport is present in the plasma. In each time step, the diffusion coefficient is adjusted in order for the simulated plasma current to exactly match a prescribed plasma current (typically taken from experiment).

Learn more about how to use the frozen current mode in DREAM in the online documentation.

iii. External iterator

by Mathias Hoppe

In order for the frozen current mode to be implemented, a new technique was devised in order to make the solver robust. The equation which must be satisfied in order for the radial diffusion coefficient to be constrained is

where is the total plasma current and the user-prescribed value. This equation however makes no explicit mention of and so can make the system of equations severely ill-conditioned. One way of avoiding this is to explicitly assign a value to , solve the system of equations for that value, and then assess whether the obtained value of is as desired and adjust if not. This is the technique used in LUKE (a linear solver) to solve inherently non-linear problems. In DREAM, although a non-linear solver is available, it was found that merely providing a constraint on in the system of equations was not sufficient to stabilize the solution.

A new iterator, termed the external iterator was thus implemented. The external iterator is assigned a set of equations to solve, which appear time-independent to the usual non-linear/linearly implicit solver, but which are updated by the external iterator. The external iterator will repeatedly solve for the same time step until all unknowns handled by it satisfy the specified equations. This is observed to greatly enhance the stability of the solver for these otherwise ill-conditioned problems.

Although the plasma current condition prescribed in the frozen current mode is so far the only equation implemented for the external iterator, other difficult equations may in the future also be implemented for the external iterator. Note that equations handled by the external iterator require a special implementation which not only describes the condition to be satisfied, but also the algorithm to use for updating the value of the corresponding unknown quantity.

At the moment it is unclear how the stability of the external iterator would be affected if multiple conditions were imposed simultaneously. Since external iterator recalculates every time step multiple times, it is therefore generally slower to use than the regular non-linear solver, and it is likely that multiple conditions would interfere with each other and cause even slower convergence.

A potential candidate for future implementation in the external iterator is the particle source which depends on a condition somewhat similar to that for the total plasma current in frozen current mode. It has been observed to lead to numerical instabilities in certain cases.

iv. CORSICA data file reader

by Oskar Vallhagen

CORSICA is an integrated tokamak discharge simulator which has been used to calculate plasma profiles for ITER. A new data reader for CORSICA output files has been added in order to provide input to DREAM simulations.

v. Parallel version of runiface()

by Marcin Wilczyński

When running parameter scans with DREAM, simulations are generally independent of each other and could in principle be run in parallel. The new routine runiface_parallel() enables this in practice and allows an array of DREAMSettings objects to be given simultaneously to the routine. The routine will then schedule and execute each of the DREAM simulations in parallel.

TODO: Add documentation link

vi. Better support for tungsten

by Jędrzej Walkowiak

The support for simulations with tungesten impurities has been improved with pull request #225. A new model for the mean excitation energy of elements with was developed and implemented by Jędrzej, and is now available on master. Jędrzej has also reviewed the ADAS and NIST data used for tungsten and has updated some of it with more appropriate datasets.

vii. Prescribed runaway distribution

by Mathias Hoppe

Functionality has been added to run simulations in which is evolved according to user prescribed values, instead of solving a kinetic equation. This feature can be useful when the evolution of the background plasma in the presence of a given distribution function is of interest. The prescribed functionality was added in pull request #243 and is now available on master.

II. Interface changes

i. Major radius factor added to heat transport

by Oskar Vallhagen

The Rechester-Rosenbluth parallel transport model states that the diffusion coefficient is given by

where is the safety factor and is the plasma major radius. In the implementation of this diffusion coefficient for the heat transport model, the factor (which is normally the quantity evaluated in DREAM, rather than just the by itself) was set identical to 1.

A patch has now been added to the code which explicitly introduces the factor , while just assuming (which is dimensionless and could vary significantly during a simulation, making the transport much less predictable). In larger devices, significant increases in heat transport may therefore be observed despite maintaining all parameter values.

This change was introduced with pull request #207 and has now been merged into the master branch.

ii. Plot volume-integrated runaway rates

by Mathias Hoppe

For a while, it has been possible to run T_cold.plotEnergyBalance() in the DREAM CLI interface and get the volume-integrated power balance plotted. The same functionality has now been added for runaway generation rates, for which we previously had to specify either a radial index (or time index). The functionality was added in pull request #230 which is now available on the master branch.

III. Bug fixes

i. Error in ion transient term

by Peter Halldestam

It was discovered that the ion transient term was incorrectly implemented for the linearly implicit solver. This bug caused the linearly implicit solver to fail when ions were evolved dynamically. Likely, it has avoided discovery until now since the non-linear solver is almost always used when evolving the ions in time.

The bug was fixed in pull request #226 and is now available on master.

ii. Bug in Svensson transport model

by Mathias Hoppe

A bug was discovered in the Svensson transport model, which would cause the provided advection/diffusion coefficients to only be evaluated at the lowest momentum point specified, rather than be averaged over all momenta as prescribed by the model. This bug is expected to affect all simulations using the model and could give significantly different transport rates. In tests, both increases and decreases in transport rates by up to two orders of magnitude have been observed.

The bug was fixed in pull request #245 and is now available on master.

IV. Recent publications