.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gen_examples/bound_free/plot_ipd.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gen_examples_bound_free_plot_ipd.py: Compare IPD Models ================== This example shows different IPD models implemented in the code for Carbon at 100 eV and for varying densities. .. GENERATED FROM PYTHON SOURCE LINES 8-78 .. image-sg:: /gen_examples/bound_free/images/sphx_glr_plot_ipd_001.svg :alt: plot ipd :srcset: /gen_examples/bound_free/images/sphx_glr_plot_ipd_001.svg :class: sphx-glr-single-img .. code-block:: Python import jax.numpy as jnp import matplotlib.pyplot as plt import jaxrts ureg = jaxrts.ureg plt.style.use("science") test_setup = jaxrts.setup.Setup( ureg("145°"), ureg("5keV"), jnp.linspace(4.5, 5.5) * ureg.kiloelectron_volts, lambda x: jaxrts.instrument_function.instrument_gaussian( x, 1 / ureg.second ), ) fig, ax = plt.subplots() nes = [] ipds = {"dh": [], "sp": [], "is": [], "pb": []} keys = ["dh", "sp", "is", "pb"] md = jnp.logspace(-3, 3, 500) for m in md: test_state = jaxrts.PlasmaState( ions=[jaxrts.Element("C")], Z_free=jnp.array([5]), mass_density=jnp.array([m]) * ureg.gram / ureg.centimeter**3, T_e=jnp.array([100]) * ureg.electron_volt / ureg.k_B, ) nes.append(test_state.n_e.m_as(1 / ureg.cc)) for i, IPDModel in enumerate( [ jaxrts.models.DebyeHueckelIPD(), jaxrts.models.StewartPyattIPD(), jaxrts.models.IonSphereIPD(), jaxrts.models.PauliBlockingIPD(), ] ): IPDModel.model_key = "ipd" shift = IPDModel.evaluate( plasma_state=test_state, setup=test_setup ).m_as(ureg.electron_volt) # print(test_state.n_e.m_as(1 / ureg.cc), shift) ipds[keys[i]].append(-shift[0]) ax.plot(nes, ipds["dh"], label="Debye Hueckel Model") ax.plot(nes, ipds["sp"], label="Stewart Pyatt Model") ax.plot(nes, ipds["is"], label="Ion Sphere Model") ax.plot(nes, ipds["pb"], label="Pauli Blocking Model") plt.xscale("log") # plt.yscale("symlog") plt.xlabel("$n_i$ [cm$^{-3}$]") plt.ylabel("IPD [eV]") plt.legend() plt.xlim(1e23, 1e26) # plt.ylim(0.5, 15) plt.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 7.451 seconds) .. _sphx_glr_download_gen_examples_bound_free_plot_ipd.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ipd.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ipd.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_