fix: Apply expression updates directly in NX journal
Critical fix - the expressions were not being applied during optimization! The journal now receives expression values and applies them using EditExpressionWithUnits() BEFORE rebuilding geometry and regenerating FEM. ## Key Changes ### Expression Application in Journal (solve_simulation.py) - Journal now accepts expression values as arguments (tip_thickness, support_angle) - Applies expressions using EditExpressionWithUnits() on active Bracket part - Calls MakeUpToDate() on each modified expression - Then calls UpdateManager.DoUpdate() to rebuild geometry with new values - Follows the exact pattern from the user's working journal ### NX Solver Updates (nx_solver.py) - Added expression_updates parameter to run_simulation() and run_nx_simulation() - Passes expression values to journal via sys.argv - For bracket: passes tip_thickness and support_angle as separate args ### Test Script Updates (test_journal_optimization.py) - Removed nx_updater step (no longer needed - expressions applied in journal) - model_updater now just stores design vars in global variable - simulation_runner passes expression_updates to nx_solver - Sequential workflow: update vars -> run journal (apply expressions) -> extract results ## Results - OPTIMIZATION NOW WORKS! Before (all trials same stress): - Trial 0: tip=23.48, angle=37.21 → stress=197.89 MPa - Trial 1: tip=20.08, angle=20.32 → stress=197.89 MPa (SAME!) - Trial 2: tip=18.19, angle=35.23 → stress=197.89 MPa (SAME!) After (varying stress values): - Trial 0: tip=21.62, angle=30.15 → stress=192.71 MPa ✅ - Trial 1: tip=17.17, angle=33.52 → stress=167.96 MPa ✅ BEST! - Trial 2: tip=15.06, angle=21.81 → stress=242.50 MPa ✅ Mesh also changes: 1027 → 951 CTETRA elements with different parameters. The optimization loop is now fully functional with expressions being properly applied and the FEM regenerating with correct geometry! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,8 +17,8 @@ symbol=DELDIR='c:/program files/siemens/simcenter3d_2412/nxnastran/scnas/nast/de
|
||||
symbol=DEMODIR='c:/program files/siemens/simcenter3d_2412/nxnastran/scnas/nast/demo' $(program default)
|
||||
symbol=SSSALTERDIR='c:/program files/siemens/simcenter3d_2412/nxnastran/scnas/nast/misc/sssalter' $(program default)
|
||||
symbol=TPLDIR='c:/program files/siemens/simcenter3d_2412/nxnastran/scnas/nast/tpl' $(program default)
|
||||
SDIR='c:/users/antoi/appdata/local/temp/bracket_sim1-solution_1.T137752_30'
|
||||
DBS='c:/users/antoi/appdata/local/temp/bracket_sim1-solution_1.T137752_30'
|
||||
SDIR='c:/users/antoi/appdata/local/temp/bracket_sim1-solution_1.T88884_20'
|
||||
DBS='c:/users/antoi/appdata/local/temp/bracket_sim1-solution_1.T88884_20'
|
||||
SCR=yes
|
||||
SMEM=20.0X
|
||||
NEWDEL='c:/program files/siemens/simcenter3d_2412/nxnastran/scnas/em64tntl/SSS'
|
||||
@@ -43,9 +43,9 @@ NXN_MSG: stderr
|
||||
--------------------------------------------------------------------------------------
|
||||
Current resource limits:
|
||||
Physical memory: 65208 MB
|
||||
Physical memory available: 37314 MB
|
||||
Physical memory available: 36826 MB
|
||||
Paging file size: 83640 MB
|
||||
Paging file size available: 36444 MB
|
||||
Paging file size available: 34984 MB
|
||||
Virtual memory: 134217727 MB
|
||||
Virtual memory available: 134213557 MB
|
||||
--------------------------------------------------------------------------------------
|
||||
@@ -66,20 +66,20 @@ System configuration:
|
||||
Disk block size: 512 bytes (64 words)
|
||||
Remote shell cmd: Remote capabilities not available.
|
||||
--------------------------------------------------------------------------------------
|
||||
Simcenter Nastran started Sat Nov 15 12:40:30 EST 2025
|
||||
12:40:30 Beginning Analysis
|
||||
Simcenter Nastran started Sat Nov 15 12:47:20 EST 2025
|
||||
12:47:20 Beginning Analysis
|
||||
|
||||
12:40:30 Simcenter NASTRAN Authorization Information - System Attributes
|
||||
12:40:30 --------------------------------------------------------
|
||||
12:40:30 Model: Intel(R) Core(TM) i7-14700HX (An
|
||||
12:40:30 Machine: Intel64 Family 6 Model 183 Stepp
|
||||
12:40:30 OS: Windows 10
|
||||
12:40:30 Version:
|
||||
12:40:30 License File(s): 29000@AntoineThinkpad
|
||||
12:47:20 Simcenter NASTRAN Authorization Information - System Attributes
|
||||
12:47:20 --------------------------------------------------------
|
||||
12:47:20 Model: Intel(R) Core(TM) i7-14700HX (An
|
||||
12:47:20 Machine: Intel64 Family 6 Model 183 Stepp
|
||||
12:47:20 OS: Windows 10
|
||||
12:47:20 Version:
|
||||
12:47:20 License File(s): 29000@AntoineThinkpad
|
||||
|
||||
12:40:30 app set license server to 29000@AntoineThinkpad
|
||||
12:47:20 app set license server to 29000@AntoineThinkpad
|
||||
|
||||
12:40:30 ************** License Server/File Information **************
|
||||
12:47:20 ************** License Server/File Information **************
|
||||
|
||||
Server/File : 29000@AntoineThinkpad
|
||||
License File Sold To / Install : 10219284 - Atomaste
|
||||
@@ -89,10 +89,10 @@ Simcenter Nastran started Sat Nov 15 12:40:30 EST 2025
|
||||
Flexera Daemon Version : 11.19
|
||||
Vendor Daemon Version : 11.1 SALT v5.0.0.0
|
||||
|
||||
12:40:30 *************************************************************
|
||||
12:47:20 *************************************************************
|
||||
|
||||
|
||||
12:40:30 **************** License Session Information ****************
|
||||
12:47:20 **************** License Session Information ****************
|
||||
|
||||
Toolkit Version : 2.6.2.0
|
||||
Server Setting Used : 29000@AntoineThinkpad
|
||||
@@ -100,30 +100,30 @@ Simcenter Nastran started Sat Nov 15 12:40:30 EST 2025
|
||||
|
||||
Number of bundles in use : 0
|
||||
|
||||
12:40:30 *************************************************************
|
||||
12:47:20 *************************************************************
|
||||
|
||||
12:40:30 SALT_startLicensingSession: call count: 1
|
||||
12:47:20 SALT_startLicensingSession: call count: 1
|
||||
|
||||
12:40:30 Simcenter NASTRAN Authorization Information - Checkout Successful
|
||||
12:40:30 -----------------------------------------------------------------
|
||||
12:40:30 License for module Simcenter Nastran Basic - NX Desktop (Bundle) checked out successfully
|
||||
12:47:20 Simcenter NASTRAN Authorization Information - Checkout Successful
|
||||
12:47:20 -----------------------------------------------------------------
|
||||
12:47:20 License for module Simcenter Nastran Basic - NX Desktop (Bundle) checked out successfully
|
||||
|
||||
12:40:30 Analysis started.
|
||||
12:40:30 Geometry access/verification to CAD part initiated (if needed).
|
||||
12:40:30 Geometry access/verification to CAD part successfully completed (if needed).
|
||||
12:40:30 Finite element model generation started.
|
||||
12:40:31 Finite element model generated 12240 degrees of freedom.
|
||||
12:40:31 Finite element model generation successfully completed.
|
||||
12:40:31 Application of Loads and Boundary Conditions to the finite element model started.
|
||||
12:40:31 Application of Loads and Boundary Conditions to the finite element model successfully completed.
|
||||
12:40:31 Solution of the system equations for linear statics started.
|
||||
12:40:31 Solution of the system equations for linear statics successfully completed.
|
||||
12:40:31 Linear static analysis completed.
|
||||
12:40:31 NSEXIT: EXIT(0)
|
||||
12:40:31 SALT_term: Successful session call count: 0
|
||||
12:40:31 Session has been terminated.
|
||||
12:40:31 Analysis complete 0
|
||||
Real: 0.795 seconds ( 0:00:00.795)
|
||||
User: 0.296 seconds ( 0:00:00.296)
|
||||
12:47:20 Analysis started.
|
||||
12:47:20 Geometry access/verification to CAD part initiated (if needed).
|
||||
12:47:20 Geometry access/verification to CAD part successfully completed (if needed).
|
||||
12:47:20 Finite element model generation started.
|
||||
12:47:21 Finite element model generated 10626 degrees of freedom.
|
||||
12:47:21 Finite element model generation successfully completed.
|
||||
12:47:21 Application of Loads and Boundary Conditions to the finite element model started.
|
||||
12:47:21 Application of Loads and Boundary Conditions to the finite element model successfully completed.
|
||||
12:47:21 Solution of the system equations for linear statics started.
|
||||
12:47:21 Solution of the system equations for linear statics successfully completed.
|
||||
12:47:21 Linear static analysis completed.
|
||||
12:47:21 NSEXIT: EXIT(0)
|
||||
12:47:21 SALT_term: Successful session call count: 0
|
||||
12:47:21 Session has been terminated.
|
||||
12:47:21 Analysis complete 0
|
||||
Real: 0.814 seconds ( 0:00:00.814)
|
||||
User: 0.250 seconds ( 0:00:00.250)
|
||||
Sys: 0.140 seconds ( 0:00:00.140)
|
||||
Simcenter Nastran finished Sat Nov 15 12:40:31 EST 2025
|
||||
Simcenter Nastran finished Sat Nov 15 12:47:21 EST 2025
|
||||
|
||||
Reference in New Issue
Block a user