Electric charging is one of the essential aerosol dynamic mechanisms and is harnessed for detection, capture and control of ultrafine aerosol particles in a range of devices. For simplicity, charging and transport mechanisms are commonly modelled with zero spatial dimensions (0-D) and averaged properties such as mean charge or mean particle diameter. These models often neglect localised effects of the flow distribution, diffusion, discrete charge states, and particle polydispersity, often proving inadequate to explain experimental data. This work aims to provide an open-source three-dimensional (3-D) aerosol charging and transport model including bipolar and unipolar diffusion charging, and photoelectric charging algorithms for use in detailed design and analyses of aerosol systems. The computational model consists of more than 200 particle transport equations for discrete charge states and polydisperse sizes coupled with ion conservation equations in the framework of OpenFOAM, an open-source computational fluid dynamics platform. Three test cases are introduced to verify implementation of three charging models by comparison with published literature: bipolar and unipolar diffusion charging, and photoelectric charging. Tutorial cases, which model three distinct aerosol sensors, are described and demonstrate the capabilities of the 3-D aerosol charging and transport models within the predetermined flow field. The aerosolChargingFoam code is available at https://openaerosol.sourceforge.io for widespread use and can be further modified under the GNU general public licence. Program summaryProgram title: aerosolChargingFoamCPC Library link to program files:https://doi.org/10.17632/4pf4n2vg9f.1Developer's repository link:https://openaerosol.sourceforge.io/Licensing provisions: GNU General Public License 3Programming language: C++Nature of problem: aerosolChargingFoam solves generalised aerosol electrical charging and transport equations coupled with computational fluid dynamics using the open-source computational platform, OpenFOAM [1]. The electric charging algorithm including unipolar diffusion charging, bipolar diffusion charging, and photoelectric charging is verified with zero-dimensional test cases [2-4] and generalized to three-dimensional monodisperse or polydisperse particle distributions for more than 50 particle charge states. aerosolChargingFoam can be straightforwardly coupled with other existing solvers, which enables computations of complex multi-physics aerosol charging processes in practical conditions.Solution method: aerosolChargingFoam employs an explicit time-stepping for the time-dependent source terms for generalised aerosol charging. The solution methods and schemes provided by OpenFOAM 9 are used for solving the spatial and time derivatives in the transport equations.