Electrochemistry

Contents

Electrochemistry#

Models of electrochemistry, built on sumfem.models.

The package has three layers, each importing only from those before it:

Every name is also imported from here.

The package imports from the core of sumfem, and never the other way around.

Materials#

What the cells are made of: ions, electrolytes, couples and electrodes.

These describe materials and their properties, as parameters and the expressions of them that the models share, and hold no equations of their own.

  • Electrolytes: Electrolyte, a dilute solution of Ion.

  • Redox couples: RedoxCouple, the reaction of a half-cell.

  • Porous electrodes: PorousElectrode, and the Region of a cell filled with electrolyte.

The materials import nothing from the models or the cells.

Electrolytes#

class sumfem.electrochemistry.Electrolyte(name, domain, ions=(), temperature=298.15, density=None, viscosity=None, concentration_floor=1e-14)[source]#

A dilute electrolyte solution: its ions, temperature and constants.

An electrolyte is a solution of ions in a solvent, e.g. vanadium ions, protons and sulfate in water. In a dilute solution the ions do not interact with each other: each ion \(k\), of charge number \(z_k\), concentration \(c_k\) and diffusivity \(D_k\), moves by diffusion, by migration in the electric field and with the solvent, with the Nernst-Planck flux \(\mathbf{N}_k\) of (44). The solution is electroneutral:

(42)#\[\begin{aligned} \sum_k z_k c_k &= 0. \end{aligned}\]

The state of the solution is the concentrations of its ions and the temperature \(T\). Its properties are the diffusivities of the ions and the density and viscosity of the solution.

The electrolyte gives the quantities of dilute-solution theory that the models of a solution share. These are the concentration of each ion, concentration(), and the charge the ions carry, the current density current_density():

(43)#\[\begin{split}\begin{aligned} \mathbf{i}_l &= F \sum_k z_k \mathbf{N}_k, \\ \mathbf{i}_l &= -\kappa \nabla \phi - F \sum_k z_k t D_k \nabla c_k, \\ \kappa &= \frac{F^2}{R T} \sum_k z_k^2 t D_k c_k, \end{aligned}\end{split}\]

with the electrolyte potential \(\phi\), the ionic conductivity() \(\kappa\), the current of diffusion, diffusion_current(), and a correction \(t\) of every diffusivity, e.g. Bruggeman’s in a porous electrode. Advection carries no charge, by (42). The transport, conduction and reaction models, e.g. NernstPlanck, ElectrolyteConduction and ButlerVolmer, build their terms from one electrolyte, so they agree on these quantities.

At most one ion may have no field. Its concentration follows from (42), see balanced. Nothing keeps that concentration positive, so choose the most abundant ion of the supporting electrolyte, e.g. sulfate in a vanadium electrolyte, never an ion of a reaction, and check its minimum, e.g. with minimum_balanced_concentration(). Without ions, the electrolyte has a uniform composition, and only provides the constants, the temperature and the properties of the solution.

Its constants, temperature and properties of the solution, and the diffusivity of each ion, see diffusivity(), are parameters named "<name>.<parameter>", e.g. the temperature "<name>.T". Models that share an electrolyte share these parameters. The temperature, density and viscosity may instead be given as expressions, e.g. fields of a heat equation or of a flow, which couples the models to them.

Parameters:
  • name (str) – Prefix of the parameter names.

  • domain (Domain) – The domain of the parameters.

  • ions (Sequence[Ion]) – The ions.

  • temperature (ExpressionOrDefault) – The temperature: an expression in K, e.g. the field of a heat equation, or the default value of the parameter the electrolyte creates.

  • density (ExpressionOrDefault) – Density of the solution: an expression in kg/m^3, e.g. a parameter shared with a flow model, or the default value of the parameter the electrolyte creates. None for no default.

  • viscosity (ExpressionOrDefault) – Dynamic viscosity of the solution, in Pa s, given like the density.

  • concentration_floor (float) – Default regularization of positive concentrations in mol/m^3, see positive_part().

Raises:

ValueError – If there are ions but none has a field, more than one ion has none, the ion without one has no charge, or two ions share a name.

property name: str#

Prefix of the parameter names.

property ions: Mapping[str, Ion]#

The ions by name, in the given order, as given.

property balanced: str | None#

Name of the ion that follows from electroneutrality, if any.

property F: Parameter#

Faraday’s constant.

property R: Parameter#

The gas constant.

property T: Expr#

The temperature, the parameter "<name>.T" unless given.

property floor: Parameter#

Regularization of positive concentrations.

property density: Expr#

Density of the solution.

property viscosity: Expr#

Dynamic viscosity of the solution.

positive_part(c)[source]#

The smooth positive part (c + sqrt(c^2 + floor^2)) / 2.

Reaction kinetics take it of the concentrations they react, see ButlerVolmer, so that a concentration that undershoots zero neither reverses a reaction nor enters a logarithm.

Parameters:

c (Expr) – A concentration.

Return type:

Expr

concentration(name)[source]#

Concentration of an ion, with its sign.

That is the field of a transported ion, and the expression given by electroneutrality for the ion without one. The conductivity uses it as it is, as Nernst-Planck migration does, so the current is the charge the ions carry, see current_density().

Parameters:

name (str) – Name of the ion.

Return type:

Expr

diffusivity(name)[source]#

Diffusivity of an ion in free electrolyte, the parameter D_<ion>.

Parameters:

name (str) – Name of the ion.

Return type:

Parameter

conductivity(correction=1.0)[source]#

The ionic conductivity \(\kappa\) of (43).

Parameters:

correction (Expr | float) – The correction \(t\) of every diffusivity, e.g. Bruggeman’s in a porous electrode.

Return type:

Expr

diffusion_current(correction=1.0)[source]#

The current of diffusion, \(F \sum_k z_k t D_k \nabla c_k\).

It is the current of (43) without migration.

Parameters:

correction (Expr | float) – See conductivity().

Return type:

Expr

current_density(potential, correction=1.0)[source]#

The current density \(\mathbf{i}_l\) of (43).

It is the charge the ions carry, with the Nernst-Planck fluxes of every ion, also the one given by (42), as the conductivity and the migration use the same concentrations.

Parameters:
Return type:

Expr

class sumfem.electrochemistry.Ion(name, charge, diffusivity, concentration=None)[source]#

An ion in an electrolyte solution.

The ion describes itself; the Electrolyte it is in gives its diffusivity as a parameter, Electrolyte.diffusivity(), and its concentration, Electrolyte.concentration(), which for the ion without a field follows from electroneutrality.

Parameters:
name#

Name of the ion, e.g. "V2".

Type:

str

charge#

Charge number z.

Type:

float

diffusivity#

Diffusion coefficient in free electrolyte, in m^2/s or a quantity with units, e.g. 1e-9 * syu.m**2 / syu.s. It is the default value of the parameter the electrolyte creates.

Type:

float | sympy.core.expr.Expr

concentration#

The field of a transported ion. None for the one ion whose concentration follows from electroneutrality.

Type:

sumfem.symbolic.terminals.Field | None

property field: Field#

The field of a transported ion.

Raises:

TypeError – For the ion given by electroneutrality.

Redox couples#

class sumfem.electrochemistry.RedoxCouple(reduced, oxidized, rate_constant, formal_potential, oxidation_on_discharge, electrons=1, anodic_transfer=0.5, cathodic_transfer=0.5, reactants=None, products=None)[source]#

A redox couple and its reaction at an electrode.

Oxidation turns the reduced ion into the oxidized one, as the reaction reactants -> products + n e-. The reactants hold the reduced ion and the products the oxidized one, and either may hold other species of the reaction, e.g. VO2+ + H2O -> VO2+ + 2 H+ + e- consumes water and produces protons. The coefficients are those of RateReaction. The kinetics are those of ButlerVolmer, in the concentrations of the couple.

The rate constant, the formal potential and the transfer coefficients are each an expression, used as given, e.g. a rate constant of a temperature field by Arrhenius’ law, or the default of the parameter of the half-cell of the couple, see expression_or_parameter().

reduced#

Name of the reduced ion, e.g. "V2".

Type:

str

oxidized#

Name of the oxidized ion, e.g. "V3".

Type:

str

rate_constant#

Standard rate constant, in m/s or with units.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

formal_potential#

Formal potential, in V or with units.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

oxidation_on_discharge#

Whether discharge oxidizes the couple, as in the negative half-cell of a battery; the positive half-cell reduces its couple on discharge.

Type:

bool

electrons#

Number of electrons n the reaction transfers.

Type:

int

anodic_transfer#

Anodic transfer coefficient.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

cathodic_transfer#

Cathodic transfer coefficient.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

reactants#

The coefficient of each ion that oxidation consumes, by name. Defaults to the reduced ion alone, e.g. {"VO": 1, "H2O": 1}.

