Numerical calculations and simulation of electrostatic fields