  We developed a 6D multi-particle tracking program CETASim in C++ programming
language to simulate intensity-dependent effects in electron storage rings. The
program can simulate the beam collective effects due to short-range/long-range
wakefields for single/coupled-bunch instability studies. It also features to
simulate interactions among charged ions and the trains of electron bunches,
including both fast ion and ion trapping effects. The bunch-by-bunch feedback
is also included so that the user can simulate the damping of the unstable
motion when its growth rate is faster than the radiation damping rate. The
particle dynamics is based on the one-turn map, including the nonlinear effects
of amplitude-dependent tune shift, high-order chromaticity, and second-order
momentum compaction factor. A skew quadrupole can also be introduced by the
users, which is very useful for the emittance sharing and the emittance
exchange studies. This paper describes the code structure, the physics models,
and the algorithms used in CETASim. We also present the results of its
application to PETRA-IV storage ring.