Type:

Mapping[str, int] | None

products#

The coefficient of each ion that oxidation produces. Defaults to the oxidized ion alone, e.g. {"VO2": 1, "H": 2}.

Type:

Mapping[str, int] | None

Raises:

ValueError – If the reactants lack the reduced ion or the products the oxidized one.

Parameters:
property species: tuple[str, ...]#

the reactants, then the products.

Type:

Names of the ions of the reaction

check(ions)[source]#

Check the reaction against the ions of an electrolyte.

Raises:

ValueError – If an ion of the reaction is not among the ions, or the reaction does not conserve charge.

Parameters:

ions (Sequence[Ion])

Return type:

None

Porous electrodes#

class sumfem.electrochemistry.PorousElectrode(name, domain, markers=(), porosity=None, conductivity=None, specific_area=None, fiber_diameter=None, kozeny_carman_constant=None, pore_length=None)[source]#

A porous electrode of carbon fibers, filled with electrolyte.

Each property is an expression, used as given, e.g. a field of another model such as the porosity of a compressed felt or a conductivity of the temperature, or the default of the parameter "<name>.<property>", such as "<name>.porosity", in SI units or a quantity with units, e.g. 0.5 * syu.micrometer, see expression_or_parameter(). Models that share an electrode share these. A parameter without a default value must be set on the discretization before it is used.

Parameters:
  • name (str) – Prefix of the parameter names.

  • domain (Domain) – The domain of the parameters.

  • markers (tuple[str, ...]) – Cell markers of the electrode. Empty for the whole domain.

  • porosity (ExpressionOrDefault) – The porosity.

  • conductivity (ExpressionOrDefault) – The conductivity of the fiber material, in S/m.

  • specific_area (ExpressionOrDefault) – The specific area, in 1/m.

  • fiber_diameter (ExpressionOrDefault) – The fiber diameter, in m.

  • kozeny_carman_constant (ExpressionOrDefault) – The Kozeny-Carman constant.

  • pore_length (ExpressionOrDefault) – The characteristic pore length of Ergun’s drag, in m.

property markers: tuple[str, ...]#

Cell markers of the electrode.

property region: Region#

The electrolyte-filled pores, as a region.

property porosity: Expr#

Porosity.

property specific_area: Expr#

Specific area.

property fiber_diameter: Expr#

Fiber diameter.

effective_conductivity()[source]#

Bruggeman’s conductivity of the solid.

That is \(\sigma_\text{eff} = (1 - \varepsilon)^{3/2} \sigma\), with the conductivity \(\sigma\) of the fibres and the porosity \(\varepsilon\).

Return type:

Expr

permeability()[source]#

Kozeny-Carman permeability of the fibers, see kozeny_carman().

Return type:

Expr

forchheimer()[source]#

Ergun’s inertial drag coefficient, an estimate for fibres, see ergun_coefficient().

Return type:

Expr

class sumfem.electrochemistry.Region(markers=(), porosity=1.0, bruggeman_exponent=1.5)[source]#

Cells filled with electrolyte: free electrolyte, or an electrode’s pores.

Parameters:
markers#

Cell markers of the region. Empty for the whole domain.

Type:

tuple[str, …]

porosity#

Porosity of a porous electrode. Defaults to one, for free electrolyte.

Type:

ufl.core.expr.Expr | float

bruggeman_exponent#

Exponent of the Bruggeman correction of transport in the pores.

Type:

float

property storage: Expr | float#

Volume fraction of electrolyte, the porosity.

property transport: Expr | float#

Correction of diffusivities, Bruggeman’s \(\varepsilon^b\).

It is one in free electrolyte, with porosity one.

Models#

The equations of electrochemistry: residuals of the materials’ fields.

  • Charge and transport in the electrolyte: ElectrolyteConduction and NernstPlanck, with storage TransientNernstPlanck.

  • Kinetics: ExchangeCurrentButlerVolmer, ButlerVolmer, MassTransferButlerVolmer and PistonVelocityButlerVolmer, on ElectrodeReaction, with the Butler-Volmer equation butler_volmer().

  • Membranes: ProtonExchangeMembrane, with the flow of water of SchloeglFlow, whose current the protons of an electrode carry through its face, MembraneProtonFlux.

  • The flow of the electrolyte through the electrodes: any ElectrodeFlow, e.g. DarcyFlow, created from a FlowSetup.

The models import from the materials, and nothing from the cells.

Charge and transport#

class sumfem.electrochemistry.ElectrolyteConduction(name, potential, electrolyte, region=Region(markers=(), porosity=1.0, bruggeman_exponent=1.5))[source]#

Charge conservation in the electrolyte, \(-(\mathbf{i}_l, \nabla v)\).

The weak form of \(\nabla \cdot \mathbf{i}_l = 0\), with the current density \(\mathbf{i}_l\) of (43), the charge the ions carry, computed by the electrolyte’s current_density() with the diffusivities corrected for the region, \(t\) the region’s transport, as in (44). Sources, e.g. of an ElectrodeReaction, are added to it as models of their own.

Parameters:
  • name (str) – Name of the model.

  • potential (Field) – The electrolyte potential.

  • electrolyte (Electrolyte) – The electrolyte.

  • region (Region) – The region filled with electrolyte.

current_density()[source]#

The current density of the electrolyte in the region.

Return type:

Expr

residual()[source]#

Return this component’s contribution to the residual.

The form must be linear in test functions field.v and contain no trial functions. A contribution that is zero, e.g. for some inputs, is ufl.ZeroBaseForm((field.v,)): UFL drops the test function from a form whose terms vanish.

Return type:

Form

class sumfem.electrochemistry.NernstPlanck(name, ion, electrolyte, potential, region=Region(markers=(), porosity=1.0, bruggeman_exponent=1.5), velocity=None)[source]#

Nernst-Planck transport of one ion, \(-(\mathbf{N}, \nabla w)\).

The molar flux of the ion of charge \(z\) and concentration \(c\) is

(44)#\[\begin{aligned} \mathbf{N} &= -D_\text{eff} \nabla c - \frac{z F}{R T} D_\text{eff} c \nabla \phi + \mathbf{u} c, \end{aligned}\]

with its diffusivity \(D\) corrected for the region, \(D_\text{eff} = t D\) with \(t\) the region’s transport, the electrolyte potential \(\phi\) and the superficial velocity \(\mathbf{u}\). For transient transport, see TransientNernstPlanck.

Parameters:
  • name (str) – Name of the model.

  • ion (Ion) – The ion, one of the electrolyte’s with a field.

  • electrolyte (Electrolyte) – The electrolyte of the ion.

  • potential (Field) – The electrolyte potential phi.

  • region (Region) – The region filled with electrolyte.

  • velocity (ufl.core.expr.Expr | None) – The superficial velocity u. Defaults to zero, without advection.

Raises:
  • ValueError – If the ion is not in the electrolyte.

  • TypeError – If the ion follows from electroneutrality.

property ion: Ion#

The transported ion.

flux()[source]#

The molar flux N.

Return type:

Expr

residual()[source]#

Return this component’s contribution to the residual.

The form must be linear in test functions field.v and contain no trial functions. A contribution that is zero, e.g. for some inputs, is ufl.ZeroBaseForm((field.v,)): UFL drops the test function from a form whose terms vanish.

Return type:

Form

class sumfem.electrochemistry.TransientNernstPlanck(name, ion, electrolyte, potential, region=Region(markers=(), porosity=1.0, bruggeman_exponent=1.5), velocity=None)[source]#

Storage and Nernst-Planck transport of one ion.

The conservation law of the ion in a region of porosity \(\varepsilon\),

(45)#\[\begin{aligned} \varepsilon \frac{\partial c}{\partial t} + \nabla \cdot \mathbf{N} &= 0, \end{aligned}\]

with the flux \(\mathbf{N}\) of (44). Sources, e.g. of an ElectrodeReaction, are added to it as models of their own. It is the sum of "<name>_storage", an Accumulation weighted with the region’s storage, and "<name>_transport", a NernstPlanck.

Parameters:
  • name (str) – Name of the sum, and prefix of its summands’ names.

  • ion (Ion) – The ion, one of the electrolyte’s with a field.

  • electrolyte (Electrolyte) – The electrolyte of the ion.

  • potential (Field) – The electrolyte potential \(\phi\).

  • region (Region) – The region filled with electrolyte.

  • velocity (ufl.core.expr.Expr | None) – The superficial velocity \(\mathbf{u}\). Defaults to zero, without advection.

Raises:
  • ValueError – If the ion is not in the electrolyte.

  • TypeError – If the ion follows from electroneutrality.

property ion: Ion#

The transported ion.

flux()[source]#

The molar flux \(\mathbf{N}\), see NernstPlanck.flux().

