Skip to content

Electrical Potential

ElectricalPotential manages the electrode configuration of an electrochemical simulation. It declares how many electrodes are present in the domain, pairs each with its counter-electrode, and reads the integer elementary-charge valence zq of every component. The module then computes each component's molar charge

(1)MolarChargeq=zqF,

with F the Faraday constant, which ElectricProperties uses to build the space charge density consumed by the Poisson solver described on the Electrics overview.

Key Classes and Concepts

  • ElectricalPotential : public OPObject: holds the electrode list, the per-component ElementarCharges[q] and derived MolarCharge[q].
  • Electrode: one electrode entry with an index, a charge, an interface volume, a 3-vector position, and a counter-electrode index.

Usage

Input

Defined in the @ElectricalPotential block. Electrodes are numbered 1-based in the input; inside the code they are stored zero-based (the reader subtracts 1).

text
@ElectricalPotential

$Nelectrodes    Number of electrodes in the domain       : 2

$CntElectr1     Counter-electrode index for electrode 1  : 2
$CntElectr2     Counter-electrode index for electrode 2  : 1

# Elementary charge valence of each component (zero-based) {#elementary-charge-valence-of-each-component-zero-based}
$Z0             Valence of component 0                   : 1
$Z1             Valence of component 1                   : -1
TokenVariableTypeRequired
$NelectrodesNelectrodesintyes
$CntElectr<i>electrodes[i-1].counterElectrodeint (1-based on input)yes, one per electrode
$Z<q>ElementarCharges[q]intyes, one per component

Output

No dedicated output file. The derived MolarCharge[q] array is forwarded to ElectricProperties::CalculateChargeDensity during the solve, whose result ends up in the VTK output written through the Electrics overview solver pipeline.

Example

cpp
#include "ElectricalPotential.h"
#include "Electrics/ElectricProperties.h"

ElectricalPotential  EPot(OPSettings, InputFile);
ElectricProperties   ElecP(OPSettings, InputFile);

for(RTC.tStep = RTC.tStart; RTC.tStep <= RTC.nSteps; RTC.IncrementTimeStep())
{
    // ElecP uses ElementarCharges published by EPot
    ElecP.CalculateChargeDensity(Cx);
    ElecP.SetBoundaryConditions(BC);
    // ... solver step ...
}

Dependencies

Released under the GNU GPLv3 License.