Closes the optimization loop: OP2 results → density field refinement.
**extract_stress_field_2d.py (new)**
- Reads OP2 (3D solid or 2D shell elements) + BDF via pyNastran
- Projects element centroids to 2D sandbox coords using geometry transform
- Averages stress through thickness (for solid 3D meshes)
- Normalises by sigma_yield to [0..1]
- save/load helpers (NPZ) for trial persistence
**stress_feedback.py (new)**
- StressFeedbackField: converts 2D stress scatter → smooth density modifier
- Gaussian blur (configurable radius, default 40mm) prevents oscillations
- RBF interpolator (thin-plate spline) for fast pointwise evaluation
- evaluate(x, y) returns S_stress ∈ [0..1]
- from_field() and from_npz() constructors
**density_field.py (modified)**
- evaluate_density() now accepts optional stress_field= argument
- Adaptive formula: η = η₀ + α·I + β·E + γ·S_stress
- gamma_stress param controls feedback gain (0.0 = pure parametric)
- Fully backward compatible (no stress_field = original behaviour)
Usage:
field = extract_stress_field_2d(op2, bdf, geometry["transform"], sigma_yield=276.0)
feedback = StressFeedbackField.from_field(field, blur_radius_mm=40.0)
eta = evaluate_density(x, y, geometry, params, stress_field=feedback)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adaptive Isogrid — Plate Lightweighting Tool
Status: Foundation / Pre-Implementation
Architecture: Python Brain + NX Hands + Atomizer Manager
What It Does
Takes a plate with holes → generates an optimally lightweighted isogrid pattern → produces manufacturing-ready geometry. Isogrid density varies across the plate based on hole importance, edge proximity, and optimization-driven meta-parameters.
Architecture
| Component | Role | Runtime |
|---|---|---|
| Python Brain | Density field → Gmsh Frontal-Delaunay → rib profile | ~1-2 sec |
| NX Hands | Import profile → mesh → AFEM merge → Nastran solve → extract results | ~60-90 sec |
| Atomizer Manager | Optuna TPE sampling → objective evaluation → convergence | 500-2000 trials |
Key Insight: Assembly FEM with Superposed Models
- Model A (permanent): Spider elements at holes + edge BC nodes. All loads/BCs applied here.
- Model B (variable): 2D shell mesh of ribbed plate. Rebuilt each iteration.
- Node merge at fixed interface locations connects them reliably every time.
Loads and BCs never need re-association. Only the rib pattern changes.
Directory Structure
adaptive-isogrid/
├── README.md
├── requirements.txt
├── docs/
│ └── technical-spec.md # Full architecture spec
├── src/
│ ├── brain/ # Python geometry generator
│ │ ├── __init__.py
│ │ ├── density_field.py # η(x) evaluation
│ │ ├── triangulation_gmsh.py # Gmsh Frontal-Delaunay meshing (production)
│ │ ├── pocket_profiles.py # Pocket inset + filleting
│ │ ├── profile_assembly.py # Final plate - pockets - holes
│ │ └── validation.py # Manufacturing constraint checks
│ ├── nx/ # NXOpen journal scripts
│ │ ├── extract_geometry.py # One-time: face → geometry.json
│ │ ├── build_interface_model.py # One-time: Model A + spiders
│ │ └── iteration_solve.py # Per-trial: rebuild Model B + solve
│ └── atomizer_study.py # Atomizer/Optuna integration
└── tests/
└── test_geometries/ # Sample geometry.json files
Implementation Phases
- Python Brain standalone (1-2 weeks) — geometry generator with matplotlib viz
- NX extraction + AFEM setup (1-2 weeks) — one-time project setup scripts
- NX iteration script (1-2 weeks) — per-trial mesh/solve/extract loop
- Atomizer integration (1 week) — wire objective function + study management
- Validation + first real project (1-2 weeks) — production run on client plate
Quick Start (Phase 1)
cd tools/adaptive-isogrid
pip install -r requirements.txt
python -m src.brain --geometry tests/test_geometries/sample_bracket.json --params default
Parameter Space
15 continuous parameters optimized by Atomizer (Optuna TPE):
- Density field: η₀, α, R₀, κ, p, β, R_edge
- Spacing: s_min, s_max
- Rib thickness: t_min, t₀, γ
- Manufacturing: w_frame, r_f, d_keep
See docs/technical-spec.md for full formulation.