Return type:

Expr

Kinetics#

class sumfem.electrochemistry.ElectrodeReaction(name, solid_potential, electrolyte_potential, electrolyte, reactants=None, products=None, specific_area=None, electrons=1, markers=())[source]#

An electrode reaction reactants -> products + n e- in a porous electrode.

A RateReaction that also moves charge between the phases. The volumetric current f = a i, with the specific area a and the interfacial current density i of current_density(), leaves the solid and enters the electrolyte. The reaction happens f / (n F) times per unit volume and time, so it consumes each reactant and produces each product at that rate times its coefficient, e.g. V2+ -> V3+ + e-, or VO2+ + H2O -> VO2+ + 2 H+ + e-, which also produces two protons and consumes one water molecule. Participants without a field get no source. Subclasses give the kinetics.

Parameters:
  • name (str) – Name of the model.

  • solid_potential (Field) – The potential of the solid, phi_s.

  • electrolyte_potential (Field) – The potential of the electrolyte, phi_l.

  • electrolyte (Electrolyte) – The electrolyte, for the constants and temperature.

  • reactants (Mapping[ufl.core.expr.Expr, int] | None) – The coefficient of each species that oxidation consumes, by concentration. None for a reaction that only moves charge.

  • products (Mapping[ufl.core.expr.Expr, int] | None) – The coefficient of each species that oxidation produces.

  • specific_area (ExpressionOrValue) – Specific area a. Defaults to the parameter "<name>.specific_area" in 1/m.

  • electrons (int) – Number of electrons n transferred.

  • markers (tuple[str, ...]) – Cell markers of the electrode. Empty for the whole domain.

property electrolyte: Electrolyte#

The electrolyte.

current_density()[source]#

The interfacial current density i.

Return type:

Expr

source()[source]#

The volumetric current f = a i.

Return type:

Expr

rate()[source]#

The rate f / (n F) of the reaction, per unit volume.

Return type:

Expr

residual()[source]#

Return this component’s contribution to the residual.

The form must be linear in test functions field.v and contain no trial functions. A contribution that is zero, e.g. for some inputs, is ufl.ZeroBaseForm((field.v,)): UFL drops the test function from a form whose terms vanish.

Return type:

Form

class sumfem.electrochemistry.ExchangeCurrentButlerVolmer(name, solid_potential, electrolyte_potential, electrolyte, exchange_current=None, equilibrium_potential=None, anodic_transfer=None, cathodic_transfer=None, reduced=None, oxidized=None, specific_area=None, electrons=1, markers=())[source]#

Butler-Volmer kinetics with a given exchange current density.

The current density of butler_volmer(), i = i0 (exp(alpha_a n F eta / (R T)) - exp(-alpha_c n F eta / (R T))) with eta = phi_s - phi_l - E_eq. The exchange current density may depend on concentrations. With both transfer coefficients one half and one electron, i = 2 i0 sinh(F eta / (2 R T)).

Parameters:
overpotential()[source]#

phi_s - phi_l - E_eq.

Return type:

Expr

current_density()[source]#

The interfacial current density i.

Return type:

Expr

class sumfem.electrochemistry.ButlerVolmer(name, solid_potential, electrolyte_potential, electrolyte, reduced, oxidized, specific_area=None, rate_constant=None, formal_potential=None, anodic_transfer=None, cathodic_transfer=None, electrons=1, markers=(), reactants=None, products=None)[source]#

Butler-Volmer kinetics of a redox couple of an electrolyte.

The Butler-Volmer equation, see butler_volmer(), with an exchange current density from the concentrations of the couple. The interfacial current density is

(46)#\[\begin{split}\begin{aligned} i &= n F \left( k_a c_\text{red}^s - k_c c_\text{ox}^s \right), \\ k_a &= k_0 e^{\alpha_a n F \eta / (R T)}, \\ k_c &= k_0 e^{-\alpha_c n F \eta / (R T)}, \\ \eta &= \phi_s - \phi_l - E_0, \end{aligned}\end{split}\]

with the standard rate constant \(k_0\), the transfer coefficients \(\alpha_a\) and \(\alpha_c\), the formal potential \(E_0\), and the concentrations \(c_\text{red}^s\) and \(c_\text{ox}^s\) of the reduced and oxidized ion at the electrode surface. These are, by default, the smooth positive parts of the bulk concentrations, \(c^+ = (c + \sqrt{c^2 + c_\text{floor}^2}) / 2\), see positive_part(). The reduced and oxidized ions are ions in the electrolyte, given by name.

Subclasses change the kinetics by overriding surface_concentrations(), rate_constants() or current_density().

Parameters:
  • name (str) – Name of the model.

  • solid_potential (Field) – See ElectrodeReaction.

  • electrolyte_potential (Field) – See ElectrodeReaction.

  • electrolyte (Electrolyte) – The electrolyte of the ions.

  • reduced (str) – Name of the reduced ion.

  • oxidized (str) – Name of the oxidized ion.

  • specific_area (ExpressionOrValue) – See ElectrodeReaction.

  • rate_constant (ExpressionOrValue) – Standard rate constant k0. Defaults to the parameter "<name>.rate_constant" in m/s.

  • formal_potential (ExpressionOrValue) – Formal potential E0. Defaults to the parameter "<name>.formal_potential" in V.

  • anodic_transfer (ExpressionOrValue) – Anodic transfer coefficient alpha_a. Defaults to the parameter "<name>.anodic_transfer", 0.5.

  • cathodic_transfer (ExpressionOrValue) – Cathodic transfer coefficient alpha_c. Defaults to the parameter "<name>.cathodic_transfer", 0.5.

  • electrons (int) – See ElectrodeReaction.

  • markers (tuple[str, ...]) – See ElectrodeReaction.

  • reactants (Mapping[str, int] | None) – The coefficient of each ion that oxidation consumes, by name, see ElectrodeReaction. Defaults to the reduced ion alone, e.g. {"VO": 1, "H2O": 1} for VO2+ + H2O -> VO2+ + 2 H+ + e-.

  • products (Mapping[str, int] | None) – The coefficient of each ion that oxidation produces. Defaults to the oxidized ion alone, e.g. {"VO2": 1, "H": 2}.

Raises:

ValueError – If the reactants lack the reduced ion or the products the oxidized one, or if an ion of the reaction other than the couple has no field, as the ion that follows from electroneutrality.

property reduced: Ion#

The reduced ion.

property oxidized: Ion#

The oxidized ion.

rate_constants()[source]#

The anodic and cathodic rate constants k_a and k_c.

Return type:

tuple[Expr, Expr]

surface_concentrations()[source]#

Concentrations of the reduced and oxidized ion at the surface.

These are the positive parts of the bulk concentrations.

Return type:

tuple[Expr, Expr]

current_density()[source]#

The interfacial current density i.

Return type:

Expr

equilibrium_potential()[source]#

Nernst’s potential E0 + R T / (n F) ln(c_ox / c_red).

The concentrations are the positive parts of the bulk ones, each plus the electrolyte’s concentration floor.

Return type:

Expr

overpotential()[source]#

phi_s - phi_l minus the equilibrium_potential().

Return type:

Expr

class sumfem.electrochemistry.MassTransferButlerVolmer(name, solid_potential, electrolyte_potential, electrolyte, reduced, oxidized, velocity, fiber_diameter=None, density=None, viscosity=None, sherwood_factor=7.0, reynolds_exponent=0.4, speed_floor=1e-16, transfer_floor=1e-14, specific_area=None, rate_constant=None, formal_potential=None, anodic_transfer=None, cathodic_transfer=None, electrons=1, markers=(), reactants=None, products=None)[source]#

Butler-Volmer kinetics limited by mass transfer to the fibers.

The surface concentrations of (46) are those at which mass transfer from the bulk, with the coefficients \(m_\text{red}\) and \(m_\text{ox}\), balances the reaction:

(47)#\[\begin{split}\begin{aligned} m_\text{red} \left( c_\text{red}^+ - c_\text{red}^s \right) &= k_a c_\text{red}^s - k_c c_\text{ox}^s, \\ m_\text{ox} \left( c_\text{ox}^s - c_\text{ox}^+ \right) &= k_a c_\text{red}^s - k_c c_\text{ox}^s, \end{aligned}\end{split}\]

two linear equations, solved in closed form. Each coefficient has a small floor added. The coefficients follow from the Sherwood number \(\mathrm{Sh} = a \, \mathrm{Re}^b\) of the flow past fibers of diameter \(d\):

(48)#\[\begin{split}\begin{aligned} m_\text{red} &= \mathrm{Sh} \frac{D_\text{red}}{d}, \\ m_\text{ox} &= \mathrm{Sh} \frac{D_\text{ox}}{d}, \\ \mathrm{Re} &= \frac{\rho |\mathbf{u}| d}{\mu}, \end{aligned}\end{split}\]

