VARUNA — named after the Vedic deity of water and cosmic order — is an AI-powered drainage planning system for rural India. It combines Physics-Informed Graph Neural Networks (PI-GNN), real terrain data, and IMD rainfall records to generate hydraulically sound, PMGSY-compliant drainage designs with sub-kilometre precision.
- Overview
- Architecture
- Tech Stack
- Repository Structure
- Pipeline Phases
- Physics Model
- Dashboard (VO)
- Installation
- Usage
- Configuration
- Outputs
- Dataset Sources
- Team
Rural flood damage in India costs billions annually and disproportionately harms agrarian communities. Existing drainage design tools are either too expensive, rely on coarse data, or ignore terrain physics entirely.
VARUNA solves this by:
- Processing real LiDAR or DEM elevation data to build terrain graphs
- Simulating flood behaviour using shallow-water physics embedded in a GNN
- Designing Manning's-equation-compliant drainage pipe networks
- Exporting results as GeoJSON and AutoCAD DXF for direct field use
- Providing a live interactive Next.js dashboard for visual decision-making
┌─────────────────────────────────────────────────────────────────┐
│ Project VARUNA │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────────┐ │
│ │ LiDAR /DEM │──▶│ Terrain │──▶│ PI-GNN Model │ │
│ │ Input Data │ │ Graph Build │ │ (DUALFloodGNN) │ │
│ └──────────────┘ └──────────────┘ └───────┬───────────┘ │
│ │ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────▼───────────┐ │
│ │ CAD DXF │◀──│ Drainage │◀──│ Flood Simulation│ │
│ │ GeoJSON out │ │ Designer │ │ (SWE Physics) │ │
│ └──────────────┘ └──────────────┘ └───────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ VO — Next.js Interactive Dashboard │ │
│ │ Leaflet map · Layer toggles · Flood zone overlays │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
| Component | Technology |
|---|---|
| GNN Model | PyTorch + PyTorch Geometric |
| Terrain Graph | NetworkX + PySheds |
| LiDAR Processing | PDAL, LASpy, RandLA-Net |
| DEM & Rasters | Rasterio, WhiteboxTools |
| Spatial Analysis | GeoPandas, Shapely, OSMnx |
| Rainfall Data | IMD NetCDF4 / xarray |
| CAD Export | ezdxf |
| Web Server | Python http.server (ThreadingHTTPServer) |
| Component | Technology |
|---|---|
| Framework | Next.js 16 (Turbopack) |
| Language | TypeScript / React 19 |
| Map | Leaflet + react-leaflet |
| Charts | Recharts |
| UI Components | Radix UI + shadcn/ui |
| Styling | Tailwind CSS v4 |
Project-VARUNA/
├── src/varuna/
│ ├── main.py # CLI entrypoint (all sub-commands)
│ ├── pipeline.py # End-to-end orchestration
│ ├── config/
│ │ ├── settings.py # VarunaConfig dataclass
│ │ └── default_config.yaml # Tunable defaults
│ ├── lidar/
│ │ ├── segmenter.py # Ground/non-ground LiDAR classification
│ │ ├── dtm.py # Digital Terrain Model generation
│ │ ├── hydrology.py # Flow accumulation, watershed delineation
│ │ ├── manning.py # Manning's n lookup from LULC codes
│ │ ├── randlanet.py # RandLA-Net deep LiDAR segmentation
│ │ └── pdal_utils.py # PDAL pipeline wrappers
│ ├── graph/
│ │ ├── builder.py # TerrainGraphBuilder — DEM → PyG Data
│ │ ├── assembly.py # Graph edge/node feature assembly
│ │ └── adaptive.py # Adaptive density graph refinement
│ ├── pignn/
│ │ ├── model.py # DUALFloodGNN (depth + u/v + edge flow)
│ │ ├── losses.py # Continuity, momentum, gravity-alignment loss
│ │ ├── trainer.py # PIGNNTrainer — training loop
│ │ ├── predictor.py # FloodPredictor — inference
│ │ └── engine.py # FloodSimulationEngine — simulation wrapper
│ ├── drainage/
│ │ ├── designer.py # DrainageDesigner — Manning's pipe sizing
│ │ ├── cad_export.py # GeoJSON → AutoCAD DXF
│ │ └── design_summary.py # JSON summary statistics
│ ├── data/
│ │ ├── village_demo.py # OSMnx village boundary + DEM fetcher
│ │ ├── imd_loader.py # IMD rainfall CSV / NetCDF loader
│ │ ├── training_dataset.py # PyG dataset builder
│ │ └── dataset_audit.py # Data readiness checker
│ ├── benchmark/
│ │ ├── speed_compare.py # Inference latency benchmarks
│ │ ├── physics_blind_demo.py# Physics-blind vs PI-GNN comparison
│ │ ├── imd_stress_test.py # IMD extreme-rainfall stress test
│ │ ├── village_impact.py # Flood impact assessment
│ │ └── panel_pack.py # Judge evidence bundle generator
│ └── visualization/
│ └── __init__.py
├── VO/ # Next.js interactive dashboard
│ ├── app/
│ │ ├── page.tsx # Main dashboard page
│ │ └── layout.tsx # Root layout + metadata
│ ├── components/
│ │ ├── drainage-map.tsx # Leaflet map with all overlay layers
│ │ ├── control-sidebar.tsx # Layer toggles, analysis controls
│ │ ├── detail-panel.tsx # Click-to-inspect panel details
│ │ └── header.tsx # Top navigation bar
│ ├── lib/
│ │ ├── drainage-data.ts # Demo location data + metrics engine
│ │ ├── varuna-loader.ts # GeoJSON loader + MST recommendation engine
│ │ └── utils.ts # Shared utilities
│ └── public/
│ └── varuna_drainage_design.geojson # Pre-computed real GNN output
├── data/
│ └── imd/ # IMD daily rainfall data
├── tests/
│ └── test_pignn_physics.py # Physics validation test suite
├── pyproject.toml
├── requirements.txt
└── train_varuna.py # Standalone training script
Accepts either a raw .las/.laz point cloud (PDAL + SMRF classification) or a pre-processed DEM GeoTIFF. For village demos, OSMnx fetches the village boundary from OpenStreetMap and downloads SRTM/ASTER elevation data automatically.
The DEM is converted into a PyTorch Geometric Data object. Each pixel/cell becomes a node with features:
| Feature | Description |
|---|---|
x[:,0] |
Elevation (m) |
x[:,1] |
Slope magnitude |
x[:,2] |
Manning's n from LULC |
x[:,3] |
Topographic Wetness Index (TWI) |
x[:,4] |
Rainfall intensity proxy |
Edges are directed downhill-only (configurable), with edge attributes encoding slope and distance.
The DUALFloodGNN model processes the graph through:
- A node feature encoder (2-layer MLP → hidden_dim)
- A stack of message-passing processor layers with slope-weighted aggregation (downhill edges get higher weight via
softplus(slope)) - Four prediction heads:
- Depth head (
softplus→ always non-negative water depth) - u-head (x-velocity component,
tanh) - v-head (y-velocity component,
tanh) - Edge flow head (directional flow magnitude)
- Depth head (
The DrainageDesigner selects up to 220 diverse seed nodes ranked by TWI + rainfall score. From each seed it traces a steepest-descent path downstream (~24 hops). For every segment it computes:
- Manning's diameter:
d = ((Q·n·4^(5/3)) / (π·√S))^(3/8) - Diameter class:
D060_080,D080_100, orD100_PLUS - PMGSY compliance check (min 0.6 m)
- Chainage, flow rate, slope
All segments are exported as GeoJSON and AutoCAD DXF.
Results are served to the VO React dashboard for interactive exploration.
VARUNA embeds three physical constraints as loss terms during training:
∂h/∂t + ∇·Q = r
Residual: (h / dt) + divergence(edge_flow) - rainfall_term
(Δu² + Δv²) ≈ |Δh|
Velocity differences across edges should scale with the hydraulic head gradient.
Penalises water flowing uphill on downhill terrain edges:
L_gravity = mean(ReLU(-dot(velocity_src, edge_direction))) [downhill edges only]
L = w_data · MSE(h_pred, h_target)
+ w_physics · (L_continuity + 0.5 · L_momentum)
+ w_gravity · L_gravity
Default weights: w_data = 0.7, w_physics = 0.2, w_gravity = 0.1
The interactive dashboard is a Next.js 16 application located in the VO/ directory.
| Feature | Description |
|---|---|
| 🗺️ Interactive Map | Leaflet map with real village boundaries |
| 🌊 Flood Zone Overlay | Problem zones coloured by severity |
| 🔵 Drainage Network | Existing vs proposed pipeline segments |
| 📊 Metrics Panel | Total length, pipeline counts, coverage area |
| 🌧️ Rainfall Simulation | Intensify flood zones by 1.5× |
| 🔍 Click-to-Inspect | Click any segment or zone for details |
| 📍 Multi-location | Switchable demo villages + real VARUNA output |
cd VO
npm install
npm run devOpen http://localhost:3000.
The dashboard loads the pre-computed public/varuna_drainage_design.geojson (real PI-GNN output) for the VARUNA Real — Ralegan Siddhi location.
- Python ≥ 3.10
- Node.js ≥ 18 + npm
- CUDA-capable GPU (optional but recommended for training)
# Clone the repository
git clone https://github.com/SenseiSuraj24/Project-VARUNA.git
cd Project-VARUNA
# Create a virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/macOS
# Install the package + dependencies
pip install -e .
pip install -r requirements.txtcd VO
npm install
npm run devAll backend commands go through the varuna-run CLI entry point (or python -m varuna.main).
varuna-run run path/to/village.laz --scenario baseline --prettyvaruna-run run-dem path/to/dem.tif --scenario baseline --max-cells 320 --prettyvaruna-run village-demo "Ralegan Siddhi, Maharashtra, India" --half-km 1.5 --prettyvaruna-run train outputs/graphs/village_graph.pt --epochs 50varuna-run predict outputs/graphs/village_graph.pt outputs/models/checkpoint.ptvaruna-run auditvaruna-run benchmark outputs/graphs/village_graph.ptvaruna-run dashboard --serve --port 8000All defaults are in src/varuna/config/default_config.yaml:
rainfall:
baseline_mm_per_hr: 75.0 # IMD 50-year return period
infiltration_mm_per_hr: 10.0
return_period_years: 50
graph:
node_spacing_m: 2.0
downhill_only_edges: true
pignn:
hidden_dim: 64
num_layers: 3
loss_weight_data: 0.7
loss_weight_physics: 0.2
loss_weight_gravity: 0.1
train_epochs: 20
learning_rate: 0.001
drainage:
min_pipe_diameter_m: 0.6 # PMGSY minimum
manning_n_concrete: 0.013Override any value by editing the YAML or by extending VarunaConfig in code.
| Output | Path | Format |
|---|---|---|
| Drainage design | outputs/varuna_drainage_design.geojson |
GeoJSON |
| CAD drawing | outputs/varuna_drainage_design.dxf |
AutoCAD DXF |
| Design summary | outputs/varuna_drainage_summary.json |
JSON |
| Trained model | outputs/training/best_model.pt |
PyTorch checkpoint |
| Training report | outputs/training/latest_training_report.json |
JSON |
| Village boundary | outputs/village_boundary.geojson |
GeoJSON |
| Dataset | Source | Use |
|---|---|---|
| LiDAR Point Clouds | Field survey / Open TopoData | Ground truth terrain |
| SRTM/ASTER DEM | NASA / OpenTopography | Elevation (village demo) |
| IMD Gridded Rainfall | RF25_ind*.nc (IMD) |
Rainfall scenarios |
| LULC Rasters | Bhuvan / ISRO | Manning's n values |
| OSM Village Boundaries | OpenStreetMap (osmnx) | AOI definition |
| PMGSY Standards | MoRD, Government of India | Pipe sizing compliance |
Project VARUNA was built for the PAML Hackathon 2026.
| Member | Role |
|---|---|
| Suraj | Architecture, PI-GNN, Dashboard |
| Sudarshan G | Backend, Visualization, UI Refactor |
| Narendra Kanchi | Physics Loss, Testing, Documentation |
This project is developed for academic and hackathon purposes.
© 2026 Project VARUNA Team. All rights reserved.