Electrostatic and magnetostatic particle simulation models in three dimensions