with the diffusivities \(D_\text{red}\) and \(D_\text{ox}\) of the reduced and oxidized ion in free electrolyte, and the density \(\rho\) and viscosity \(\mu\) of the electrolyte. The defaults \(a = 7\) and \(b = 0.4\) are the correlation of Krishnamurthy et al., 2011, and the surface concentrations those of equation 20 of Aghabarari et al., 2026.

Parameters:
  • name (str) – Name of the model.

  • solid_potential (Field) – See ButlerVolmer.

  • electrolyte_potential (Field) – See ButlerVolmer.

  • electrolyte (Electrolyte) – See ButlerVolmer.

  • reduced (str) – See ButlerVolmer.

  • oxidized (str) – See ButlerVolmer.

  • velocity (ufl.core.expr.Expr) – The superficial velocity u.

  • fiber_diameter (ExpressionOrValue) – Fiber diameter d. Defaults to the parameter "<name>.fiber_diameter" in m.

  • density (ExpressionOrValue) – Density rho of the electrolyte. Defaults to the density of the electrolyte.

  • viscosity (ExpressionOrValue) – Dynamic viscosity mu of the electrolyte. Defaults to the viscosity of the electrolyte.

  • sherwood_factor (float) – The factor a of the Sherwood number.

  • reynolds_exponent (float) – The exponent b of the Sherwood number.

  • speed_floor (float) – Regularization of |u|, in m/s.

  • transfer_floor (float) – Regularization added to k_m, in m/s.

  • specific_area (ExpressionOrValue) – See ButlerVolmer.

  • rate_constant (ExpressionOrValue) – See ButlerVolmer.

  • formal_potential (ExpressionOrValue) – See ButlerVolmer.

  • anodic_transfer (ExpressionOrValue) – See ButlerVolmer.

  • cathodic_transfer (ExpressionOrValue) – See ButlerVolmer.

  • electrons (int) – See ButlerVolmer.

  • markers (tuple[str, ...]) – See ButlerVolmer.

  • reactants (Mapping[str, int] | None)

  • products (Mapping[str, int] | None)

reynolds_number()[source]#

The Reynolds number rho |u| d / mu of the flow past a fiber.

Return type:

Expr

mass_transfer_coefficients()[source]#

The mass-transfer coefficients of the reduced and oxidized ion.

Return type:

tuple[Expr, Expr]

surface_concentrations()[source]#

Surface concentrations balancing reaction and mass transfer.

Return type:

tuple[Expr, Expr]

class sumfem.electrochemistry.PistonVelocityButlerVolmer(name, solid_potential, electrolyte_potential, electrolyte, reduced, oxidized, fiber_distance=None, transfer_floor=1e-14, **kwargs)[source]#

Butler-Volmer kinetics limited by diffusion between the fibres.

The surface concentrations balance the reaction with mass transfer as in (47), with the piston velocities

(49)#\[\begin{split}\begin{aligned} m_\text{red} &= \frac{D_\text{red}}{\delta}, \\ m_\text{ox} &= \frac{D_\text{ox}}{\delta}, \end{aligned}\end{split}\]

the diffusivities of the reduced and oxidized ion in free electrolyte over the mean distance \(\delta\) between the fibres, see equations 23 and 24 of Shah et al., 2008. Unlike MassTransferButlerVolmer, the transfer does not depend on the flow.

Parameters:
mass_transfer_coefficients()[source]#

The piston velocities D / delta of the reduced and oxidized ion.

Return type:

tuple[Expr, Expr]

surface_concentrations()[source]#

Surface concentrations balancing reaction and mass transfer.

Return type:

tuple[Expr, Expr]

Membranes#

class sumfem.electrochemistry.ProtonExchangeMembrane(name, potential, markers, water=None, pressure=None, fixed_charge=None, proton_diffusivity=None, water_diffusivity=None, electrokinetic_permeability=None, hydraulic_permeability=None, viscosity=None, temperature=298.15)[source]#

A proton-exchange membrane saturated with water.

The membrane of Bernardi and Verbrugge, 1991, as in the full cell of Shah et al., 2008, Section 3.2. Its fixed charges, of concentration \(c_f\), are neutralized by protons, the only mobile ions, so the proton concentration is \(c_\text{H} = c_f\) throughout. The membrane is then an Ohmic conductor for the electrolyte potential \(\phi\), and the water, of concentration \(c_w\), moves with the velocity \(\mathbf{v}\) of (51):

(50)#\[\begin{split}\begin{aligned} -\nabla \cdot (\kappa_m \nabla \phi) &= 0, \\ \kappa_m &= \frac{F^2}{R T} D_\text{H} c_f, \\ \frac{\partial c_w}{\partial t} + \nabla \cdot (-D_w \nabla c_w + \mathbf{v} c_w) &= 0, \end{aligned}\end{split}\]

with the proton and water diffusivities \(D_\text{H}\) and \(D_w\) of the membrane. The current density \(-\kappa_m \nabla \phi\) uses the sign of ElectrolyteConduction, so with one potential across the membrane and the electrodes beside it, the current is continuous across its faces, and so is the flux of water with one water field.

Every equation is a bulk equation on the cells of the membrane, markers, whose thickness the mesh resolves. Its fields may extend beyond them: in a FullCell the potential and the water live on both electrodes and the membrane, and each electrode’s models add the equations there. The faces then need no term of their own for these fields: their continuity, and that of their fluxes, is natural. The protons are not a field of the membrane; the faces pass them to the electrodes’ own fields with proton_flux(), one condition per face.

The membrane is the sum of "<name>_conduction", a Conduction; with a water field, "<name>_water_storage", an Accumulation, and "<name>_water_diffusion", a Diffusion; and with a pressure, "<name>_flow", a SchloeglFlow, and "<name>_water_advection", a ConservativeAdvection of the water. Without a pressure, the water does not flow, and only diffuses.

The membrane creates its constants and properties as parameters named "<name>.<parameter>": Faraday’s constant, the gas constant and the temperature, see Electrolyte, and one for each argument from fixed_charge on, with the argument as its default value.

Parameters:
  • name (str) – Name of the membrane, and prefix of its parameters and models.

  • potential (Field) – The electrolyte potential \(\phi\), e.g. one field over the membrane and the electrodes.

  • markers (tuple[str, ...]) – Cell markers of the membrane.

  • water (Field | None) – The water concentration \(c_w\), or None without water transport.

  • pressure (Field | None) – The pressure \(p\) of (51), or None without flow.

  • fixed_charge (ExpressionOrDefault) – The concentration \(c_f\) of fixed charges, in mol/m^3 or with units.

  • proton_diffusivity (ExpressionOrDefault) – \(D_\text{H}\) in the membrane, in m^2/s or with units.

  • water_diffusivity (ExpressionOrDefault) – \(D_w\) in the membrane, in m^2/s or with units.

  • electrokinetic_permeability (ExpressionOrDefault) – \(k_\phi\), in m^2 or with units.

  • hydraulic_permeability (ExpressionOrDefault) – \(k_p\), in m^2 or with units.

  • viscosity (ExpressionOrDefault) – The viscosity \(\mu\) of water, in Pa s or with units.

  • temperature (ExpressionOrDefault) – The temperature \(T\): an expression in K, e.g. the field of a heat equation, or the default value of a parameter.

property potential: Field#

The electrolyte potential.

property fixed_charge: Expr#

The concentration of the fixed charges.

property markers: tuple[str, ...]#

Cell markers of the membrane.

property constants: Electrolyte#

Faraday’s constant, the gas constant and the temperature.

current_density()[source]#

The current density \(-\kappa_m \nabla \phi\) of the membrane.

Return type:

Expr

proton_flux(name, protons, measure, charge=1.0)[source]#

The membrane current carried by the protons of an electrode.

See MembraneProtonFlux.

Parameters:
  • name (str) – Name of the model.

  • protons (Field) – The proton concentration of the electrode.

  • measure (Measure) – The interface measure of the face, with the electrode on its "+" side and the membrane on its "-" side, from interface().

  • charge (float) – The charge number of the protons.

Returns:

The proton flux at the face.

Return type:

MembraneProtonFlux

property velocity: Expr#

The velocity of the water in the membrane, zero without a pressure.

It holds on the membrane’s cells only, see SchloeglFlow.

proton_conditions(protons, faces)[source]#

The proton concentration of the membrane at its faces.

Electroneutrality holds the protons at the concentration of the fixed charges, also where the electrodes meet the membrane.

Parameters:
  • protons (Sequence[Field]) – The proton concentrations of the electrodes beside the membrane.

  • faces (str | tuple[str, ...]) – Facet markers of the faces of the membrane.

Returns:

