Boundary Conditions for Running and Controlling Electrochemical Cells
An electrochemical cell is typically operated by controlling either the cell voltage (potentiostatic control) or the cell current (galvanostatic control). In a lab experiment this is accomplished by using a potentiostat.
In a model, potentiostatic control is defined by using fixed potential boundary conditions. This can be done by setting the Electric Potential with respect to ground to control the cell potential, or the Electrode Potential with respect to a reference potential somewhere in the system. Galvanostatic control can be accomplished using Total Current or Average Current Density boundary conditions. For both cases, one electrode in the cell needs to be grounded.
Mathematically, a Total Current or Average Current Density condition implies setting the potential of a boundary to be equal to an additional extra global potential degree of freedom (floating potential) to comply with the specified current condition. For this reason, solving for galvanic control is numerically slightly more complex.
Note that explicitly prescribing the current density distribution on an electrode boundary is hard to accomplish in a real world experiment. In higher dimensions than 1D, Electrode Current Density and Electrolyte Current Density boundary conditions should be used with care.
Short-circuiting a cell and Galvanic Corrosion
The simplest way to model a short-circuited cell is to set both electrodes to the same (electronic) potential, using a fixed potential boundary condition. The charge balance equation of the electrolyte will make sure the total current over all electrode surfaces sums up to zero.
Note that many galvanic corrosion situations are practically equivalent to a short circuit of two electrodes consisting of different metals. In such models, the two metals are set to the same potential. Usually this potential is chosen to be zero (ground).