
### SYSTEM DIRECTIVE: GEOPHYSICAL THREAT & AIRSPACE INTERSEC...
Prompt
### SYSTEM DIRECTIVE: GEOPHYSICAL THREAT & AIRSPACE INTERSECTION PLATFORM (AeroSeis-4D) You are tasked with engineering a production-grade, mathematically rigorous, full-stack real-time geohazard monitoring and aviation safety simulator called **AeroSeis-4D**. The system must detect earthquakes, simulate volcanic plume kinetics, process satellite thermal band anomalies, stream live transponder flight data, and dynamically execute 4D flight path re-routing around ash plumes in real time. --- ### CORE SPECIFICATIONS & CONSTRAINTS #### 1. Ingestion Engine & Live External Feeds Implement asynchronous, fault-tolerant ingestion pipelines with automatic backoff and offline synthetic failover modes: * **Seismic Data**: Ingest live seismic events via the USGS FDSN Web Service (GeoJSON feed). Run a real-time STA/LTA (Short-Term Average / Long-Term Average) trigger algorithm on a simulated triaxial accelerometer stream ($100\text{ Hz}$) to identify P-wave and S-wave phase arrivals. * **Aviation Data**: Ingest live commercial flights via the OpenSky Network API (REST/Live ADS-B vectors). Parse 17-point state vectors (`icao24`, `callsign`, `latitude`, `longitude`, `baro_altitude`, `velocity`, `heading`, `vertical_rate`). * **Satellite Feeds & Earth Observation**: Interface with NASA GIBS / Sentinel Hub / NOAA GOES-R ABI multispectral data. Implement split-window thermal difference processing (Brightness Temperature Difference $\text{BTD} = T_{11\mu\text{m}} - T_{12\mu\text{m}}$) to distinguish volcanic silicate ash clouds and sulfur dioxide ($\text{SO}_2$) plumes from meteorological water vapor. #### 2. Deterministic & Stochastic Physics Simulation Write complete, un-truncated numerical algorithms for the following geophysical phenomena: * **Seismic Wave Propagation**: Calculate ground displacement and Peak Ground Acceleration (PGA) using anelastic attenuation with seismic quality factor $Q$ and Joyner-Boore distance ($R_{jb}$): $$A(r, f) = A_0 \cdot \frac{1}{r} \cdot \exp\left(-\frac{\pi f r}{Q v}\right)$$ Compute radial wavefront expansions across terrain elevation bounds for both primary ($v_p \approx 6.0\text{ km/s}$) and shear ($v_s \approx 3.5\text{ km/s}$) velocities. * **Volcanic Ash Column & Dispersion Dynamics**: Model vertical plume mass distribution using the 1D Suzuki eruption column equation: $$S(z) = S_0 \cdot \frac{k\left(1 - \frac{z}{H}\right)\exp\left[k\left(\frac{z}{H} - 1\right)\right]}{H\left[1 - (1+k)\exp(-k)\right]}$$ Couple this with a 3D Eulerian-Lagrangian transport model advected by isobaric wind vectors ($u, v, w$) across atmospheric flight levels (FL100 through FL450) with gravitational settling velocity $v_s$ determined by Stokes' Law with Cunningham slip correction. #### 3. 4D Collision Detection & Kinetic Aircraft Re-Routing * **Volcanic Ash Advisory (VAAC) Dynamic Geometry**: Generate dynamic, time-indexed 3D polygon envelopes (convex hulls) around ash concentrations exceeding safe engine ingestion thresholds ($\ge 2.0\text{ mg/m}^3$). * **Trajectory Conflict Interception**: Continuous raycasting and spatial polyhedron collision detection between aircraft 4D kinematic trajectories $\mathbf{X}(t) = [x(t), y(t), z(t)]$ and the evolving 3D ash cloud geometry. * **Autonomous Avoidance Re-Routing**: When an intersection is predicted within a 30-minute lookahead window, execute a real-time Dubins path or 3D A* waypoint re-planner that respects: 1. Maximum civil aircraft bank angles ($\le 25^\circ$) and standard climb/descent gradients. 2. Fuel-burn penalty optimization. 3. Controlled Airspace (FIR) boundary constraints. #### 4. Visualization & Frontend Rendering Architecture Provide the WebGL / CesiumJS / Three.js front-end pipeline specification: * Volumetric raymarching shader or GPU instanced particle systems representing the volcanic cloud with dynamic density and opacity falloff. * Interpolated 3D flight paths showing altitude color ramps, heading vectors, historical breadcrumbs, and emergency vector routes. * Real-time multi-layered geospatial base: OpenStreetMap/Mapbox raster tiles, dynamic geo-referenced infrared satellite raster overlays, and animated seismic epicenter shockwaves. --- ### DELIVERABLE REQUIREMENTS 1. **Architecture Blueprint**: A complete system diagram delineating WebSocket event buses, caching layers (Redis), the simulation loop (ticker frequency $\Delta t$), and API ingestion workers. 2. **Production-Ready Implementation**: Provide full, fully-typed code (Python 3.12+ FastAPI backend + WebSockets, alongside TypeScript/CesiumJS or Three.js/WebGL frontend code). 3. **Zero Placeholders**: Do NOT output comments such as `// TODO: Implement calculation here` or `/* Ash dispersion logic goes here */`. Write out the complete mathematical, vector manipulation, and network communication routines. 4. **Resilience & Edge-Case Handling**: Provide mathematical guards against division by zero in zero-wind scenarios, handle OpenSky API rate limits (HTTP 429) with continuous synthetic dead-reckoning extrapolation, and resolve polygon non-manifold edge artifacts during mesh generation.
A system prompt was added to support web rendering