PyCOMPLETE / PyECLOUD

PyECLOUD code for the simulation of electron cloud effects in particle accelerators. More info at: https://github.com/PyCOMPLETE/PyECLOUD/wiki
21 stars 11 forks source link

Checks for lifetime and kinetic energy histograms #110

Closed lmether closed 5 years ago

lmether commented 5 years ago

In pyecloud_saver.py

lmether commented 5 years ago

In impact_management_class.py

               # add to lifetime histogram
                if self.flag_lifetime_hist:
                    lifetime_impact = tt_curr - MP_e.t_last_impact[flag_impact]
                    if sum(MP_e.t_last_impact[flag_impact] > 0) > 0:
                        histf.compute_hist(lifetime_impact[MP_e.t_last_impact[flag_impact] > 0], nel_impact[MP_e.t_last_impact[flag_impact] > 0], 0., Dt_lifetime_hist, self.lifetime_hist_line)
lmether commented 5 years ago

In pyecloud_saver.py

* N_mp is not used in arrays

* Doesn't work if N_mp is non-zero and sum(nel_mp) = 0
            # Histogram of the kinetic energy of all the particles
            v_mod = np.sqrt(MP_e.vx_mp**2 + MP_e.vy_mp**2 + MP_e.vz_mp**2)
            Ekin = 0.5 * MP_e.mass/qe * v_mod * v_mod
            ekin_hist = np.zeros(impact_man.Nbin_En_hist, float)
            nel = MP_e.nel_mp[np.nonzero(MP_e.nel_mp)]
            N_mp = MP_e.N_mp
            if N_mp > 0:
                histf.compute_hist(Ekin[np.nonzero(MP_e.nel_mp)], nel, 0, impact_man.DEn_hist, ekin_hist)
            self.all_Ekin_hist.append(ekin_hist.copy())

Modified in separate branch, to be merged

lmether commented 5 years ago

Solved in #111