Files
Atomizer/studies/bracket_displacement_maximizing/README.md
Anto01 2f3afc3813 feat: Add substudy system with live history tracking and workflow fixes
Major Features:
- Hierarchical substudy system (like NX Solutions/Subcases)
  * Shared model files across all substudies
  * Independent configuration per substudy
  * Continuation support from previous substudies
  * Real-time incremental history updates
- Live history tracking with optimization_history_incremental.json
- Complete bracket_displacement_maximizing study with substudy examples

Core Fixes:
- Fixed expression update workflow to pass design_vars through simulation_runner
  * Restored working NX journal expression update mechanism
  * OP2 timestamp verification instead of file deletion
  * Resolved issue where all trials returned identical objective values
- Fixed LLMOptimizationRunner to pass design variables to simulation runner
- Enhanced NXSolver with timestamp-based file regeneration verification

New Components:
- optimization_engine/llm_optimization_runner.py - LLM-driven optimization runner
- optimization_engine/optimization_setup_wizard.py - Phase 3.3 setup wizard
- studies/bracket_displacement_maximizing/ - Complete substudy example
  * run_substudy.py - Substudy runner with continuation
  * run_optimization.py - Standalone optimization runner
  * config/substudy_template.json - Template for new substudies
  * substudies/coarse_exploration/ - 20-trial coarse search
  * substudies/fine_tuning/ - 50-trial refinement (continuation example)
  * SUBSTUDIES_README.md - Complete substudy documentation

Technical Improvements:
- Incremental history saving after each trial (optimization_history_incremental.json)
- Expression update workflow: .prt update → NX journal receives values → geometry update → FEM update → solve
- Trial indexing fix in substudy result saving
- Updated README with substudy system documentation

Testing:
- Successfully ran 20-trial coarse_exploration substudy
- Verified different objective values across trials (workflow fix validated)
- Confirmed live history updates in real-time
- Tested shared model file usage across substudies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 21:29:54 -05:00

116 lines
3.8 KiB
Markdown

# Bracket Displacement Maximization Study
**Study Name**: bracket_displacement_maximizing
**Created**: 2025-11-16
**Phase**: 3.3 - Optimization Setup Wizard
## Overview
This study demonstrates the complete Phase 3.3 workflow for optimizing a bracket design to maximize displacement while maintaining structural safety.
## Problem Statement
**Objective**: Maximize the displacement of a bracket under load
**Constraints**:
- Safety factor ≥ 4.0
- Material: Aluminum 6061-T6 (Yield strength = 276 MPa)
- Allowable stress: 69 MPa (276/4)
**Design Variables**:
- `tip_thickness`: 15-25 mm (baseline: 17 mm)
- `support_angle`: 20-40° (baseline: 38°)
## Model Information
- **Geometry**: Bracket part with tip and support features
- **Mesh**: 585 nodes, 316 elements (CHEXA, CPENTA)
- **Load**: Applied force at tip
- **Boundary Conditions**: Fixed support at base
## Optimization Setup
### Phase 3.3 Wizard Workflow
1. **Model Introspection** - Read NX expressions from .prt file
2. **Baseline Simulation** - Run initial simulation to validate setup
3. **OP2 Introspection** - Auto-detect element types (CHEXA, CPENTA)
4. **Workflow Configuration** - Build LLM workflow with detected element types
5. **Pipeline Validation** - Dry-run test of all components
6. **Optimization** - Run 20-trial TPE optimization
### Extractors
- **Displacement**: Extract max displacement from OP2 file
- **Stress**: Extract von Mises stress from solid elements (auto-detected: CHEXA)
### Calculations
- **Safety Factor**: `SF = 276.0 / max_von_mises`
- **Objective**: `neg_displacement = -max_displacement` (minimize for maximization)
### Constraints
- **Safety Factor Hook**: Enforces SF ≥ 4.0 with penalty
## Directory Structure
```
bracket_displacement_maximizing/
├── model/ # NX model files (isolated from tests/)
│ ├── Bracket.prt # Part geometry
│ ├── Bracket_fem1.fem # FE model
│ └── Bracket_sim1.sim # Simulation setup
├── results/ # Optimization results
│ ├── optimization_history.json
│ ├── best_design.json
│ └── trial_*.op2 # OP2 files for each trial
├── config/ # Study configuration
│ └── study_config.json # Complete study setup
├── run_optimization.py # Main optimization script
├── optimization_log.txt # Execution log
└── README.md # This file
```
## Running the Study
```bash
cd studies/bracket_displacement_maximizing
python run_optimization.py
```
The script will:
1. Initialize the Phase 3.3 wizard
2. Validate the complete pipeline
3. Run 20 optimization trials
4. Save results to `results/` directory
5. Generate comprehensive report
## Results
Results are saved in the `results/` directory:
- **optimization_history.json**: Complete trial history
- **best_design.json**: Best design parameters and performance
- **optimization_report.md**: Human-readable summary
## Key Features Demonstrated
**Phase 3.3 Wizard** - Automated validation before optimization
**Dynamic Element Detection** - Auto-detects all element types from OP2
**Self-Contained Study** - Isolated model files prevent conflicts
**Complete Logging** - Full execution trace for debugging
**Reproducible** - Configuration files enable exact reproduction
## Notes
- All simulations run in the `model/` directory to isolate from test files
- OP2 files are regenerated for each trial (no caching issues)
- Study can be re-run without affecting other tests or studies
- Configuration is fully documented in `config/study_config.json`
## References
- [Phase 3.3 Wizard Documentation](../../docs/PHASE_3_3_WIZARD.md)
- [Hook Architecture](../../docs/HOOK_ARCHITECTURE.md)
- [LLM Integration](../../docs/PHASE_2_7_LLM_INTEGRATION.md)