Repository navigation
A first full cell: two half-cells and a proton-exchange membrane - #27
Merged
Merged
Conversation
Base automatically changed from
dokken/temperature-dependent-electrolyte-concentrations
to
main
November 12, 2026 12:39
# Conflicts: # src/sumfem/electrochemistry/electrolyte.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
FullCell, which builds a redox flow battery cell from twoRedoxHalfCells and aProtonExchangeMembraneon one mesh. It follows Shah et al. (2008), with one deliberate correction at the membrane faces (sulfate is blocked, see below), and without flow for now.The full cell (
electrochemistry/full_cell.py)FullCell(domain, negative, positive, membrane, collector_conductivity): each side is aHalfCellSpec(ions, reservoir, couple, electrode properties, optional fibre distance), and the membrane is aMembraneSpec.NegativeCollector,NegativeElectrode,Membrane,PositiveElectrode,PositiveCollector, and the facet markersNegativeTerminal,PositiveTerminal,NegativeFace,PositiveFace.FullCell.mesh_dataadds the unions the unknowns live on:NegativeSolid,PositiveSolid,Electrolyte.Subdomain:collector=None, membrane=None);ground());initializestarts at the reservoir concentrations,voltageis the potential difference between the terminals.Sulfate is blocked at the membrane faces (
electrochemistry/membrane.py)MembraneProtonFluxmakes an electrode's protons carry the membrane's current through its face: $\mathbf{N}_\mathrm{H}\cdot\mathbf{n} = \mathbf{i}m\cdot\mathbf{n}/(z\mathrm{H}F)$, using the current on the membrane's side. Since sulfate follows from electroneutrality, this is what keeps it from crossing; every other ion has zero flux naturally.ProtonExchangeMembrane.proton_conditions, butFullCelldoes not use it."+"side and the membrane on the"-"side.current_density(),proton_flux(...),markersandconstants.Core additions
symbolic.expression_or_parameteruses an expression as given, or makes a value the default of a named parameter with a unit. It complementsinput_or_parameter, which turns a number into a unitless constant.Electrolyte(temperature, density, viscosity), the membrane and the full cell's collector conductivity now use it.Domain.interfaces_of(measure)gives the subdomains and marker of each interface an interior-facet measure covers.RateReactionandMembraneProtonFluxuse it instead of their own marker lookups.RedoxHalfCell.formal_potentialis now a public property.Tests
tests/electrochemistry/test_full_cell.py, on a 1D cell with Shah's dimensions:tests/symbolic: tests forexpression_or_parameterandDomain.interfaces_of.Not in this PR
🤖 Generated with Claude Code