A pore network model of porous electrodes in electrochemical devices