Run the routine from files

Process the file

First import divHretention and run Exposition

[1]:
from divHretention import Exposition

filename = "examples/WEST/West-LSN-P3.58e+21-IP2.5MW.csv"
res = Exposition(filename, filetype="WEST")

The result (res) is an object containing several attributes that are: - arc_length: arc_length along the divertor (in m) - temperature: surface temperature profile (in K) along the divertor - concentration: surface mobile concentration profile (in H/m3) along the divertor - inventory: inventory profile (in H per monoblock) along the divertor (divide by the monoblock thickness to get H/m) - stdev_in: inventory standard deviation along the divertor

Plot the temperature profile

[2]:
import matplotlib.pyplot as plt
arc_length_div = res.arc_length
T = res.temperature
plt.plot(arc_length_div, T)
plt.xlabel("Distance along divertor (m)")
plt.ylabel("Surface temperature (K)")
plt.show()
_images/WEST_inventory_5_0.svg

Plot the surface concentration profile

[3]:
c_max = res.concentration
plt.yscale("log")
plt.ylim(min(c_max)*0.9, max(c_max)*1.1)

plt.plot(arc_length_div, c_max)

plt.xlabel("Distance along divertor (m)")
plt.ylabel("$c_\mathrm{surface}$ (m$^{-3}$)")
plt.show()
_images/WEST_inventory_7_0.svg

Plot the inventory profile along the divertor

[4]:
import numpy as np

inventories = res.inventory  # inventory in H/m
sigmas = res.stdev_inv

plt.plot(arc_length_div, inventories)

plt.fill_between(
    arc_length_div, 10**(2*sigmas + np.log10(inventories)), 10**(-2*sigmas + np.log10(inventories)),
    facecolor='blue', alpha=0.3, label=r"95% confidence")
plt.legend()
plt.xlabel("Distance along divertor (m)")
plt.yscale("log")
plt.ylabel("Inventory per unit thickness (H/m)")
plt.show()
_images/WEST_inventory_9_0.svg

Example for several cases

[5]:
from divHretention import Exposition
import matplotlib.pyplot as plt
import numpy as np

# puffing rates
Ps = [
    1.0e21,
    1.3e21,
    1.6e21,
    2.0e21,
    2.5e21,
]

for P in Ps:
    filename = "examples/WEST/West-LSN-P{:.1e}-IP0.449MW.csv".format(P)
    res = Exposition(filename, filetype="WEST")
    inventories = res.inventory  # inventory in H/m
    sigmas = res.stdev_inv
    line, = plt.plot(res.arc_length, inventories, label="P = {:.1e}".format(P) + " s$^{-1}$")

    plt.fill_between(
        res.arc_length, 10**(2*sigmas + np.log10(inventories)), 10**(-2*sigmas + np.log10(inventories)),
        facecolor=line.get_color(), alpha=0.3)

plt.legend()
plt.xlabel("Distance along divertor (m)")
plt.yscale("log")
plt.ylabel("Inventory per unit thickness (H/m)")
plt.show()
_images/WEST_inventory_11_0.svg

Plotting examples

Plot (Temperature, concentration) map with distributions

[10]:
from divHretention import plot_Tc_map_with_subplots

filenames = [
    "examples/WEST/West-LSN-P3.58e+21-IP2.5MW.csv",
    "examples/WEST/WPN54696-1.5MW-FESTIM_inputs.csv"
]
my_plot = plot_Tc_map_with_subplots(filenames=filenames, filetypes="WEST", T_bounds=[320, 550])
for c in my_plot.CS.collections:  # for avoiding white lines in pdf
        c.set_edgecolor("face")
_images/WEST_inventory_14_0.svg

Plot T, c, inventory along divertor

[7]:
from divHretention import plot_T_c_inv_along_divertor

filenames = [
    "examples/WEST/West-LSN-P3.58e+21-IP2.5MW.csv",
    "examples/WEST/WPN54696-1.5MW-FESTIM_inputs.csv"
]

my_plot = plot_T_c_inv_along_divertor(filenames=filenames, filetypes="WEST")
my_plot.show()
No handles with labels found to put in legend.
No handles with labels found to put in legend.
_images/WEST_inventory_16_1.svg

Plot particle exposure along divertor

[8]:
from divHretention import plot_particle_exposure_along_divertor

filenames = [
    "examples/WEST/West-LSN-P3.58e+21-IP2.5MW.csv",
    "examples/WEST/WPN54696-1.5MW-FESTIM_inputs.csv"
]

my_plot = plot_particle_exposure_along_divertor(filenames=filenames, filetypes="WEST")
my_plot.show()
No handles with labels found to put in legend.
No handles with labels found to put in legend.
_images/WEST_inventory_18_1.svg

Plot custom quantities along divertor

[9]:
from divHretention import plot_along_divertor
quantities = [
    "heat_flux",
    "ion_flux", "atom_flux",
    "ion_energy", "atom_energy",
    "ion_angle", "atom_angle"
]

filename = "examples/WEST/WPN54696-1.5MW-FESTIM_inputs.csv"

my_plot = plot_along_divertor(filenames=[filename], filetypes="WEST", quantities=quantities)
No handles with labels found to put in legend.
_images/WEST_inventory_20_1.svg
[ ]: