Exemple #1
0
 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')
Exemple #2
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')
Exemple #3
0
 def eosDensity(self,pressure):
     return np.where(pressure<self.p_match,EOS_BPS.eosDensity(pressure),self.eosDensity_match_Quarkyonic(pressure))
Exemple #4
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)


def p3_max(pressure1, pressure2):
Exemple #5
0
    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')
args_4=list(opt.root(equations4,[955,3.1453328966256469,2.5839138055246758,5.2328896495712973],tol=1e-8,args=[n_s,n1,p1,e1,dpdn1,n2,p2,e2]).x)+[dpdn1,n1/n_s,n_s]
Exemple #6
0
 def eosDensity(self, pressure):
     return np.where(
         pressure < self.p_match, EOS_BPS.eosDensity(pressure),
         np.where(pressure < self.p_max, self.eosDensity_matchPNM(pressure),
                  self.eosCSS.eosDensity(pressure)))
Exemple #7
0
 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')
    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))
result_logic = np.zeros((len(E_array), len(L_array))).astype('bool')

import pickle
from scipy import interpolate
Exemple #9
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')