# esranow/rippl architecture

> Architecture diagram of the GitHub repository esranow/rippl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/esranow/rippl
- Repository: https://github.com/esranow/rippl

## Overview

1. **What this repository is**
   rippl is a Python-first “physics compiler” for neural networks: users define a PDE/physics problem and a neural model, and rippl turns that into a training/inference workflow with residuals, boundary conditions, adaptive losses, and solver integration.

2. **Primary user-facing entry points**
   The main public surface is the top-level `rippl` package plus `rippl.nn`. The README’s flow (`compile(...)` then `run(...)`) matches the architecture: model + domain + equation are assembled into an execution engine, then launched through a high-level API or CLI.

3. **Core orchestration layer**
   `rippl/core` is the control plane. It contains the abstractions that glue everything together: configuration, experiments, simulations, operator experiments, inverse problems, equation/system representations, solver selection, and artifact handling. This is where the repository’s “physics compiler” behavior is coordinated.

4. **Physics and equation definitions**
   `rippl/physics` is the domain library for PDE residuals and constraints. It includes many physics-specific modules such as Navier–Stokes, Schrodinger, Maxwell, Euler, elasticity, phase-field, stochastic, reaction-diffusion, and fractional operators. These modules provide the mathematical problem definitions that the engine compiles against.

5. **Geometry and domain construction**
   `rippl/geometry` and `rippl/operators` support spatial domains and operator-level utilities. The CSG module indicates constructive solid geometry is used for complex shapes, while grid/operator utilities help map equations onto sampled domains or operator-learning settings.

6. **Neural model layer**
   `rippl/nn` and `rippl/models` define the network architectures used by the physics workflows. The repo includes MLPs, SIREN, Fourier/spectral models, FNO, DeepONet, Hamiltonian/Lagrangian models, neural ODEs, and specialized blocks for conservation, boundaries, gradients, and residual computation. This layer is where the learning representation is chosen.

7. **Training subsystem**
   `rippl/training` is the main optimization stack. It includes engines for Lightning and Accelerate, adaptive sampling, causal training, curriculum learning, NTK weighting, Pareto balancing, VPINN/FBPINN recipes, uncertainty quantification, and callbacks/logging. This subsystem is responsible for how physics losses are scheduled and optimized.

8. **Solvers, sampling, and data flow**
   `rippl/solvers`, `rippl/sampling`, `rippl/data`, and `rippl/datasets` form the numerical/data pipeline around the model. They handle finite-difference and spectral solvers, spectral sampling strategies, sensor data ingestion, and synthetic dataset generation. The flow is generally: geometry/domain → sampled collocation/sensor points → residuals/constraints → training or verification.

9. **Diagnostics and validation**
   `rippl/diagnostics` provides evaluation beyond standard ML metrics: energy-based checks, spectral analysis, physics validators, and generic metrics. This is the verification layer used to confirm that learned solutions respect the underlying PDE or conservation law.

10. **Import/export and persistence**
   `rippl/io` and `rippl/export` manage checkpoints and model export, including quantization support. These modules define the persistence boundary for trained artifacts and are important for deployment or reproducibility.

11. **Performance-critical native backend**
   `rippl_backend` is a Rust extension package that backs hot paths such as derivatives, boundary handling, causal weighting, NTK weighting, Pareto balancing, distance computations, and fingerprint/license utilities. The Python package wraps this backend, so the architecture splits between high-level orchestration in Python and low-latency kernels in Rust.

12. **Plugin and enterprise extension boundary**
   `rippl_pro` is a separate extension tree for advanced capabilities such as multi-GPU/distributed training and CAD/mesh ingestion. It is intentionally isolated from the core package, indicating a plugin-style boundary for premium or specialized workflows.

13. **Migration and compatibility layer**
   `rippl/migrate` contains a transpiler for moving from other physics-ML ecosystems. That suggests an explicit compatibility boundary: existing models/configs can be converted into rippl’s internal abstractions rather than rewritten manually.

14. **Validation, benchmarks, and repository role**
   `rippl/benchmarks`, `tests_real`, and the regular test suite show that the project is organized around end-to-end physics scenarios, not just unit tests. The many notebooks and benchmark scripts indicate the repo serves as both a library and a verified reference implementation for PDE/operator-learning workflows.

15. **How the main data/control flow fits together**
   A typical run starts with a user model and PDE definition, passes through core configuration/engine setup, uses geometry and physics modules to generate residuals and boundary conditions, trains through the training stack with possible native backend acceleration, and finally emits diagnostics/exported artifacts. The major architectural boundary is between declarative physics definition and the compiled execution engine that actually trains or solves the problem.

