H = cosmo.get_Hubble(a_start) * 1000 / Mpc # 1/sec # Set photoheating and photoionization rates uvb_rates = Load_Grackle_UVB_File(uvb_rates_file) uvb_parameters = { 'scale_H': 1.0, 'scale_He': 1.0, 'delta_z_H': 0.0, 'delta_z_He': 0.0 } uvb_rates = Modify_UVB_Rates(uvb_parameters, uvb_rates) solution = Integrate_Evolution(n_H_comov, n_He_comov, T_start, uvb_rates, cosmo, z_start, z_end, n_samples, output_to_file=None) output_file_name = output_dir + 'solution.h5' Write_Solution(solution, output_file_name) # # z = solution['z'] # nH = solution['n_H'] # nHII = solution['n_HII'] # nHe = solution['n_He'] # nHeIII = solution['n_HeIII'] # ion_frac_H = 0.99 # ion_frac_He = 0.99 # HII_frac = nHII / nH
rho_gas_mean = cosmo.rho_gas_mean # kg cm^-3 rho_H = X * rho_gas_mean rho_He = (1 - X) * rho_gas_mean n_H_comov = rho_H / M_p # cm^-3 n_He_comov = rho_He / (4 * M_p) # cm^-3 a_start = 1. / (z_start + 1) rho_cgs = rho_gas_mean * 1e3 / a_start**3 H = cosmo.get_Hubble(a_start) * 1000 / Mpc # 1/sec for model_id, model_file_name in enumerate(model_files): file_name = input_dir + model_file_name rates = Load_Grackle_UVB_File(file_name) uvb_parameters = { 'scale_He': 1.0, 'scale_H': 1.0, 'delta_z_He': 0.0, 'delta_z_H': 0.0 } uvb_rates = Modify_UVB_Rates(uvb_parameters, rates) solution = Integrate_Evolution(n_H_comov, n_He_comov, T_start, uvb_rates, cosmo, z_start, z_end, n_samples) output_file_name = output_dir + f'solution_{model_id}.h5' Write_Solution(solution, output_file_name) # Plot_Solution( output_dir, solution, file_name=f'solution_{model_id}.png' ) # Plot_HI_fraction( output_dir, solution=solution, input_file=None, solutions=None, file_name='HI_fraction.png', HI_data=None, data_labels=None )