This commit completes the optimization loop infrastructure by implementing
the full FEM regeneration workflow based on the user's working journal.
## Changes
### FEM Regeneration Workflow (solve_simulation.py)
- Added STEP 1: Switch to Bracket.prt and update geometry
- Uses SetActiveDisplay() to make Bracket.prt active
- Calls UpdateManager.DoUpdate() to rebuild CAD geometry with new expressions
- Added STEP 2: Switch to Bracket_fem1 and update FE model
- Uses SetActiveDisplay() to make FEM active
- Calls fEModel1.UpdateFemodel() to regenerate FEM with updated geometry
- Added STEP 3: Switch back to sim part before solving
- Close and reopen .sim file to force reload from disk
### Enhanced Journal Output (nx_solver.py)
- Display journal stdout output for debugging
- Shows all journal steps: geometry update, FEM regeneration, solve, save
- Helps verify workflow execution
### Verification Tools
- Added verify_parametric_link.py journal to check expression dependencies
- Added FEM_REGENERATION_STATUS.md documenting the complete status
## Status
### ✅ Fully Functional Components
1. Parameter updates - nx_updater.py modifies .prt expressions
2. NX solver - ~4s per solve via journal
3. Result extraction - pyNastran reads .op2 files
4. History tracking - saves to JSON/CSV
5. Optimization loop - Optuna explores parameter space
6. **FEM regeneration workflow** - Journal executes all steps successfully
### ❌ Remaining Issue: Expressions Not Linked to Geometry
The optimization returns identical stress values (197.89 MPa) for all trials
because the Bracket.prt expressions are not referenced by any geometry features.
Evidence:
- Journal verification shows FEM update steps execute successfully
- Feature dependency check shows no features reference the expressions
- All optimization infrastructure is working correctly
The code is ready - waiting for Bracket.prt to have its expressions properly
linked to the geometry features in NX.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements NX solver integration that connects to running Simcenter3D GUI
to solve simulations using the journal API. This approach handles licensing
properly and ensures fresh output files are generated for each iteration.
**New Components:**
- optimization_engine/nx_solver.py: Main solver wrapper with auto-detection
- optimization_engine/solve_simulation.py: NX journal script for batch solving
- examples/test_journal_optimization.py: Complete optimization workflow test
- examples/test_nx_solver.py: Solver integration tests
- tests/journal_*.py: Reference journal files for NX automation
**Key Features:**
- Auto-detects NX installation and version
- Connects to running NX GUI session (uses existing license)
- Closes/reopens .sim files to force reload of updated .prt files
- Deletes old output files to force fresh solves
- Waits for background solve completion
- Saves simulation to ensure all outputs are written
- ~4 second solve time per iteration
**Workflow:**
1. Update parameters in .prt file (nx_updater.py)
2. Close any open parts in NX session
3. Open .sim file fresh from disk (loads updated .prt)
4. Reload components and switch to FEM component
5. Solve in background mode
6. Save .sim file
7. Wait for .op2/.f06 to appear
8. Extract results from fresh .op2
**Tested:**
- Multiple iteration loop (3+ iterations)
- Files regenerated fresh each time (verified by timestamps)
- Complete parameter update -> solve -> extract workflow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Enhanced expression extraction to find ALL named expressions in .prt files,
not just specific format. Added pyNastran-based result extraction example.
Expression Extraction Improvements:
- Updated regex to handle all NX expression format variations:
* #(Type [units]) name: value;
* (Type [units]) name: value;
* *(Type [units]) name: value;
* ((Type [units]) name: value;
- Added Root:expression_name: pattern detection
- Finds expressions even when value is not immediately available
- Deduplication to avoid duplicates
- Filters out NX internal names
Test Results with Bracket.prt:
- Previously: 1 expression (tip_thickness only)
- Now: 5 expressions found:
* support_angle = 30.0 degrees
* tip_thickness = 20.0 mm
* p3 = 10.0 mm
* support_blend_radius = 10.0 mm
* p11 (reference found, value unknown)
OP2 Result Extraction (pyNastran):
- Created example extractor: op2_extractor_example.py
- Functions for common optimization metrics:
* extract_max_displacement() - max displacement magnitude on any node
* extract_max_stress() - von Mises or max principal stress
* extract_mass() - total mass and center of gravity
- Handles multiple element types (CQUAD4, CTRIA3, CTETRA, etc.)
- Returns structured JSON for optimization engine integration
- Command-line tool for testing with real OP2 files
Usage:
python optimization_engine/result_extractors/op2_extractor_example.py <file.op2>
Integration Ready:
- pyNastran already in requirements.txt
- Result extractor pattern established
- Can be used as template for custom metrics
Next Steps:
- Integrate result extractors into MCP tool framework
- Add safety factor calculations
- Support for thermal, modal results
- Update project name in all documentation files
- Update GitHub repository references to Anto01/Atomizer
- Update Python package name to 'atomizer'
- Update conda environment name references
- Update all module docstrings with new branding
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Set up Python package structure with pyproject.toml
- Created MCP server, optimization engine, and NX journals modules
- Added configuration templates
- Implemented pluggable result extractor architecture
- Comprehensive README with architecture overview
- Project ready for GitHub push
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>