Major changes: - Dashboard: WebSocket-based chat with session management - Dashboard: New chat components (ChatPane, ChatInput, ModeToggle) - Dashboard: Enhanced UI with parallel coordinates chart - MCP Server: New atomizer-tools server for Claude integration - Extractors: Enhanced Zernike OPD extractor - Reports: Improved report generator New studies (configs and scripts only): - M1 Mirror: Cost reduction campaign studies - Simple Beam, Simple Bracket, UAV Arm studies Note: Large iteration data (2_iterations/, best_design_archive/) excluded via .gitignore - kept on local Gitea only. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
"""Quick test to verify expression updates are working"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
|
|
|
from optimization_engine.nx.solver import NXSolver
|
|
from optimization_engine.nx.updater import NXParameterUpdater
|
|
|
|
study_dir = Path(__file__).parent
|
|
prt_file = study_dir / "model" / "Bracket.prt"
|
|
sim_file = study_dir / "model" / "Bracket_sim1.sim"
|
|
|
|
print("Testing expression update workflow...")
|
|
print()
|
|
|
|
# Test with two different parameter sets
|
|
test_params = [
|
|
{'tip_thickness': 15.0, 'support_angle': 25.0},
|
|
{'tip_thickness': 25.0, 'support_angle': 35.0},
|
|
]
|
|
|
|
updater = NXParameterUpdater(prt_file_path=prt_file)
|
|
solver = NXSolver(nastran_version='2412', use_journal=True)
|
|
|
|
for i, params in enumerate(test_params):
|
|
print(f"Trial {i}: tip_thickness={params['tip_thickness']}, support_angle={params['support_angle']}")
|
|
|
|
# Update .prt file
|
|
updater.update_expressions(params)
|
|
updater.save()
|
|
|
|
# Run simulation WITH expression_updates
|
|
result = solver.run_simulation(sim_file, expression_updates=params)
|
|
|
|
if result['success']:
|
|
print(f" SUCCESS: OP2 generated")
|
|
|
|
# Read OP2 to check displacement
|
|
from pyNastran.op2.op2 import OP2
|
|
model = OP2()
|
|
model.read_op2(str(result['op2_file']))
|
|
|
|
if hasattr(model, 'displacements') and model.displacements:
|
|
disp = model.displacements[1]
|
|
max_disp = abs(disp.data[:, :3]).max()
|
|
print(f" Max displacement: {max_disp:.6f} mm")
|
|
print()
|
|
else:
|
|
print(f" FAILED")
|
|
print()
|
|
|
|
print("If the two displacement values are DIFFERENT, the fix worked!")
|