Lithium intercalation in porous carbon electrodes