.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/giese/giese_testing2.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_auto_examples_giese_giese_testing2.py: Giese testing 2 =============== Compare Giese fluid profiles with PTtools .. GENERATED FROM PYTHON SOURCE LINES 7-94 .. image-sg:: /auto_examples/giese/images/sphx_glr_giese_testing2_001.png :alt: $c_{s,s}^2=1/3, c_{s,b}^2=1/3$, $c_{s,s}^2=1/3, c_{s,b}^2=1/4$, $c_{s,s}^2=1/4, c_{s,b}^2=1/4$ :srcset: /auto_examples/giese/images/sphx_glr_giese_testing2_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Models Model: css2=0.333, csb2=0.333, alpha_n_min=0.267 (a_s=5.000, a_b=1.000, V_s=1.000, V_b=0.000) 0.9709835434146397 v_cj: 0.8583590383869816 Model: css2=0.333, csb2=0.250, alpha_n_min=0.275 (a_s=5.000, a_b=1.000, V_s=1.000, V_b=0.000) 0.9799021311566245 v_cj: 0.792246700371606 Model: css2=0.250, csb2=0.250, alpha_n_min=0.267 (a_s=5.000, a_b=1.000, V_s=1.000, V_b=0.000) 0.9713811036382461 v_cj: 0.7929786601480452 Solving bubbles Model: css2=0.333, csb2=0.333, alpha_n_min=0.267 (a_s=5.000, a_b=1.000, V_s=1.000, V_b=0.000) Bubble: css2=0.3333333333333333, csb2=0.3333333333333333, v_wall=0.8122449, sol_type=SolutionType.HYBRID alpha_theta_bar_n_giese 0.3 Bubble: css2=0.3333333333333333, csb2=0.3333333333333333, v_wall=0.82755102, sol_type=SolutionType.HYBRID alpha_theta_bar_n_giese 0.3 Bubble: css2=0.3333333333333333, csb2=0.3333333333333333, v_wall=0.84285714, sol_type=SolutionType.HYBRID alpha_theta_bar_n_giese 0.3 Bubble: css2=0.3333333333333333, csb2=0.3333333333333333, v_wall=0.85816327, sol_type=SolutionType.HYBRID alpha_theta_bar_n_giese 0.3 Model: css2=0.333, csb2=0.250, alpha_n_min=0.275 (a_s=5.000, a_b=1.000, V_s=1.000, V_b=0.000) Bubble: css2=0.3333333333333333, csb2=0.25, v_wall=0.8122449, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.3058385667717307 Bubble: css2=0.3333333333333333, csb2=0.25, v_wall=0.82755102, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.3058385667717307 Bubble: css2=0.3333333333333333, csb2=0.25, v_wall=0.84285714, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.3058385667717307 Bubble: css2=0.3333333333333333, csb2=0.25, v_wall=0.85816327, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.3058385667717307 Model: css2=0.250, csb2=0.250, alpha_n_min=0.267 (a_s=5.000, a_b=1.000, V_s=1.000, V_b=0.000) Bubble: css2=0.25, csb2=0.25, v_wall=0.8122449, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.30833333333333335 Bubble: css2=0.25, csb2=0.25, v_wall=0.82755102, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.30833333333333335 Bubble: css2=0.25, csb2=0.25, v_wall=0.84285714, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.30833333333333335 Bubble: css2=0.25, csb2=0.25, v_wall=0.85816327, sol_type=SolutionType.DETON alpha_theta_bar_n_giese 0.30833333333333335 | .. code-block:: Python import typing as tp import matplotlib.pyplot as plt import numpy as np from examples import utils from pttools.analysis.utils import A4_PAPER_SIZE from pttools.bubble import Bubble, Phase, lorentz, kappaNuMuModel, v_chapman_jouguet_const_cs from pttools.models import Model, BagModel, ConstCSModel def main(): alpha_n = 0.3 theta_bar = False # v_walls = np.array([0.5, 0.6, 0.65]) v_walls = np.array([0.8122449, 0.82755102, 0.84285714, 0.85816327]) colors = ["r", "g", "b", "orange"] a_s = 5 a_b = 1 V_s = 1 models = [ # BagModel(a_s=a_s, a_b=a_b, V_s=V_s, alpha_n_min=alpha_theta_bar_n) ConstCSModel(css2=1/3, csb2=1/3, a_s=a_s, a_b=a_b, V_s=V_s, alpha_n_min=alpha_n), ConstCSModel(css2=1/3, csb2=1/4, a_s=a_s, a_b=a_b, V_s=V_s, alpha_n_min=alpha_n), # ConstCSModel(css2=1/4, csb2=1/3, a_s=a_s, a_b=a_b, V_s=V_s, alpha_n_min=alpha_n), ConstCSModel(css2=1/4, csb2=1/4, a_s=a_s, a_b=a_b, V_s=V_s, alpha_n_min=alpha_n) ] print("Models") for model in models: alpha_theta_bar_n = model.alpha_theta_bar_n_from_alpha_n(alpha_n) print("Model:", model.params_str(), model.tn(alpha_n=alpha_n, theta_bar=theta_bar)/model.critical_temp()) print("v_cj:", v_chapman_jouguet_const_cs(model, alpha_theta_bar_plus=alpha_theta_bar_n)) fig: plt.Figure = plt.figure(figsize=A4_PAPER_SIZE) axs = fig.subplots(2, 2) axs_flat = np.ravel(axs) print("Solving bubbles") for ax, model in zip(axs_flat, models): print("Model:", model.params_str()) for v_wall, color in zip(v_walls, colors): bubble = Bubble(model=model, v_wall=v_wall, alpha_n=alpha_n, theta_bar=theta_bar) print("Bubble:", f"css2={model.css2}, csb2={model.csb2}, v_wall={v_wall}, sol_type={bubble.sol_type}") ax.plot(bubble.xi, bubble.v, label=f"$v_w={v_wall}$", c=color) if not theta_bar: alpha_theta_bar_n = model.alpha_theta_bar_n_from_alpha_n(alpha_n=alpha_n) print("alpha_theta_bar_n_giese", alpha_theta_bar_n) else: alpha_theta_bar_n = alpha_n # If the Giese code has not been loaded if kappaNuMuModel is None: continue kappa, v, w, xi, mode, vp, vm = kappaNuMuModel( cs2s=model.cs2(model.w_crit, Phase.SYMMETRIC), cs2b=model.cs2(model.w_crit, Phase.BROKEN), al=alpha_theta_bar_n, vw=v_wall ) ax.plot(xi, v, ls=":", c=color) if np.isclose(v_wall, 0.8): print(np.nanmax(v)) # The dotted line can be computed directly xi_mu = np.linspace(np.sqrt(model.csb2), 1, 20) v_mu = lorentz(xi=xi_mu, v=np.sqrt(model.csb2)) ax.plot(xi_mu, v_mu, ls=":", c="k") ax.set_title(model.label_latex) ax.set_xlim(0, 1) ax.set_ylim(0, 1) ax.set_xlabel(r"$\xi$") ax.set_ylabel("$v$") ax.legend() fig.tight_layout() utils.save(fig, "giese_testing2.png") return fig if __name__ == "__main__": main() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.585 seconds) **Estimated memory usage:** 264 MB .. _sphx_glr_download_auto_examples_giese_giese_testing2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: giese_testing2.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: giese_testing2.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: giese_testing2.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_