nx_stress.nx
buildroot/runtime/nx_stress.nx
about
nx_stress.nx -- mechanical stress primitive (σ = F/A in Pascals).
THREE-WAY cross-domain composition demo per
[[feedback-engineering-sciences-bits-up-3d-print-first]]:
nx_force (force input, Layer 1 physics)
<area-source> (polygon/mesh-derived, Layer 3 geometry)
material-strength (polymer literature, Layer 2 chemistry-derived)
→ stress classification (Layer 3 engineering output)
Unit convention: integer Pascals (N/m²). Engineering yield
strengths are MPa range (10^6 Pa); ultimate tensile up to GPa
(10^9 Pa). i64 Pa range = ±9.2 × 10^18 Pa = ±9.2 × 10^12 GPa,
vastly exceeding any engineering analysis.
Algebra: σ_Pa = F_N / A_m². Both Q14 inputs scale identically,
so σ_Pa = F_q14 / A_q14 (Q14 scaling cancels in the ratio).
Integer result, no rescaling.
Material yield strengths (MPa) verified against polymer / FDM
literature consensus:
PLA: yield 50 / ultimate 65
PETG: yield 45 / ultimate 50
ABS: yield 35 / ultimate 45
ASA: yield 35 / ultimate 45
PC: yield 65 / ultimate 70
TPU: yield 30 / ultimate 40 (highly elastic; values for TPU 95A)
NYLON: yield 60 / ultimate 80
PA-CF: yield 80 / ultimate 120 (carbon-fibre reinforced)
PEEK: yield 95 / ultimate 100
Per cardinal feedback-nishilang-multi-line-binary-op-statement-break:
every multi-line arithmetic uses named temporaries throughout.
license_tier: ORIGINAL
dependencies 3 imports · 1 importers
imports: nx_syscalls.nxnx_material_profile.nxnx_abs.nx
imported by: nx_stress_test.nx
structs
| 73 | struct NxStress |
consts
| 39 | const NX_MAGIC_1000000: i64 = 1000000 |
| 40 | const NX_MAGIC_50000000: i64 = 50000000 |
| 41 | const NX_MAGIC_45000000: i64 = 45000000 |
| 42 | const NX_MAGIC_35000000: i64 = 35000000 |
| 43 | const NX_MAGIC_65000000: i64 = 65000000 |
| 44 | const NX_MAGIC_30000000: i64 = 30000000 |
| 45 | const NX_MAGIC_60000000: i64 = 60000000 |
| 46 | const NX_MAGIC_80000000: i64 = 80000000 |
| 47 | const NX_MAGIC_95000000: i64 = 95000000 |
| 48 | const NX_MAGIC_70000000: i64 = 70000000 |
| 49 | const NX_MAGIC_40000000: i64 = 40000000 |
| 50 | const NX_MAGIC_120000000: i64 = 120000000 |
| 51 | const NX_MAGIC_100000000: i64 = 100000000 |
| 55 | const NX_STRESS_SAFE: i64 = 0 // < yield / 2 -- ample margin |
| 56 | const NX_STRESS_WORKING: i64 = 1 // [yield/2, yield) -- design range |
| 57 | const NX_STRESS_YIELDED: i64 = 2 // [yield, ultimate) -- permanent deformation |
| 58 | const NX_STRESS_FRACTURED: i64 = 3 // >= ultimate -- catastrophic failure |
| 59 | const NX_STRESS_UNKNOWN_MAT: i64 = 4 // material class not in registry |
| 60 | const NX_STRESS_N: i64 = 5 |
| 77 | const NX_STRESS_BYTES: i64 = 8 |
functions
| 62 | func nx_stress_verdict_name(v: i64) -> *u8 |
| 81 | func nx_stress_new(pa: i64) -> *NxStress |
| 87 | func nx_stress_zero() -> *NxStress calls 1: nx_stress_new |
| 100 | func nx_stress_from_force_area(force_n_q14: i64, area_m2_q14: i64) -> *NxStress |
| 108 | func nx_stress_to_mpa(s: *NxStress) -> i64 called by 1: main |
| 112 | func nx_stress_to_kpa(s: *NxStress) -> i64 |
| 121 | func nx_stress_yield_pa(material_class: i64) -> i64 |
| 134 | func nx_stress_ultimate_pa(material_class: i64) -> i64 |
| 157 | func nx_stress_classify(s: *NxStress, material_class: i64) -> i64 |