コード例 #1
0
ファイル: Quarkyonic.py プロジェクト: sotzee/ns2019
 def __init__(self,args,defaut_u_min=1e-8,defaut_u_max=20):
     self.baryon_density_s,self.E,self.L,self.Lambda,self.kappa,self.mass_args=args
     self.a,self.b=get_ab(toMev4(self.baryon_density_s,'mevfm'),self.E,self.L,self.mass_args)
     self.args=self.baryon_density_s,self.a,self.b,self.Lambda,self.kappa,self.mass_args
     self.u_max=defaut_u_max
     self.u_min=1
     eos_array_quarkyonic,self.sol_saturation,self.causality_stability=get_eos_array(self.u_min,self.u_max,self.args)
     self.pressure_s=self.sol_saturation[2]
     self.density_s=self.sol_saturation[1]
     
     self.n1_match=0.06
     self.n2_match=self.baryon_density_s
     p1=EOS_BPS.eosPressure_frombaryon(self.n1_match)
     e1=EOS_BPS.eosDensity(p1)
     dpdn1=EOS_BPS().eosCs2(p1)*EOS_BPS().eosChempo(p1)
     p2=self.pressure_s
     e2=self.density_s
     dpdn2=dpdn1#this parameter is not used in match_eos, so it was trivially set to dpdn1
     self.p_match=p1
     self.matching_args=self.baryon_density_s,self.n1_match,p1,e1,dpdn1,self.n2_match,p2,e2,dpdn2,self.match_init
     self.matching_para,self.matching_success=match_eos(self.matching_args)
     self.eos_success=self.matching_success and self.causality_stability
     if(self.matching_success):
         u_array_low=np.linspace(self.n1_match/self.baryon_density_s,self.n2_match/self.baryon_density_s,81)
         eos_array_match=match_get_eos_array(u_array_low,self.matching_para)
     else:
         eos_array_match=[[self.n1_match,self.n2_match],[e1,e2],[p1,p2]]
     self.eos_array=np.concatenate((np.array([[0],[0],[0]]),np.array(eos_array_match)[:,:-1],eos_array_quarkyonic),axis=1)
     self.unit_mass=const.c**4/(const.G**3*self.density_s*1e51*const.e)**0.5
     self.unit_radius=const.c**2/(const.G*self.density_s*1e51*const.e)**0.5
     self.unit_N=self.unit_radius**3*self.baryon_density_s*1e45
     self.eosPressure_frombaryon_match_Quarkyonic = interp1d(self.eos_array[0],self.eos_array[2], kind='linear')
     self.eosDensity_match_Quarkyonic  = interp1d(self.eos_array[2],self.eos_array[1], kind='linear')
     self.eosBaryonDensity_match_Quarkyonic = interp1d(self.eos_array[2],self.eos_array[0], kind='linear')
コード例 #2
0
ファイル: PNM_expansion.py プロジェクト: sotzee/ns
 def eosPressure_frombaryon(self, baryon_density):
     return np.where(
         baryon_density < self.n1_match,
         EOS_BPS.eosPressure_frombaryon(baryon_density),
         np.where(baryon_density < self.n_max,
                  self.eosPressure_frombaryon_matchPNM(baryon_density),
                  self.eosCSS.eosPressure_frombaryon(baryon_density)))
