plasma

Input data representing plasma background species.

Plasma input is required for simulations with collisions or collisional diagnostics enabled. This includes BBNBI5 and ASCOT-BMC.

a5py.ascot5io.plasma.plasma_1D

Plasma profiles that have only radial dependency.

a5py.ascot5io.plasma.plasma_1DS

Same input as plasma_1D but interpolated with splines.

class a5py.ascot5io.plasma.plasma_1D(root, path, **kwargs)

Bases: DataGroup

Plasma profiles that have only radial dependency.

static create_dummy()

Create dummy data that has correct format and is valid, but can be non-sensical.

This method is intended for testing purposes or to provide data whose presence is needed but which is not actually used in simulation.

The dummy output is an uniform hydrogen plasma.

Returns:
datadict

Input data that can be passed to write_hdf5 method of a corresponding type.

plot_radial(rholim=None, densitylim=None, temperaturelim=None, axes=None)

Plot plasma profiles as a function of rho.

Parameters:
rholim[float, float], optional

Limits on x-axis.

densitylim[float, float, float], optional

Limits on the first y axis where the middle value is when the scale changes from logarithmic to linear [m^-3].

temperaturelim[float, float, float], optional

Limits on the second y axis where the middle value is when the scale changes from logarithmic to linear [eV].

axesAxes, optional

The axes where figure is plotted or otherwise new figure is created.

read()

Read data from HDF5 file.

Returns:
datadict

Data read from HDF5 stored in the same format as is passed to write_hdf5().

static write_hdf5(fn, nrho, nion, anum, znum, mass, charge, rho, edensity, etemperature, idensity, itemperature, desc=None)

Write input data to the HDF5 file.

Parameters:
fnstr

Path to hdf5 file.

nrhoint

Number of rho grid points.

nionint

Number of ion species.

anumarray_like (nion,1)

Ion species atomic mass number

znumarray_like (nion,1)

Ion species charge number.

massarray_like (nion,1)

Ion species mass [amu].

chargearray_like (nion,1)

Ion species charge [e].

rhoarray_like (nrho,1)

rho grid, doesn’t have to be uniform.

edensityarray_like (nrho,1)

Electron density [m^-3].

etemperaturearray_like (nrho,1)

Electron temperature [eV].

idensityarray_like (nrho,nion)

Ion density [m^-3].

itemperaturearray_like (nrho,1)

Ion temperature [ev].

descstr, optional

Input description.

Returns:
namestr

Name, i.e. “<type>_<qid>”, of the new input that was written.

Raises:
ValueError

If inputs were not consistent.

class a5py.ascot5io.plasma.plasma_1DS(root, path, **kwargs)

Same input as plasma_1D but interpolated with splines.

Spline interpolation could yield negative value even though the inputs were all positive. To avoid this, ASCOT5 internally takes a logarithm of the input data before constructing the splines. The actual values are then computed after the spline-evaluation. The logarithmic also helps to interpolate the values at the edge more accurately.

static create_dummy()

Create dummy data that has correct format and is valid, but can be non-sensical.

This method is intended for testing purposes or to provide data whose presence is needed but which is not actually used in simulation.

The dummy output is an uniform hydrogen plasma.

Returns:
datadict

Input data that can be passed to write_hdf5 method of a corresponding type.

plot_radial(rholim=None, densitylim=None, temperaturelim=None, axes=None)

Plot plasma profiles as a function of rho.

Parameters:
rholim[float, float], optional

Limits on x-axis.

densitylim[float, float, float], optional

Limits on the first y axis where the middle value is when the scale changes from logarithmic to linear [m^-3].

temperaturelim[float, float, float], optional

Limits on the second y axis where the middle value is when the scale changes from logarithmic to linear [eV].

axesAxes, optional

The axes where figure is plotted or otherwise new figure is created.

read()

Read data from HDF5 file.

Returns:
datadict

Data read from HDF5 stored in the same format as is passed to write_hdf5().

static write_hdf5(fn, nrho, nion, anum, znum, mass, charge, rhomin, rhomax, edensity, etemperature, idensity, itemperature, desc=None)

Write input data to the HDF5 file.

Parameters:
fnstr

Path to hdf5 file.

nrhoint

Number of rho grid points.

nionint

Number of ion species.

anumarray_like (nion,1)

Ion species atomic mass number

znumarray_like (nion,1)

Ion species charge number.

massarray_like (nion,1)

Ion species mass [amu].

chargearray_like (nion,1)

Ion species charge [e].

rhominfloat

Minimum rho grid value.

rhomaxfloat

Maximum rho grid value.

edensityarray_like (nrho,1)

Electron density [m^-3].

etemperaturearray_like (nrho,1)

Electron temperature [eV].

idensityarray_like (nrho,nion)

Ion density [m^-3].

itemperaturearray_like (nrho,1)

Ion temperature [ev].

descstr, optional

Input description.

Returns:
namestr

Name, i.e. “<type>_<qid>”, of the new input that was written.

Raises:
ValueError

If inputs were not consistent.