membrane-ro-fundamentals
Reverse Osmosis (RO) and Electrodeionization (EDI) process fundamentals — formulas (recovery, rejection, NDP, osmotic pressure, TCF, NPF/NSP), authoritative standards reference (ASTM/ISO/USP/Ph.Eur./WHO/EN), vendor design windows (DuPont, Hydranautics, Toray, Suez, LANXESS), water chemistry, EDI quick reference, IT/EN glossary. Use when working on RO/EDI plant code, KPI calculations, or normative citations.
What this skill does
# RO & EDI Process Fundamentals
Reference for water-treatment expertise: formulas, normative standards, vendor design envelopes, water chemistry, and bilingual terminology.
Convention markers used throughout the membrane skills:
- `⚠️` — likely bug or incorrect numerical approximation in calling code; highest priority
- `💡` — enhancement opportunity (new KPI, new model field, refined threshold)
---
## §1 — RO Process Fundamentals
All formulas in SI (LMH, bar, °C) with US field-unit (GFD, psi, °F) variant noted. Variables: `Qf` feed flow, `Qp` permeate, `Qc` concentrate, `Cf`/`Cp`/`Cc` concentrations, `Am` membrane area, `T` temperature.
### 1.1 Recovery (Water Recovery / Recupero)
```
Y = Qp / Qf
```
Typical ranges (vendor-dependent):
- SWRO single-pass: 35–50 %
- BWRO: 70–85 %
- BWRO high-recovery (w/ antiscalant): 90 %+
- Double-pass RO+RO overall: 70–80 %
Source: ASTM D6161-19; DuPont 45-D01504; Hydranautics TSB 107.
### 1.2 Concentration Factor (CF)
```
CF_ideal = 1 / (1 - Y) # for R = 1
CF_real = (1 - Y·(1 - R)) / (1 - Y) # for rejection R
```
At Y = 0.75 and R = 0.99: CF_ideal = 4.00, CF_real ≈ 3.97 (error < 1 %), so the ideal form is acceptable for SWRO/BWRO design.
Source: DuPont 45-D01591 (Design Equations).
### 1.3 Salt Rejection — three definitions
| Variant | Symbol | Formula | When used |
|---|---|---|---|
| Observed (apparent) | R_obs | `1 − Cp/Cf` | What instruments measure |
| System (log-mean) | R_sys | `1 − Cp / mean(Cf, Cc)` | Standard reporting |
| Intrinsic (at wall) | R_int | `1 − Cp / (β · mean(Cf, Cc))` | Corrected for polarization |
Concentration polarization factor:
```
β = Cwall / Cbulk = exp(0.7 · Y_element)
```
where `Y_element` is per-element recovery. FilmTec design limit: β ≤ 1.2 → Y_element ≤ 18 % (the **18 % per-element rule**). Hydranautics is more conservative at 15 %.
⚠️ A code path that confuses `R_obs` with `R_sys` will under-report rejection by 5–15 % at high recovery. Always specify which definition the calculator returns.
Sources: DuPont 45-D01591; Hydranautics *Terms and Equations of RO*.
### 1.4 Permeate Flux (Jw)
```
Jw = A · NDP · TCF · FF # vendor model
Jw = Qp / Am # operational
```
`A` = water permeability (LMH/bar), `FF` = fouling factor (0.85 design / 0.70 EOL).
Unit conversion: **1 GFD = 1.6987 LMH** (≈ 1.70).
Typical design flux windows (vendor consensus):
| Application | GFD | LMH |
|---|---|---|
| SWRO open intake (SDI 3–5) | 7–9 | 12–15 |
| SWRO beach well (SDI < 2) | 8–10 | 14–17 |
| BWRO well (SDI < 3) | 14–18 | 24–30 |
| BWRO surface (SDI 3–5) | 10–14 | 17–24 |
| RO permeate / 2nd pass | 20–30 | 34–51 |
⚠️ A hard-coded `flux_max = 25 LMH` threshold is incorrect for SWRO (well above limit) and conservative for BWRO well (well below limit). Threshold must be water-source-aware.
Sources: DuPont 45-D01695 Rev 14 (Feb 2026); Hydranautics TSB 105; AMTA *Optimum Flux Rates*.
### 1.5 Salt Flux (Js)
```
Js = B · (mean(Cf,Cc) − Cp) ≈ B · mean(Cf,Cc)
Cp = Js / Jw # key inverse relation
```
`B` is **temperature-dependent but pressure-independent** (unlike `A`). At cold feed temperature, `Jw` drops while `Js` is relatively unchanged → `Cp` rises → permeate quality degrades. Cold-water permeate TDS spikes are explained by this relation.
Source: DuPont 45-D01591; Hydranautics *Terms and Equations*.
### 1.6 Net Driving Pressure (NDP)
```
NDP = (Pf + Pc)/2 − Pp − (πw − πp)
= mean_feed_pressure − permeate_pressure − osmotic_differential_at_wall
```
with `πw = β · π_mean(Cf,Cc)` (osmotic pressure at membrane wall, corrected for polarization).
Source: ASTM D4516-19a §6; DuPont 45-D01591.
### 1.7 Osmotic Pressure (π)
**Rigorous Van't Hoff:**
```
π = i · M · R · T # i ≈ 1.8–2.0 for NaCl
# R = 0.08314 L·bar/(mol·K)
# T in Kelvin
```
**Engineering shortcut (industry standard at 25 °C):**
```
π [psi] ≈ 0.0085 · TDS [ppm]
π [bar] ≈ 0.000586 · TDS [ppm]
```
Shortcut accuracy:
- ±3 % for NaCl-dominated brackish (1 000–10 000 ppm)
- ±5 % for seawater (32 000–40 000 ppm) — agrees with Pitzer model up to 70 g/L NaCl
- Diverges > 10 % for sulfate-rich or hardness-dominated brines — use OLI/PHREEQC instead
Seawater rule of thumb: 35 000 ppm → π ≈ 25–28 bar bulk; ≈ 32–35 bar at wall with β = 1.15.
⚠️ A formula returning π ≈ 8 bar for seawater under-estimates by 3–4× — verify constants and unit handling. The correct order of magnitude for seawater is **25–35 bar**.
Source: Pitzer comparison (Tandfonline 2019); Stark-Water RO Working Principle Guide; FilmTec 45-D01591.
### 1.8 Temperature Correction Factor (TCF)
ASTM D4516-19a normalizes flux to a 25 °C reference. General exponential form:
```
TCF = exp[ Ke · (1/298 − 1/(273 + T)) ]
```
Membrane-chemistry constants (Hydranautics TSB 107.28 Apr 2025; FilmTec 45-D01616 Rev 10 Feb 2022):
| Membrane type | Ke | Regime |
|---|---|---|
| FilmTec BW30 / SW30 (T ≥ 25 °C) | **3 020** | Hot |
| FilmTec BW30 / SW30 (T < 25 °C) | **2 640** | Cold (flux drops faster) |
| Hydranautics CPA / ESPA | 2 500–3 480 | Element-specific (TSB 107) |
| Hydranautics SWC seawater | ~3 020 | |
Practitioner shortcut: TCF ≈ 1.03 per °C around 25 °C; doubles every ~25 °C rise.
### 1.9 Normalized Permeate Flow (NPF) — ASTM D4516-19a §7
```
NPF = Qp_meas · (NDP_std / NDP_actual) · (TCF_std / TCF_actual)
```
Action thresholds (industry consensus):
- NPF drop **10 %** vs baseline → schedule CIP
- NPF drop **15 %** → CIP mandatory
- NPF drop **30 %** → autopsy / replacement evaluation
⚠️ NPF cannot be computed without a baseline. Code paths declaring `NPF` as a field but never populating it because `calculate_kpis()` receives no baseline are silently broken.
### 1.10 Normalized Salt Passage (NSP) — ASTM D4516-19a §8
```
NSP = SP_meas · (mean_C_std / mean_C_actual) · (EPF_actual / EPF_std) · (STCF_std / STCF_actual)
```
where `SP = Cp / mean(Cf, Cc)` and `STCF` is the salt-passage temperature factor (different exponent constant: `Ks ≈ 2 200`).
Action threshold: NSP rise **15 %** → integrity check via ASTM D6908 VDT or ASTM D3923 leak test.
### 1.11 Element / Vessel / Stage / Train Hierarchy
```
Train (skid)
└── Stage 1 ┐ array typically 2:1 or 3:2:1
├── Pressure Vessel │
│ ├── Element 1 │ standard 8"×40" or 4"×40"
│ ├── Element 2 │ 6–8 elements per vessel
│ └── … │ typical per-vessel Y = 8–15 %
└── Stage 2 / 3 reuses concentrate as feed
```
Per-stage recovery rule of thumb:
- Stage 1 (8 elements, single pass): Y₁ ≈ 50 %
- 2-stage train: `Ysys = 1 − (1−Y1)·(1−Y2) ≈ 75 %`
- 3-stage train: 85–90 % for high-recovery BWRO
Per-element max: Y_element ≤ 18 % (FilmTec) or ≤ 15 % (Hydranautics).
---
## §2 — Authoritative Standards Reference
| Standard | Title | Edition | When to invoke |
|---|---|---|---|
| **ASTM D4516-19a** | Standardizing RO Performance Data | 2019 | Normalize NPF, NSP — any commissioning, surveillance, warranty claim |
| **ASTM D3923** | Detecting Leaks in RO and NF Devices | 2023 (also 2018) | New-element acceptance; suspected O-ring / glue-line failure |
| **ASTM D3739-19** | Calculation of the Langelier Saturation Index for RO | 2019 | CaCO₃ scaling prediction; valid for concentrate TDS 10–10 000 mg/L |
| **ASTM D4582** | Stiff & Davis Stability Index | current | CaCO₃ scaling at TDS > 10 000 mg/L |
| **ASTM D4194-23** | Operating Characteristics of RO and NF Devices | 2023 | Short-term (< 24 h) factory or commissioning test — not for plant design |
| **ASTM D4195** | Water Analysis for RO/NF Application | 2014 (withdrawn 2023, still authoritative for scope) | Feedwater characterization scope |
| **ASTM D6161-19** | Terminology for Membrane Separation | 2019 | Definitive glossary; ciRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.