コード例 #3
0
 def __init__(self,init_args,init_sat,args):
     self.baryon_density_sat,self.bd_energy,self.incompressibility,\
     self.m_eff,self.J,self.L,self.self_W,self.mass_args=args
     self.args=args
     self.eos_RMF=EOS_RMF(init_args,init_sat,args)
     self.eos_args=self.eos_RMF.eos_args
     self.init_sat=self.eos_RMF.init_sat
     self.eos_array=self.eos_RMF.eos_array
     self.sol_saturation=toMevfm(np.array(self.eos_RMF.sol_saturation),'mev4')
     fix_crust_baryon_density=np.linspace(0.6,0.3,4)*self.sol_saturation[0]
     self.fix_crust_logic=False
     for fix_crust_baryon_density_i in fix_crust_baryon_density:
         if(self.sol_saturation[2]>1.1*EOS_BPS.eosPressure_frombaryon(fix_crust_baryon_density_i)):
             self.eos_SLY4withPoly=EOS_BPSwithPoly([fix_crust_baryon_density_i,self.sol_saturation[2],self.sol_saturation[0],4*self.sol_saturation[2],2*self.sol_saturation[0],8*self.sol_saturation[2],3*self.sol_saturation[0]])
             self.fix_crust_logic=True
             break
         
     self.stability=self.eos_RMF.stability
     self.positive_pressure=self.eos_RMF.positive_pressure
     self.baryon_density_s=self.eos_RMF.baryon_density_s
     self.pressure_s=self.eos_RMF.pressure_s
     self.density_s=self.eos_RMF.density_s
     self.unit_mass=self.eos_RMF.unit_mass
     self.unit_radius=self.eos_RMF.unit_radius
     self.unit_N=self.eos_RMF.unit_N
コード例 #4
0
ファイル: PNM_expansion.py プロジェクト: sotzee/ns
 def eosChempo(self, pressure):
     return np.where(
         pressure < self.p_match,
         EOS_BPS().eosChempo(pressure),
         np.where(pressure < self.p_max,
                  (pressure + self.eosDensity_matchPNM(pressure)) /
                  self.eosBaryonDensity_matchPNM(pressure),
                  self.eosCSS.eosChempo(pressure)))
コード例 #5
0
ファイル: PNM_expansion.py プロジェクト: sotzee/ns
 def eosCs2(self, pressure):
     return np.where(
         pressure < self.p_match,
         EOS_BPS().eosCs2(pressure),
         np.where(
             pressure < self.p_max,
             1.0 / derivative(self.eosDensity_matchPNM,
                              pressure,
                              dx=pressure * dlnx_cs2),
             self.eosCSS.eosCs2(pressure)))
コード例 #6
0
 def __init__(self,args,eos_args,eos_array_rmf):
     self.eos_args=eos_args
     self.args=args
     self.baryon_density_s=baryon_density_s
     self.bd_energy=m-BindE
     self.incompressibility=K
     self.mass_args=mass_args
     
     self.eos_array_rmf=eos_array_rmf[:,eos_array_rmf[2]!=0.]
     self.n_max,self.e_max,self.p_max=self.eos_array_rmf[:,-1]
     self.eos_array_rmf=np.concatenate((self.eos_array_rmf,self.eos_array_rmf[:,-1][:,np.newaxis]+np.multiply((self.eos_array_rmf[:,-1]-self.eos_array_rmf[:,-2])[:,np.newaxis],eos_array_rmf[0,self.eos_array_rmf.shape[1]:]-self.eos_array_rmf[0,-1])/(self.eos_array_rmf[0,-1]-self.eos_array_rmf[0,-2])),axis=1)
     self.positive_pressure=self.eos_array_rmf[2,:].min()>0
     
     self.n1_match=0.06
     self.n2_match,self.density_s,self.pressure_s=self.eos_array_rmf[:,0]
     p1=EOS_BPS.eosPressure_frombaryon(self.n1_match)
     e1=EOS_BPS.eosDensity(p1)
     dpdn1=EOS_BPS().eosCs2(p1)*EOS_BPS().eosChempo(p1)
     p2=self.pressure_s
     e2=self.density_s
     dpdn2=dpdn1#this parameter is not used in match_eos, so it was trivially set to dpdn1
     self.p_match=p1
     self.matching_args=self.baryon_density_s,self.n1_match,p1,e1,dpdn1,self.n2_match,p2,e2,dpdn2,self.match_init
     self.matching_para,self.matching_success=match_eos(self.matching_args)
     self.eos_success=self.matching_success and self.positive_pressure
     if(self.matching_success):
         u_array_low=np.linspace(self.n1_match/self.baryon_density_s,self.n2_match/self.baryon_density_s,81)
         eos_array_match=match_get_eos_array(u_array_low,self.matching_para)
     else:
         eos_array_match=[[self.n1_match,self.n2_match],[e1,e2],[p1,p2]]
     self.eos_array=np.concatenate((np.array([[0],[0],[0]]),np.array(eos_array_match)[:,:-1],self.eos_array_rmf),axis=1)
     self.unit_mass=const.c**4/(const.G**3*self.density_s*1e51*const.e)**0.5
     self.unit_radius=const.c**2/(const.G*self.density_s*1e51*const.e)**0.5
     self.unit_N=self.unit_radius**3*self.baryon_density_s*1e45
     self.eosPressure_frombaryon_matchRMF = interp1d(self.eos_array[0],self.eos_array[2], kind='linear')
     self.eosDensity_matchRMF  = interp1d(self.eos_array[2],self.eos_array[1], kind='linear')
     self.eosBaryonDensity_matchRMF = interp1d(self.eos_array[2],self.eos_array[0], kind='linear')
