Grid#
- class cherab.lhd.emc3.Grid(zone: str, dataset: str = 'emc3/grid-360.nc', grid_file: str | Path | None = None, **kwargs)Source#
Bases:
objectClass for dealing with grid coordinates defined by EMC3-EIRENE.
This class handles originally defined EMC3-EIRENE grid coordinates in \((R, Z)\), and offers methods to produce cell vertices in \((X, Y, Z)\) coordinates and their indices, which a cell means a cubic-like mesh with 8 vertices. Using these data, procedure of generating a
TetraMeshDatainstance is also implemented.Total number of grids coordinates is L x M x N, each letter of which means:L: Radial grid resolutionM: Poloidal grid resolutionN: Toroidal grid resolution.- Parameters:
- zone{“zone0”, …, “zone21”}
Name of grid zone. Users can select only one option of
"zone0"-"zone21".- dataset
str,optional Name of dataset, by default
"emc3/grid-360.nc".- grid_file
Path|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
>>> grid = Grid("zone0") >>> grid Grid(zone='zone0', dataset='/path/to/cache/cherab/lhd/emc3/grid-360.nc') >>> str(grid) 'Grid for (zone: zone0, L: 82, M: 601, N: 37, number of cells: 1749600)'
Methods
__getitem__(key)Return grid coordinates indexed by (l, m, n, RZ).
Generate cell indices array.
Generate grid vertices array.
plot([fig, ax, n_phi, rz_range, show_phi, ...])Plotting EMC3-EIRENE-defined grids in \(R–Z\) plane.
plot_coarse(**kwargs)Plotting EMC-EIRENE-defined coarse grids in \(R–Z\) plane.
plot_outline([phi, fig, ax, show_phi])Plotting EMC3-EIRENE-defined grid outline in \(R–Z\) plane.
Attributes