The conditions \(c_\text{H} = c_f\) on the faces.

Return type:

list[DirichletBC]

class sumfem.electrochemistry.SchloeglFlow(name, pressure, potential, charge_density=None, electrokinetic_permeability=None, hydraulic_permeability=None, viscosity=None, markers=())[source]#

Flow of water through a charged membrane, by Schlögl’s equation.

The protons that neutralize the fixed charges of the membrane drag the water with them, so the velocity of the water has an electro-osmotic part besides the pressure-driven one:

(51)#\[\begin{split}\begin{aligned} \mathbf{v} &= -\frac{k_\phi}{\mu} \rho \nabla \phi - \frac{k_p}{\mu} \nabla p, \\ \nabla \cdot \mathbf{v} &= 0, \end{aligned}\end{split}\]

with the electrokinetic and hydraulic permeabilities \(k_\phi\) and \(k_p\), the viscosity \(\mu\) of water, and the charge density \(\rho = F c_\text{H}\) of the mobile protons. The residual is \(-(\mathbf{v}, \nabla q)\) on the pressure, as for Darcy flow.

The equation is a bulk equation on the cells of the membrane, markers, and the velocity holds there only: \(\rho\) is the charge of the membrane’s mobile ions, which the fixed charges set. With one pressure over the membrane and the electrodes beside it, each with a flow model of its own, the pressure is continuous across the faces, and so, weakly, is the normal velocity.

Parameters:
  • name (str) – Name of the model.

  • pressure (Field) – The pressure \(p\).

  • potential (ufl.core.expr.Expr) – The electrolyte potential \(\phi\).

  • charge_density (ExpressionOrValue) – The charge density \(\rho\) of the mobile ions. Defaults to the parameter "<name>.charge_density" in C/m^3.

  • electrokinetic_permeability (ExpressionOrValue) – \(k_\phi\). Defaults to the parameter "<name>.electrokinetic_permeability" in m^2.

  • hydraulic_permeability (ExpressionOrValue) – \(k_p\). Defaults to the parameter "<name>.hydraulic_permeability" in m^2.

  • viscosity (ExpressionOrValue) – \(\mu\). Defaults to the parameter "<name>.viscosity" in Pa s.

  • markers (tuple[str, ...]) – Cell markers of the membrane. Empty for the whole domain.

property velocity: Expr#

The velocity \(\mathbf{v}\) of (51).

residual()[source]#

Return this component’s contribution to the residual.

The form must be linear in test functions field.v and contain no trial functions. A contribution that is zero, e.g. for some inputs, is ufl.ZeroBaseForm((field.v,)): UFL drops the test function from a form whose terms vanish.

Return type:

Form

class sumfem.electrochemistry.MembraneProtonFlux(name, protons, membrane, measure, charge=1.0)[source]#

The protons of an electrode carry the current of a membrane beside it.

A cation-exchange membrane passes protons only, so at the face between an electrode and the membrane the protons of the electrode carry the whole current \(\mathbf{i}_m\) of the membrane,

(52)#\[\begin{aligned} \mathbf{N}_\text{H} \cdot \mathbf{n} &= \frac{\mathbf{i}_m \cdot \mathbf{n}}{z_\text{H} F}, \end{aligned}\]

with the normal \(\mathbf{n}\) out of the electrode, and every other ion has no flux. The residual is \((\mathbf{N}_\text{H} \cdot \mathbf{n}, w)\) on the face, with the test function \(w\) of the protons. The current is that of the membrane’s side of the face, ProtonExchangeMembrane.current_density().

With the ion of the electrolyte that follows from electroneutrality, e.g. sulfate, the zero flux of that ion is no natural condition: it holds when the protons carry the current, by this condition. The proton concentration at the face is not held at the fixed charge, so the model has no Donnan potential across the face.

The condition is a surface term of the electrode’s proton equation, on one face of the membrane and from one side, the electrode’s: each face needs its own, with the protons of the electrode on that face. It is not an equation of the membrane, which has no proton field.

Parameters:
  • name (str) – Name of the model.

  • protons (Field) – The proton concentration \(c_\text{H}\) of the electrode.

  • membrane (ProtonExchangeMembrane) – The membrane.

  • measure (ufl.Measure) – The interface measure of the face, with the electrode on its "+" side and the membrane on its "-" side, from interface().

  • charge (float) – The charge number \(z_\text{H}\) of the protons.

Raises:

ValueError – If the measure is not that of an interface with the membrane on its "-" side and the protons’ subdomain on its "+" side.

flux()[source]#

The proton flux \(\mathbf{N}_\text{H} \cdot \mathbf{n}\) out of the electrode, on its side of the face.

Return type:

Expr

residual()[source]#

Return this component’s contribution to the residual.

The form must be linear in test functions field.v and contain no trial functions. A contribution that is zero, e.g. for some inputs, is ufl.ZeroBaseForm((field.v,)): UFL drops the test function from a form whose terms vanish.

Return type:

Form

Flow through the electrodes#

class sumfem.electrochemistry.ElectrodeFlow(setup)[source]#

The flow of the electrolytes through the electrodes of a full cell.

A flow gives the cell the superficial velocity \(\mathbf{u}\) of each electrode, velocity(), which carries the ions in the electrode, out of its outlet and to its tank, and its own models and conditions, which the cell adds to its own. The cell holds the ions’ inflow at the inlets itself, (56), so the flow needs to take in the electrolyte there at the inlet velocity of the FlowSetup.

A subclass creates its unknowns and models from the setup in its constructor. Its models may hold time derivatives, e.g. of the velocity of transient Stokes flow, which the cell’s simulation steps in time with the rest. Its pressure lives on FlowSetup.electrolyte, which the cell shares with what lies between the electrodes, see FullCell.

Example

Darcy flow with a storage of the pressure, a flow that changes in time, is DarcyFlow with one more model, given to the cell by its FlowSpec:

class StoredDarcyFlow(DarcyFlow):
    @property
    def models(self):
        storage = Accumulation(
            f"{self.setup.name}_storage",
            self.pressure,
            weight=storativity,
            markers=("NegativeElectrode", "PositiveElectrode"),
        )
        return [*super().models, storage]

flow = FlowSpec(inlet_velocity=v_in, model=StoredDarcyFlow)

A Brinkman-Forchheimer or a transient Stokes flow creates a velocity field on each electrode’s subdomain, FlowSetup.subdomains, and its pressure on the electrolyte’s, FlowSetup.electrolyte, with BrinkmanForchheimer or Stokes and an Accumulation of the velocity, returns them from velocity() and pressure, and holds the inlet velocity on the velocity in conditions().

Parameters:

setup (FlowSetup) – What the cell gives the flow.

property setup: FlowSetup#

What the cell gives the flow.

abstract velocity(side)[source]#

The superficial velocity in a side’s electrode.

Parameters:

side (str) – "negative" or "positive".

Return type:

Expr

abstract property models: list[Residual]#

The models of the flow, which the cell adds to its own.

abstract property pressure: Field#

The pressure of the flow, on FlowSetup.electrolyte.

conditions()[source]#

The Dirichlet conditions of the flow, none by default.

Return type:

list[DirichletBC]

initialize(discretization)[source]#

Set the initial state of the flow’s unknowns, none by default.

Parameters:

discretization (Discretization) – The discretization of the cell.

Return type:

None

class sumfem.electrochemistry.DarcyFlow(setup)[source]#

Darcy flow through the electrodes, with one pressure.

The pressure \(p\) lives on FlowSetup.electrolyte, see ElectrodeFlow.pressure. In each electrode it follows Darcy flow, "<name>_<side>_darcy", with the Kozeny-Carman permeability of its fibres, PorousElectrode.permeability(), and the viscosity of its electrolyte.

The electrolyte enters each electrode at its inlet at the inlet velocity, "<name>_<side>_inflow", a BoundaryFlux, and leaves at its outlet, held at the outlet pressure, conditions().

The pressure’s scale is the pressure drop of a uniform flow at the inlet velocity through the negative electrode over the domain’s length scale, if the defaults give it, else one pascal.

Parameters:

setup (FlowSetup) – What the cell gives the flow.

velocity(side)[source]#

The superficial velocity of the side’s Darcy flow.

Parameters:

side (str) – "negative" or "positive".

Return type:

Expr

property models: list[Residual]#

The Darcy flow and the inflow of each electrode.

property pressure: Field#

The pressure, on FlowSetup.electrolyte.

conditions()[source]#

The outlet pressure at both outlets.

Return type:

list[DirichletBC]

initialize(discretization)[source]#

Set the pressure to the outlet pressure.

Parameters:

discretization (Discretization) – The discretization of the cell.

Return type:

None

class sumfem.electrochemistry.FlowSetup(name, domain, electrolyte, electrodes, subdomains, viscosities, densities, inlets, outlets, inlet_velocity, outlet_pressure, degree)[source]#

What a full cell gives the flow of its electrolytes.

Parameters:
name#

Prefix of the flow’s models and parameters, the cell’s name.

Type:

str

domain#

The domain of the cell.

Type:

sumfem.symbolic.domains.Domain

electrolyte#

The subdomain of the electrolyte, the electrodes and what lies between them, where the pressure lives.

Type:

sumfem.symbolic.domains.Subdomain

electrodes#

The porous electrodes, by side, "negative" and "positive", with their cell markers and properties, e.g. the permeability of their fibres.

Type:

Mapping[str, sumfem.electrochemistry.materials.electrode.PorousElectrode]

subdomains#

The subdomain of each electrode, by side, e.g. for a velocity field of the electrode.

Type:

Mapping[str, sumfem.symbolic.domains.Subdomain]

viscosities#

The dynamic viscosity of each side’s electrolyte.

Type:

Mapping[str, ufl.core.expr.Expr]

densities#

The density of each side’s electrolyte.

Type:

Mapping[str, ufl.core.expr.Expr]

inlets#

The facet marker of each electrode’s inlet, by side.

Type:

Mapping[str, str]

outlets#

The facet marker of each electrode’s outlet, by side.

Type:

Mapping[str, str]

inlet_velocity#

The superficial velocity at the inlets.

Type:

ufl.core.expr.Expr

outlet_pressure#

The gauge pressure at the outlets.

Type:

ufl.core.expr.Expr

degree#

The degree of the Lagrange elements of the cell’s unknowns.

Type:

int

Cells#

Cells of a redox flow battery, assembled from the materials and models.

  • Half-cells: RedoxHalfCell, negative or positive, of any redox couple and electrolyte.

  • Full cells: FullCell, two half-cells, each a HalfCellSpec, and a membrane between them, a MembraneSpec, with the flow of the electrolytes from their tanks, a FlowSpec.

Half-cells#

class sumfem.electrochemistry.RedoxHalfCell(domain, ions, reservoir, couple, electrode, channels=(), velocity=None, mass_transfer=None, fiber_distance=None, collector=('CurrentCollector',), membrane=('Membrane',), outlet=(), proton_flux=False, density=1399.8, viscosity=0.006963, temperature=298.15, degree=1, name='cell', phi_s=None, phi_l=None, fields=None, electrolyte_name='electrolyte')[source]#

A half-cell of a redox flow battery, of a couple of dissolved ions.

The macro-homogeneous porous-electrode model of RFBniCS, Aghabarari et al., 2026, Section II, for any couple, electrolyte and sign of the half-cell.

The unknowns are the potential \(\phi_s\) of the solid and \(\phi_l\) of the electrolyte, and the concentration \(c_k\) of every ion with a reservoir concentration. In the porous electrode, of porosity \(\varepsilon\) and specific area \(a\), charge is conserved in the solid and the electrolyte, which exchange the current \(a i\) of the reaction, and each ion is stored, transported and produced:

(53)#\[\begin{split}\begin{aligned} -\nabla \cdot (\sigma_\text{eff} \nabla \phi_s) + a i &= 0, \\ \nabla \cdot \mathbf{i}_l - a i &= 0, \\ \varepsilon \frac{\partial c_k}{\partial t} + \nabla \cdot \mathbf{N}_k &= \nu_k \frac{a i}{n F}, \\ \sum_k z_k c_k &= 0. \end{aligned}\end{split}\]

The terms are those of the components of the cell:

  • \(\sigma_\text{eff}\), the effective conductivity of the solid, PorousElectrode.effective_conductivity;

  • \(\mathbf{i}_l\), the current density of the electrolyte, (43);

  • \(\mathbf{N}_k\), the Nernst-Planck flux of the ion of charge \(z_k\), (44), with the superficial velocity \(\mathbf{u}\) of the electrolyte;

  • \(i\), the interfacial current density of the couple, (46), at surface concentrations limited by mass transfer, (47), with flow or a fibre distance;

  • \(\nu_k\) and \(n\), the coefficient of the ion in the reaction of the couple, negative for a reactant, positive for a product and zero for an ion that takes no part, and the number of electrons, see RedoxCouple.

The one ion without a reservoir concentration follows from electroneutrality, the last equation. In free channels, \(\varepsilon = 1\) and there is no reaction or solid.

The cell is galvanostatic, with the current density \(j\) of the cell through the membrane, positive on discharge. On discharge the couple is oxidized in the negative half-cell, \(s = 1\), and reduced in the positive one, \(s = -1\). With the outward normal \(\mathbf{n}\), the current enters the solid at the current collector and leaves the electrolyte at the membrane,

(54)#\[\begin{split}\begin{aligned} \sigma_{\text{eff}} \nabla \phi_s \cdot \mathbf{n} &= s j r && \text{at the current collector}, \\ \mathbf{i}_l \cdot \mathbf{n} &= s j && \text{at the membrane}, \\ \mathbf{N}_\text{H} \cdot \mathbf{n} &= \frac{s j}{z_\text{H} F} && \text{at the membrane, with a proton flux}, \\ (\mathbf{N}_k - \mathbf{u} c_k) \cdot \mathbf{n} &= 0 && \text{at an outlet}, \end{aligned}\end{split}\]

where the ratio \(r\) of the membrane area to the collector area makes the total currents equal, see balance_currents(). Other boundaries carry no flux.

The model, model, is the sum of:

  • "<name>_solid": the first equation of (53) without the reaction, Conduction;

  • "<name>_reaction": the kinetics (46), with (47) under mass transfer, ButlerVolmer, MassTransferButlerVolmer with mass transfer, or PistonVelocityButlerVolmer with a fibre distance, which adds the reaction to (53);

  • with collector and membrane markers, "<name>_collector_current" and "<name>_membrane_current": the first two conditions of (54), BoundaryFlux;

  • for the electrode’s pores and, with a suffix "_channels", the free channels: the charge in the electrolyte, ElectrolyteConduction, and the balance (45) of every ion, TransientNernstPlanck, named "<name>_<ion>", whose summands are "<name>_<ion>_storage" and "<name>_<ion>_transport";

  • with an outlet, "<name>_outflow_<ion>": the outlet condition, Outflow;

  • with a proton flux, "<name>_proton_flux": the proton condition at the membrane, a BoundaryFlux of the ion "H".

Parameters:
  • domain (Domain) – The domain of the cell.

  • ions (Sequence[Ion]) – The ions of the electrolyte, with their charges \(z_k\) and diffusivities \(D_k\), without fields: the cell creates the field of every ion that has a reservoir concentration.

  • reservoir (Mapping[str, float | sympy.Expr]) – The concentration of each transported ion in the reservoir, in mol/m^3 or a quantity with units, the default of the parameter "<name>.c0_<ion>".

  • couple (RedoxCouple) – The redox couple and its reaction: the coefficients \(\nu_k\), \(n\) and \(s\), and the kinetics (46), whose parameters are those of the cell: "<name>.rate_constant" \(k_0\), "<name>.formal_potential" \(E_0\), "<name>.anodic_transfer" \(\alpha_a\) and "<name>.cathodic_transfer" \(\alpha_c\).

  • electrode (PorousElectrode) – The porous electrode: \(\varepsilon\), \(a\) and \(\sigma\).

  • channels (tuple[str, ...]) – Cell markers of free channels. Empty for none.

  • velocity (ufl.core.expr.Expr | None) – The superficial velocity \(\mathbf{u}\), or None without flow.

  • mass_transfer (bool | None) – Limit the kinetics by mass transfer to the fibres, (47), with the coefficients of the flow’s correlation, (48), which needs a velocity. Defaults to whether there is one.

  • fiber_distance (ExpressionOrDefault) – The mean distance \(\delta\) between the fibres, in m or with units. Limits the kinetics by (47) with the piston velocities, (49), instead, with or without flow.

  • collector (tuple[str, ...] | None) – Facet markers of the current collector, or None for a cell whose collector is resolved, e.g. in a full cell.

  • membrane (tuple[str, ...] | None) – Facet markers of the membrane, or None for a cell whose membrane is resolved.

  • outlet (tuple[str, ...]) – Facet markers of an outlet. Empty for none.

  • proton_flux (bool) – Carry the membrane current by protons, the ion "H", through the membrane, the third condition of (54).

  • density (ExpressionOrDefault) – Density of the electrolyte, for the mass transfer, see Electrolyte. Pass the parameter of a flow model to share it.

  • viscosity (ExpressionOrDefault) – Dynamic viscosity of the electrolyte, given like the density.

  • temperature (ExpressionOrDefault) – The temperature of the electrolyte, an expression, e.g. the field of a heat equation, or the default of its parameter, in K, see Electrolyte.

  • degree (int) – Degree of the Lagrange elements of the unknowns.

  • name (str) – Prefix of the cell’s own parameters, "<name>.<parameter>", and of the names of its models, "<name>_<model>". The current density \(j\) is the parameter "<name>.current", in A/m^2, and the area ratio \(r\) "<name>.area_ratio".

  • phi_s (Field | None) – The potential \(\phi_s\) of the solid, if it exists, e.g. over the electrode and its current collector. Created on the domain otherwise.

  • phi_l (Field | None) – The potential \(\phi_l\) of the electrolyte, if it exists, e.g. over the electrodes and the membrane of a full cell.

  • fields (Mapping[str, Field] | None) – Existing fields of transported ions, by name, e.g. of water shared with a membrane. The others are created on the domain.

  • electrolyte_name (str) – Prefix of the parameters of the electrolyte, see Electrolyte.

Raises:

ValueError – For mass transfer or an outlet without a velocity, a proton flux without membrane markers, a reservoir concentration of an ion that the electrolyte does not have, a reservoir that lacks not exactly one ion, an ion of the reaction without one, a reaction that does not conserve charge, or a balanced ion without charge.

property couple: RedoxCouple#

The redox couple and its reaction.

property model: Residual#

The sum of all models of the cell.

property electrode: PorousElectrode#

The porous electrode.

property electrolyte: Electrolyte#

The electrolyte.

property reaction: ButlerVolmer#

The reaction in the electrode.

property phi_s: Field#

Potential of the solid.

property phi_l: Field#

Potential of the electrolyte.

property concentrations: Mapping[str, Field]#

Concentration of each transported ion, by ion name.

property inlet: Mapping[str, Parameter]#

Reservoir concentration of each transported ion, by ion name.

property current: Parameter#

Current density through the membrane, positive on discharge.

property formal_potential: Expr#

Formal potential of the couple.

property area_ratio: Parameter#

Ratio of the membrane area to the current collector area.

inlet_conditions(markers)[source]#

The reservoir concentration of every transported ion on some facets.

Parameters:

markers (str | tuple[str, ...])

Return type:

list[DirichletBC]

reservoir_concentration(ion)[source]#

The reservoir concentration of a transported ion, as given.

Parameters:

ion (str) – The name of the ion.

Returns:

The default of its parameter "<name>.c0_<ion>", in mol/m^3.

Return type:

float

equilibrium_potential(discretization)[source]#

Nernst’s potential of the couple at its reservoir concentrations.

That is E0 + R T / (n F) ln(c_ox / c_red), see equilibrium_potential(), with the reservoir concentrations as given, reservoir_concentration(), averaged over the electrode, so that a formal potential or a temperature given as an expression, e.g. of a field, counts with its values on the discretization.

Parameters:

discretization (Discretization) – The discretization, for the values of the formal potential, the constants and any fields they hold.

Returns:

The mean potential in V.

Return type:

float

initialize(discretization)[source]#

Set a state at rest, as RFBniCS starts.

The concentrations start at their reservoir values, the solid at zero and the electrolyte at minus the formal potential, its mean over the electrode if it is an expression.

Parameters:

discretization (Discretization)

Return type:

None

balance_currents(discretization)[source]#

Set the area ratio from the areas of membrane and current collector.

Raises:

ValueError – For a cell without collector or membrane markers.

Parameters:

discretization (Discretization)

Return type:

None

voltage(discretization)[source]#

The half-cell voltage in V.

That is the mean solid potential on the current collector minus the mean electrolyte potential on the membrane.

Raises:

ValueError – For a cell without collector or membrane markers.

Parameters:

discretization (Discretization)

Return type:

float

state_of_charge(discretization)[source]#

The share of the reduced ion in the couple, over the cell.

Parameters:

discretization (Discretization)

Return type:

float

minimum_balanced_concentration(discretization)[source]#

The smallest concentration of the ion given by electroneutrality.

Nothing keeps that concentration positive. A negative minimum means the electrolyte cannot stay neutral with the computed concentrations, e.g. after a time step that is too long, or because the balanced ion is not abundant enough, see Electrolyte.

Parameters:

discretization (Discretization) – The discretization of the cell.

Returns:

The minimum over the nodes of the concentrations’ space, over all processes.

Return type:

float

local_state_of_charge()[source]#

The share of the reduced ion in the couple, c_red / (c_red + c_ox).

Return type:

Expr

Full cells#

class sumfem.electrochemistry.FullCell(domain, negative, positive, membrane=MembraneSpec(fixed_charge=None, proton_diffusivity=None, water_diffusivity=None, electrokinetic_permeability=None, hydraulic_permeability=None, viscosity=None, temperature=298.15), collector_conductivity=1000.0, flow=None, degree=1, name='cell')[source]#

The full cell of a redox flow battery.

The cell of Shah et al., 2008, corrected: from left to right, a current collector, the negative porous electrode, a proton-exchange membrane, the positive porous electrode and a current collector, each a layer of the mesh, see mesh_data(). Each unknown lives where it is defined: the potential of each side’s solid on its collector and electrode, the electrolyte potential, the water and, with flow, the pressure on both electrodes and the membrane, and the other ions of each side in its electrode.

The cell is made of:

  • a RedoxHalfCell for each side, whose collector and membrane are layers of the mesh;

  • the ProtonExchangeMembrane, whose protons carry the current through each face, MembraneProtonFlux, so the ion that follows from electroneutrality, e.g. sulfate, stays on its side. Shah et al. hold the protons at the fixed charge at the faces instead, which lets that ion carry part of the current through them;

  • Ohmic conduction in the collectors, Conduction;

  • the current density of the cell at the positive terminal, with the negative terminal grounded, see conditions();

  • with flow, the flow of the electrolytes through the electrodes from their inlets to their outlets, (56), an ElectrodeFlow such as DarcyFlow, see flow, and tanks, update_tanks().

Parameters:
  • domain (Domain) – The domain of the cell, with the markers of mesh_data().

  • negative (HalfCellSpec) – The negative side.

  • positive (HalfCellSpec) – The positive side.

  • membrane (MembraneSpec) – The properties of the membrane. Parameters without defaults by default.

  • collector_conductivity (ExpressionOrDefault) – The conductivity of the collectors: an expression, used as given, e.g. one of the temperature, or the default of the parameter "<name>.collector_conductivity", in S/m or with units.

  • flow (FlowSpec | None) – The flow of the electrolytes, None for none.

  • degree (int) – Degree of the Lagrange elements of the unknowns.

  • name (str) – Prefix of the cell’s own parameters and models.

Raises:

ValueError – If only one side transports water.

static mesh_data(marked)[source]#

Mesh data with the unions of the layers the cell’s unknowns live on.

The cell’s mesh has the cell markers of its layers, "NegativeCollector", "NegativeElectrode", "Membrane", "PositiveElectrode" and "PositiveCollector", and the facet markers "NegativeTerminal" and "PositiveTerminal", the outer faces of the collectors, "NegativeFace" and "PositiveFace", the faces of the membrane, and with flow, "NegativeInlet", "NegativeOutlet", "PositiveInlet" and "PositiveOutlet", the ends of the electrodes. This adds "NegativeSolid" and "PositiveSolid", a collector and its electrode, and "Electrolyte", the electrodes and the membrane.

Parameters:

marked (MeshData) – Mesh data with the layers and the facet markers.

Returns:

The mesh data with the cell markers "NegativeSolid", "PositiveSolid" and "Electrolyte" added.

Return type:

MeshData

property model: Residual#

The sum of all models of the cell.

These are the models of the half-cells, "negative_<model>" and "positive_<model>", of the membrane, "<name>_membrane_<model>", the conduction in the collectors, "<name>_<side>_collector", the current at the positive terminal, "<name>_terminal_current", the proton fluxes at the faces, "<name>_<side>_protons", and with flow, the models of the flow, e.g. those of DarcyFlow, and the inflow of each ion of each electrode, "<name>_<side>_inflow_<ion>".

property half_cells: Mapping[str, RedoxHalfCell]#

The half-cells, "negative" and "positive".

property membrane: ProtonExchangeMembrane#

The membrane.

property phi_l: Field#

Potential of the electrolyte, over the electrodes and the membrane.

property water: Field | None#

Concentration of the water, if transported.

property flow: ElectrodeFlow | None#

The flow of the electrolytes, if any.

property pressure: Field | None#

The pressure of the flow over the electrodes and the membrane, None without flow.

property current: Parameter#

Current density of the cell, positive on discharge.

subdomain(marker)[source]#

The subdomain of a cell marker of the cell, e.g. "Membrane".

Parameters:

marker (str)

Return type:

Subdomain

conditions()[source]#

The Dirichlet conditions of the cell.

