| name | membrane-system-design |
| description | Expert skill for membrane filtration and separation system design including process selection, flux calculations, fouling analysis, and concentrate management. |
| allowed-tools | Read, Grep, Write, Bash, Edit, Glob |
| category | Water and Wastewater Treatment |
| backlog-id | SK-003 |
| metadata | {"author":"babysitter-sdk","version":"1.0.0"} |
| graph | {"domains":["domain:environmental-engineering"],"skillAreas":["skill-area:data-analysis","skill-area:statistical-analysis","skill-area:geospatial-data-analysis"],"workflows":["workflow:experiment-design"],"roles":["role:research-engineer"]} |
Membrane System Design Skill
Membrane filtration and separation system design for water and wastewater treatment applications.
Purpose
This skill provides comprehensive capabilities for designing membrane treatment systems, including process selection, flux and recovery calculations, fouling analysis, pretreatment requirements, and concentrate management planning.
Capabilities
Membrane Process Selection
- Microfiltration (MF) applications
- Ultrafiltration (UF) applications
- Nanofiltration (NF) applications
- Reverse Osmosis (RO) applications
- Process selection criteria and decision matrix
- Hybrid system configurations
Flux and Recovery Rate Calculations
- Design flux determination
- Temperature correction factors
- Recovery rate optimization
- Concentration polarization effects
- Osmotic pressure calculations
- Permeate quality estimation
Pretreatment Requirements Assessment
- Feed water characterization
- Silt Density Index (SDI) analysis
- Modified Fouling Index (MFI) calculation
- Pretreatment technology selection
- Chemical conditioning requirements
Fouling Analysis and Mitigation
- Fouling mechanism identification
- Biofouling assessment
- Scaling potential analysis
- Colloidal fouling evaluation
- Organic fouling characterization
- Mitigation strategy development
Concentrate Management Planning
- Concentrate characterization
- Disposal options evaluation
- Zero Liquid Discharge (ZLD) considerations
- Brine concentration technologies
- Regulatory compliance for disposal
CIP System Design
- Clean-in-Place system configuration
- Chemical cleaning protocols
- Cleaning frequency optimization
- Chemical compatibility assessment
- Cleaning effectiveness monitoring
Energy Recovery Device Selection
- Pressure exchanger sizing
- Turbocharger systems
- Energy recovery efficiency
- Economic analysis
- System integration
Membrane Pilot Testing Protocols
- Pilot system design
- Test protocol development
- Data collection requirements
- Performance metrics
- Scale-up considerations
Prerequisites
Installation
pip install numpy scipy pandas matplotlib
Optional Dependencies
pip install scipy pymoo
pip install plotly seaborn
Usage Patterns
Membrane System Sizing
import numpy as np
from dataclasses import dataclass
from typing import Dict, List, Optional
@dataclass
class FeedWaterQuality:
"""Feed water quality parameters"""
tds_mg_l: float
temperature_c: float
ph: float
tss_mg_l: float
toc_mg_l: float
hardness_mg_l: float = 0
silica_mg_l: float = 0
sdi: float = 0
@dataclass
class MembraneElement:
"""Membrane element specifications"""
manufacturer: str
model: str
area_m2: float
permeability_lmh_bar: float
salt_rejection: float
max_recovery: float
min_concentrate_flow_m3_hr: float
class ROSystemDesign:
"""Reverse Osmosis system design"""
def __init__(self, feed: FeedWaterQuality, element: MembraneElement):
self.feed = feed
self.element = element
() -> :
* (tds_mg_l / ) * ( + .feed.temperature_c) /
() -> :
T_kelvin = + .feed.temperature_c
np.exp( * (/ - /T_kelvin))
() -> :
avg_concentration_factor = / ( - recovery/)
avg_tds = .feed.tds_mg_l * avg_concentration_factor
pi_avg = .osmotic_pressure(avg_tds)
ndp = feed_pressure_bar - pi_avg -
tcf = .temperature_correction_factor()
flux = .element.permeability_lmh_bar * ndp * tcf
flux
() -> :
flux = .calculate_flux(feed_pressure_bar, target_recovery)
permeate_flow = feed_flow_m3_hr * target_recovery
required_area = (permeate_flow * ) / flux
num_elements = np.ceil(required_area / .element.area_m2)
elements_per_vessel =
num_vessels = np.ceil(num_elements / elements_per_vessel)
actual_elements = num_vessels * elements_per_vessel
concentrate_flow = feed_flow_m3_hr * ( - target_recovery)
concentrate_tds = .feed.tds_mg_l / ( - target_recovery)
avg_passage = - .element.salt_rejection
permeate_tds = .feed.tds_mg_l * avg_passage * ( + target_recovery)
pump_efficiency =
sec_kwh_m3 = (feed_pressure_bar * ) / ( * pump_efficiency * target_recovery)
{
: flux,
: required_area,
: (num_vessels),
: elements_per_vessel,
: (actual_elements),
: permeate_flow,
: concentrate_flow,
: permeate_tds,
: concentrate_tds,
: sec_kwh_m3
}
feed = FeedWaterQuality(
tds_mg_l=,
temperature_c=,
ph=,
tss_mg_l=,
toc_mg_l=,
sdi=
)
element = MembraneElement(
manufacturer=,
model=,
area_m2=,
permeability_lmh_bar=,
salt_rejection=,
max_recovery=,
min_concentrate_flow_m3_hr=
)
ro_system = ROSystemDesign(feed, element)
design = ro_system.design_system(
feed_flow_m3_hr=,
target_recovery=,
feed_pressure_bar=
)
()
()
()
()
()
Scaling Potential Analysis
class ScalingAnalysis:
"""Membrane scaling potential analysis"""
Ksp = {
'CaCO3': 3.3e-9,
'CaSO4': 4.9e-5,
'BaSO4': 1.1e-10,
'SrSO4': 3.4e-7,
'SiO2': 120
}
def __init__(self, water_quality: Dict):
self.wq = water_quality
def langelier_saturation_index(self, temperature_c: float,
tds_mg_l: float) -> float:
"""Calculate Langelier Saturation Index for CaCO3"""
pH = self.wq.get('pH', 7.5)
Ca = self.wq.get('Ca_mg_l', 100)
alkalinity = self.wq.get('alkalinity_mg_l', 100)
pCa = -np.log10(Ca / 40080)
pAlk = -np.log10(alkalinity / 50040)
A = (np.log10(tds_mg_l) - 1) / 10
B = -13.12 * np.log10(temperature_c + 273) + 34.55
C = np.log10(Ca / ) -
D = np.log10(alkalinity / )
pHs = ( + A + B) - C - D
lsi = pH - pHs
lsi
() -> :
pH = .wq.get(, )
Ca = .wq.get(, )
alkalinity = .wq.get(, )
K =
pCa = -np.log10(Ca / * )
pAlk = -np.log10(alkalinity / * )
pK = -np.log10(K)
pHs = pK + pCa + pAlk
sdi = pH - pHs
sdi
() -> :
Ca = .wq.get(, )
SO4 = .wq.get(, )
cf = / ( - recovery)
Ca_conc = (Ca / ) * cf
SO4_conc = (SO4 / ) * cf
ip = Ca_conc * SO4_conc
sr = ip / .Ksp[]
sr
() -> :
SiO2 = .wq.get(, )
cf = / ( - recovery)
SiO2_conc = SiO2 * cf
saturation_limit = .Ksp[] + (temperature_c - ) *
SiO2_conc / saturation_limit
() -> :
tds_concentrate = .wq.get(, ) / ( - recovery)
results = {
: recovery,
: / ( - recovery),
: tds_concentrate,
: .langelier_saturation_index(temperature_c, tds_concentrate),
: .calcium_sulfate_saturation(recovery),
: .silica_saturation(recovery, temperature_c)
}
results[] = results[] > \
results[] >
results[] = results[] > \
results[] >
results[] = results[] > \
results[] >
results
water_quality = {
: ,
: ,
: ,
: ,
: ,
:
}
scaling = ScalingAnalysis(water_quality)
results = scaling.analyze_scaling_potential(recovery=, temperature_c=)
()
()
()
()
CIP Protocol Development
class CIPProtocol:
"""Clean-in-Place protocol development"""
def __init__(self, membrane_type: str = 'polyamide'):
self.membrane_type = membrane_type
self.ph_limits = {
'polyamide': (2, 11),
'cellulose_acetate': (4, 7),
'polysulfone': (1, 13)
}
self.temperature_limit = {
'polyamide': 45,
'cellulose_acetate': 35,
'polysulfone': 50
}
def recommend_cleaning_chemicals(self, fouling_type: str) -> List[Dict]:
"""Recommend cleaning chemicals based on fouling type"""
recommendations = {
'biofouling': [
{'chemical': 'NaOH', 'concentration': '0.1%', 'ph': 12, 'temperature_c': 35},
{'chemical': 'Biocide', 'concentration': 'Per manufacturer', 'ph': , : }
],
: [
{: , : , : , : },
{: , : , : , : }
],
: [
{: , : , : , : },
{: , : , : , : }
],
: [
{: , : , : , : },
{: , : , : , : }
],
: [
{: , : , : , : }
]
}
recommendations.get(fouling_type, [])
() -> :
ph_min, ph_max = .ph_limits.get(.membrane_type, (, ))
temp_max = .temperature_limit.get(.membrane_type, )
procedure = {
: .membrane_type,
: ,
: temp_max,
: system_volume_m3,
: []
}
procedure[].append({
: ,
: ,
: ,
: ,
:
})
step_num =
fouling fouling_types:
chemicals = .recommend_cleaning_chemicals(fouling)
chem chemicals:
chem[] <= temp_max ph_min <= chem[] <= ph_max:
procedure[].append({
: step_num,
: ,
: chem[],
: chem[],
: chem[],
: ,
: ,
: ,
:
})
step_num +=
procedure[].append({
: step_num,
: ,
: ,
:
})
procedure
cip = CIPProtocol(membrane_type=)
procedure = cip.generate_cip_procedure(
fouling_types=[, ],
system_volume_m3=
)
()
step procedure[]:
()
Usage Guidelines
When to Use This Skill
- Membrane system design and specification
- Pilot testing protocol development
- Fouling diagnosis and mitigation
- System optimization and troubleshooting
- Pretreatment system design
Best Practices
- Characterize feed water thoroughly before design
- Use pilot testing for critical applications
- Design for maintainability including CIP access
- Monitor membrane performance trends regularly
- Maintain chemical dosing records for troubleshooting
- Plan for concentrate management early in design
Process Integration
- WW-003: Membrane Treatment System Design (all phases)
- WW-005: Water Reuse System Implementation (membrane phases)
Dependencies
- numpy: Numerical calculations
- scipy: Optimization routines
References
- AWWA M46 "Reverse Osmosis and Nanofiltration"
- Dow Water & Process Solutions Technical Manual
- Hydranautics Technical Application Bulletins