Skip to content

Commit 1fa2c3c

Browse files
committed
docs: Add page on Cherab interface
1 parent a0de284 commit 1fa2c3c

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

docs/cherab.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Cherab interface
2+
================
3+
4+
Cherab (https://www.cherab.info/) is a python library for forward
5+
modelling diagnostics based on spectroscopic plasma emission. It is
6+
based on the Raysect (http://www.raysect.org/) scientific ray-tracing
7+
framework.
8+
9+
Triangulation
10+
-------------
11+
12+
Before Cherab can be used, a triangulated mesh must be generated. This
13+
mesh is stored in an attribute ``cherab_grid``. This can be attached to
14+
a Dataset or DataArray by calling the ``bout.with_cherab_grid()`` accessor::
15+
16+
ds = ds.bout.with_cherab_grid()
17+
18+
Following operations will generate a grid if needed, but if this
19+
attribute is already present then the grid is not
20+
recalculated. Calling this method on a dataset before performing
21+
Cherab operations improves efficiency.
22+
23+
24+
Wall heat fluxes
25+
----------------
26+
27+
To calculate radiation heat fluxes to walls, first create an ``xbout.AxisymmetricWall``
28+
object that represents a 2D (R, Z) axisymmetric wall. This can be done by
29+
reading the wall coordinates from a GEQDSK equilibrium file::
30+
31+
wall = xbout.wall.read_geqdsk("geqdsk")
32+
33+
Triangulate a grid and attach to the dataset::
34+
35+
ds = ds.bout.with_cherab_grid()
36+
37+
Extract a data array. This must be 2D (x, y) so select a single time
38+
slice and toroidal angle e.g. excitation radiation::
39+
40+
da = -bd['Rd+_ex'].isel(t=1, zeta=0)
41+
42+
Remove potentially invalid data in the guard cells::
43+
44+
da[:2,:] = 0.0
45+
da[-2:,:] = 0.0
46+
47+
Attach data to the Cherab triangulated mesh, returning an
48+
``xbout.cherab.TriangularData`` object that Cherab can work with::
49+
50+
data = da.bout.as_cherab_data()
51+
52+
Calculate the wall heat fluxes::
53+
54+
result = data.wall_flux(cat_wall, pixel_samples=1000)
55+
56+
This result is a list of dicts, one for each wall element. Those dicts
57+
contain coordinates "rz1" and "rz2", results "power_density" and
58+
"total_power".
59+

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ suggestions.
2121

2222
loading_data
2323
accessor_methods
24+
cherab
2425
extending_xbout
2526

2627
.. toctree::

0 commit comments

Comments
 (0)