Newsletter #1, January 2023

Happy New Year, and welcome to the first edition of what will hopefully be a regularly published (well, at least more than once a year) DREAM newsletter! The purpose of this newsletter will be to keep users up-to-date about new developments in DREAM and give tips about new convenience features which could help users in utilizing the code. My vision of the newsletter is that the actual email sent out will contain a brief list of contents of the newsletter, and that a more in-depth description will be available online for the interested to divulge.

// Mathias

I. New features

i. Adaptive time stepper

by Mathias Hoppe

When injecting neutrals into a hot plasma with DREAM, the initial time scale which must be properly resolved by the code to avoid instabilities and large errors is that set by the ionization of the neutrals. Usually, after a microsecond or so, the ionization is more or less finished and the time step is now rather limited by other phyical processes which allow for significantly larger time steps than the ionization. So far, we have handled this by running two separate simulations with DREAM, but with this we run the risk of either taking unnecessarily short time steps for during the second phase, or—even worse—taking too long time step during the ionization which could lead to a code crash.

With the new ionization-based adaptive time stepper, we gradually rescale the initial time step as the ionization proceeds until a user-prescribed maximum allowed time step is reached. Beyond this point the time stepper behaves like the uniform time stepper. This allows us to combine the ionization and thermal/current quench phases of our disruption simulations into a single simulation, while often giving remarkable performance improvements.

Learn more about the new adaptive time stepper in the online documentation.

ii. Timeout in runiface()

by Ida Ekmark

When launching a large number of DREAM simulations with different input parameters, there is always a risk that the simulation will run into numerical issues which significantly slow down the simulation and effectively halts it quietly. With the new timeout parameter to the runiface() function, execution of DREAM will be aborted after a specified amount of time if the simulation has not yet finished.

Use as follows:

from DREAM import DREAMSettings, runiface

MINUTES = 60    # 1 minute = 60 seconds
ds = DREAMSettings()
...
timeout = 10 * MINUTES
do = runiface(ds, outfile='output.h5', timeout=timeout)

where timeout is the number of seconds after which execution should be aborted.

iii. Magnetic compression operator

by Mathias Hoppe

After recent experiments on TCV where the toroidal magnetic field strength was varied (), the need for a kinetic model operator in DREAM was realized. The operator models the effect of a conserved magnetic moment when is changed externally, and manifests itself as an advection in pitch-angle.

Details about the background theory are documented in doc/notes/pdf/magnetic_compression.pdf, and the operator is documented online.

iv. Ion source term

by Mathias Hoppe

Generally when simulating tokamak disruptions with DREAM, we have so far deposited any injected impurities instantaneously, using a uniform profile. With the new ion source term, we could however inject neutrals continuously from the edge of the plasma.

While this may sound like a major improvement, this feature is unlikely to immediately revolutionize our simulations, since it only models how the impurities appear in the plasma—not how they subsequently make their way into the core of the plasma. For this appropriate transport coefficients are needed. At the moment, it is possible to prescribe advective/diffusive transport of ions and neutrals, but the coefficients are not connected to any particular physics in the simulation. Hence, strong assumptions still need to be made about how the impurities enter the plasma.

The new source term is enabled with

from DREAM import DREAMSettings
import DREAM.Settings.Equations.IonSpecies as Ions
import numpy as np

ds = DREAMSettings()
...
ds.eqsys.n_i.addIon(name='D', Z=1, iontype=Ions.IONS_DYNAMIC, Z0=1, n=5e19)
# Enable the ion source for species 'D' with
# injection rate 1e19 atoms/s
ds.eqsys.n_i.addIonSource('D', dNdt=1e19)

Further details can be found in the online documentation.

v. New other quantities

Ionization/recombination rates
The ionization/recombination rates appearing in the ion rate equations can now be exported as other quantities during the simulation. They are located in the fluid category and are called fluid/ni_posIonization, fluid/ni_negIonization, fluid/ni_posRecombination and fluid/ni_negRecombination respectively.

II. Interface changes

i. other.fluid.gammaCompton

For consistency with the naming of other runaway rates, the definition of the other quantity other.fluid.gammaCompton has now been changed so that it includes a factor , and thus represents an actual generation rate. Prior to this change, other.fluid.gammaCompton was normalized to , and would therefore have had to be multiplied with for the corresponding production rate of runaways to be obtained.

ii. MPI-free compilation

For a long time, MPI has been kept as a dependence of DREAM even though the code cannot utilize this mode of parallelization. The reason is that MPI is, by default, a dependence of PETSc (which is used for linear algebra by DREAM). PETSc can, however, be compiled without MPI support relatively straightforwardly and this can be beneficial when building DREAM on certain systems.

For a while it has been possible to manually disable MPI as a dependency in DREAM, but now CMake will automatically detect whether PETSc was compiled with or without MPI support and will only consider MPI as a dependency if necessary.

To compile PETSc without MPI, one can add the --with-mpi=0 when running the PETSc configure script.

III. Bug fixes

i. Incorrect integration limits in bounce averages

A bug in the calculation of bounce averages caused the integration limits (i.e. bounce points) to be incorrectly determined in non-up down symmetric magnetic fields. Since the analytical magnetic field avaiable in DREAM is explicitly up down symmetric, this should only have affected simulations using certain numerical equilibria. The error was also easily recognized as it prevented the code exited with an error message during the bounce averaging phase of the simulation (which occurs before the very first time step).

IV. Recent publications

The following journal articles using DREAM have been published in 2022: