Note
Click here to download the full example code
A gallery of Fusion Machines¶
This tutorial functions as a gallery of fusion machines that can easily be loaded with tofu.
We start by importing tofu.
import tofu as tf
tofu provides a geometry helper function that allows creating a configuration with a single call.
Some configurations are pre-defined, for example ITER’s configuration.
By printing the config object created, a text representation of its components is printed. This allows inspecting the component names, number of sections, color or visibility.
config = tf.load_config("ITER") # create ITER configuration
print(config)
Out:
tot. Struct tot. occur tot. points
----------- ---------- -----------
27 759 671
class Name SaveName nP noccur move color visible
----- -------- ------------------------------------------------------ --- ------ ---- ------------------------ -------
Ves InnerV0 TFG_Ves_ExpITER_InnerV0_sh00000_Vers1.5.0-3-g96c1c10c 135 0 None ( 0.0, 0.0, 0.0, 1.0) True
Ves OuterV0 TFG_Ves_ExpITER_OuterV0_sh00000_Vers1.5.0-3-g96c1c10c 151 0 None ( 0.0, 0.0, 0.0, 1.0) True
Ves Cryostat TFG_Ves_ExpITER_Cryostat_sh00000_Vers1.5.0-3-g96c1c10c 16 0 None ( 0.0, 0.0, 0.0, 1.0) True
PFC BLK01 TFG_PFC_ExpITER_BLK01_sh00000_Vers1.5.0-3-g96c1c10c 6 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK02 TFG_PFC_ExpITER_BLK02_sh00000_Vers1.5.0-3-g96c1c10c 6 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK03 TFG_PFC_ExpITER_BLK03_sh00000_Vers1.5.0-3-g96c1c10c 6 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK04 TFG_PFC_ExpITER_BLK04_sh00000_Vers1.5.0-3-g96c1c10c 6 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK05 TFG_PFC_ExpITER_BLK05_sh00000_Vers1.5.0-3-g96c1c10c 6 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK06 TFG_PFC_ExpITER_BLK06_sh00000_Vers1.5.0-3-g96c1c10c 6 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK07 TFG_PFC_ExpITER_BLK07_sh00000_Vers1.5.0-3-g96c1c10c 8 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK08 TFG_PFC_ExpITER_BLK08_sh00000_Vers1.5.0-3-g96c1c10c 10 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK09 TFG_PFC_ExpITER_BLK09_sh00000_Vers1.5.0-3-g96c1c10c 9 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK10 TFG_PFC_ExpITER_BLK10_sh00000_Vers1.5.0-3-g96c1c10c 5 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK11 TFG_PFC_ExpITER_BLK11_sh00000_Vers1.5.0-3-g96c1c10c 4 36 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK12 TFG_PFC_ExpITER_BLK12_sh00000_Vers1.5.0-3-g96c1c10c 4 36 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK13 TFG_PFC_ExpITER_BLK13_sh00000_Vers1.5.0-3-g96c1c10c 4 36 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK14 TFG_PFC_ExpITER_BLK14_sh00000_Vers1.5.0-3-g96c1c10c 4 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK15 TFG_PFC_ExpITER_BLK15_sh00000_Vers1.5.0-3-g96c1c10c 4 18 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK16 TFG_PFC_ExpITER_BLK16_sh00000_Vers1.5.0-3-g96c1c10c 4 36 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK17 TFG_PFC_ExpITER_BLK17_sh00000_Vers1.5.0-3-g96c1c10c 4 36 None ( 0.8, 0.8, 0.8, 0.8) True
PFC BLK18 TFG_PFC_ExpITER_BLK18_sh00000_Vers1.5.0-3-g96c1c10c 4 36 None ( 0.8, 0.8, 0.8, 0.8) True
PFC Div1 TFG_PFC_ExpITER_Div1_sh00000_Vers1.5.0-3-g96c1c10c 76 54 None ( 0.8, 0.8, 0.8, 0.8) True
PFC Div2 TFG_PFC_ExpITER_Div2_sh00000_Vers1.5.0-3-g96c1c10c 11 54 None ( 0.8, 0.8, 0.8, 0.8) True
PFC Div3 TFG_PFC_ExpITER_Div3_sh00000_Vers1.5.0-3-g96c1c10c 60 54 None ( 0.8, 0.8, 0.8, 0.8) True
PFC Div4 TFG_PFC_ExpITER_Div4_sh00000_Vers1.5.0-3-g96c1c10c 10 54 None ( 0.8, 0.8, 0.8, 0.8) True
PFC Div5 TFG_PFC_ExpITER_Div5_sh00000_Vers1.5.0-3-g96c1c10c 60 54 None ( 0.8, 0.8, 0.8, 0.8) True
PFC Div6 TFG_PFC_ExpITER_Div6_sh00000_Vers1.5.0-3-g96c1c10c 52 54 None ( 0.8, 0.8, 0.8, 0.8) True
To get a list of all available built-in configs, one has to know some details about tofu. Configurations can be accessed by names (ITER, WEST, JET, etc).
print(tf.geom.utils.get_available_config())
Out:
A config is the geometry of a tokamak
You can define your own, see online tutorial at:
https://tofuproject.github.io/tofu/auto_examples/tutorials/tuto_plot_create_geometry.html
tofu also also provides some pre-defined config ready to load
They are available via their name or via shortcuts
unique names shortcuts
------------ -------------------------
- AUG-V1 ['AUG-V1', 'AUG']
- COMPASS-V0 ['COMPASS-V0', 'COMPASS']
- COMPASS-V1 ['COMPASS-V1']
- COMPASS2-V0 ['COMPASS2-V0']
- DEMO-2019 ['DEMO-2019', 'DEMO']
- ITER-V0 ['ITER-V0']
- ITER-V1 ['ITER-V1', 'A2']
- ITER-V2 ['ITER-V2', 'B4', 'ITER']
- JET-V0 ['JET-V0', 'JET']
- NSTX-V0 ['NSTX-V0', 'NSTX']
- TCV-V0 ['TCV-V0', 'TCV']
- TOMAS-V0 ['TOMAS-V0', 'TOMAS']
- WEST-Sep ['WEST-Sep', 'A3']
- WEST-V0 ['WEST-V0']
- WEST-V1 ['WEST-V1', 'A1']
- WEST-V2 ['WEST-V2', 'B1']
- WEST-V3 ['WEST-V3', 'B2']
- WEST-V4 ['WEST-V4', 'B3', 'WEST']
=> to get a pre-defined config, call for example:
config = tf.geom.utils.create_config('ITER')
=> to also load coils add '-coils' to the config name, e.g.:
config = tf.geom.utils.create_config('ITER-coils')
None
With that being said, let’s create a gallery of the “top 3” fusion machines provided by tofu to accelerate diagnostic development.
for fusion_machine in ['ITER', 'WEST', 'JET', 'NSTX', 'AUG', 'DEMO', 'TOMAS',
'COMPASS', 'TCV']:
config = tf.load_config(fusion_machine)
config.plot()
Out:
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
/home/lasofivec/tofu/tofu/geom/_def.py:127: MatplotlibDeprecationWarning:
The set_window_title function was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
f.canvas.set_window_title(wintit)
Total running time of the script: ( 0 minutes 5.610 seconds)