コード例 #7
0
ファイル: Quarkyonic.py プロジェクト: sotzee/ns2019
 def eosChempo(self,pressure):
     return np.where(pressure<self.p_match,EOS_BPS().eosChempo(pressure),(pressure+self.eosDensity_match_Quarkyonic(pressure))/self.eosBaryonDensity_match_Quarkyonic(pressure))
コード例 #8
0
ファイル: Quarkyonic.py プロジェクト: sotzee/ns2019
 def eosBaryonDensity(self,pressure):
     return np.where(pressure<self.p_match,EOS_BPS.eosBaryonDensity(pressure),self.eosBaryonDensity_match_Quarkyonic(pressure))
コード例 #9
0
ファイル: Quarkyonic.py プロジェクト: sotzee/ns2019
 def eosCs2(self,pressure):
     return np.where(pressure<self.p_match,EOS_BPS().eosCs2(pressure),1.0/derivative(self.eosDensity_match_Quarkyonic,pressure,dx=pressure*dlnx_cs2))
コード例 #10
0
N_E = 91
N_L = 150  #N_L=18
N_K = 1
N_Q = 1
N_Z = 1
m_eff = 939 * 0.6
E_pnm = np.linspace(30 - 16, 36. - 16, N_E)
L_pnm = np.linspace(2, 300, N_L)
K_pnm = np.linspace(200, 200, N_K)  #K_pnm = np.linspace(0,500,N_K)
Q_pnm = np.linspace(200, 200, N_Q)  #Q_pnm = np.linspace(-1000,1000,N_Q)
Z_pnm = np.linspace(-500, -500, N_Z)
Preset_Pressure_final = 1e-8
Preset_rtol = 1e-4
args = []