Main entry points: [`rippl/core/engine.py`](https://github.com/esranow/rippl/blob/main/rippl/core/engine.py) (Engine), [`rippl/core`](https://github.com/esranow/rippl/tree/main/rippl/core) (Core), [`rippl/physics`](https://github.com/esranow/rippl/tree/main/rippl/physics) (Physics), [`rippl/training`](https://github.com/esranow/rippl/tree/main/rippl/training) (Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_public["Public API"]
  node_n_api["rippl API<br/>package entry<br/>[__init__.py]"]
  node_n_cli["CLI<br/>command entry<br/>[cli.py]"]
end

subgraph group_grp_core["Core Engine"]
  node_n_core["Core<br/>orchestration"]
  node_n_engine["Engine<br/>[engine.py]"]
  node_n_equation["Equations<br/>problem model<br/>[equation.py]"]
end

subgraph group_grp_physics["Physics Domain"]
  node_n_physics["Physics<br/>pde library"]
  node_n_geometry["Geometry<br/>domain modeling<br/>[csg.py]"]
  node_n_operators["Operators<br/>domain utils"]
end

subgraph group_grp_learning["Learning Stack"]
  node_n_nn["NN layer<br/>model library"]
  node_n_models["Models<br/>architectures"]
  node_n_training["Training<br/>optimization stack"]
  node_n_sampling["Sampling"]
end

subgraph group_grp_runtime["Runtime & IO"]
  node_n_solvers["Solvers"]
  node_n_data["Data"]
  node_n_diag["Diagnostics<br/>validation"]
  node_n_io["IO & export<br/>persistence"]
  node_n_migrate["Migrate<br/>transpiler<br/>[transpiler.py]"]
end

subgraph group_grp_ext["Extensions"]
  node_n_backend["Backend<br/>rust extension"]
  node_n_pro["rippl_pro<br/>extension package"]
end

node_n_api -->|"compile/run"| node_n_core
node_n_cli -->|"invoke"| node_n_api
node_n_core -->|"builds"| node_n_engine
node_n_core -->|"assembles"| node_n_equation
node_n_engine -->|"residuals"| node_n_physics
node_n_engine -->|"domains"| node_n_geometry
node_n_engine -->|"samples"| node_n_sampling
node_n_engine -->|"optimizes"| node_n_training
node_n_engine -->|"solves"| node_n_solvers
node_n_physics -->|"uses"| node_n_operators
node_n_nn -->|"implements"| node_n_models
node_n_training -->|"accelerates"| node_n_backend
node_n_physics -->|"accelerates"| node_n_backend
node_n_data -->|"feeds"| node_n_sampling
node_n_diag -->|"checks"| node_n_engine
node_n_io -->|"persists"| node_n_engine
node_n_migrate -->|"adapts"| node_n_core
node_n_pro -->|"extends"| node_n_training
node_n_pro -->|"ingests"| node_n_geometry
node_n_backend -.->|"supports"| node_n_io

click node_n_api "https://github.com/esranow/rippl/blob/main/rippl/__init__.py"
click node_n_cli "https://github.com/esranow/rippl/blob/main/rippl/cli.py"
click node_n_core "https://github.com/esranow/rippl/tree/main/rippl/core"
click node_n_engine "https://github.com/esranow/rippl/blob/main/rippl/core/engine.py"
click node_n_equation "https://github.com/esranow/rippl/blob/main/rippl/core/equation.py"
click node_n_physics "https://github.com/esranow/rippl/tree/main/rippl/physics"
click node_n_geometry "https://github.com/esranow/rippl/blob/main/rippl/geometry/csg.py"
click node_n_operators "https://github.com/esranow/rippl/tree/main/rippl/operators"
click node_n_nn "https://github.com/esranow/rippl/tree/main/rippl/nn"
click node_n_models "https://github.com/esranow/rippl/tree/main/rippl/models"
click node_n_training "https://github.com/esranow/rippl/tree/main/rippl/training"
click node_n_sampling "https://github.com/esranow/rippl/tree/main/rippl/sampling"
click node_n_solvers "https://github.com/esranow/rippl/tree/main/rippl/solvers"
click node_n_data "https://github.com/esranow/rippl/tree/main/rippl/data"
click node_n_diag "https://github.com/esranow/rippl/tree/main/rippl/diagnostics"
click node_n_io "https://github.com/esranow/rippl/tree/main/rippl/io"
click node_n_backend "https://github.com/esranow/rippl/tree/main/rippl_backend"
click node_n_pro "https://github.com/esranow/rippl/tree/main/rippl_pro"
click node_n_migrate "https://github.com/esranow/rippl/blob/main/rippl/migrate/transpiler.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n_api,node_n_cli toneBlue
class node_n_core,node_n_engine,node_n_equation toneAmber
class node_n_physics,node_n_geometry,node_n_operators toneMint
class node_n_nn,node_n_models,node_n_training,node_n_sampling toneRose
class node_n_solvers,node_n_data,node_n_diag,node_n_io,node_n_migrate toneIndigo
class node_n_backend,node_n_pro toneTeal
```

## Components

### Public API

User entry points and top-level package surface.

- [rippl API](https://github.com/esranow/rippl/blob/main/rippl/__init__.py): package entry · Top-level public package and high-level compile/run surface. · `rippl/__init__.py`
- [CLI](https://github.com/esranow/rippl/blob/main/rippl/cli.py): command entry · Command-line entry point for running workflows. · `rippl/cli.py`

### Core Engine

Compilation, experiment, and execution orchestration.

- [Core](https://github.com/esranow/rippl/tree/main/rippl/core): orchestration · Configuration, experiments, engine setup, inverse problems, and system wiring. · `rippl/core`
- [Engine](https://github.com/esranow/rippl/blob/main/rippl/core/engine.py): runtime engine · Compiled execution engine that drives training or simulation runs. · `rippl/core/engine.py`
- [Equations](https://github.com/esranow/rippl/blob/main/rippl/core/equation.py): problem model · Equation and system representations used by the compiler. · `rippl/core/equation.py`

### Physics Domain

PDEs, residuals, geometry, and domain operators.

- [Physics](https://github.com/esranow/rippl/tree/main/rippl/physics): pde library · PDE residuals, operators, and conservation/constraint definitions. · `rippl/physics`
- [Geometry](https://github.com/esranow/rippl/blob/main/rippl/geometry/csg.py): domain modeling · Spatial domains and constructive solid geometry helpers. · `rippl/geometry/csg.py`
- [Operators](https://github.com/esranow/rippl/tree/main/rippl/operators): domain utils · Grid and operator-mode utilities supporting sampled domains. · `rippl/operators`

### Learning Stack

Neural models, training, and sampling.

- [NN layer](https://github.com/esranow/rippl/tree/main/rippl/nn): model library · Neural network components and physics-aware blocks. · `rippl/nn`
- [Models](https://github.com/esranow/rippl/tree/main/rippl/models): architectures · Named model architectures such as DeepONet, FNO, Hamiltonian, Lagrangian, and neural ODEs. · `rippl/models`
- [Training](https://github.com/esranow/rippl/tree/main/rippl/training): optimization stack · Engines and recipes for adaptive, causal, curriculum, NTK, Pareto, VPINN, and FBPINN training. · `rippl/training`
- [Sampling](https://github.com/esranow/rippl/tree/main/rippl/sampling): point sampling · Collocation and spectral sampling strategies. · `rippl/sampling`

### Runtime & IO

Solvers, data flow, diagnostics, persistence, and logging.

- [Solvers](https://github.com/esranow/rippl/tree/main/rippl/solvers): numerical solvers · Finite-difference and spectral solver implementations. · `rippl/solvers`
- [Data](https://github.com/esranow/rippl/tree/main/rippl/data): sensor/data · Sensor ingestion and dataset generation. · `rippl/data`
- [Diagnostics](https://github.com/esranow/rippl/tree/main/rippl/diagnostics): validation · Energy, spectral, metrics, and physics validation checks. · `rippl/diagnostics`
- [IO & export](https://github.com/esranow/rippl/tree/main/rippl/io): persistence · Checkpoints, export, and quantization of trained artifacts. · `rippl/io`
- [Migrate](https://github.com/esranow/rippl/blob/main/rippl/migrate/transpiler.py): transpiler · Compatibility layer for converting external physics-ML projects into rippl abstractions. · `rippl/migrate/transpiler.py`

### Extensions

Native backend and premium extension boundary.

- [Backend](https://github.com/esranow/rippl/tree/main/rippl_backend): rust extension · Native kernels for derivatives, boundary handling, weighting, distance, and utility hot paths. · `rippl_backend`
- [rippl_pro](https://github.com/esranow/rippl/tree/main/rippl_pro): extension package · Isolated premium/enterprise extensions for distributed training and CAD/mesh ingestion. · `rippl_pro`

## Connections

- rippl API → Core: compile/run · Public API delegates to the orchestration layer.
- CLI → rippl API: invoke · CLI routes user commands into the public API.
- Core → Engine: builds · Core configures and launches the execution engine.
- Core → Equations: assembles · Core binds equations and systems into a runnable problem.
- Engine → Physics: residuals · Engine evaluates PDE constraints and operators.
- Engine → Geometry: domains · Engine uses geometry to define collocation and boundary regions.
- Engine → Sampling: samples · Engine consumes sampling strategies for points and operators.
- Engine → Training: optimizes · Engine trains via the optimization stack and recipes.
- Engine → Solvers: solves · Engine may delegate to numerical solvers for verification or hybrid workflows.
- Physics → Operators: uses · Physics modules rely on operator/grid utilities.
- NN layer → Models: implements · Model package provides reusable neural architectures.
- Training → Backend: accelerates · Training uses native kernels for hot-path weighting and derivatives.
- Physics → Backend: accelerates · Physics computations use Rust-backed derivative and boundary routines.
- Data → Sampling: feeds · Sensor and dataset inputs are transformed into training points.
- Diagnostics → Engine: checks · Diagnostics validate solutions produced by the engine.
- IO & export → Engine: persists · IO stores checkpoints and exported artifacts from runs.
- Migrate → Core: adapts · Migration rewrites external problems into rippl core abstractions.
- rippl_pro → Training: extends · Enterprise package adds distributed training capabilities.
- rippl_pro → Geometry: ingests · Pro geometry layer supports CAD/mesh workflows.
- Backend → IO & export: supports · Native utilities assist artifact-related infrastructure.
