Discretization Of Poisson-Boltzmann And Poisson-Nernst-Planck Equations With Applications To Electrochemical Systems