Files
Atomizer/studies/simple_beam_optimization/COMPREHENSIVE_BENCHMARK_RESULTS.md
Anto01 8b14f6e800 feat: Add robust NX expression import system for all expression types
Major Enhancement:
- Implemented .exp file-based expression updates via NX journal scripts
- Fixes critical issue with feature-linked expressions (e.g., hole_count)
- Supports ALL NX expression types including binary-stored ones
- Full 4D design space validation completed successfully

New Components:
1. import_expressions.py - NX journal for .exp file import
   - Uses NXOpen.ExpressionCollection.ImportFromFile()
   - Replace mode overwrites existing values
   - Automatic model update and save
   - Comprehensive error handling

2. export_expressions.py - NX journal for .exp file export
   - Exports all expressions to text format
   - Used for unit detection and verification

3. Enhanced nx_updater.py
   - New update_expressions_via_import() method
   - Automatic unit detection from .exp export
   - Creates study-variable-only .exp files
   - Replaces fragile binary .prt editing

Technical Details:
- .exp Format: [Units]name=value (e.g., [MilliMeter]beam_length=5000)
- Unitless expressions: name=value (e.g., hole_count=10)
- Robustness: Native NX functionality, no regex failures
- Performance: < 1 second per update operation

Validation:
- Simple Beam Optimization study (4D design space)
  * beam_half_core_thickness: 10-40 mm
  * beam_face_thickness: 10-40 mm
  * holes_diameter: 150-450 mm
  * hole_count: 5-15 (integer)

Results:
 3-trial validation completed successfully
 All 4 variables update correctly in all trials
 Mesh adaptation verified (hole_count: 6, 15, 11 → different mesh sizes)
 Trial 0: 5373 CQUAD4 elements (6 holes)
 Trial 1: 5158 CQUAD4 + 1 CTRIA3 (15 holes)
 Trial 2: 5318 CQUAD4 (11 holes)

Problem Solved:
- hole_count expression was not updating with binary .prt editing
- Expression stored in feature parameter, not accessible via text regex
- Binary format prevented reliable text-based updates

Solution:
- Use NX native expression import/export
- Works for ALL expressions (text and binary-stored)
- Automatic unit handling
- Model update integrated in journal

Documentation:
- New: docs/NX_EXPRESSION_IMPORT_SYSTEM.md (comprehensive guide)
- Updated: CHANGELOG.md with Phase 3.2 progress
- Study: studies/simple_beam_optimization/ (complete example)

Files Added:
- optimization_engine/import_expressions.py
- optimization_engine/export_expressions.py
- docs/NX_EXPRESSION_IMPORT_SYSTEM.md
- studies/simple_beam_optimization/ (full study)

Files Modified:
- optimization_engine/nx_updater.py
- CHANGELOG.md

Compatibility:
- NX 2412 tested and verified
- Python 3.10+
- Works with all NX expression types

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 12:34:06 -05:00

164 lines
4.1 KiB
Markdown

# Comprehensive Benchmark Analysis - Simple Beam Optimization
**Date**: 2025-11-17
**Study**: simple_beam_optimization
**Model**: Beam.prt (CQUAD4 shell elements)
## 🔍 Complete Results Analysis
### Expression Discovery (via .exp export)
**Total Expressions**: 30 (100% captured with seamless .exp export!)
**Key Design Variables**:
- `beam_half_core_thickness`: 20.0 mm
- `beam_face_thickness`: 20.0 mm
- `holes_diameter`: 300.0 mm
- `hole_count`: 10 (unitless)
**Mass Expression**:
- `p173`: **973.968 kg**
### OP2 File Analysis
**File**: beam_sim1-solution_1.op2
**Available Results**:
| Result Type | Status | Subcases | Notes |
|-------------|--------|----------|-------|
| Displacement | ✅ YES | [1] | Max: 22.12 mm at node 5186 |
| Stress | ✅ YES | [1] | Max von Mises: 131.507 MPa at element 454 |
| Strain | ❌ NO | - | Not configured in NX simulation |
| Element Forces | ❌ NO | - | Not configured in NX simulation |
| SPC Forces | ✅ YES | [1] | Reaction forces at constraints |
**Element Types**: CQUAD4 (shell elements, 9782 elements)
### F06 File Analysis
**File**: beam_sim1-solution_1.f06
**Available Results**:
- ❌ NO displacement output
- ❌ NO stress output
- ❌ NO strain output
- ❌ NO force output
**Conclusion**: F06 file does not contain tabular results. All usable results are in OP2.
## 📊 Baseline Performance
**Current Design**:
- beam_half_core_thickness = 20 mm
- beam_face_thickness = 20 mm
- holes_diameter = 300 mm
- hole_count = 10
**Measured Results**:
- **Max Displacement**: 22.12 mm (exceeds 10mm target!)
- **Max von Mises Stress**: 131.507 MPa (at element 454)
- **Mass**: 973.97 kg
## 🎯 Available Optimization Objectives
Based on what's actually in the output files:
### Can Optimize NOW:
1. **Displacement** (from OP2)
- Minimize max displacement
- Constrain to < 10mm
- Current: 22.12 mm (VIOLATES constraint!)
2. **Stress** (from OP2)
- Minimize max von Mises stress
- Current: 131.507 MPa
- Element type: CQUAD4 (shells)
3. **Mass** (from p173 expression)
- Minimize weight
- Current: 973.97 kg
4. **SPC Forces** (from OP2)
- Reaction forces at constraints
- Could be used as objective or constraint
### Cannot Optimize (yet):
1. **Strain** - Not in output files
2. **Element Forces** - Not in output files
## 📝 Recommended Configuration
**Full Multi-Objective Optimization (All 3 objectives available NOW!)**
```json
{
"extractors": [
{
"name": "max_displacement",
"action": "extract_displacement"
},
{
"name": "max_stress",
"action": "extract_solid_stress"
},
{
"name": "mass",
"action": "extract_expression",
"parameters": {
"expression_name": "p173"
}
}
],
"objectives": [
{
"name": "minimize_displacement",
"extractor": "max_displacement",
"goal": "minimize",
"weight": 0.33
},
{
"name": "minimize_stress",
"extractor": "max_stress",
"goal": "minimize",
"weight": 0.33
},
{
"name": "minimize_mass",
"extractor": "mass",
"goal": "minimize",
"weight": 0.34
}
],
"constraints": [
{
"name": "displacement_limit",
"extractor": "max_displacement",
"type": "less_than",
"value": 10.0
}
]
}
```
## ✅ What Works
- ✅ Expression gathering (30/30 expressions captured seamlessly!)
- ✅ Displacement extraction from OP2 (max: 22.12 mm)
- ✅ Stress extraction from OP2 (max von Mises: 131.507 MPa) **FIXED!**
- ✅ Mass extraction from expressions (p173: 973.97 kg)
- ✅ Proper unit system handling (MN-MM → MPa conversion)
- ✅ SPC forces available if needed
- ✅ Load from folder settings working
- ✅ FEM file loading working
## 🔄 Next Steps
**Immediate (Ready to start!)**:
1. Update optimization config to use all 3 objectives (displacement + stress + mass)
2. Run validation trials to test complete pipeline
3. If successful, run full optimization (50 trials)
**Baseline to Beat**:
- Displacement: 22.12 mm → target < 10 mm
- Stress: 131.507 MPa → minimize
- Mass: 973.97 kg → minimize