|
| 1 | +""" |
| 2 | +Barotropic EOS functions |
| 3 | +======================================= |
| 4 | +
|
| 5 | +""" |
| 6 | + |
| 7 | +import matplotlib.pyplot as plt |
| 8 | +import numpy as np |
| 9 | + |
| 10 | +import shamrock |
| 11 | + |
| 12 | +cs = 190.0 |
| 13 | +rho_c1 = 1.92e-13 * 1000 # g/cm^3 -> kg/m^3 |
| 14 | +rho_c2 = 3.84e-8 * 1000 # g/cm^3 -> kg/m^3 |
| 15 | +rho_c3 = 1.92e-3 * 1000 # g/cm^3 -> kg/m^3 |
| 16 | + |
| 17 | + |
| 18 | +si = shamrock.UnitSystem() |
| 19 | +sicte = shamrock.Constants(si) |
| 20 | +kb = sicte.kb() |
| 21 | +print(kb) |
| 22 | +mu = 2.375 |
| 23 | +mh = 1.00784 * sicte.dalton() |
| 24 | +print(mu * mh * kb) |
| 25 | + |
| 26 | +rho_plot = np.logspace(-15, 5, 1000) |
| 27 | +P_plot = [] |
| 28 | +cs_plot = [] |
| 29 | +T_plot = [] |
| 30 | +for rho in rho_plot: |
| 31 | + P, _cs, T = shamrock.phys.eos.eos_Machida06( |
| 32 | + cs=cs, rho=rho, rho_c1=rho_c1, rho_c2=rho_c2, rho_c3=rho_c3, mu=mu, mh=mh, kb=kb |
| 33 | + ) |
| 34 | + P_plot.append(P) |
| 35 | + cs_plot.append(_cs) |
| 36 | + T_plot.append(T) |
| 37 | + |
| 38 | +plt.figure() |
| 39 | +plt.plot(rho_plot, P_plot, label="P") |
| 40 | +plt.yscale("log") |
| 41 | +plt.xscale("log") |
| 42 | +plt.xlabel("$\\rho$ [kg.m^-3]") |
| 43 | +plt.ylabel("$P$ [Pa]") |
| 44 | +plt.axvspan(rho_c1, rho_c2, color="grey", alpha=0.5) |
| 45 | +plt.axvspan(rho_c3, rho_plot[-1], color="grey", alpha=0.5) |
| 46 | + |
| 47 | +plt.figure() |
| 48 | +plt.plot(rho_plot, cs_plot, label="cs") |
| 49 | +plt.yscale("log") |
| 50 | +plt.xlabel("$\\rho$ [kg.m^-3]") |
| 51 | +plt.xscale("log") |
| 52 | +plt.ylabel("$c_s$ [m/s]") |
| 53 | +plt.axvspan(rho_c1, rho_c2, color="grey", alpha=0.5) |
| 54 | +plt.axvspan(rho_c3, rho_plot[-1], color="grey", alpha=0.5) |
| 55 | + |
| 56 | +plt.figure() |
| 57 | +plt.plot(rho_plot, T_plot, label="T") |
| 58 | +plt.yscale("log") |
| 59 | +plt.xscale("log") |
| 60 | +plt.xlabel("$\\rho$ [kg.m^-3]") |
| 61 | +plt.ylabel("$T$ [K]") |
| 62 | +plt.axvspan(rho_c1, rho_c2, color="grey", alpha=0.5) |
| 63 | +plt.axvspan(rho_c3, rho_plot[-1], color="grey", alpha=0.5) |
| 64 | + |
| 65 | + |
| 66 | +plt.tight_layout() |
| 67 | +plt.show() |
0 commit comments