'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 # HeIII_frac = nHeIII / nHe # z_ion_H = z[HII_frac > ion_frac_H].max() # z_ion_He = z[HeIII_frac > ion_frac_He].max() # # # global_props = { 'ion_frac_H':ion_frac_H, 'ion_frac_He':ion_frac_He, 'z_ion_H':z_ion_H, 'z_ion_He':z_ion_He }
params_chain = np.array( params_chain ).T n_in_chain = params_chain.shape[0] ids_global = np.arange( 0, n_in_chain, dtype=int ) ids_local = split_array_mpi( ids_global, rank, n_procs) n_local = len(ids_local ) print( f'proc_id: {rank} n_local: {n_local}' ) #Select parameters and compute modified UVB rates for sim_id in ids_local: output_file_name = output_dir + f'solution_{sim_id}.h5' if os.path.isfile(output_file_name): print( f'Skipping {sim_id}' ) continue sim_params = params_chain[sim_id] scale_He, scale_H, delta_z_He, delta_z_H = sim_params # # Set photoheating and photoionization rates uvb_rates = Load_Grackle_UVB_File( uvb_rates_file ) uvb_parameters = {'scale_He':scale_He, 'scale_H':scale_H, 'delta_z_He':delta_z_He, 'delta_z_H':delta_z_H } uvb_rates = Modify_UVB_Rates( uvb_parameters, uvb_rates ) # Integrate the solution integrator = 'bdf' # integrator = 'rk4' solution = Integrate_Evolution( n_H_comov, n_He_comov, T_start, uvb_rates, cosmo, z_start, z_end, n_samples, output_to_file=None, integrator=integrator ) Write_Solution( solution, output_file_name, n_stride=50, fields_to_write=['z', 'temperature', 'n_H', 'n_HI', 'n_e'] ) # Plot_Solution( output_dir, solution, file_name=f'solution_{sim_id}.png' )