Newsletter #8, September 2025

The last few months have seen limited progress in DREAM development due to conferences, vacation and teaching. However, the DREAM development team is steadily growing and there are a number of projects in the pipeline which will hopefully make it into the master branch in the next few months.

The DREAM Developer Council

Latest DREAM release: version 25.9

I. New features

i. Line-integration of fluid quantities

by Peter Halldestam and Oskar Vallhagen

A new method for calculating line integrals of any FluidQuantity object is now available in DREAMOutput objects. The user provides a starting point and a direction, which together defines the line-of-sight on which the integral is evaluated. These are assumed to be given in “SPI coordinates” (as described in doc/notes/SPIcoordinates.tex).

For example, the line-averaged electron density along a vertical line passing through the magnetic axis is obtained with

ne_average = do.eqsys.n_cold.lineIntegrated(x0=[0, 2, 0], n=[0, -1, 0], normaliseToPathLength=True)

In this example, it is assumed that 2 m above the magnetic axis is outside of the plasma.

This feature was added in pull request #446 and is now available on master.

ii. Tool for saving volume-integrated distribution function

by Ida Ekmark

This tool takes a radially resolved distribution function from DREAM and integrates it over the plasma volume. The volume integrated distribution will be a function of either momentum and cosine of the pitch angle (), energy and pitch angle (), or cylindrical momentum coordinates (). This can be useful for studying RE heat loads.
The tool is kept under tools/saveDistributionFunction.py.

This tool was added in pull request #445 and is now available on master.

iii. LCFS radius saved as other quantity

by Ida Ekmark

The recent LCFSLossRateTerm class, which was implemented to study the effect of RE scrape-off during vertical displacement events, contains an effective radius of the last closed flux surface (LCFS). While this quantity can often be useful in postprocessing of simulations, it was not previously saved after a simulation. With this improvement, it is now available as an other quantity under scalar/r_LCFS.

This feature was added in pull request #442 and is now available on master.

iv. Specification of initial wall current

by Mathias Hoppe

The initial wall current has previously always been initialized to zero (or the value in the previous simulation). With this improvement the user can now specify an initial value for the wall current. This may be useful in order to avoid certain numerical instabilities or to obtain a more robust initial electric field profile.

The initial wall current may be set with python ds.eqsys.E_field.setInitialWallCurrent(I_wall_0)

This feature was added in pull request #433 and is now available on master.

v. Fraction of heat redeposition due to plasmoid drifts

by Oskar Vallhagen

When accounting for plasmoid drifts in SPI simulations, the spatial displacement of the cloud of ablated material will also cause a displacement of heat absorbed by the cloud to where the material is later deposited. However, for neon doped pellets this energy is expected to instead be lost via radiation during the drift motion. A redeposition factor has therefore been added, for which removes the energy from the system (neon doped). This may be set with the method ds.eqsys.spi.setShiftPramsAnalytical together with the keyword argument heatReDepositionFactorDrift, which takes values between 0 and 1.

This feature was added in pull request #448 and is now available on master.

vi. Neutral beam heating of electrons

by Linn Ekman

A neutral beam heating (NBH) model has been implemented in DREAM. The model was developed in the masters thesis of Linn Ekman and is intended for application to neutral beam heated disruptions in TCV. At the moment, the model only considers transfer of energy to electrons, i.e. it is only added to the electron heat equation. The model however also accounts for the energy which is normally transferred to the ions, but adds it directly to the electrons instead. A generalization of this model to account for the partitioning of energy between electrons and ions is under development and will be merged in the near future.

An example of how to use the NBI model can be found under examples/nbi_test in the DREAM GitHub repository. The key lines set the various free parameters of the NBI model: :::python from scipy.constants import e # elementary charge from scipy.constants import m_p, m_n # proton/neutron mass

# Enable the NBI model
ds.eqsys.T_cold.nbi.setEnabled(True)

# Set neutral beam origin
ds.eqsys.T_cold.nbi.setOrigin([0.685, -1.028, 0.0])
# Set direction vector of beam
ds.eqsys.T_cold.nbi.setDirection([0.0, 1.0, 0.0])

# Set beam radius, beam temperature, and ion mass
ds.eqsys.T_cold.nbi.setBeamParameters(r_beam=0.02, Ti_beam=e*25, m_i_beam=m_p+m_n)
# Specify ion charge (Zion) and the charge state in which it should be deposited
ds.eqsys.T_cold.nbi.setIons(Z0=0, Zion=1)  
# Set neutral beam power (in W)
ds.eqsys.T_cold.nbi.setPower(beam_power=1) #57e3
# Set the tokamak major radius used in the NBI model
ds.eqsys.T_cold.nbi.setR0_NBI(R0)

# Visualize the NBI setup
ds.eqsys.T_cold.nbi.visualize_flux_surfaces_top_view(r)

This feature was introduced in pull request #420 and is now available on master.

II. Bug fixes

i. Replacement of numpy.array.tostring()

by Mathias Hoppe

In recent versions of numpy, the numpy.ndarray.tostring() method was deprecated in favour of the equivalent method numpy.ndarray.tobytes(), and in a recent version of numpy the former was removed altogether. This has now been fixed in all parts of the DREAM Python interface which relied on the old method. The tobytes() has been present in numpy for a long time and so should not cause any conflicts.

This fix was introduced in pull request #439 and is now available on master.

ii. Incorrect size for runaway/kinioniz_rate

by Nathan Schoonheere

The other quantity runaway/kinioniz_rate was allocated with the size of the hot-tail grid, instead of the runaway grid. This would cause problems when the two grids were of different sizes. The fix resolves this issue and allocates memory of the appropriate size and shape.

This fix was introduced in pull request #434 and is now available on master.

iii. Problem with scalar density in coronal equilibrium

by Ida Ekmark

When a scalar value is extracted from a numpy array, it will not be classified as a float, but as a numpy.float64. This lead to densities extracted from numpy arrays not being identified as proper scalar values, and resulted in a dimensionality error. The problem was solved by using the Numbers class of the numbers module, which encompasses all number data types.

This fix was introduced in pull request #431 and is now available on master.

iv. Bug in Rechester-Rosenbluth diffusion for runaway density

by Mathias Hoppe

It was discovered that the Rechester-Rosenbluth diffusion coefficient for the runaway electron density had all elements initialized except for the very last (outermost) element. This would cause the runaway electron density to not be lost even when a lossy transport boundary condition was being applied.

Since the Rechester-Rosenbluth diffusion operator for the runaway electron density is a recent addition to the code, and has a separate implementation from the Rechester-Rosenbluth heat transport, the effect of this bug is expected to be limited.

This fix was introduced in pull request #429 and is now available on master.

III. Recent publications