AugmentedPBSystem
AugmentedPoissonBoltzmann.SolverCore.AugmentedPBSystem — Function
AugmentedPBSystem(grid, data)Create MPB system with pressure. Ion conserving if data.conserveions==true. In that case, the solution is a sparse matrix.
VoronoiFVM.unknowns — Function
unknowns(sys, data)Initialize and return unknown vector.
VoronoiFVM.unknowns(cell::AbstractAugmentedPBCell)Initialize and return the unknown vector for a given cell.
Arguments
cell::AbstractAugmentedPBCell: The cell configuration
Returns
- Initial unknown vector with appropriate structure and values
The unknowns include:
- Ion mole fractions (y_α for α = 1,...,N)
- Solvent mole fraction (y_0)
- Electric potential (φ)
- Pressure (p)
- Electric field strength (E)
- For ion-conserving cells: bulk ion concentrations at the domain center
Initial values are set to reasonable defaults (mole fractions ≈ 0.1 for ions, adjusted for solvent to maintain sum = 1).
AugmentedPoissonBoltzmann.SolverCore.calc_cnum — Function
calc_cnum(sol,sys)Obtain ion number densities from system
AugmentedPoissonBoltzmann.SolverCore.calc_c0num — Function
calc_c0num(sol,sys)Obtain solvent number density from system
AugmentedPoissonBoltzmann.SolverCore.calc_cmol — Function
calc_cmol(sol,sys)Obtain ion molarities (molar densities in mol/L) from system
calc_cmol(sol, cell::AbstractAugmentedPBCell)Calculate ion concentrations in mol/L from the solution.
Arguments
sol: Solution vector from the solvercell::AbstractAugmentedPBCell: The cell configuration
Returns
- Matrix of ion concentrations in mol/L (one row per species, one column per node)
AugmentedPoissonBoltzmann.SolverCore.calc_c0mol — Function
calc_c0mol(sol,sys)Obtain solvent molarity (molar density in mol/L) from system
calc_c0mol(sol, cell::AbstractAugmentedPBCell)Calculate solvent concentration in mol/L from the solution.
Arguments
sol: Solution vector from the solvercell::AbstractAugmentedPBCell: The cell configuration
Returns
- Vector of solvent concentrations in mol/L (one value per node)
AugmentedPoissonBoltzmann.SolverCore.calc_χ — Function
calc_χ(sol,sys)calc_χ(sol, cell::AbstractAugmentedPBCell)Calculate electric susceptibility from the solution.
Arguments
sol: Solution vector from the solvercell::AbstractAugmentedPBCell: The cell configuration
Returns
- Vector of susceptibility values (one value per node)
AugmentedPoissonBoltzmann.SolverCore.calc_spacecharge — Function
calc_spacecharge(sys, sol)AugmentedPoissonBoltzmann.SolverCore.ysum — Method
ysum(sys,sol)AugmentedPoissonBoltzmann.SolverCore.qsweep — Function
qsweep(sys)
Sweep over series of surface charges and calculate resulting potential difference.
AugementedPBData
AugmentedPoissonBoltzmann.SolverCore.AugmentedPBData — Type
struct AugmentedPBDataData structure containing data for equilibrium calculations. All data including molarity in SI basic units
z::Vector{Int64}: Ion charge numbers.N::Int64: Number of ionic speciesκ::Vector{Float64}: Ion solvation numbersmolarity::Float64: Bulk molarity transformed to number densityn_E::Vector{Float64}: Bulk ion number densitiesn_avg::Vector{Float64}: Average ion number densitiesq::Vector{Float64}: Surface chargesφ::Float64: Applied potentialn0_ref::Float64: Solvent molarityv0::Float64: Solvent molecular volumevu::Vector{Float64}: Unsolvated ion molecular volumeχ0::Float64: Dielectric susceptibility of solventχ::Any: Dielectric susceptibilityχvar::Bool: Dielectric susceptibility model flagi0::Int64: Solvent molar fraction indexiφ::Int64: Electric potential species indexip::Int64: Pressure species indexiE::Int64: Field strength species indexcoffset::Int64: Offset of n_E in species listp_ref::Float64: Reference pressurepscale::Float64: Pressure scaling nparametercscale::Float64: Concentration scaling parameterqscale::Float64: Charge scaling parameterEscale::Float64: Electric field scaling parameterE_ref::Float64: Reference voltageT::Float64: Temperatureδ0::Any: Variable susceptibility parameter for solventδ::Any: Variable susceptibility parameterskT::Float64: Temperature times Boltzmann constante::Float64: Electron chargeε_0::Float64: Vacuum permittivityconserveions::Bool: Ion conservation flagnv::Vector{Float64}: node volumes
AugmentedPoissonBoltzmann.SolverCore.apply_voltage! — Function
apply_voltage!(data, v)Set working electrode voltage
AugmentedPoissonBoltzmann.SolverCore.apply_charge! — Function
apply_charge!(data,q)Set surface charge in data
AugmentedPoissonBoltzmann.SolverCore.set_molarity! — Function
set_molarity!(data,M)
Set the molarity of the electrolyte and update depending data
set_molarity!(cell::AbstractAugmentedPBCell, M)Set the bulk electrolyte molarity.
Arguments
cell::AbstractAugmentedPBCell: The cell configurationM: Molarity in mol/L
Updates the bulk ion concentrations and related parameters in the cell data.
AugmentedPoissonBoltzmann.SolverCore.L_Debye — Function
L_Debye(data)\[L_{Debye}=\sqrt{ \frac{(1+χ)ε_0k_BT}{e^2n_E}}\]
AugmentedPoissonBoltzmann.SolverCore.dlcap0 — Function
dlcap0(data)Double layer capacitance at $φ=0$
\[C_{dl,0}=\sqrt{\frac{2(1+χ) ε_0e^2 n_E}{k_BT}}\]
AugmentedPoissonBoltzmann.SolverCore.capscalc — Function
capscalc(sys, molarities)Calculate double layer capacitances using qsweep results.
This provides an "inverse" method to calculate these capacitances. Usually one calculates charges dependent on voltages, here we calculate voltages dependent on charges.
Internal: Constitutive model
AugmentedPoissonBoltzmann.SolverCore.DerivedData — Type
struct DerivedDataStruct holding some derived data
v::Vector{Float64}: Effective ion volumesy_E::Vector: Bulk ion mole fractionsy0_E::Any: Bulk solvent mole fraction
AugmentedPoissonBoltzmann.SolverCore.DerivedData — Method
DerivedData(augmentedpbdata)Calculate bulk mole fractions from incompressibiltiy
AugmentedPoissonBoltzmann.SolverCore.DerivedData — Method
DerivedData(augmentedpbdata, n_E)Calculate bulk mole fractions from incompressibiltiy:
\[\begin{aligned} \sum\limits_αv_αn_α^E&=1\\ n_0^E&=\frac1{v_0}\left(1-∑\limits_{α>0}v_αn_α^E\right)\\ n^E&=\frac1{v_0}\left(1-∑\limits_{α>0}v_αn_α^E\right)+ ∑\limits_{α>0}n_α^E\\ &=\frac1{v_0}\left(1-∑\limits_{α>0}(v_α-v_0)n_α^E\right)\\ &=\frac1{v_0}\left(1-∑\limits_{α>0}((1+ κ_α)v_0-v_0)n_α^E\right)\\ &=\frac1{v_0}\left(1-∑\limits_{α>0}κ_αv_0n_α^E\right)\\ &=\frac1{v_0}-∑\limits_{α>0}κ_αn_α^E\\ y_α^E&=\frac{n_α^E}{n^E} \end{aligned}\]
AugmentedPoissonBoltzmann.SolverCore.makeδ — Function
makeδ(v, χ, T)Calculate δ parameter for susceptibility models
AugmentedPoissonBoltzmann.SolverCore.W — Function
W(x)$W(x)= 3\frac{\mathcal L(x)}{x}= \frac{\coth(x)-\frac1x}{x}$
$\mathcal L(x)$ is called Langevin function.
AugmentedPoissonBoltzmann.SolverCore.Λ — Function
Λ(x)$\Lambda(x)=\ln\left( \frac{\sinh(x)}x \right)$ This is the antiderivative of the Langevin function $\mathcal L(x)$.
AugmentedPoissonBoltzmann.SolverCore.y_α — Function
y_α(φ,p,E,α,data, ddata)Ion molar fractions
Equilibrium expression for mole fractions ($α≥0$) (16)
\[y_α(φ,p, E)=y_α^E\exp\left(\frac{-z_αe}{k_BT}(φ- φ^E)-\frac{v_α}{k_BT}(p-p^E) + \Lambda\left(\frac{\delta_\alpha |E|}{k_BT}\right)¸\right)\]
AugmentedPoissonBoltzmann.SolverCore.y0 — Function
y0(p, E, data, ddata)
Solvent molar fraction
AugmentedPoissonBoltzmann.SolverCore.ysum — Method
ysum(u, data)AugmentedPoissonBoltzmann.SolverCore.spacecharge — Function
spacecharge(u, data)Solvated ion volumes:
\[\begin{aligned} q(φ,p)&=e∑\limits_α z_αn_α = ne∑\limits_α z_αy_α\\ &=e\frac{∑\limits_α z_αy_α(\phi,p)}{∑\limits_α v_α y_α(\phi,p)}\\ v_α&=v^u_α+κ_αv_0 \end{aligned}\]
AugmentedPoissonBoltzmann.SolverCore.susceptibility — Function
susceptibility(u, data)Susceptibility model
AugmentedPoissonBoltzmann.SolverCore.c_num! — Function
c_num!(c,φ,p, data)Calculate number concentrations at discretization node
\[\begin{aligned} n&=\sum_{i=0}^N y_α v_α\\ n_α&=ny_α \end{aligned}\]
AugmentedPoissonBoltzmann.SolverCore.c0_num — Function
c0_num(c,φ,p, data)Calculate number concentration of solvent at discretization node
Internal: System
AugmentedPoissonBoltzmann.SolverCore.reaction! — Function
reaction!(f,u,node, data)Callback which runs in every grid point.
- Calculate space charge density and add this to the poisson equation
AugmentedPoissonBoltzmann.SolverCore.poisson_and_p_flux! — Function
poisson_and_p_flux!(f, u, edge, data)Runs on every grid edge. Calculate fluxes for the Poisson and the pressure equations.
AugmentedPoissonBoltzmann.SolverCore.bcondition! — Function
bcondition!(y, u, bnode, data)Boundary condition callback. The Dirichlet condition for the pressure in the mid of the domain ensures uniqueness of the pressure equation.
AugmentedPoissonBoltzmann.SolverCore.ionconservation! — Function
ionconservation!(f, u, sys, data)"Generic callback" which shall ensure the ion conservation constraint. This method runs over the full grid, and its sparsity pattern is automatically detected. It is called if ion conservation is required. In this case, $n^E_lpha$ are additional unknowns scaled by cscale (default: $N_A$) which are attached to the mid of the domain (node i3), and additional equations need to be assembled. These are N-1 ion conservation constraints and the an electroneutrality constraint.