Plot_me.py
Go to the documentation of this file.
1 # Author: M. Reichert
2 import numpy as np
3 import matplotlib.pyplot as plt
4 
5 fig, ax = plt.subplots(2,1,figsize=(5,5),sharex=True)
6 plt.subplots_adjust(hspace=0)
7 time,temp,rho = np.loadtxt("mainout.dat",unpack=True,usecols=[1,2,3])
8 
9 # WinNet density and temperature
10 ax[0].plot(time-time[0],rho/1e6,color="tab:blue",lw=4,alpha=0.7,label="WinNet")
11 ax[1].plot(time-time[0],temp,color="tab:red",lw=4,alpha=0.7)
12 
13 
14 # Calculate the thermodynamic quantities and check if they are okay:
15 R0 = 0.2
16 rho_0 = 1e6
17 T9_analytic = lambda x: 2.4*(R0)**(-3./4.)*np.exp(-x/ (3*(446/np.sqrt(7*rho_0))))
18 rho_analytic = lambda x: 7*rho_0 *np.exp(-x / (446/np.sqrt(7*rho_0)))
19 T9_gridpoint = T9_analytic(time)
20 rho_gridpoint = rho_analytic(time)
21 ax[0].plot(time-time[0],rho_gridpoint/1e6,ls="--",color="k",label="Analytic")
22 ax[1].plot(time-time[0],T9_gridpoint,ls="--",color="k")
23 
24 
25 fig2 = plt.figure(figsize=(5,3))
26 ax2 = fig2.gca()
27 A,X = np.loadtxt("finabsum.dat",unpack=True,usecols=[0,2])
28 ax2.plot(A,X)
29 ax2.set_xlim(0,80)
30 ax2.set_ylim(1e-8,1)
31 ax2.set_yscale("log")
32 ax2.set_title("Final mass fractions")
33 ax2.set_ylabel("Mass fraction X")
34 ax2.set_xlabel("Mass number A")
35 
36 
37 ax[0].set_ylabel(r"$\rho$ [10$^6$ g cm$^{-3}$]")
38 ax[1].set_ylabel("T[GK]")
39 ax[1].set_xlabel("Time [s]")
40 ax[0].set_xlim(0,3)
41 ax[0].legend()
42 fig2.savefig("final_massfractions.pdf",bbox_inches="tight")
43 plt.show()
Plot_me.T9_analytic
float T9_analytic
Definition: Plot_me.py:17
Plot_me.rho_analytic
int rho_analytic
Definition: Plot_me.py:18