feat: Add AtomizerField training data export and intelligent model discovery
Major additions: - Training data export system for AtomizerField neural network training - Bracket stiffness optimization study with 50+ training samples - Intelligent NX model discovery (auto-detect solutions, expressions, mesh) - Result extractors module for displacement, stress, frequency, mass - User-generated NX journals for advanced workflows - Archive structure for legacy scripts and test outputs - Protocol documentation and dashboard launcher 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -475,6 +475,76 @@ sys.argv = ['', {argv_str}] # Set argv for the main function
|
||||
|
||||
return errors[:10] # Limit to first 10 errors
|
||||
|
||||
def discover_model(self, sim_file: Path) -> Dict[str, Any]:
|
||||
"""
|
||||
Discover model information without solving.
|
||||
|
||||
This scans the NX simulation file and reports:
|
||||
- All solutions (names, types)
|
||||
- All expressions (potential design variables)
|
||||
- Mesh info
|
||||
- Linked geometry parts
|
||||
|
||||
Args:
|
||||
sim_file: Path to .sim file
|
||||
|
||||
Returns:
|
||||
Dictionary with discovered model info
|
||||
"""
|
||||
import json
|
||||
|
||||
sim_file = Path(sim_file)
|
||||
if not sim_file.exists():
|
||||
return {'success': False, 'error': f'Sim file not found: {sim_file}'}
|
||||
|
||||
# Use the discover_model journal
|
||||
discover_journal = Path(__file__).parent.parent / "nx_journals" / "discover_model.py"
|
||||
|
||||
if not discover_journal.exists():
|
||||
return {'success': False, 'error': f'Discovery journal not found: {discover_journal}'}
|
||||
|
||||
print(f"\n[NX SOLVER] Discovering model: {sim_file.name}")
|
||||
print(f" Using journal: {discover_journal.name}")
|
||||
|
||||
try:
|
||||
cmd = [str(self.solver_exe), str(discover_journal), '--', str(sim_file.absolute())]
|
||||
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=60, # 1 minute timeout for discovery
|
||||
cwd=str(sim_file.parent)
|
||||
)
|
||||
|
||||
# Print stderr (debug/progress messages)
|
||||
if result.stderr:
|
||||
for line in result.stderr.strip().split('\n'):
|
||||
print(f" {line}")
|
||||
|
||||
# Parse stdout as JSON
|
||||
if result.stdout:
|
||||
try:
|
||||
discovery_result = json.loads(result.stdout)
|
||||
return discovery_result
|
||||
except json.JSONDecodeError as e:
|
||||
return {
|
||||
'success': False,
|
||||
'error': f'Failed to parse discovery output: {e}',
|
||||
'raw_output': result.stdout[:1000]
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'success': False,
|
||||
'error': 'No output from discovery journal',
|
||||
'stderr': result.stderr
|
||||
}
|
||||
|
||||
except subprocess.TimeoutExpired:
|
||||
return {'success': False, 'error': 'Discovery timeout (60s)'}
|
||||
except Exception as e:
|
||||
return {'success': False, 'error': str(e)}
|
||||
|
||||
def _cleanup_temp_files(self, working_dir: Path, base_name: str):
|
||||
"""Remove temporary solver files."""
|
||||
# Files to keep
|
||||
|
||||
Reference in New Issue
Block a user