Lagrangian and Network Formulations of Nonlinear Electrochemical Systems