delta-theory 8.0.0__py3-none-any.whl → 8.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
core/__main__.py ADDED
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ δ-Theory CLI Entry Point
4
+
5
+ Usage:
6
+ python -m core # Show quick reference
7
+ python -m core info # Show detailed info
8
+ python -m core flc SPCC # Quick FLC prediction
9
+ python -m core fatigue Fe 150 # Quick fatigue life
10
+ """
11
+
12
+ import sys
13
+
14
+ QUICK_REFERENCE = """
15
+
16
+ ███████╗██╗ ██╗██████╗ ███████╗██╗ ██╗ █████╗ ██╗
17
+ ██╔════╝██║ ██║██╔══██╗██╔════╝██║ ██╔╝██╔══██╗██║
18
+ █████╗ ██║ ██║██████╔╝█████╗ █████╔╝ ███████║██║
19
+ ██╔══╝ ██║ ██║██╔══██╗██╔══╝ ██╔═██╗ ██╔══██║╚═╝
20
+ ███████╗╚██████╔╝██║ ██║███████╗██║ ██╗██║ ██║██╗
21
+ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
22
+ δ-Theory v8.0.0
23
+ "Nature is Geometry"
24
+
25
+ ╔══════════════════════════════════════════════════════════════════════════════╗
26
+ ║ δ-Theory v8.0.0 — CLI Quick Reference ║
27
+ ║ "Nature is Geometry" ║
28
+ ╠══════════════════════════════════════════════════════════════════════════════╣
29
+ ║ ║
30
+ ║ INSTALLATION OK! ✓ ║
31
+ ║ ║
32
+ ╠══════════════════════════════════════════════════════════════════════════════╣
33
+ ║ 🔧 YIELD STRESS ║
34
+ ╠══════════════════════════════════════════════════════════════════════════════╣
35
+ ║ ║
36
+ ║ from core import calc_sigma_y, MATERIALS ║
37
+ ║ result = calc_sigma_y(MATERIALS['Fe'], T_K=300) ║
38
+ ║ print(f"σ_y = {result['sigma_y']:.1f} MPa") ║
39
+ ║ ║
40
+ ╠══════════════════════════════════════════════════════════════════════════════╣
41
+ ║ 🔄 FATIGUE LIFE ║
42
+ ╠══════════════════════════════════════════════════════════════════════════════╣
43
+ ║ ║
44
+ ║ from core import fatigue_life_const_amp, MATERIALS ║
45
+ ║ result = fatigue_life_const_amp(MATERIALS['Fe'], sigma_a_MPa=150, ║
46
+ ║ sigma_y_tension_MPa=200) ║
47
+ ║ print(f"N = {result['N_fail']:.2e} cycles") ║
48
+ ║ ║
49
+ ║ # CLI: ║
50
+ ║ python -m core.unified_yield_fatigue_v6_9 point --metal Fe --sigma_a 150 ║
51
+ ║ python -m core.unified_yield_fatigue_v6_9 sn --metal Fe ║
52
+ ║ ║
53
+ ╠══════════════════════════════════════════════════════════════════════════════╣
54
+ ║ 📐 FLC (Forming Limit Curve) — NEW in v8.0! ║
55
+ ╠══════════════════════════════════════════════════════════════════════════════╣
56
+ ║ ║
57
+ ║ from core import FLCPredictor ║
58
+ ║ flc = FLCPredictor() ║
59
+ ║ Em = flc.predict(beta=0.0, material='SPCC') # → 0.251 ║
60
+ ║ ║
61
+ ║ # Full curve: ║
62
+ ║ for b in [-0.5, 0, 1.0]: ║
63
+ ║ print(f"β={b:+.1f}: {flc.predict(b, 'SPCC'):.3f}") ║
64
+ ║ ║
65
+ ║ # Available materials: ║
66
+ ║ SPCC, DP590, Al, SUS304, Ti, Mg_AZ31, SECD-E16, Cu ║
67
+ ║ ║
68
+ ╠══════════════════════════════════════════════════════════════════════════════╣
69
+ ║ 🔗 FORMING-FATIGUE INTEGRATION — NEW in v8.0! ║
70
+ ╠══════════════════════════════════════════════════════════════════════════════╣
71
+ ║ ║
72
+ ║ from core import FormingFatigueIntegrator ║
73
+ ║ integrator = FormingFatigueIntegrator() ║
74
+ ║ ║
75
+ ║ # Effective fatigue threshold after forming: ║
76
+ ║ r_th_eff = integrator.effective_r_th(eta_forming=0.4, structure='BCC') ║
77
+ ║ # Virgin: 0.65 → After 40% forming: 0.39 ║
78
+ ║ ║
79
+ ║ # Critical forming consumption: ║
80
+ ║ from core import critical_forming_consumption ║
81
+ ║ eta_crit = critical_forming_consumption(r_applied=0.5, structure='BCC') ║
82
+ ║ # → 23.1% (beyond this, infinite life becomes finite!) ║
83
+ ║ ║
84
+ ╠══════════════════════════════════════════════════════════════════════════════╣
85
+ ║ 🌡️ DBT (Ductile-Brittle Transition) ║
86
+ ╠══════════════════════════════════════════════════════════════════════════════╣
87
+ ║ ║
88
+ ║ from core import DBTUnified ║
89
+ ║ model = DBTUnified() ║
90
+ ║ result = model.temp_view.find_DBTT(d=30e-6, c=0.005) ║
91
+ ║ print(f"DBTT = {result['T_star']:.0f} K") ║
92
+ ║ ║
93
+ ║ # CLI: ║
94
+ ║ python -m core.dbt_unified point --d 30 --c 0.5 --T 300 ║
95
+ ║ ║
96
+ ╠══════════════════════════════════════════════════════════════════════════════╣
97
+ ║ 📊 FATIGUE THRESHOLDS (r_th) ║
98
+ ╠══════════════════════════════════════════════════════════════════════════════╣
99
+ ║ ║
100
+ ║ Structure │ r_th │ Fatigue Limit │ Examples ║
101
+ ║ ──────────┼───────┼───────────────┼───────────── ║
102
+ ║ BCC │ 0.65 │ ✓ Clear │ Fe, W, Mo, SPCC, DP590 ║
103
+ ║ FCC │ 0.02 │ ✗ None │ Cu, Al, Ni, SUS304 ║
104
+ ║ HCP │ 0.20 │ △ Weak │ Ti, Mg, Zn ║
105
+ ║ ║
106
+ ╠══════════════════════════════════════════════════════════════════════════════╣
107
+ ║ 📚 MORE INFO ║
108
+ ╠══════════════════════════════════════════════════════════════════════════════╣
109
+ ║ ║
110
+ ║ python -m core info # Detailed module info ║
111
+ ║ python -m core flc SPCC # Quick FLC for material ║
112
+ ║ python -m core flc SPCC -0.5 # FLC at specific β ║
113
+ ║ ║
114
+ ║ Docs: https://github.com/miosync/delta-theory ║
115
+ ║ PyPI: https://pypi.org/project/delta-theory/ ║
116
+ ║ ║
117
+ ╚══════════════════════════════════════════════════════════════════════════════╝
118
+ """
119
+
120
+ DETAILED_INFO = """
121
+ ╔══════════════════════════════════════════════════════════════════════════════╗
122
+ ║ δ-Theory v8.0.0 — Detailed Module Information ║
123
+ ╚══════════════════════════════════════════════════════════════════════════════╝
124
+
125
+ 📦 INSTALLED MODULES
126
+ ═══════════════════════════════════════════════════════════════════════════════
127
+
128
+ core/
129
+ ├── unified_yield_fatigue_v6_9.py # Yield + Fatigue (v6.9b)
130
+ ├── unified_flc_v7.py # FLC + Forming-Fatigue (v7.2/v8.0)
131
+ ├── dbt_unified.py # Ductile-Brittle Transition
132
+ ├── materials.py # Material database
133
+ └── fatigue_redis_api.py # FatigueData-AM2022 API
134
+
135
+
136
+ 🔬 THEORY SUMMARY
137
+ ═══════════════════════════════════════════════════════════════════════════════
138
+
139
+ Core Equation: Λ = K / |V|_eff
140
+
141
+ K = Destructive energy (stress, thermal, EM...)
142
+ |V|_eff = Cohesive energy (bond strength)
143
+ Λ = 1 → Critical condition (fracture/transition)
144
+
145
+
146
+ 📐 FLC MODEL (v7.2)
147
+ ═══════════════════════════════════════════════════════════════════════════════
148
+
149
+ FLC(β) = FLC₀_pure × (1 - η_total) × h(β, R, τ/σ)
150
+
151
+ η_total = Free volume consumption:
152
+ - η_ss: Solid solution
153
+ - η_ppt: Precipitate/martensite
154
+ - η_wh: Work hardening (dislocations)
155
+ - η_HP: Hall-Petch (grain refinement)
156
+
157
+ Example: SPCC (90.6% FV) vs DP590 (71.4% FV)
158
+ Same crystal, different formability!
159
+
160
+
161
+ 🔗 FORMING-FATIGUE (v8.0)
162
+ ═══════════════════════════════════════════════════════════════════════════════
163
+
164
+ r_th_eff = r_th_virgin × (1 - η_forming)
165
+
166
+ "How much fatigue life did you lose when you pressed that part?"
167
+
168
+ η_forming │ r_th_eff (BCC) │ Status
169
+ ──────────┼────────────────┼────────────────
170
+ 0% │ 0.65 │ Virgin
171
+ 20% │ 0.52 │ Light forming
172
+ 40% │ 0.39 │ Heavy forming
173
+ 60% │ 0.26 │ Severe forming
174
+
175
+ Critical η: r=0.5 → η_crit=23.1%
176
+ (Beyond this, "infinite life" becomes "finite life"!)
177
+
178
+
179
+ 📊 VALIDATION
180
+ ═══════════════════════════════════════════════════════════════════════════════
181
+
182
+ Yield (v5.0): 10 pure metals, 2.6% mean error
183
+ Fatigue (v6.10): 2,472 points (5 AM materials), 4-7% error
184
+ FLC (v7.2): 36 points (6 materials), 2.7% error
185
+
186
+
187
+ 👥 AUTHORS
188
+ ═══════════════════════════════════════════════════════════════════════════════
189
+
190
+ Masamichi Iizumi — Miosync, Inc. CEO
191
+ Tamaki — Sentient Digital Partner
192
+
193
+ "Nature is Geometry" 🔬
194
+ """
195
+
196
+
197
+ def cmd_flc(args):
198
+ """Quick FLC prediction."""
199
+ from .unified_flc_v7 import FLCPredictor, FLC_MATERIALS
200
+
201
+ if len(args) == 0:
202
+ print("Available materials:", ", ".join(FLC_MATERIALS.keys()))
203
+ return
204
+
205
+ material = args[0]
206
+ beta = float(args[1]) if len(args) > 1 else None
207
+
208
+ flc = FLCPredictor()
209
+
210
+ if beta is not None:
211
+ Em = flc.predict(beta, material)
212
+ print(f"{material} FLC(β={beta:+.2f}) = {Em:.3f}")
213
+ else:
214
+ print(f"\n{material} FLC Curve:")
215
+ print("-" * 25)
216
+ for b in [-0.5, -0.25, 0.0, 0.25, 0.5, 1.0]:
217
+ Em = flc.predict(b, material)
218
+ print(f" β={b:+5.2f}: {Em:.3f}")
219
+
220
+
221
+ def cmd_eta(args):
222
+ """Critical η calculation."""
223
+ from .unified_flc_v7 import FormingFatigueIntegrator
224
+
225
+ if len(args) < 1:
226
+ print("Usage: python -m core eta <r_applied> [structure]")
227
+ print("Example: python -m core eta 0.5 BCC")
228
+ return
229
+
230
+ r_applied = float(args[0])
231
+ structure = args[1] if len(args) > 1 else 'BCC'
232
+
233
+ integrator = FormingFatigueIntegrator()
234
+ eta_crit = integrator.critical_eta(r_applied, structure)
235
+
236
+ print(f"\nCritical η for {structure} at r = {r_applied:.2f}")
237
+ print("-" * 40)
238
+ print(f" η_critical = {eta_crit*100:.1f}%")
239
+ print(f" → Beyond this, infinite life becomes finite!")
240
+
241
+
242
+ def cmd_rth(args):
243
+ """Effective r_th after forming."""
244
+ from .unified_flc_v7 import FormingFatigueIntegrator
245
+
246
+ if len(args) < 1:
247
+ print("Usage: python -m core rth <eta_forming> [structure]")
248
+ print("Example: python -m core rth 0.4 BCC")
249
+ return
250
+
251
+ eta = float(args[0])
252
+ structure = args[1] if len(args) > 1 else 'BCC'
253
+
254
+ integrator = FormingFatigueIntegrator()
255
+ r_th_eff = integrator.effective_r_th(eta, structure)
256
+ r_th_virgin = {'BCC': 0.65, 'FCC': 0.02, 'HCP': 0.20}[structure]
257
+
258
+ print(f"\nEffective r_th for {structure} after η = {eta:.0%} forming")
259
+ print("-" * 45)
260
+ print(f" Virgin r_th: {r_th_virgin:.3f}")
261
+ print(f" Effective r_th: {r_th_eff:.3f}")
262
+ print(f" Reduction: {(1 - r_th_eff/r_th_virgin)*100:.1f}%")
263
+
264
+
265
+ def main():
266
+ args = sys.argv[1:]
267
+
268
+ if len(args) == 0:
269
+ print(QUICK_REFERENCE)
270
+ return
271
+
272
+ cmd = args[0].lower()
273
+
274
+ if cmd == 'info':
275
+ print(DETAILED_INFO)
276
+ elif cmd == 'flc':
277
+ cmd_flc(args[1:])
278
+ elif cmd == 'eta':
279
+ cmd_eta(args[1:])
280
+ elif cmd == 'rth':
281
+ cmd_rth(args[1:])
282
+ elif cmd in ['help', '-h', '--help']:
283
+ print(QUICK_REFERENCE)
284
+ else:
285
+ print(f"Unknown command: {cmd}")
286
+ print("Try: python -m core help")
287
+
288
+
289
+ if __name__ == '__main__':
290
+ main()