eos_low = EOS_BPS()
eos_high = []
eos = []
eos_matching_success = []
L_max = []
L_min = []
for i in range(len(E_pnm)):
    L_max_i = 0
    L_min_i = 10000
    for j in range(len(L_pnm)):
        for k in range(len(K_pnm)):
            for l in range(len(Q_pnm)):
                for s in range(len(Z_pnm)):
                    args.append([
                        n_s, m, m_eff, E_pnm[i], L_pnm[j], K_pnm[k], Q_pnm[l],
                        Z_pnm[s]
コード例 #11
0
ファイル: Quarkyonic.py プロジェクト: sotzee/ns2019
 def eosPressure_frombaryon(self,baryon_density):
     return np.where(baryon_density<self.n1_match,EOS_BPS.eosPressure_frombaryon(baryon_density),self.eosPressure_frombaryon_match_Quarkyonic(baryon_density))
コード例 #12
0
    fig.savefig(dir_name + '/parameter_impact_on_eos_' + show_eos_index_name)
    fig.clear()

from eos_class import EOS_BPS
import show_properity
for show_eos_index, show_eos_index_name, xlim, ylim in zip(
    [1, 5], ['pressure', 'cs2'], [[0.16, 1], [0.16, 1]], [[0, 2000], [0, 1]]):
    fig, axes = plt.subplots(1, 1, figsize=(8, 6), sharex=True, sharey=True)
    show_properity.show_eos(axes,
                            eos_flat[np.logical_and(eos_success,
                                                    logic)[eos_logic]][::10],
                            0,
                            show_eos_index,
                            500,
                            baryon_density_range=[n_s, 1, 'log'])
    show_properity.show_eos(axes, [EOS_BPS()],
                            0,
                            show_eos_index,
                            500,
                            baryon_density_range=[n_s, 1, 'log'],
                            legend=['SLY4'],
                            lw=3,
                            legend_fontsize=15)
    axes.set_xlim(*xlim)
    axes.set_ylim(*ylim)
    fig.savefig(dir_name + '/eos_n_' + show_eos_index_name)
    fig.clear()

p1_limit_array_list = []
p1_limit_txt = [
    '', '_p1_less_30', '_lambda_over_2', '_lambda_over_2_p1_less_30'
コード例 #13
0
ファイル: NM_expansion.py プロジェクト: sotzee/ns
        os.mkdir(path + dir_name)
    N1 = 6
    N2 = 15
    N3 = 21
    n_s = 0.16
    m = 939
    E_pnm = 32 - 16
    L_pnm = np.linspace(30, 70, N1)
    K_pnm = np.linspace(50, 400, N2)
    Q_pnm = np.linspace(-400, 600, N3)
    Preset_Pressure_final = 1e-8
    Preset_rtol = 1e-4
    args = []

    from eos_class import EOS_BPS
    eos_low = EOS_BPS()
    eos_high = []
    eos = []
    for i in range(len(L_pnm)):
        for j in range(len(K_pnm)):
            for k in range(len(Q_pnm)):
                args.append([n_s, m, E_pnm, L_pnm[i], K_pnm[j], Q_pnm[k]])
                eos_high.append(EOS_PnmCSS(args[-1]))
                #print args[-1]
                eos.append(EOS_Sly4_match_PnmCSS(eos_low, eos_high[-1]))
    args = np.reshape(np.array(args), (N1, N2, N3, 6))
    args_flat = np.reshape(np.array(args), (N1 * N2 * N3, 6))
    eos = np.reshape(np.array(eos), (N1, N2, N3))
    eos_flat = np.array(eos).flatten()
    f_file = open(path + dir_name + '/Lambda_PNM_calculation_args.dat', 'wb')
    cPickle.dump(args, f_file)
コード例 #14
0
            self.cs2[-1] = np.min([
                (cs2_max - cs2_min) / (1 + np.exp(sol)) + cs2_min, 1.
            ])
            self.density_array[i] = self.density_array[
                i - 1] + (self.pressure_array[i] -
                          self.pressure_array[i - 1]) / self.cs2[-1]
            self.baryon_density = np.concatenate(
                (self.baryon_density,
                 np.array([self.eosBaryonDensity(self.pressure_array[i])])))
            axis[1].plot([self.density_array[i]], [self.pressure_array[i]],
                         '*')
            axis[1].plot([eos_bps.eosDensity(self.pressure_array[i])],
                         [self.pressure_array[i]], 'o')
        #some_radius=interpolate.splev(some_mass, R_from_M_tck, der=0)

eos_bps = EOS_BPS()
# =============================================================================
# Preset_Pressure_final=1e-10
# Preset_rtol=1e-6
# mr_bps=[]
# for pc_i in log_array(np.array([1,1100]),2000,1000)[2]:
#     mr_bps.append(MassRadius(pc_i,Preset_Pressure_final,Preset_rtol,'MR',eos_bps))
# mr_bps=np.array(mr_bps)
# plt.plot(mr_bps[:,1],mr_bps[:,0],'.')
# np.savetxt('sly4_mr.txt',mr_bps)
# =============================================================================
mr_bps = np.loadtxt('sly4_mr.txt')

#a=EOS_PiecewiseCSS([[3.,10.],10.,5]))       #[3.0, 0.4170938377798279, 0.5756462732485115, 5]
#a=EOS_PiecewiseCSS([[3.,30.],40.,7])        #[3.0, 0.37000266298316076, 0.6148132423523227, 7]
#a=EOS_PiecewiseCSS([3.0, 0.4170938377798279, 0.5756462732485115, 12],init_type=1)
コード例 #15
0
"""
Created on Tue Oct  2 14:47:19 2018

@author: sotzee
"""

import numpy as np
from eos_class import EOS_BPS  #,EOS_BPSwithPoly

baryon_density_s = 0.16
baryon_density0 = 0.16 / 2.7
baryon_density1 = 1.85 * 0.16
baryon_density2 = 3.7 * 0.16
baryon_density3 = 7.4 * 0.16
Preset_Pressure_final = 1e-6
pressure0 = EOS_BPS.eosPressure_frombaryon(baryon_density0)
density0 = EOS_BPS.eosDensity(pressure0)
Preset_pressure_center_low = 10
Preset_Pressure_final_index = 1

std_Lambda_ratio = 0.04


def Density_i(pressure_i, baryon_density_i, pressure_i_minus,
              baryon_density_i_minus, density_i_minus):
    gamma_i = np.log(pressure_i / pressure_i_minus) / np.log(
        baryon_density_i / baryon_density_i_minus)
    return gamma_i,(density_i_minus-pressure_i_minus/(gamma_i-1))*\
            (pressure_i/pressure_i_minus)**(1./gamma_i)+pressure_i/(gamma_i-1)

コード例 #16
0
                J_L_matching_bound_lower_gamma_over_1
        ]:
            for axis_i in axis1 + axis2:
                axis_i[i, j].plot(
                    J_L_matching_bound(args[1, 0, ::3, 0, ::2][j, i]) +
                    0 * args[0, :, ::3, 0, ::2][:, j, i],
                    args[0, :, ::3, 0, ::2][:, j, i],
                    lw=2)
                axis_i[i, j].set_xlim(0, 120)
fig1[0].savefig(path + dir_name + '/rmf_bulk_para_space_with_Lambda')
fig2[0].savefig(path + dir_name + '/rmf_bulk_para_space_with_maxmass')

args_txt = ['m$_{eff}$', 'E$_{pnm}$', 'L$_{pnm}$', '$\zeta_\omega$']
args_txt_unit = ['MeV', 'MeV', 'MeV', '']
from eos_class import EOS_BPS
SLY4_EoS = EOS_BPS()
import show_properity
args_index_center = [20, 4, 16,
                     0]  #set center EoS to have parameter args[:,1,4,8,6]
args_index_around = [
    3, 3, 5, 1
]  #firt parameter has step 1, second parameter has step 2 ...
#which means second parameter should pick [0,2,4,6, ...]
for show_eos_index, show_eos_index_name, xlim, ylim in zip(
    [1, 5], ['pressure', 'cs2'], [[0.16, 1], [0.16, 1]], [[0, 850], [0, 1]]):
    fig, axes = plt.subplots(2, 2, figsize=(12, 10), sharex=True, sharey=True)
    title = np.core.defchararray.add(args_txt, np.array(['='] * len(args_txt)))
    title = np.core.defchararray.add(
        title,
        np.round(args.transpose(range(1,
                                      len(args_shape) + 1) +
コード例 #17
0
ファイル: match_eos.py プロジェクト: sotzee/ns
    p_array=n_s*(a+c*gamma*u_array**2/u1*(u_array/u1-1)**(gamma-1))
    return u_array,e_array,p_array
def match_eos(n_s,n1,p1,e1,n2,p2,e2):
    a=p1/n_s
    u1=n1/n_s
    b=(p1+e1)/n1
    gamma=(n2-n1)*(p2-p1)/(n2*(e2+p1)-n2**2*b)
    c=((e2+p1)/n2-b)/(n2/n1-1)**gamma
    return a,b,c,gamma,u1,n_s

#0.16 0.1 0.618833146813 95.0749758461 0.16 2.66666666667 152.8
from eos_class import EOS_BPS
n_s=0.16
n1=0.1
n2=1*0.16
p1=EOS_BPS.eosPressure_frombaryon(n1)
e1=EOS_BPS.eosDensity(p1)
dpdn1=EOS_BPS().eosCs2(p1)*EOS_BPS().eosChempo(p1)
p2=2.666667
e2=152.8
eos_array_list=[]
eos_label_list=[]
args_1=match_eos(n_s,n1,p1,e1,n2,p2,e2)
eos_array_list.append(match_get_eos_array(np.linspace(n1/n_s,n2/n_s,100),args_1))
eos_label_list.append('type 1')
args_2=list(opt.root(equations,[955,3,3,5],tol=1e-8,args=[n_s,n1,p1,e1,n2,p2,e2]).x)+[n_s]
eos_array_list.append(match_get_eos_array_equations(np.linspace(n1/n_s,n2/n_s,100),args_2))
eos_label_list.append('type 2')
args_3=list(opt.root(equations3,[955,3.1453328966256469,2.5839138055246758,0.1,5.2328896495712973],tol=1e-8,args=[n_s,n1,p1,e1,dpdn1,n2,p2,e2]).x)+[n_s]
eos_array_list.append(match_get_eos_array_equations3(np.linspace(n1/n_s,n2/n_s,100),args_3))
eos_label_list.append('type 3')
コード例 #18
0
 def __init__(self,
              args,
              PNM_EXPANSION_TYPE,
              defaut_u_min=1e-8,
              defaut_u_max=10):
     if (PNM_EXPANSION_TYPE == 'around_vccume'):
         self.baryon_density_s,self.m,self.E_n,self.L_n,\
         self.K_n,self.Q_n=args
         self.args = args
         self.ELKQ_array = np.array(args[2:])
         get_parameters = get_parameters_pnm_around_vccume
     elif (PNM_EXPANSION_TYPE == 'pnm_margueron'):
         self.baryon_density_s,self.m,self.m_eff,self.E_n,self.L_n,\
         self.K_n,self.Q_n,self.Z_n=args
         self.args = args
         self.ELKQ_array = np.array(args[2:])
         get_parameters = get_parameters_pnm_margueron
     self.n1_match = 0.06
     self.n2_match = 0.16
     self.T = .3 * (1.5 * np.pi**2 * toMev4(self.baryon_density_s,
                                            'mevfm3'))**(2. / 3) / self.m
     self.abcd_array = get_parameters(self.m, self.T * 2**(2. / 3),
                                      self.ELKQ_array)
     self.u_max = get_baryon_density_u_max(self.abcd_array, defaut_u_max)
     self.u_min = defaut_u_min
     eos_array_PNM, self.sol_saturation = get_eos_array(
         self.n2_match / self.baryon_density_s, self.u_max,
         self.baryon_density_s, self.m, self.T, self.abcd_array)
     p1 = EOS_BPS.eosPressure_frombaryon(self.n1_match)
     e1 = EOS_BPS.eosDensity(p1)
     dpdn1 = EOS_BPS().eosCs2(p1) * EOS_BPS().eosChempo(p1)
     p2 = eos_array_PNM[2, 0]
     e2 = eos_array_PNM[1, 0]
     dpdn2 = EOS_BPS().eosCs2(p2) * EOS_BPS().eosChempo(p2)
     self.matching_args, self.matching_success = match_eos(
         self.baryon_density_s, self.n1_match, p1, e1, dpdn1, self.n2_match,
         p2, e2, dpdn2, self.match_init)
     if (self.matching_success):
         u_array_low = np.linspace(self.n1_match / self.baryon_density_s,
                                   self.n2_match / self.baryon_density_s,
                                   100)
         eos_array_match = match_get_eos_array(u_array_low,
                                               self.matching_args)
     else:
         eos_array_match = [[self.n1_match, self.n2_match], [e1, e2],
                            [p1, p2]]
     self.p_match = p1
     self.eos_array = np.concatenate(
         (np.array([[0], [0], [0]
                    ]), np.array(eos_array_match)[:, :-1], eos_array_PNM),
         axis=1)
     self.pressure_s = self.sol_saturation[2]
     self.density_s = self.sol_saturation[1]
     self.unit_mass = const.c**4 / (const.G**3 * self.density_s * 1e51 *
                                    const.e)**0.5
     self.unit_radius = const.c**2 / (const.G * self.density_s * 1e51 *
                                      const.e)**0.5
     self.unit_N = self.unit_radius**3 * self.baryon_density_s * 1e45
     self.eosPressure_frombaryon_matchPNM = interp1d(self.eos_array[0],
                                                     self.eos_array[2],
                                                     kind='linear')
     self.eosPressure_matchPNM = interp1d(self.eos_array[1],
                                          self.eos_array[2],
                                          kind='linear')
     self.eosDensity_matchPNM = interp1d(self.eos_array[2],
                                         self.eos_array[1],
                                         kind='linear')
     self.eosBaryonDensity_matchPNM = interp1d(self.eos_array[2],
                                               self.eos_array[0],
                                               kind='linear')
コード例 #19
0
ファイル: PNM_expansion.py プロジェクト: sotzee/ns
 def eosBaryonDensity(self, pressure):
     return np.where(
         pressure < self.p_match, EOS_BPS.eosBaryonDensity(pressure),
         np.where(pressure < self.p_max,
                  self.eosBaryonDensity_matchPNM(pressure),
                  self.eosCSS.eosBaryonDensity(pressure)))
コード例 #20
0
 def eosDensity(self, pressure):
     return np.where(pressure < self.p_match, EOS_BPS.eosDensity(pressure),
                     self.eosDensity_matchPNM(pressure))
コード例 #21
0
ファイル: PNM_expansion.py プロジェクト: sotzee/ns
 def __init__(self, args, PNM_EXPANSION_TYPE, defaut_u_max=12):
     if (PNM_EXPANSION_TYPE == 'around_vccume'):
         self.baryon_density_s,self.m,self.E_n,self.L_n,\
         self.K_n,self.Q_n=args
         self.args = args
         self.ELKQ_array = np.array(args[2:])
         get_parameters = get_parameters_pnm_around_vccume
     elif (PNM_EXPANSION_TYPE == 'pnm_margueron'):
         self.baryon_density_s,self.m,self.m_eff,self.E_n,self.L_n,\
         self.K_n,self.Q_n,self.Z_n=args
         self.args = args
         self.ELKQ_array = np.array(args[2:])
         get_parameters = get_parameters_pnm_margueron
     self.n1_match = 0.06
     self.n2_match = 0.16
     self.T = .3 * (1.5 * np.pi**2 * toMev4(self.baryon_density_s,
                                            'mevfm3'))**(2. / 3) / self.m
     self.abcd_array = get_parameters(self.m, self.T * 2**(2. / 3),
                                      self.ELKQ_array)
     self.u_max = get_baryon_density_u_max(self.abcd_array, defaut_u_max)
     self.get_eos_array_args = self.n2_match / self.baryon_density_s, self.u_max, self.baryon_density_s, self.m, self.T, self.abcd_array
     eos_array_PNM, self.sol_saturation = get_eos_array(
         self.get_eos_array_args)
     self.n_max, self.e_max, self.p_max = eos_array_PNM[:, -2]
     self.high_stability_success = self.p_max > 100.
     self.cs2 = 1
     self.args_eosCSS = [self.e_max, self.p_max, self.n_max, self.cs2]
     self.eosCSS = EOS_CSS(self.args_eosCSS)
     p1 = EOS_BPS.eosPressure_frombaryon(self.n1_match)
     e1 = EOS_BPS.eosDensity(p1)
     dpdn1 = EOS_BPS().eosCs2(p1) * EOS_BPS().eosChempo(p1)
     p2 = eos_array_PNM[2, 1]
     e2 = eos_array_PNM[1, 1]
     dpdn2 = dpdn1  #this parameter is not used in match_eos, so it was trivially set to dpdn1
     self.matching_args = self.baryon_density_s, self.n1_match, p1, e1, dpdn1, self.n2_match, p2, e2, dpdn2, self.match_init
     self.matching_para, self.matching_success = match_eos(
         self.matching_args)
     self.eos_success = self.high_stability_success and self.matching_success
     if (self.matching_success):
         u_array_low = np.linspace(self.n1_match / self.baryon_density_s,
                                   self.n2_match / self.baryon_density_s,
                                   81)
         eos_array_match = match_get_eos_array(u_array_low,
                                               self.matching_para)
     else:
         eos_array_match = np.array([[self.n1_match, self.n2_match],
                                     [e1, e2], [p1, p2]])
         eos_array_PNM = np.array([[self.n2_match, 10 * self.n2_match],
                                   [e2, 10 * e2], [p2, 10 * p2]])
     self.p_match = p1
     self.eos_array = np.concatenate((np.array(
         [[0], [0], [0]]), eos_array_match[:, :-1], eos_array_PNM[:, 1:]),
                                     axis=1)
     self.pressure_s = self.sol_saturation[2]
     self.density_s = self.sol_saturation[1]
     self.unit_mass = const.c**4 / (const.G**3 * self.density_s * 1e51 *
                                    const.e)**0.5
     self.unit_radius = const.c**2 / (const.G * self.density_s * 1e51 *
                                      const.e)**0.5
     self.unit_N = self.unit_radius**3 * self.baryon_density_s * 1e45
     self.eosPressure_frombaryon_matchPNM = interp1d(self.eos_array[0],
                                                     self.eos_array[2],
                                                     kind='quadratic')
     self.eosDensity_matchPNM = interp1d(self.eos_array[2],
                                         self.eos_array[1],
                                         kind='quadratic')
     self.eosBaryonDensity_matchPNM = interp1d(self.eos_array[2],
                                               self.eos_array[0],
                                               kind='quadratic')
コード例 #22
0
    return spectra3.eosBaryonDensity(p2) - n2, spectra3.eosDensity(p2) - e2


def logic_causal_p2(sol_x, init_i, args, args_extra):
    n_s, n1, p1, e1, dpdn1, n2 = args_extra
    p2, e2 = args
    gamma0 = np.log(dpdn1 * n1 / p1)
    Gamma2 = Gamma(np.log(p2 / p1), [gamma0, sol_x[0], sol_x[1]])
    cs2 = Gamma2 * p2 / (e2 + p2)
    #print('cs2=%f'%cs2)
    return 0 < cs2 <= 1 and np.max(np.abs(sol_x)) < 10


from eos_class import EOS_BPS

eos_bps = EOS_BPS()
ns = 0.16
n0 = 0.06
p0 = eos_bps.eosPressure_frombaryon(n0)
e0 = eos_bps.eosDensity(p0)
dpdn0 = eos_bps.eosCs2(p0) * eos_bps.eosChempo(p0)
gamma0 = np.log(dpdn0 * n0 / p0)

import scipy.optimize as opt

n2 = 0.16
E_array = np.linspace(31, 34, 61)
L_array = np.linspace(20, 80, 121)
e2_array = (939 - 16 + E_array) * n2
p2_array = L_array / 3. * n2
result_x = np.zeros((len(E_array), len(L_array), 2))