General remarks

All physical quantities are assumed to be consistently represented through their values expressed in basic SI units (m, kg, s, A, K, mol, cd), supported by the LessUnitful.jl package built on top of Unitful.jl.

Electrolyte data

LiquidElectrolytes.ElectrolyteDataType
mutable struct ElectrolyteData <: AbstractElectrolyteData

Data for electrolyte. It is defined using Base.@kwdef has keyword constructors like

    ElectrolyteData(nc=3,z=[-1,2,1])
  • nc::Int64: Number of ionic species.

  • na::Int64: Number of surface species

  • iϕ::Int64: Potential index in species list.

  • ip::Int64: Pressure index in species list

  • D::Vector{Float64}: Mobility coefficient

  • z::Vector{Int64}: Charge numbers of ions

  • M0::Float64: Molar weight of solvent

  • M::Vector{Float64}: Molar weight of ions

  • v0::Float64: Molar volume of solvent

  • v::Vector{Float64}: Molar volumes of ions

  • κ::Vector{Float64}: Solvation numbers

  • c_bulk::Vector{Float64}: Bulk ion concentrations

  • ϕ_bulk::Float64: Bulk voltage

  • p_bulk::Float64: Bulk pressure

  • Γ_bulk::Int64: Bulk boundary number

  • ϕ_we::Float64: Working electrode voltage

  • Γ_we::Int64: Working electrode boundary number

  • T::Float64: Temperature

  • RT::Float64: Molar gas constant scaled with temperature

  • F::Float64: Faraday constant

  • ε::Float64: Dielectric permittivity of solvent

  • ε_0::Float64: Dielectric permittivity of vacuum

  • pscale::Float64: Pressure scaling factor

  • eneutral::Bool: Local electroneutrality switch

  • scheme::Symbol: Flux caculation scheme This allows to choose between

    • :μex (default): excess chemical potential (SEDAN) scheme, see sflux
    • :act : scheme based on reciprocal activity coefficients, see aflux
    • :cent : central scheme, see cflux.
  • epsreg::Float64: Regularization parameter used in rlog
  • weights::Vector{Float64}: Species weights for norms in solver control.
source

The default values for electrolyte data are those of an symmetric 0.1M aqueous binary electrolyte at 298.5K with solvation number κ=10, ion molar volumes similar to water molecules and diffusion coefficient 2.0e-9 $m^2/s$. All values given in SI base units.

using LiquidElectrolytes
ElectrolyteData()
                  nc = 2
                  na = 0
                  iϕ = 3
                  ip = 4
                   D = [2.0e-9, 2.0e-9]
                   z = [1, -1]
                  M0 = 0.018015
                   M = [0.018015, 0.018015]
                  v0 = 1.8051e-5
                   v = [1.8051e-5, 1.8051e-5]
                   κ = [10.0, 10.0]
              c_bulk = [100.0, 100.0]
              ϕ_bulk = 0.0
              p_bulk = 0.0
              Γ_bulk = 2
                ϕ_we = 0.0
                Γ_we = 1
                   T = 298.15
                  RT = 2479.0
                   F = 96485.0
                   ε = 78.49
                 ε_0 = 8.8542e-12
              pscale = 1.0e9
            eneutral = false
              scheme = μex
              epsreg = 1.0e-20
             weights = [1.8051e-5, 1.8051e-5, 1.0, 0.0]
LiquidElectrolytes.dlcap0Method
dlcap0(electrolyte)

Double layer capacitance at zero voltage for symmetric binary electrolyte.

Example

using LessUnitful
ely = ElectrolyteData(c_bulk=fill(0.01ufac"mol/dm^3",2))
round(dlcap0(ely),sigdigits=5) |> u"μF/cm^2"
# output

22.847 μF cm^-2
source
LiquidElectrolytes.debyelengthMethod
debyelength(electrolyte)

Debye length.

using LessUnitful
ely = ElectrolyteData(c_bulk=fill(0.01ufac"mol/dm^3",2))
round(debyelength(ely),sigdigits=5) |> u"nm"
# output

4.3018 nm
source
LiquidElectrolytes.chemical_potentials!Function
chemical_potentials!(μ,u,electrolyte)

Calculate chemical potentials from concentrations.

Input:

  • μ: memory for result (will be filled)
  • u: local solution vector (concentrations, potential, pressure)

Returns μ0, μ: chemical potential of solvent and chemical potentials of ions.

using LessUnitful
ely = ElectrolyteData(c_bulk=fill(0.01ufac"mol/dm^3",2))
μ0,μ=chemical_potentials!([0.0,0.0],vcat(ely.c_bulk,[0,0]),ely)
round(μ0,sigdigits=5),round.(μ,sigdigits=5)
# output

(-0.89834, [-21359.0, -21359.0])
source
LiquidElectrolytes.c0_barcFunction
c0_barc(u,electrolyte)

Calculate solvent concentration $c_0$ and summary concentration $\bar c$ from vector of concentrations c using the incompressibility constraint (assuming $κ_0=0$):

\[ \sum_{i=0}^N c_i (v_i + κ_iv_0) =1\]

This gives

\[ c_0v_0=1-\sum_{i=1}^N c_i (v_i+ κ_iv_0)\]

\[c_0= 1/v_0 - \sum_{i=1}^N c_i(\frac{v_i}{v_0}+κ_i)\]

Then we can calculate

\[ \bar c= \sum_{i=0}^N c_i\]

source
LiquidElectrolytes.iselectroneutralFunction
iselectroneutral(cx::Vector,celldata)

Check for electroneutrality of concentration vector

source
iselectroneutral(tsol::TransientSolution,celldata)

Check for electorneutrality of transient solution

source
LiquidElectrolytes.isincompressibleFunction
isincompressible(cx::Vector,celldata)

Check for incompressibility of concentration vector

source
isincompressible(tsol::TransientSolution,celldata)

Check for incompressibility of transient solution

source

Poisson-Boltzmann system

LiquidElectrolytes.PBSystemFunction
PBSystem(grid;
         celldata=ElectrolyteData(),
         bcondition=default_bcondition,
         kwargs...)

Create VoronoiFVM system generalized Poisson-Boltzmann. Input:

  • grid: discretization grid
  • celldata: composite struct containing electrolyte data
  • bcondition: boundary condition
  • kwargs: Keyword arguments of VoronoiFVM.System
source

Poisson-Nernst-Planck system

LiquidElectrolytes.PNPSystemFunction
PNPSystem(grid;
         celldata=ElectrolyteData(),
         bcondition=default_bcondition,
         kwargs...)

Create VoronoiFVM system for generalized Poisson-Nernst-Planck. Input:

  • grid: discretization grid
  • celldata: composite struct containing electrolyte data
  • bcondition: boundary condition
  • reaction : reactions of the bulk species
  • kwargs: Keyword arguments of VoronoiFVM.System
source