Methods

Method

MDC — Donnan-exclusion salt flux

mdc-donnan-faradaic-v1 · ion_transport · MDC

What it predicts

Salt removal rate, desalination efficiency and energy per kg salt for a three-chamber CEM/AEM stack.

Governing relations

Each relation is transcribed from the implementation. Where the code cites no source, the source line says so.

  1. Salt flux from current
    NNaCl=CEdesal jF PCEM PAEMN_{NaCl} = \frac{CE_{desal}\, j}{F}\, P_{CEM}\, P_{AEM}

    Source: Faraday's law; Cao et al. 2009, Environ. Sci. Technol. 43:7148 (about 90 % desalination in the first MDC).

    SymbolMeaningUnit
    NNaClN_{NaCl}salt removal fluxmol/m²/s
    CEdesalCE_{desal}coulombic-to-salt efficiency (default 1.0, clamped 0–1.5)1
    jjanode current density from predict.tsA/m²
    FFFaraday constant, 96 485C/mol
    PCEM,PAEMP_{CEM}, P_{AEM}membrane permselectivities (default 0.95 each)1

    Worked example

    These inputs, passed to the predictor, return the output below. A test re-runs the example on every change, so this number is the one the code produces.

    inputvalueunit
    temperatureC25°C
    ph7pH
    electrodeSpacingCm2cm
    hrtHours24h
    codMgL1,000mg/L

    Output · mdc.saltRemovalRate = 1.403e-6 mol Na⁺/m²/s, within ±0.1 %

    By hand · j = 0.15 A/m² from predict.ts at 25 °C, pH 7, 1000 mg/L COD, no anode named (see the MFC worked example). N = 1.0 × 0.15 / 96 485 × 0.95 × 0.95 = 1.403×10⁻⁶ mol/m²/s.

    Reproduce · Pinned by libs/shared/electrochemistry/src/predictors/worked-examples.test.ts. Run it from the repository root:

    pnpm exec jest -c libs/shared/electrochemistry/jest.config.js worked-examples.test.ts -t "mdc.saltRemovalRate"
  2. Depletion toward a floor
    C(t)=Cfloor+(C0−Cfloor)e−kt,Cfloor=0.1 C0,k=NA/VC0−CfloorC(t) = C_{floor} + \left(C_0 - C_{floor}\right) e^{-k t}, \qquad C_{floor} = 0.1\, C_0, \quad k = \frac{N A / V}{C_0 - C_{floor}}

    Source: First-order approach to a 10 % floor; Cao et al. 2009 reached about 10 % residual after 24 h (as stated in mdc.ts).

    k is chosen so the initial rate equals the Faradaic salt flux; the floor is a fixed fraction, not a conductivity model.

    SymbolMeaningUnit
    C0C_0initial middle-chamber salt concentration (default 35)g/L
    CfloorC_{floor}residual floor where conductivity collapsesg/L
    AAsmaller of the CEM and AEM areas (default 0.001)m²
    VVmiddle-chamber volume (default 50 mL)m³
    ttrun duration (default 24 h)s
  3. Net energy per kg salt
    Espec=(jAVapp−PanA)t3.6×106 msaltE_{spec} = \frac{\left(j A V_{app} - P_{an} A\right) t}{3.6\times 10^{6}\ m_{salt}}

    Source: Energy balance as stated in mdc.ts; Cao et al. 2009 observed power output during desalination.

    SymbolMeaningUnit
    EspecE_{spec}net energy per kg salt removed; negative when the anode out-produces the biaskWh/kg
    VappV_{app}external bias (default 0)V
    PanP_{an}anode power density from predict.tsW/m²
    msaltm_{salt}salt mass removedkg

Assumptions and constants

  • Anode current from the shared Butler-Volmer biofilm kinetics in predict.ts (Geobacter on acetate), with the same Arrhenius, substrate, pH and ohmic corrections as the MFC predictor.
  • CE_desal defaults to 1.0 (literature 0.85–1.2; Cao et al. 2009 report ~90 % desalination efficiency).
  • Membrane permselectivity ≈ 95 % for both CEM and AEM; co-ion leakage is a multiplicative loss.
  • Anode area is taken equal to the smaller membrane area.

Corrections applied

  • Co-ion leakage factors on CEM and AEM.
  • Conductivity collapse as the middle chamber depletes.

Not modelled

  • Osmotic water flux (significant only above ~35 g/L feeds).
  • Biofouling kinetics over weeks of operation.

Literature anchors in the source

  • Cao et al. 2009, Environ. Sci. Technol. 43:7148 (first MDC, ~90 % desalination efficiency)
  • Kim & Logan 2013, Desalination 308:122

Implementation

libs/shared/electrochemistry/src/predictors/mdc.ts

Interval the predictor ships

heuristic_fixed_fraction — A fixed ±25 % placeholder band. It is NOT a calibrated interval; when served through /api/ml/predict it is replaced by the benchmark band below, or withheld. How served intervals are built

Calibration artifacts used when served

  • Benchmark out-of-fold residual quantiles: bes-benchmark-v1 · gkf5 · generated 2026-09-09
  • Split-conformal calibration: split-conformal · generated 2026-05-21
  • Hierarchical-priors v2 trust snapshot: populated · generated 2026-05-16

Benchmark cells for this predictor’s systems

Each row is a stratum with n ≥ 30 residuals at nominal level 90%. Coverage is the cross-validated share of held-out points inside the band.

targetstratumnpaperscoverageCV
cod_removalMDC511376.5%
cod_removalMDC|desalination33661.5%

Prior trust by served parameter

The state the lab badge shows for each served parameter and system, from the v2 priors fit.

parametersystemstatepapersprior
cod_removalMDCmodeled12weakly_informative

Scientific-rigor gates

pnpm verify:science runs these rules over the committed priors and validation artifacts in pre-commit. Known violations are baselined per rule and slug; a new one blocks the commit. Baseline from hierarchical-priors-v2.json@2026-10-26T00:10:47.721880+00:00.

rulebaselined
gate-honestyNo parameter may pass a rounded-threshold gate read while converged=false1
support-containmentBounded quantities must have ci95 inside physical support, width <= range3
magnitude-sanityNo ci95 bound may exceed the plausibility ceiling (1.0e+6)0
slug-uniquenessNo two slugs may share a spelling-independent identity; scale must agree2
secondary-source-purityNo fitted prior may carry a REVIEW (secondary-source) stratum0
artifact-pairingEach fit must have its own coverage evidence; the served fit must have some0
coverage-sharpnessAny coverage figure must ship its interval width alongside0
interval-calibrationHeld-out interval coverage per parameter may not newly degrade128
effects-gap-completenesseffects.json is schema 2.0; every non-high effect has a gap per archetype; no gap is "high"0