baryon_density_s=0.16 m=939 BindE=16 mass_args=(939,313,313) #args=np.mgrid[(m-BindE+30):(m-BindE+36):5j,0:220:23j,340:440:21j,0.0:1.5:31j] args=np.mgrid[(m-BindE+30):(m-BindE+36):3j,0:220:11j,340:440:6j,0.0:1.5:6j] args_flat=args.reshape((-1,np.prod(np.shape(args)[1:]))).transpose() f_file=open(path+dir_name+'/Quarkyonic_args.dat','wb') cPickle.dump(args,f_file) f_file.close() J,L,Lambda,kappa=args args_shape=np.shape(J) f_eos_RMF='./'+dir_name+'/Quarkyonic_eos.dat' from Parallel_process import main_parallel_unsave eos_flat=main_parallel_unsave(Calculation_creat_eos_Quarkyonic,np.concatenate((np.full((len(args_flat),1),baryon_density_s),args_flat),axis=1),other_args=mass_args) eos=eos_flat.reshape(args_shape) logic_causality_stability=[] eos_success=[] for i in range(len(args_flat)): logic_causality_stability.append(eos_flat[i].causality_stability) eos_success.append(eos_flat[i].eos_success) logic_causality_stability=np.array(logic_causality_stability).reshape(args_shape) eos_success=np.array(eos_success).reshape(args_shape) f_file=open(path+dir_name+'/Quarkyonic_eos_logic.dat','wb') cPickle.dump(logic_causality_stability,f_file) f_file.close() f_file=open(path+dir_name+'/Quarkyonic_eos_success.dat','wb')
""" from eos_class import EOS_PiecewisePoly3WithCrust import numpy as np args = np.mgrid[0.06:0.06:1j, 3.75:30:43j, 100:300:41j, 0:1:40j] args[3] = 1 - 250 + 450 * 5**args[3] eos_shape = args[0].shape def Calculation_creat_EOS(eos_args_args_array, other): return EOS_PiecewisePoly3WithCrust(eos_args_args_array) from Parallel_process import main_parallel_unsave eos_flat = main_parallel_unsave(Calculation_creat_EOS, args.reshape((4, -1)).transpose()) eos = eos_flat.reshape(eos_shape) p_185 = [] logic_success_eos = [] for eos_i in eos_flat: if (eos_i.success_eos): p_185.append(eos_i.eosPressure_frombaryon(0.16 * 1.85)) else: p_185.append(0) logic_success_eos.append(eos_i.success_eos) p_185 = np.array(p_185).reshape(eos_shape) unitary_gas_constrain = p_185 > 3.74 neutron_matter_constrain = np.logical_and(p_185 > 8.4, p_185 < 30.) logic_success_eos = np.array(logic_success_eos).reshape(eos_shape)
for t in range(len(m_eff)): for i in range(len(E_pnm)): 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[t], E_pnm[i], L_pnm[j], K_pnm[k], Q_pnm[l], Z_pnm[s] ]) args_flat = np.array(args) args = np.reshape(args_flat, (N_m, N_E, N_L, N_K, N_Q, N_Z, -1)) from Parallel_process import main_parallel_unsave eos_flat = main_parallel_unsave( Calculation_creat_eos_SLY4_match_EXPANSION_PNM, args_flat, other_args='pnm_margueron') eos = eos_flat.reshape((N_m, N_E, N_L, N_K, N_Q, N_Z)) eos_success = [] for eos_i in eos_flat: eos_success.append(eos_i.eos_success) eos_success = np.array(eos_success) # ============================================================================= # n_s=0.16 # m=939 # N_m=5 # N_E=5 # N_L=26 #N_L=18 # N_K=31 # N_Q=37
path = '../' args, eos_array_logic, eos_array_list_success = pickle_load( path + dir_name + '/', dir_prp, ['args', 'eos_array_logic', 'eos_array_list_success']) eos_shape = args[0].shape from Parallel_process import main_parallel_unsave def Calculation_creat_EOS(eos_args_args_array, other): return EOS_Spectral3_match(eos_args_args_array, other) eos_sly4 = EOS_SLY4() eos_success = main_parallel_unsave(Calculation_creat_EOS, eos_array_list_success, other_args=EOS_SLY4()) pickle_dump(path, dir_name, ([eos_success, 'eos_success'], )) # ============================================================================= # eos_sly4=EOS_SLY4() # eos_success=[] # for eos_array_list_success_i in eos_array_list_success: # eos_success.append(EOS_Spectral3_match(eos_array_list_success_i,eos_sly4)) # eos_success=np.array(eos_success) # ============================================================================= success_match = [] causal_match = [] p_185_success = [] success_eos = []
from eos_class import EOS_SLY4, EOS_Spectral3 import numpy as np eos_sly4 = EOS_SLY4() args = np.mgrid[0.06:0.08:2j, 0:0.8:401j, -0.13:0.04:341j] args = args[:, :, :, args[2, 0, 0] != 0] eos_shape = args[0].shape def Calculation_creat_EOS_Spectral3(eos_args_args_array, eos_low): return EOS_Spectral3(eos_args_args_array, eos_low) from Parallel_process import main_parallel_unsave eos_flat = main_parallel_unsave(Calculation_creat_EOS_Spectral3, args.reshape((3, -1)).transpose(), other_args=eos_sly4) eos = eos_flat.reshape(eos_shape) eos_array_list_success = [] p_185 = [] logic_success_eos = [] for eos_i in eos_flat: if (eos_i.success_eos): p_185.append(eos_i.eosPressure_frombaryon(0.16 * 1.85)) eos_array_list_success.append(eos_i.eos_array) else: p_185.append(0) logic_success_eos.append(eos_i.success_eos) p_185 = np.array(p_185).reshape(eos_shape) unitary_gas_constrain = p_185 > 3.74
def Calculation_parallel(equations,logic_calculatable_array,init_array,args_array,vary_list=np.linspace(1.,1.,1),tol=1e-12,logic_success_f=eos_logic_sol,equations_extra_args=[]): main_parallel_result=main_parallel_unsave(Calculation_parallel_sub,zip(logic_calculatable_array,init_array,args_array),other_args=(vary_list,tol,equations_extra_args)) return main_parallel_result[:,0].astype('bool'),main_parallel_result[:,1:]