Optical Fiber Simulation
A single-page web application for numerical simulation of ultrashort pulse propagation in optical fiber, built on the Generalized Nonlinear Schrödinger Equation (GNLSE). Covers dispersion, nonlinear effects (SPM, SRS, self-steepening), soliton dynamics, and link power budget analysis.
- IP-RK45 solver - Interaction Picture method with RK45 adaptive step control; absorbs the linear dispersion operator analytically and applies the nonlinear operator in the interaction picture frame
- Solver stability guard - automatically detects divergence (ΔE > 200 % or ΔE > 50 % with peak amplitude × 5) and returns an error before producing corrupted plots
- Physics toggles - Raman scattering (SRS) and self-steepening can be switched on/off independently via checkboxes
- Full dispersion Taylor series - β₂ slider (−50 to +50 ps²/km) with higher-order terms fixed to PCF values
| Section | Plots |
|---|---|
| Communication Analysis | Eye Diagram (full-width) - overlaid 10 Gbps NRZ traces showing signal quality |
| Evolution Maps | Spectral evolution λ vs Z (linear & log dB), Temporal evolution τ vs Z (linear & log dB) |
| Output Slices | Output spectrum PSD [dB], Spectral slices (input · mid · output), Output pulse power, Temporal slices |
| Pulse Dynamics | Instantaneous frequency / chirp δν(τ), Spectral phase φ(λ), Peak power P/P₀ vs Z, Spectral bandwidth σ_ν vs Z |
- Streams simulation log in real time via Server-Sent Events
- Logs dispersion length L_D, nonlinear length L_NL, soliton order N, regime classification, and energy conservation check
- [PARAM] change tracking - every slider/input/select change is logged as
[PARAM] Label: old → newin orange - [PRESET] logging - preset selection and parameter reset are logged
- ↓ Download Log - exports the full terminal session as a
.txtfile with a timestamped entry
Soliton Order (N) · Peak Intensity · BER · Total Loss · Link Margin · Link Status (PASS / FAIL) - all computed live on every parameter change.
| Key | Description | λ₀ | P_peak | L_fiber | β₂ | Pulse |
|---|---|---|---|---|---|---|
| Dudley SC | Supercontinuum (default) | 835 nm | 10 kW | 15 cm | −11.8 ps²/km | Sech |
| Soliton Fission | Soliton propagation | 835 nm | 8 kW | 50 cm | −11.8 ps²/km | Sech |
| Soliton Fission | Higher-order fission | 1064 nm | 20 kW | 10 cm | −11.8 ps²/km | Sech |
| Dispersive Wave | DW generation | 835 nm | 5 kW | 15 cm | −11.8 ps²/km | Sech |
| Telecom SMF | Standard SMF-28 regime | 1550 nm | 3 kW | 30 cm | −20.0 ps²/km | Gaussian |
| Low Power | Normal dispersion, weak NL | 1064 nm | 1 kW | 20 cm | +20.0 ps²/km | Gaussian |
- ↓ Save Results - saves all 12 plots as PNG +
params.txt+terminal_log.txtin a timestamped folder underresults/YYYY-MM-DD_HH-MM-SS/ - ↑ Import params.txt - loads a previously saved
params.txtback into all controls, logging each restored value in the terminal
Please check code/setup.md.
| Method | Route | Description |
|---|---|---|
GET |
/ |
Serves the UI |
GET |
/api/log/stream |
SSE stream of simulation log lines |
POST |
/api/simulate/physics |
Runs IP-RK45 solver; returns 12 base64 PNG plots + stat values |
POST |
/api/simulate/link |
Computes link power budget; returns loss, margin, PASS/FAIL |
POST |
/api/save/plots |
Saves plots, params, and logs into a timestamped results/ folder |
POST |
/api/ai/chat |
Returns AI-based parameter recommendations (ChatGPT / Gemini / Ollama) |