These are the negative terminal at zero potential, which fixes the potentials, and with flow, those of the flow, e.g. the outlet pressure of DarcyFlow.

Return type:

list[DirichletBC]

initialize(discretization)[source]#

Set a state at rest, as Shah et al. start.

The concentrations start at the reservoir values of the sides, the defaults of their parameters "<side>.c0_<ion>", the electrolyte potential at zero, the solid of each side at the equilibrium potential of its couple at those concentrations, by Nernst’s equation, so that no current flows, and the flow as it initializes itself, see ElectrodeFlow.initialize.

Raises:

ValueError – If the sides start with different water concentrations, which one water field cannot hold.

Parameters:

discretization (Discretization)

Return type:

None

voltage(discretization)[source]#

The cell voltage in V: the mean potential of the positive terminal minus that of the negative terminal.

Parameters:

discretization (Discretization)

Return type:

float

tank_volume(discretization, side)[source]#

The volume of a side’s tank, per unit of the dimensions the mesh lacks, e.g. per metre of depth for a 2D cell.

Parameters:
  • discretization (Discretization) – The discretization of the cell.

  • side (str) – "negative" or "positive".

Raises:

ValueError – For a cell without flow, or without tanks.

Return type:

float

amount(discretization, side, ion)[source]#

The amount of an ion in a side’s electrode and its tank.

The amounts are per unit of the dimensions the mesh lacks, e.g. per metre of depth for a 2D cell.

Parameters:
  • discretization (Discretization) – The discretization of the cell.

  • side (str) – "negative" or "positive".

  • ion (str) – The name of an ion of the side with a field. The water of the membrane is in neither side’s amount.

Returns:

The amount in mol, that of the tank included with tanks.

Return type:

float

state_of_charge(discretization, side)[source]#

The state of charge of a side’s couple, its tank included.

Parameters:
  • discretization (Discretization) – The discretization of the cell.

  • side (str) – "negative" or "positive".

Returns:

the reduced ion of a couple oxidized on discharge, the oxidized ion of one reduced on discharge.

Return type:

The share of the ion that charging makes

update_tanks(discretization, dt)[source]#

Take a step of the tanks after a time step of the cell.

Each tank, of volume \(V\), mixes what the outlet of its electrode returns, Shah et al.’s eq. 33 with the fluxes of the outlet and the inlet,

(55)#\[\begin{aligned} V \frac{\mathrm{d} c_k^\text{in}}{\mathrm{d} t} &= \int_\text{outlet} \mathbf{u} \cdot \mathbf{n}\, c_k \,\mathrm{d}s - v_\text{in} \int_\text{inlet} c_k^\text{in} \,\mathrm{d}s, \end{aligned}\]

see (56). The step takes the outflow of the cell’s new state and the inflow of the inlet concentrations the cell took its step with, so the cell and its tanks together conserve every ion. The concentrations of the tanks are the reservoir parameters of the half-cells, "<side>.c0_<ion>". A cell without tanks keeps them.

Parameters:
  • discretization (Discretization) – The discretization of the cell, after the step.

  • dt (float) – The size of the step, in s.

Return type:

None

class sumfem.electrochemistry.HalfCellSpec(ions, reservoir, couple, porosity, conductivity, specific_area, fiber_distance=None, fiber_diameter=None, kozeny_carman_constant=None, density=1399.8, viscosity=0.006963, temperature=298.15)[source]#

One side of a full cell: its electrolyte, its couple and its electrode.

The properties of the electrode and the electrolyte, from the porosity on, are each an expression, used as given, e.g. a field of another model such as the porosity of a compressed felt or a viscosity of the temperature, or the default of the parameter the cell creates, see expression_or_parameter(). The reservoir concentrations are values: with flow, the tanks change them.

ions#

The ions of the electrolyte, see RedoxHalfCell. Water, "H2O", if transported, must be an ion of both sides, since the water moves through the membrane.

Type:

tuple[sumfem.electrochemistry.materials.electrolyte.Ion, …]

reservoir#

The initial concentration of each transported ion, see RedoxHalfCell, and with flow, that of its tank. The protons, "H", must be one of them.

Type:

Mapping[str, float | sympy.core.expr.Expr]

couple#

The redox couple of the side.

Type:

sumfem.electrochemistry.materials.couple.RedoxCouple

porosity#

The porosity of the electrode.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

conductivity#

The conductivity of the electrode’s fibres, in S/m or with units.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

specific_area#

The specific area of the electrode, in 1/m or with units.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

fiber_distance#

The mean distance between the fibres, in m or with units, which limits the kinetics by the piston velocities, see PistonVelocityButlerVolmer. None for kinetics without them, limited by the flow’s mass transfer with flow.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

fiber_diameter#

The diameter of the electrode’s fibres, in m or with units, for the permeability with flow, and the mass transfer without a fibre distance.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

kozeny_carman_constant#

The Kozeny-Carman constant of the permeability with flow, see kozeny_carman().

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

density#

The density of the electrolyte, in kg/m^3 or with units.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

viscosity#

The dynamic viscosity of the electrolyte, in Pa s or with units, which the flow and the mass transfer share.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

temperature#

The temperature of the electrolyte, in K, e.g. the field of a heat equation.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

Raises:

ValueError – If the side does not transport protons.

Parameters:
class sumfem.electrochemistry.MembraneSpec(fixed_charge=None, proton_diffusivity=None, water_diffusivity=None, electrokinetic_permeability=None, hydraulic_permeability=None, viscosity=None, temperature=298.15)[source]#

The properties of the membrane of a full cell.

Each is an expression, used as given, or the default of the parameter "<membrane>.<property>", in SI units or with units, None for a parameter without a default, see ProtonExchangeMembrane. The last three are those of the flow of water, with a FlowSpec.

Parameters:
fixed_charge#

The concentration of the fixed charges, in mol/m^3.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

proton_diffusivity#

The proton diffusivity in the membrane, in m^2/s.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

water_diffusivity#

The water diffusivity in the membrane, in m^2/s.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

electrokinetic_permeability#

The electrokinetic permeability, in m^2.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

hydraulic_permeability#

The hydraulic permeability, in m^2.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

viscosity#

The viscosity of the water in the membrane, in Pa s.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

temperature#

The temperature of the membrane, in K, e.g. the field of a heat equation.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

class sumfem.electrochemistry.FlowSpec(inlet_velocity=None, outlet_pressure=0.0, tank_ratio=None, model=<class 'sumfem.electrochemistry.models.electrode_flow.DarcyFlow'>)[source]#

The flow of the electrolytes through the electrodes, from their tanks.

The flow of the electrolytes is a ElectrodeFlow, by default DarcyFlow, which gives the superficial velocity \(\mathbf{u}\) of each electrode. The electrolyte of each side enters its electrode at the inlet with the superficial velocity \(v_\text{in}\) and the concentrations \(c_k^\text{in}\) of its tank, and leaves at the outlet, held at the pressure \(p_\text{out}\), with the flow,

(56)#\[\begin{split}\begin{aligned} -\mathbf{u} \cdot \mathbf{n} &= v_\text{in} && \text{at the inlet}, \\ -\mathbf{N}_k \cdot \mathbf{n} &= v_\text{in} c_k^\text{in} && \text{at the inlet}, \\ p &= p_\text{out} && \text{at the outlet}, \\ (\mathbf{N}_k - \mathbf{u} c_k) \cdot \mathbf{n} &= 0 && \text{at the outlet}, \end{aligned}\end{split}\]

with the superficial velocity \(\mathbf{u}\) of the electrode and the Nernst-Planck flux \(\mathbf{N}_k\) of each ion. The inlet holds the flux of the ions, the flow’s, rather than their concentration as Shah et al. do, so that the cell takes in exactly what its tank gives.

Parameters:
inlet_velocity#

The superficial velocity at the inlets of both electrodes: an expression, or the default of the parameter "<cell>.inlet_velocity", in m/s or with units.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

outlet_pressure#

The gauge pressure at the outlets, given like the inlet velocity, in Pa.

Type:

ufl.core.expr.Expr | collections.abc.Buffer | numpy._typing._array_like._SupportsArray[numpy.dtype[Any]] | numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]] | complex | bytes | str | numpy._typing._nested_sequence._NestedSequence[complex | bytes | str] | sympy.core.expr.Expr | None

tank_ratio#

The volume of each tank over the volume of electrolyte in the pores of its electrode, None for tanks so large that the electrolyte at the inlets does not change.

Type:

float | None

model#

The flow, created from the FlowSetup the cell gives it: an ElectrodeFlow subclass, or any callable of the setup, e.g. a functools.partial() of one with options of its own.

Type:

Callable[[sumfem.electrochemistry.models.electrode_flow.FlowSetup], sumfem.electrochemistry.models.electrode_flow.ElectrodeFlow]