CenterGrid#

class cherab.lhd.emc3.CenterGrid(zone: str, index_type: str = 'coarse', dataset: str = 'emc3/grid-360.nc', grid_file: str | Path | None = None, **kwargs)Source#

Bases: object

Class for center grids of EMC3-EIRENE grids.

One EMC3-based cell is divided to six tetrahedra and the center point of each cell is defined as the average of the six tetrahedra’s barycenters. Considering various indexing ways, final center points are averaged by integrating several cells, which must have 3 dimensional resolutions w.r.t. radial/poloidal/toroidal direction.

Total number of center grid is L x M x N, each letter of which means:
L: Radial grid resolution
M: Poloidal grid resolution
N: Toroidal grid resolution.
Parameters:
zone{“zone0”, “zone11”}

Name of zone, currently supporting a few zones.

index_type{“coarse”, “cell”}

Indexing way of center grids, by default "coarse".

datasetstr, optional

Name of dataset, by default "emc3/grid-360.nc".

grid_filePath | str | None, optional

Path to the grid file. If specified, the grid dataset is loaded from the file preferentially. Otherwise, the grid file is fetched from the repository.

**kwargs

Keyword arguments to pass to fetch_file.

Examples

>>> cgrid = CenterGrid("zone0", index_type="cell")
>>> cgrid
CenterGrid(zone='zone0', index_type='cell', dataset='/path/to/cache/cherab/lhd/emc3/grid-360.nc')
>>> str(cgrid)
'CenterGrid with cell index_type (zone: zone0, L: 82, M: 601, N: 37)'

Methods

__getitem__(key)

Return center grid coordinates indexed by (l, m, n, xyz).

get_lmn(index)

Return (l, m, n) indices from 1D index.

Attributes

data_array

DataArray of center grid coordinates.

grid_data

Array of center grid coordinates of each volume.

index_type

Indexing way of center grids.

path

Path to dataset.

shape

Shape of center grids.

zone

Name of zone.