—
Run Bolsig to compute energy fraction loss in CH₄.#
This example uses BolsigSession to compute
energy fraction loss for different reduced electric fields.
Import the required libraries.#
import matplotlib.pyplot as plt
import seaborn as sns
from rizer.io.bolsig import BolsigSession
from rizer.misc.utils import get_path_to_data
sns.set_theme("poster")
Generate a database.#
E_N_min = 10
E_N_max = 500
bol = BolsigSession(overwrite=True)
bol.read_collisions(
"CH4",
cross_sections_database_path=get_path_to_data(
"kin", "cross_section", "CH4", "Hayashi.txt"
),
)
bol.set_conditions(n_gas=1e21, growth="spatial")
bol.set_series("E/N", m=E_N_min, M=E_N_max, n=100, typ="exponential")
bol.set_outputs()
Run Bolsig.#
try:
bol.run()
except FileNotFoundError:
# Deal with errors on non-Windows systems.
import os
if os.name == "nt":
# BolsigSession is tested on Windows and should have worked.
raise FileNotFoundError("BolsigSession failed on Windows.")
else:
# BolsigSession doesn't work on Linux because of shared library errors.
# ex : "./bolsigminus: error while loading shared libraries: libmkl_intel_lp64.so:
# cannot open shared object file: No such file or directory".
# For this example, just pass.
pass
else:
bol.plot_fraction_losses()
plt.show()
Running `/home/runner/work/rizer/rizer/data/io/bolsig_exec/bolsigminus /home/runner/work/rizer/rizer/data/io/bolsig_exec/bolsig_instructions.txt` in /home/runner/work/rizer/rizer/data/io/bolsig_exec
====================
stdout:
stderr: /home/runner/work/rizer/rizer/data/io/bolsig_exec/bolsig_instructions.txt: 1: /home/runner/work/rizer/rizer/data/io/bolsig_exec/bolsigminus: Permission denied
====================
Total running time of the script: (0 minutes 0.031 seconds)