diff --git a/README.md b/README.md index d1d78dd1..2c2d58e4 100644 --- a/README.md +++ b/README.md @@ -1,521 +1,344 @@ # Atomizer -> Advanced LLM-native optimization platform for Siemens NX Simcenter with Neural Network Acceleration +> **Talk, don't click.** AI-native structural optimization for Siemens NX with neural network acceleration. [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) +[![NX 2506+](https://img.shields.io/badge/NX-2506+-orange.svg)](https://www.plm.automation.siemens.com/global/en/products/nx/) [![License](https://img.shields.io/badge/license-Proprietary-red.svg)](LICENSE) -[![Status](https://img.shields.io/badge/status-beta-green.svg)](https://github.com) -[![Neural](https://img.shields.io/badge/neural-GNN%20powered-purple.svg)](docs/NEURAL_FEATURES_COMPLETE.md) - -## Overview - -Atomizer is an **LLM-native optimization framework** for Siemens NX Simcenter that transforms how engineers interact with optimization workflows. It combines AI-assisted natural language interfaces with **Graph Neural Network (GNN) surrogates** that achieve **600x-500,000x speedup** over traditional FEA simulations. - -### Core Philosophy - -Atomizer enables engineers to: -- **Describe optimizations in natural language** instead of writing configuration files -- **Accelerate optimization 1000x** using trained neural network surrogates -- **Generate custom analysis functions on-the-fly** (RSS metrics, weighted objectives, constraints) -- **Get intelligent recommendations** based on optimization results and surrogate models -- **Generate comprehensive reports** with AI-written insights and visualizations -- **Extend the framework autonomously** through LLM-driven code generation - -### Key Features - -- **Neural Network Acceleration**: Graph Neural Networks predict FEA results in 4.5ms vs 10-30min for traditional solvers -- **LLM-Driven Workflow**: Natural language study creation, configuration, and analysis -- **Advanced Optimization**: Optuna-powered TPE, Gaussian Process surrogates, multi-objective Pareto fronts -- **Dynamic Code Generation**: AI writes custom Python functions and NX journal scripts during optimization -- **Intelligent Decision Support**: Surrogate quality assessment, sensitivity analysis, engineering recommendations -- **Real-Time Monitoring**: Interactive web dashboard with live progress tracking -- **Extensible Architecture**: Plugin system with hooks for pre/post mesh, solve, and extraction phases -- **Hybrid FEA/NN Optimization**: Intelligent switching between physics simulation and neural predictions -- **Self-Improving**: Continuous learning from optimization runs to improve neural surrogates +[![Neural](https://img.shields.io/badge/neural-GNN%20powered-purple.svg)](docs/06_PHYSICS/) --- -## Documentation +## What is Atomizer? -πŸ“š **[Complete Documentation Index](docs/00_INDEX.md)** - Start here for all documentation +Atomizer is an **LLM-first optimization framework** that transforms how engineers interact with FEA optimization. Instead of manually configuring JSON files and writing extraction scripts, you describe what you want in natural language - and Atomizer handles the rest. -### Quick Links +``` +Engineer: "Optimize the M1 mirror support structure to minimize wavefront error + across elevation angles 20-90 degrees. Keep mass under 15kg." -- **[Neural Features Guide](docs/NEURAL_FEATURES_COMPLETE.md)** - Complete guide to GNN surrogates, training, and integration -- **[Neural Workflow Tutorial](docs/NEURAL_WORKFLOW_TUTORIAL.md)** - Step-by-step: data collection β†’ training β†’ optimization -- **[Visual Architecture Diagrams](docs/09_DIAGRAMS/)** - Comprehensive Mermaid diagrams showing system architecture and workflows -- **[Protocol Specifications](docs/PROTOCOLS.md)** - All active protocols (10, 11, 13) consolidated -- **[Development Guide](DEVELOPMENT.md)** - Development workflow, testing, contributing -- **[Dashboard Guide](docs/DASHBOARD.md)** - Comprehensive React dashboard with multi-objective visualization -- **[NX Multi-Solution Protocol](docs/NX_MULTI_SOLUTION_PROTOCOL.md)** - Critical fix for multi-solution workflows -- **[Getting Started](docs/HOW_TO_EXTEND_OPTIMIZATION.md)** - Create your first optimization study +Atomizer: Creates study, configures extractors, runs optimization, reports results. +``` -### By Topic +### Core Capabilities -- **Neural Acceleration**: [NEURAL_FEATURES_COMPLETE.md](docs/NEURAL_FEATURES_COMPLETE.md), [NEURAL_WORKFLOW_TUTORIAL.md](docs/NEURAL_WORKFLOW_TUTORIAL.md), [GNN_ARCHITECTURE.md](docs/GNN_ARCHITECTURE.md) -- **Protocols**: [PROTOCOLS.md](docs/PROTOCOLS.md) - Protocol 10 (Intelligent Optimization), 11 (Multi-Objective), 13 (Dashboard) -- **Architecture**: [HOOK_ARCHITECTURE.md](docs/HOOK_ARCHITECTURE.md), [NX_SESSION_MANAGEMENT.md](docs/NX_SESSION_MANAGEMENT.md) -- **Dashboard**: [DASHBOARD_MASTER_PLAN.md](docs/DASHBOARD_MASTER_PLAN.md), [DASHBOARD_REACT_IMPLEMENTATION.md](docs/DASHBOARD_REACT_IMPLEMENTATION.md) -- **Advanced**: [HYBRID_MODE_GUIDE.md](docs/HYBRID_MODE_GUIDE.md) - LLM-assisted workflows +| Capability | Description | +|------------|-------------| +| **LLM-Driven Workflow** | Describe optimizations in plain English. Claude interprets, configures, and executes. | +| **Neural Acceleration** | GNN surrogates achieve 2000-500,000x speedup over FEA (4.5ms vs 10-30min) | +| **Physics Insights** | Real-time Zernike wavefront error, stress fields, modal analysis visualizations | +| **Multi-Objective** | Pareto optimization with NSGA-II, interactive parallel coordinates plots | +| **NX Integration** | Seamless journal-based control of Siemens NX Simcenter | +| **Extensible** | Plugin system with hooks for pre/post mesh, solve, and extraction phases | --- -## Architecture +## Architecture Overview ``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ LLM Interface Layer β”‚ -β”‚ Claude Skill + Natural Language Parser + Workflow Mgr β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - ↕ -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ Optimization Engine Core β”‚ -β”‚ Plugin System + Feature Registry + Code Generator β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - ↕ -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ Traditional Path β”‚ Neural Path (New!) β”‚ -β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ -β”‚ NX Solver (via Journals) β”‚ AtomizerField GNN β”‚ -β”‚ ~10-30 min per eval β”‚ ~4.5 ms per eval β”‚ -β”‚ Full physics fidelity β”‚ Physics-informed learning β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - ↕ -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ Hybrid Decision Engine β”‚ -β”‚ Confidence-based switching β€’ Uncertainty quantificationβ”‚ -β”‚ Automatic FEA validation β€’ Online learning β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - ↕ -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ Analysis & Reporting β”‚ -β”‚ Surrogate Quality + Sensitivity + Report Generator β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” + β”‚ LLM Interface Layer β”‚ + β”‚ Claude Code + Natural Lang β”‚ + β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β”‚ + β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” + β”‚ β”‚ β”‚ + β–Ό β–Ό β–Ό + β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” + β”‚ Traditional β”‚ β”‚ Neural Path β”‚ β”‚ Dashboard β”‚ + β”‚ FEA Path β”‚ β”‚ (GNN Surrogate) β”‚ β”‚ (React) β”‚ + β”‚ ~10-30 min β”‚ β”‚ ~4.5 ms β”‚ β”‚ Real-time β”‚ + β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β”‚ β”‚ β”‚ + β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β”‚ + β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” + β”‚ Extractors & Insights β”‚ + β”‚ 20+ physics extractors β”‚ + β”‚ 8 visualization types β”‚ + β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` -### Neural Network Components (AtomizerField) +--- + +## Key Features + +### 1. Physics Extractors (20+) + +Atomizer includes a comprehensive library of validated physics extractors: + +| Category | Extractors | Notes | +|----------|------------|-------| +| **Displacement** | `extract_displacement()` | mm, nodal | +| **Stress** | `extract_von_mises_stress()`, `extract_principal_stress()` | Shell (CQUAD4) & Solid (CTETRA) | +| **Modal** | `extract_frequency()`, `extract_modal_mass()` | Hz, kg | +| **Mass** | `extract_mass_from_bdf()`, `extract_mass_from_expression()` | kg | +| **Thermal** | `extract_temperature()` | K | +| **Energy** | `extract_strain_energy()` | J | +| **Optics** | `extract_zernike_*()` (Standard, Analytic, **OPD**) | nm RMS | + +**Zernike OPD Method**: The recommended extractor for mirror optimization. Correctly accounts for lateral displacement when computing wavefront error - critical for tilted mirror analysis. + +### 2. Study Insights (8 Types) + +Interactive physics visualizations generated on-demand: + +| Insight | Purpose | +|---------|---------| +| `zernike_wfe` | Wavefront error decomposition with Zernike coefficients | +| `zernike_opd_comparison` | Compare Standard vs OPD methods across subcases | +| `msf_zernike` | Mid-spatial frequency analysis | +| `stress_field` | 3D stress field visualization | +| `modal_analysis` | Mode shapes and frequencies | +| `thermal_field` | Temperature distribution | +| `design_space` | Parameter sensitivity exploration | + +### 3. Neural Network Acceleration + +The GNN surrogate system (`optimization_engine/gnn/`) provides: + +- **PolarMirrorGraph**: Fixed 3000-node polar grid for consistent predictions +- **ZernikeGNN**: Design-conditioned graph convolutions +- **Differentiable Zernike fitting**: GPU-accelerated coefficient computation +- **Hybrid optimization**: Automatic switching between FEA and NN based on confidence + +**Performance**: 4.5ms per prediction vs 10-30 minutes for FEA (2000x+ speedup) + +### 4. Real-Time Dashboard + +React-based monitoring with: +- Live trial progress tracking +- Pareto front visualization +- Parallel coordinates for multi-objective analysis +- Insights tab for physics visualizations +- Interactive Zernike decomposition with OPD/Standard toggle + +```bash +# Start the dashboard +python launch_dashboard.py +# Opens at http://localhost:3003 +``` + +--- + +## Current Studies + +Studies are organized by geometry type: ``` -β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” -β”‚ AtomizerField System β”‚ -β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ -β”‚ β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ BDF/OP2 β”‚ β”‚ GNN β”‚ β”‚ Inference β”‚ β”‚ -β”‚ β”‚ Parser │──>β”‚ Training │──>β”‚ Engine β”‚ β”‚ -β”‚ β”‚ (Phase 1) β”‚ β”‚ (Phase 2) β”‚ β”‚ (Phase 2) β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ β”‚ β”‚ β”‚ -β”‚ β–Ό β–Ό β–Ό β”‚ -β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ -β”‚ β”‚ Neural Model Types β”‚ β”‚ -β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ -β”‚ β”‚ β€’ Field Predictor GNN (displacement + stress) β”‚ β”‚ -β”‚ β”‚ β€’ Parametric GNN (all 4 objectives directly) β”‚ β”‚ -β”‚ β”‚ β€’ Ensemble models for uncertainty β”‚ β”‚ -β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ -β”‚ β”‚ -β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +studies/ +β”œβ”€β”€ M1_Mirror/ # Telescope primary mirror optimization +β”‚ β”œβ”€β”€ m1_mirror_adaptive_V15/ # Latest: Zernike OPD + GNN turbo +β”‚ └── m1_mirror_cost_reduction_V12/ +β”œβ”€β”€ Simple_Bracket/ # Structural bracket studies +β”œβ”€β”€ UAV_Arm/ # UAV arm frequency optimization +β”œβ”€β”€ Drone_Gimbal/ # Gimbal assembly +β”œβ”€β”€ Simple_Beam/ # Beam topology studies +└── _Other/ # Experimental ``` +### Study Structure + +Each study follows a standardized structure: + +``` +study_name/ +β”œβ”€β”€ optimization_config.json # Problem definition +β”œβ”€β”€ run_optimization.py # FEA optimization script +β”œβ”€β”€ run_nn_optimization.py # Neural turbo mode (optional) +β”œβ”€β”€ README.md # Study documentation +β”œβ”€β”€ 1_setup/ +β”‚ └── model/ # NX part, sim, fem files +β”œβ”€β”€ 2_iterations/ # Trial folders (iter1, iter2, ...) +β”œβ”€β”€ 3_results/ +β”‚ β”œβ”€β”€ study.db # Optuna database +β”‚ └── optimization.log # Execution logs +└── 3_insights/ # Generated visualizations + └── zernike_*.html +``` + +--- + ## Quick Start ### Prerequisites -- **Siemens NX 2412** with NX Nastran solver -- **Python 3.10+** (recommend Anaconda) -- **Git** for version control +- **Siemens NX 2506+** with NX Nastran solver +- **Python 3.10+** (Anaconda recommended) +- **Atomizer conda environment** (pre-configured) -### Installation - -1. **Clone the repository**: - ```bash - git clone https://github.com/yourusername/Atomizer.git - cd Atomizer - ``` - -2. **Create Python environment**: - ```bash - conda create -n atomizer python=3.10 - conda activate atomizer - ``` - -3. **Install dependencies**: - ```bash - pip install -r requirements.txt - ``` - -4. **Configure NX path** (edit if needed): - - Default NX path: `C:\Program Files\Siemens\NX2412\NXBIN\run_journal.exe` - - Update in `optimization_engine/nx_solver.py` if different - -### Basic Usage - -#### Example 1: Natural Language Optimization (LLM Mode - Available Now!) - -**New in Phase 3.2**: Describe your optimization in natural language - no JSON config needed! +### Run an Optimization ```bash -python optimization_engine/run_optimization.py \ - --llm "Minimize displacement and mass while keeping stress below 200 MPa. \ - Design variables: beam_half_core_thickness (15-30 mm), \ - beam_face_thickness (15-30 mm). Run 10 trials using TPE." \ - --prt studies/simple_beam_optimization/1_setup/model/Beam.prt \ - --sim studies/simple_beam_optimization/1_setup/model/Beam_sim1.sim \ - --trials 10 +# Activate the environment +conda activate atomizer + +# Navigate to a study +cd studies/M1_Mirror/m1_mirror_adaptive_V15 + +# Run optimization (50 FEA trials) +python run_optimization.py --start --trials 50 + +# Or run with neural turbo mode (5000 GNN trials) +python run_nn_optimization.py --turbo --nn-trials 5000 ``` -**What happens automatically:** -- βœ… LLM parses your natural language request -- βœ… Auto-generates result extractors (displacement, stress, mass) -- βœ… Auto-generates inline calculations (safety factor, RSS objectives) -- βœ… Auto-generates post-processing hooks (plotting, reporting) -- βœ… Runs optimization with Optuna -- βœ… Saves results, plots, and best design +### Monitor Progress -**Example**: See [examples/llm_mode_simple_example.py](examples/llm_mode_simple_example.py) for a complete walkthrough. - -**Requirements**: Claude Code integration (no API key needed) or provide `--api-key` for Anthropic API. - -#### Example 2: Current JSON Configuration - -Create `studies/my_study/config.json`: - -```json -{ - "sim_file": "studies/bracket_stress_minimization/model/Bracket_sim1.sim", - "design_variables": [ - { - "name": "wall_thickness", - "expression_name": "wall_thickness", - "min": 3.0, - "max": 8.0, - "units": "mm" - } - ], - "objectives": [ - { - "name": "max_stress", - "extractor": "stress_extractor", - "metric": "max_von_mises", - "direction": "minimize", - "weight": 1.0, - "units": "MPa" - } - ], - "optimization_settings": { - "n_trials": 50, - "sampler": "TPE", - "n_startup_trials": 20 - } -} -``` - -Run optimization: ```bash -python tests/test_journal_optimization.py -# Or use the quick 5-trial test: -python run_5trial_test.py +# Start the dashboard +python launch_dashboard.py + +# Or check status from command line +python -c "from optimization_engine.study_state import get_study_status; print(get_study_status('.'))" ``` -## Features +--- -### Neural Network Acceleration (AtomizerField) +## Optimization Methods -- **Graph Neural Networks (GNN)**: Physics-aware architecture that respects FEA mesh topology -- **Parametric Surrogate**: Design-conditioned GNN predicts all 4 objectives (mass, frequency, displacement, stress) -- **Ultra-Fast Inference**: 4.5ms per prediction vs 10-30 minutes for FEA (2,000-500,000x speedup) -- **Physics-Informed Loss**: Custom loss functions enforce equilibrium, constitutive laws, and boundary conditions -- **Uncertainty Quantification**: Ensemble-based confidence scores with automatic FEA validation triggers -- **Hybrid Optimization**: Smart switching between FEA and NN based on confidence thresholds -- **Training Data Export**: Automatic export of FEA results in neural training format (BDF/OP2 β†’ HDF5+JSON) -- **Pre-trained Models**: Ready-to-use models for UAV arm optimization with documented training pipelines +Atomizer supports multiple optimization strategies: -### Core Optimization +| Method | Use Case | Protocol | +|--------|----------|----------| +| **TPE** | Single-objective, <50 trials | SYS_10 (IMSO) | +| **NSGA-II** | Multi-objective, Pareto optimization | SYS_11 | +| **CMA-ES** | Continuous parameters, >100 trials | SYS_10 | +| **GNN Turbo** | >50 FEA trials available for training | SYS_14 | +| **Hybrid** | Confidence-based FEA/NN switching | SYS_15 | -- **Intelligent Multi-Objective Optimization**: NSGA-II algorithm for Pareto-optimal solutions -- **Advanced Dashboard**: React-based real-time monitoring with parallel coordinates visualization -- **NX Integration**: Seamless journal-based control of Siemens NX Simcenter -- **Multi-Solution Support**: Automatic handling of combined analysis types (static + modal, thermal + structural) -- **Smart Logging**: Detailed per-trial logs + high-level optimization progress tracking -- **Plugin System**: Extensible hooks at pre-solve, post-solve, and post-extraction points -- **Study Management**: Isolated study folders with automatic result organization -- **Substudy System**: NX-like hierarchical studies with shared models and independent configurations -- **Live History Tracking**: Real-time incremental JSON updates for monitoring progress -- **Resume Capability**: Interrupt and resume optimizations without data loss -- **Pareto Front Analysis**: Automatic extraction and visualization of non-dominated solutions -- **Parallel Coordinates Plot**: Research-grade multi-dimensional visualization with interactive selection +The **Method Selector** automatically recommends the best approach based on your problem: -## Current Status +```bash +python -m optimization_engine.method_selector config.json study.db +``` -**Development Phase**: Beta - 95% Complete +--- -### Core Optimization -- βœ… **Phase 1 (Plugin System)**: 100% Complete & Production Ready -- βœ… **Phases 2.5-3.1 (LLM Intelligence)**: 100% Complete - Components built and tested -- βœ… **Phase 3.2 (LLM Mode)**: Complete - Natural language optimization available -- βœ… **Protocol 10 (IMSO)**: Complete - Intelligent Multi-Strategy Optimization -- βœ… **Protocol 11 (Multi-Objective)**: Complete - Pareto optimization -- βœ… **Protocol 13 (Dashboard)**: Complete - Real-time React dashboard +## Protocol System -### Neural Network Acceleration (AtomizerField) -- βœ… **Phase 1 (Data Parser)**: Complete - BDF/OP2 β†’ HDF5+JSON conversion -- βœ… **Phase 2 (Neural Architecture)**: Complete - GNN models with physics-informed loss -- βœ… **Phase 2.1 (Parametric GNN)**: Complete - Design-conditioned predictions -- βœ… **Phase 2.2 (Integration Layer)**: Complete - Neural surrogate + hybrid optimizer -- βœ… **Phase 3 (Testing)**: Complete - 18 comprehensive tests -- βœ… **Pre-trained Models**: Available for UAV arm optimization +Atomizer uses a layered protocol system for consistent operations: -**What's Working**: -- βœ… Complete optimization engine with Optuna + NX Simcenter -- βœ… **Neural acceleration**: 4.5ms predictions (2000x speedup over FEA) -- βœ… **Hybrid optimization**: Smart FEA/NN switching with confidence thresholds -- βœ… **Parametric surrogate**: Predicts all 4 objectives from design parameters -- βœ… **Training pipeline**: Export data β†’ Train GNN β†’ Deploy β†’ Optimize -- βœ… Real-time dashboard with Pareto front visualization -- βœ… Multi-objective optimization with NSGA-II -- βœ… LLM-assisted natural language workflows +``` +Layer 0: Bootstrap β†’ Task routing, quick reference +Layer 1: Operations β†’ OP_01-06: Create, Run, Monitor, Analyze, Export, Debug +Layer 2: System β†’ SYS_10-16: IMSO, Multi-obj, Extractors, Dashboard, Neural, Insights +Layer 3: Extensions β†’ EXT_01-04: Create extractors, hooks, protocols, skills +``` -**Production Ready**: Core optimization + neural acceleration fully functional. +### Key Protocols -See [DEVELOPMENT_GUIDANCE.md](DEVELOPMENT_GUIDANCE.md) for comprehensive status and priorities. +| Protocol | Purpose | +|----------|---------| +| **OP_01** | Create new study from description | +| **OP_02** | Run optimization | +| **OP_06** | Troubleshoot issues | +| **SYS_12** | Extractor library reference | +| **SYS_14** | Neural network acceleration | +| **SYS_16** | Study insights | + +--- + +## Development Roadmap + +### Current Status (Dec 2025) + +- Core FEA optimization engine +- 20+ physics extractors including Zernike OPD +- GNN surrogate for mirror optimization +- React dashboard with live tracking +- Multi-objective Pareto optimization +- Study insights visualization system + +### Planned + +| Feature | Status | +|---------|--------| +| Dynamic response (random vibration, PSD) | Planning | +| Code reorganization (modular structure) | Planning | +| Ensemble uncertainty quantification | Planned | +| Auto-documentation generator | Implemented | +| MCP server integration | Partial | + +--- ## Project Structure ``` Atomizer/ -β”œβ”€β”€ optimization_engine/ # Core optimization logic -β”‚ β”œβ”€β”€ runner.py # Main optimization runner -β”‚ β”œβ”€β”€ runner_with_neural.py # Neural-enhanced runner (NEW) -β”‚ β”œβ”€β”€ neural_surrogate.py # GNN integration layer (NEW) -β”‚ β”œβ”€β”€ training_data_exporter.py # Export FEAβ†’neural format (NEW) -β”‚ β”œβ”€β”€ nx_solver.py # NX journal execution -β”‚ β”œβ”€β”€ nx_updater.py # NX model parameter updates -β”‚ β”œβ”€β”€ result_extractors/ # OP2/F06 parsers -β”‚ └── plugins/ # Plugin system -β”‚ -β”œβ”€β”€ atomizer-field/ # Neural Network System (NEW) -β”‚ β”œβ”€β”€ neural_field_parser.py # BDF/OP2 β†’ neural format -β”‚ β”œβ”€β”€ validate_parsed_data.py # Physics validation -β”‚ β”œβ”€β”€ batch_parser.py # Batch processing -β”‚ β”œβ”€β”€ neural_models/ # GNN architectures -β”‚ β”‚ β”œβ”€β”€ field_predictor.py # Field prediction GNN -β”‚ β”‚ β”œβ”€β”€ parametric_predictor.py # Parametric GNN (4 objectives) -β”‚ β”‚ └── physics_losses.py # Physics-informed loss functions -β”‚ β”œβ”€β”€ train.py # Training pipeline -β”‚ β”œβ”€β”€ train_parametric.py # Parametric model training -β”‚ β”œβ”€β”€ predict.py # Inference engine -β”‚ β”œβ”€β”€ runs/ # Pre-trained models -β”‚ β”‚ └── parametric_uav_arm_v2/ # UAV arm model (ready to use) -β”‚ └── tests/ # 18 comprehensive tests -β”‚ -β”œβ”€β”€ atomizer-dashboard/ # React Dashboard (NEW) -β”‚ β”œβ”€β”€ backend/ # FastAPI + WebSocket -β”‚ └── frontend/ # React + Tailwind + Recharts -β”‚ -β”œβ”€β”€ studies/ # Optimization studies -β”‚ β”œβ”€β”€ uav_arm_optimization/ # Example with neural integration -β”‚ └── [other studies]/ # Traditional optimization examples -β”‚ -β”œβ”€β”€ atomizer_field_training_data/ # Training data storage -β”‚ └── [study_name]/ # Exported training cases -β”‚ -β”œβ”€β”€ docs/ # Documentation -β”‚ β”œβ”€β”€ NEURAL_FEATURES_COMPLETE.md # Complete neural guide -β”‚ β”œβ”€β”€ NEURAL_WORKFLOW_TUTORIAL.md # Step-by-step tutorial -β”‚ β”œβ”€β”€ GNN_ARCHITECTURE.md # Architecture deep-dive -β”‚ └── [other docs]/ -β”‚ -β”œβ”€β”€ tests/ # Integration tests -└── README.md # This file +β”œβ”€β”€ .claude/ # LLM configuration +β”‚ β”œβ”€β”€ skills/ # Claude skill definitions +β”‚ └── commands/ # Slash commands +β”œβ”€β”€ optimization_engine/ # Core Python modules +β”‚ β”œβ”€β”€ extractors/ # Physics extraction (20+ extractors) +β”‚ β”œβ”€β”€ insights/ # Visualization generators (8 types) +β”‚ β”œβ”€β”€ gnn/ # Graph neural network surrogate +β”‚ β”œβ”€β”€ hooks/ # NX automation hooks +β”‚ β”œβ”€β”€ validators/ # Config validation +β”‚ └── templates/ # Study templates +β”œβ”€β”€ atomizer-dashboard/ # React frontend + FastAPI backend +β”œβ”€β”€ studies/ # Optimization studies by geometry +β”œβ”€β”€ docs/ # Documentation +β”‚ β”œβ”€β”€ protocols/ # Protocol specifications +β”‚ └── 06_PHYSICS/ # Physics domain docs +β”œβ”€β”€ knowledge_base/ # LAC persistent learning +β”‚ └── lac/ # Session insights, failures, patterns +└── nx_journals/ # NX Open automation scripts ``` -## Example: Neural-Accelerated UAV Arm Optimization +--- -A complete working example with neural acceleration in `studies/uav_arm_optimization/`: +## Key Principles + +1. **Conversation first** - Don't ask users to edit JSON manually +2. **Validate everything** - Catch errors before expensive FEA runs +3. **Explain decisions** - Say why a sampler/method was chosen +4. **Never modify master files** - Copy NX files to study directory +5. **Reuse code** - Check existing extractors before writing new ones +6. **Document proactively** - Update docs after code changes + +--- + +## Documentation + +| Document | Purpose | +|----------|---------| +| [CLAUDE.md](CLAUDE.md) | System instructions for Claude | +| [.claude/ATOMIZER_CONTEXT.md](.claude/ATOMIZER_CONTEXT.md) | Session context loader | +| [docs/protocols/](docs/protocols/) | Protocol specifications | +| [docs/06_PHYSICS/](docs/06_PHYSICS/) | Physics domain documentation | + +### Physics Documentation + +- [ZERNIKE_FUNDAMENTALS.md](docs/06_PHYSICS/ZERNIKE_FUNDAMENTALS.md) - Zernike polynomial basics +- [ZERNIKE_OPD_METHOD.md](docs/06_PHYSICS/ZERNIKE_OPD_METHOD.md) - OPD method for lateral displacement + +--- + +## Environment + +**Critical**: Always use the `atomizer` conda environment: ```bash -# Step 1: Run initial FEA optimization (collect training data) -cd studies/uav_arm_optimization -python run_optimization.py --trials 50 --export-training-data - -# Step 2: Train neural network on collected data -cd ../../atomizer-field -python train_parametric.py \ - --train_dir ../atomizer_field_training_data/uav_arm \ - --epochs 200 - -# Step 3: Run neural-accelerated optimization (1000x faster!) -cd ../studies/uav_arm_optimization -python run_optimization.py --trials 5000 --use-neural +conda activate atomizer ``` -**What happens**: -1. Initial 50 FEA trials collect training data (~8 hours) -2. GNN trains on the data (~30 minutes) -3. Neural-accelerated trials run 5000 designs (~4 minutes total!) +Python and dependencies are pre-configured. Do not install additional packages. -**Design Variables**: -- `beam_half_core_thickness`: 5-15 mm -- `beam_face_thickness`: 1-5 mm -- `holes_diameter`: 20-50 mm -- `hole_count`: 5-15 - -**Objectives**: -- Minimize mass -- Maximize frequency -- Minimize max displacement -- Minimize max stress - -**Performance**: -- FEA time: ~10 seconds/trial -- Neural time: ~4.5 ms/trial -- Speedup: **2,200x** - -## Example: Traditional Bracket Optimization - -For traditional FEA-only optimization, see `studies/bracket_displacement_maximizing/`: - -```bash -cd studies/bracket_displacement_maximizing -python run_optimization.py --trials 50 -``` - -## Dashboard Usage - -Start the dashboard: -```bash -python dashboard/start_dashboard.py -``` - -Features: -- **Create studies** with folder structure (sim/, results/, config.json) -- **Drop .sim/.prt files** into study folders -- **Explore .sim files** to extract expressions via NX -- **Configure optimization** with 5-step wizard: - 1. Simulation files - 2. Design variables - 3. Objectives - 4. Constraints - 5. Optimization settings -- **Monitor progress** with real-time charts -- **View results** with trial history and best parameters - -## Vision: LLM-Native Engineering Assistant - -Atomizer is evolving into a comprehensive AI-powered engineering platform. See [DEVELOPMENT_ROADMAP.md](DEVELOPMENT_ROADMAP.md) for details on: - -- **Phase 1-7 development plan** with timelines and deliverables -- **Example use cases** demonstrating natural language workflows -- **Architecture diagrams** showing plugin system and LLM integration -- **Success metrics** for each phase - -### Future Capabilities - -``` -User: "Add RSS function combining stress and displacement" -β†’ LLM: Writes Python function, validates, registers as custom objective - -User: "Use surrogate to predict these 10 parameter sets" -β†’ LLM: Checks surrogate RΒ² > 0.9, runs predictions with confidence intervals - -User: "Make an optimization report" -β†’ LLM: Generates HTML with plots, insights, recommendations (30 seconds) - -User: "Why did trial #34 perform best?" -β†’ LLM: "Trial #34 had optimal stress distribution due to thickness 4.2mm - creating uniform load paths. Fillet radius 3.1mm reduced stress - concentration by 18%. This combination is Pareto-optimal." -``` - -## Development Status - -### Completed Phases - -- [x] **Phase 1**: Core optimization engine & Plugin system βœ… - - NX journal integration - - Web dashboard - - Lifecycle hooks (pre-solve, post-solve, post-extraction) - -- [x] **Phase 2.5**: Intelligent Codebase-Aware Gap Detection βœ… - - Scans existing capabilities before requesting examples - - Matches workflow steps to implemented features - - 80-90% accuracy on complex optimization requests - -- [x] **Phase 2.6**: Intelligent Step Classification βœ… - - Distinguishes engineering features from inline calculations - - Identifies post-processing hooks vs FEA operations - - Foundation for smart code generation - -- [x] **Phase 2.7**: LLM-Powered Workflow Intelligence βœ… - - Replaces static regex with Claude AI analysis - - Detects ALL intermediate calculation steps - - Understands engineering context (PCOMP, CBAR, element forces, etc.) - - 95%+ expected accuracy with full nuance detection - -- [x] **Phase 2.8**: Inline Code Generation βœ… - - LLM-generates Python code for simple math operations - - Handles avg/min/max, normalization, percentage calculations - - Direct integration with Phase 2.7 LLM output - - Optional automated code generation for calculations - -- [x] **Phase 2.9**: Post-Processing Hook Generation βœ… - - LLM-generates standalone Python middleware scripts - - Integrated with Phase 1 lifecycle hook system - - Handles weighted objectives, custom formulas, constraints, comparisons - - Complete JSON-based I/O for optimization loops - - Optional automated scripting for post-processing operations - -- [x] **Phase 3**: pyNastran Documentation Integration βœ… - - LLM-enhanced OP2 extraction code generation - - Documentation research via WebFetch - - 3 core extraction patterns (displacement, stress, force) - - Knowledge base for learned patterns - - Successfully tested on real OP2 files - - Optional automated code generation for result extraction! - -- [x] **Phase 3.1**: LLM-Enhanced Automation Pipeline βœ… - - Extractor orchestrator integrates Phase 2.7 + Phase 3.0 - - Optional automatic extractor generation from LLM output - - Dynamic loading and execution on real OP2 files - - End-to-end test passed: Request β†’ Code β†’ Execution β†’ Objective - - LLM-enhanced workflow with user flexibility achieved! - -### Next Priorities - -- [ ] **Phase 3.2**: Optimization runner integration with orchestrator -- [ ] **Phase 3.5**: NXOpen introspection & pattern curation -- [ ] **Phase 4**: Code generation for complex FEA features -- [ ] **Phase 5**: Analysis & decision support -- [ ] **Phase 6**: Automated reporting - -**For Developers**: -- [DEVELOPMENT.md](DEVELOPMENT.md) - Current status, todos, and active development -- [DEVELOPMENT_ROADMAP.md](DEVELOPMENT_ROADMAP.md) - Strategic vision and long-term plan -- [CHANGELOG.md](CHANGELOG.md) - Version history and changes - -## License - -Proprietary - Atomaste Β© 2025 +--- ## Support - **Documentation**: [docs/](docs/) -- **Studies**: [studies/](studies/) - Optimization study templates and examples -- **Development Roadmap**: [DEVELOPMENT_ROADMAP.md](DEVELOPMENT_ROADMAP.md) +- **Issue Tracker**: GitHub Issues - **Email**: antoine@atomaste.com -## Resources - -### NXOpen References -- **Official API Docs**: [Siemens NXOpen Documentation](https://docs.sw.siemens.com/en-US/doc/209349590/) -- **NXOpenTSE**: [The Scripting Engineer's Guide](https://nxopentsedocumentation.thescriptingengineer.com/) -- **Our Guide**: [NXOpen Resources](docs/NXOPEN_RESOURCES.md) - -### Optimization -- **Optuna Documentation**: [optuna.readthedocs.io](https://optuna.readthedocs.io/) -- **pyNastran**: [github.com/SteveDoyle2/pyNastran](https://github.com/SteveDoyle2/pyNastran) - --- -**Built with ❀️ by Atomaste** | Powered by Optuna, NXOpen, and Claude +## License + +Proprietary - Atomaste 2025 + +--- + +*Atomizer: Where engineers talk, AI optimizes.*