Claude
Skills
Sign in
Back

membrane-system-design

Included with Lifetime
$97 forever

Expert skill for membrane filtration and separation system design including process selection, flux calculations, fouling analysis, and concentrate management.

Water and Wastewater Treatment

What this skill does


# 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
```bash
pip install numpy scipy pandas matplotlib
```

### Optional Dependencies
```bash
# For optimization
pip install scipy pymoo

# For visualization
pip install plotly seaborn
```

## Usage Patterns

### Membrane System Sizing
```python
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  # as CaCO3
    silica_mg_l: float = 0
    sdi: float = 0  # Silt Density Index

@dataclass
class MembraneElement:
    """Membrane element specifications"""
    manufacturer: str
    model: str
    area_m2: float
    permeability_lmh_bar: float  # L/m2/hr/bar
    salt_rejection: float  # decimal
    max_recovery: float  # decimal
    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

    def osmotic_pressure(self, tds_mg_l: float) -> float:
        """Calculate osmotic pressure in bar"""
        # Simplified van't Hoff equation
        # pi = i * C * R * T
        # For typical water: pi (bar) ≈ 0.0385 * TDS (g/L)
        return 0.0385 * (tds_mg_l / 1000) * (273.15 + self.feed.temperature_c) / 298.15

    def temperature_correction_factor(self) -> float:
        """Temperature correction factor for flux"""
        # TCF = exp(2640 * (1/298 - 1/T))
        T_kelvin = 273.15 + self.feed.temperature_c
        return np.exp(2640 * (1/298.15 - 1/T_kelvin))

    def calculate_flux(self, feed_pressure_bar: float, recovery: float) -> float:
        """Calculate permeate flux in LMH"""
        # Average osmotic pressure (considering concentration polarization)
        avg_concentration_factor = 1 / (1 - recovery/2)
        avg_tds = self.feed.tds_mg_l * avg_concentration_factor
        pi_avg = self.osmotic_pressure(avg_tds)

        # Net driving pressure
        ndp = feed_pressure_bar - pi_avg - 1  # 1 bar backpressure

        # Flux with temperature correction
        tcf = self.temperature_correction_factor()
        flux = self.element.permeability_lmh_bar * ndp * tcf

        return flux

    def design_system(self, feed_flow_m3_hr: float, target_recovery: float,
                      feed_pressure_bar: float) -> Dict:
        """Design RO system for given requirements"""

        # Calculate flux
        flux = self.calculate_flux(feed_pressure_bar, target_recovery)

        # Permeate flow
        permeate_flow = feed_flow_m3_hr * target_recovery

        # Required membrane area
        required_area = (permeate_flow * 1000) / flux  # m2

        # Number of elements
        num_elements = np.ceil(required_area / self.element.area_m2)

        # Elements per vessel (typical 6-8)
        elements_per_vessel = 6
        num_vessels = np.ceil(num_elements / elements_per_vessel)
        actual_elements = num_vessels * elements_per_vessel

        # Concentrate flow and quality
        concentrate_flow = feed_flow_m3_hr * (1 - target_recovery)
        concentrate_tds = self.feed.tds_mg_l / (1 - target_recovery)

        # Permeate quality
        avg_passage = 1 - self.element.salt_rejection
        permeate_tds = self.feed.tds_mg_l * avg_passage * (1 + target_recovery)

        # Specific energy consumption estimate
        pump_efficiency = 0.80
        sec_kwh_m3 = (feed_pressure_bar * 100) / (36 * pump_efficiency * target_recovery)

        return {
            'design_flux_lmh': flux,
            'required_area_m2': required_area,
            'num_vessels': int(num_vessels),
            'elements_per_vessel': elements_per_vessel,
            'total_elements': int(actual_elements),
            'permeate_flow_m3_hr': permeate_flow,
            'concentrate_flow_m3_hr': concentrate_flow,
            'permeate_tds_mg_l': permeate_tds,
            'concentrate_tds_mg_l': concentrate_tds,
            'specific_energy_kwh_m3': sec_kwh_m3
        }

# Example usage
feed = FeedWaterQuality(
    tds_mg_l=2000,
    temperature_c=25,
    ph=7.5,
    tss_mg_l=5,
    toc_mg_l=3,
    sdi=3
)

element = MembraneElement(
    manufacturer='Example',
    model='BW30-400',
    area_m2=37.2,
    permeability_lmh_bar=3.5,
    salt_rejection=0.995,
    max_recovery=0.15,
    min_concentrate_flow_m3_hr=3.6
)

ro_system = ROSystemDesign(feed, element)
design = ro_system.design_system(
    feed_flow_m3_hr=100,
    target_recovery=0.75,
    feed_pressure_bar=15
)

print(f"Design flux: {design['design_flux_lmh']:.1f} LMH")
print(f"Number of vessels: {design['num_vessels']}")
print(f"Total elements: {design['total_elements']}")
print(f"Permeate TDS: {design['permeate_tds_mg_l']:.0f} mg/L")
print(f"Specific energy: {design['specific_energy_kwh_m3']:.2f} kWh/m3")
```

### Scaling Potential Analysis
```python
class ScalingAnalysis:
    """Membrane scaling potential analysis"""

    # Solubility product constants at 25C
    Ksp = {
        'CaCO3': 3.3e-9,
        'CaSO4': 4.9e-5,
        'BaSO4': 1.1e-10,
        'SrSO4': 3.4e-7,
        'SiO2': 120  # mg/L saturation
    }

    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)

        # pHs calculation (simplified)
        pCa = -np.log10(Ca / 40080)  # Convert to mol/L
        pAlk = -np.log10(alkalinity / 50040)

        # Temperature and TDS corrections
        A = (np.log10(tds_mg_l) - 1) / 10
        B = -13.12 * np.log10

Related in Water and Wastewater Treatment