def get_star_central_values(self): prmObj = Prm() star_params = prmObj.get_constants() EoS_params = self.get_EoS_params() Ms = star_params["Ms"] c = star_params["c"] pi = star_params["pi"] r0 = self.__r0 dr =self.__dr '''Value of barM0 for given barP0 according to the EoS''' barM0 = (4.*pi*EoS_params["e0"]/(3.*Ms*c**2))*r0**3.*self.barE(self.barP0) star_central_vals = { "r0":r0, "dr":dr, "barM_init":barM0, } return star_central_vals
def __init__(self): prmObj = Prm() conv_factors = prmObj.get_conv_factors() constants = prmObj.get_constants() '''Global constants.''' self.__mN = constants["mN"] #[gm] self.__c = constants["c"] #[cm/s] self.__pi = constants["pi"] self.__hbar = constants["hbar"] # [erg . s] self.__eN0 = self.__mN*self.__c**2 # ([erg])Rest mass energy of neutron. '''EoS specific constants.''' self.__A = 118.2 * conv_factors["MEV_TO_ERG"] # A[MeV] --> A[erg] self.__B = 65.39 * conv_factors["MEV_TO_ERG"] # B[MeV] --> B[erg] self.__sigma = 2.112 # dimension less self.__alpha = 0.0 # Dimension less self.__S0 = 30.0* conv_factors["MEV_TO_ERG"] #[erg] self.__n0 = 0.16/(10**(-13))**3 # [#/(fm^3)] --> [#/(cm^3)] self.u_lower = 0.0 # u = (n/n0) self.u_upper = 100.0 self.__e0 = self.__mN**4*self.__c**5/(3.*self.__pi**2*self.__hbar**3) # [erg/cm^-3] # This quantity is arbitrary self.__EF0 = ( (3.0/5.0)*(1.0/(2.0*self.__mN)) *(3.0*self.__pi**2*self.__hbar**3*self.__n0/2.0)**(2.0/3.0) ) # [erg] # <KE> of a nucleon corresponding to k_F(n) = k_F(n0)
def dbarP_dr(self, r_i, barM_i, barP_i): ''' RHS of the force balance eqn in the TOV eqns. ''' prmObj = Prm() params = prmObj.get_constants() R0 = params["R0"] pi = params["pi"] c = params["c"] Ms = params["Ms"] eosparams = self.get_EoS_params() e0 = eosparams["e0"] barE = self.barE(barP_i) f1 = -R0*barM_i*barE/r_i**2 f2 = 1.0 +(barP_i/barE) f3 = 1.0 + (4.0*pi*e0/(Ms*c**2))*(r_i**3)*(barP_i/barM_i) f4 = 1.0 - 2.0*R0*(barM_i/r_i) dbarP_dr = f1*f2*f3/f4 return dbarP_dr
def barP(self, u, barP_i=0.0): prmObj = Prm() conv_factors = prmObj.get_conv_factors() P = self.__n0 * ((2.0 * 35.1 / 3.0) * u**(5.0 / 3.0) - (42.1 * u**2.0) + (self.__sigma * 21.0) * u** (1.0 + self.__sigma)) * conv_factors["MEV_TO_ERG"] barP = P / self.__e0 return (barP - barP_i)
def barEu(self, u): prmObj = Prm() conv_factors = prmObj.get_conv_factors() E = self.__n0 * ( (939.6 * u) + (35.1 * u**(5.0 / 3.0)) - (42.1 * u**2.0) + (21.0 * u**(1.0 + self.__sigma))) * conv_factors["MEV_TO_ERG"] barE = E / self.__e0 return (barE)
def get_EoS_params(self): paramObj = Prm() params = paramObj.get_constants() mN = params["mN"] c = params["c"] pi = params["pi"] hbar = params["hbar"] e0 = mN**4 * c**5 / (3. * pi**2 * hbar**3) EoS_params = { "gamma_rl": self.__gamma_rl, "gamma_nrl": self.__gamma_nrl, "A_rl": self.__A_rl, "A_nrl": self.__A_nrl, "e0": e0, } return EoS_params
def __init__(self): prmObj = Prm() constants = prmObj.get_constants() '''Global constants.''' self.__mE = constants["mE"] self.__mP = constants["mP"] self.__mN = constants["mN"] #[gm] self.__c = constants["c"] #[cm/s] self.__pi = constants["pi"] self.__hbar = constants["hbar"] # [erg . s] self.__n0 = 0.16 / (10**(-13))**3 # [#/(fm^3)] --> [#/(cm^3)] self.__eN0 = self.__mN * self.__c**2 # ([erg])Rest mass energy of neutron. '''EoS specific constants.''' self.__sigma = 2.112 self.__e0 = self.__mN**4 * self.__c**5 / ( 3. * self.__pi**2 * self.__hbar**3 ) # [erg/cm^-3] # This quantity is arbitrary self.u_lower = 0.0 # u = (n/n0) self.u_upper = 100.0
def dbarM_dr(self, r_i, barP_i, barM_i): ''' RHS of the mass balance equation in the TOV eqns. ''' prmObj = Prm() params = prmObj.get_constants() Ms = params["Ms"] c = params["c"] pi = params["pi"] eosparams = self.get_EoS_params() e0 = eosparams["e0"] barE = self.barE(barP_i) dbarMdr = (4.0*pi*e0/(Ms*c**2))*(r_i**2.0*barE) return dbarMdr
def get_star_central_values(self): prmObj = Prm() star_params = prmObj.get_constants() Ms = star_params["Ms"] pi = star_params["pi"] r0 = self.__r0 dr = self.__dr '''Value of barM0 for given barP0 according to the EoS''' rho = self.get_density(self.barP0) barM0 = (1.0 / Ms) * ((4.0 / 3.0) * pi * r0**3.0) * rho star_central_vals = { "r0": r0, "dr": dr, "barP0": self.barP0, "barM0": barM0, } return star_central_vals
def __init__(self): prmObj = Prm() conv_factors = prmObj.get_conv_factors() constants = prmObj.get_constants() '''Global constants.''' self.__mE = constants["mE"] self.__mP = constants["mP"] self.__mN = constants["mN"] #[gm] self.__c = constants["c"] #[cm/s] self.__pi = constants["pi"] self.__hbar = constants["hbar"] # [erg . s] self.__eN0 = self.__mN * self.__c**2 # ([erg])Rest mass energy of neutron. '''EoS specific constants.''' self.__t0 = 1024.1 * conv_factors["MEV_TO_ERG"] * (10**-13)**3 self.__t3 = 14600.8 * conv_factors["MEV_TO_ERG"] * (10**-13)**6 self.__n0 = 0.16 / (10**(-13))**3 # [#/(fm^3)] --> [#/(cm^3)] self.__e0 = self.__mN**4 * self.__c**5 / ( 3. * self.__pi**2 * self.__hbar**3 ) # [erg/cm^-3] # This quantity is arbitrary self.__EF0 = ((3.0 / 5.0) * (1.0 / (2.0 * self.__mN)) * (3.0 * self.__pi**2 * self.__hbar**3 * self.__n0 / 2.0) **(2.0 / 3.0)) self.u_lower = 0.0 # u = (n/n0) self.u_upper = 200.0
def main(): boundary = "="*50 print("\n", " > ", boundary, "\n") eosObj = EoS() prmObj = Prm() eosObj.print_EoS_params() prmObj.print_constants() prmObj.print_conv_factors() print("\n > ",boundary) #------------------------------------------------------------------------------------------------------------ # us = [] # u0 = 20.0 # scale = 5.0 # i = 0 # for i in range(30): # us.append(u0*np.exp(-i/scale)) # # us = us[::-1] # barP0s = np.array([self.barP(u) for u in us ]) barP0s = [5.0e-5, 6.0e-5,] while barP0s[-1] <= 2.0e3: barP0s.append(barP0s[-2]+barP0s[-1]) R = [] barM = [] Nil = [] for barP0 in barP0s: print("\n > barP0: {:8.7e}".format(barP0)) NS = Star(barP0) # Instance of class NS print(" --------------------------------------------------\n") outdata = NS.TOV_solver() # Build star R.append(outdata[0]) barM.append(outdata[1]) Nil.append(float("nan")) print(" --------------------------------------------------\n") del NS print("\n\n") print("barM_max: ", np.array(barM).max()) RVsbarM = np.array([R, barM, Nil]) RVsbarM_fname = "./Output/RVsbarM.dat" np.savetxt(RVsbarM_fname, RVsbarM.T, fmt="%6.5e", delimiter="\t") if pyplot_import_error == False: plotObj = Plot() # Used for plotting plotObj.single_plot(RVsbarM_fname) print("\n > ",boundary)