Interface to SOLPS results

Example code demonstrating the use of SolpsInterface can be found in the jupyter notebook demo.

class sims.interface.SolpsInterface(balance_filepath: str)

A class which provides an interface to the results of SOLPS-ITER simulations stored in a balance.nc file.

The value of a variable at any set of (R, z) positions can be accessed using the get method. A list of available variables can be obtained using the variables method.

Parameters

balance_filepath – A path to a balance.nc file.

get(variable: str, R: ndarray, z: ndarray, outside_value: float = 0.0) ndarray

Returns the value of a chosen variable at a given set of points.

Parameters
  • variable – A string indicating which variable to retrieve.

  • R – The radius values of the points at which the variable is determined.

  • z – The z-height values of the points at which the variable is determined.

  • outside_value – The value which is assigned to any points which lie outside the SOLPS grid.

Returns

The values of the variable at the given points as a 1D numpy array.

plot(variable: str, draw_mesh=False)

Generate a colour plot of a chosen variable.

Parameters
  • variable (str) – A string indicating which variable to plot.

  • draw_mesh (bool) – A bool indicating whether to draw the mesh in the plot.

variables() list[str]

Returns a list containing all available variables.

Returns

A list of the available variables.