delta-theory 8.1.2__py3-none-any.whl → 8.2.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 CHANGED
@@ -3,10 +3,11 @@
3
3
  δ-Theory CLI Entry Point
4
4
 
5
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
6
+ python -m delta_theory # Show quick reference
7
+ python -m delta_theory info # Show detailed info
8
+ python -m delta_theory flc SPCC # Quick FLC prediction
9
+ python -m delta_theory flc Cu all # All 7 modes
10
+ python -m delta_theory fatigue Fe 150 # Quick fatigue life
10
11
  """
11
12
 
12
13
  import sys
@@ -16,100 +17,93 @@ QUICK_REFERENCE = """
16
17
  ███████╗██╗ ██╗██████╗ ███████╗██╗ ██╗ █████╗ ██╗
17
18
  ██╔════╝██║ ██║██╔══██╗██╔════╝██║ ██╔╝██╔══██╗██║
18
19
  █████╗ ██║ ██║██████╔╝█████╗ █████╔╝ ███████║██║
19
- ██╔══╝ ██║ ██║██╔══██╗██╔══╝ ██╔═██╗ ██╔══██║╚═╝
20
+ ██╔══╝ ██║ ██║██╔══██╗██╔══╝ ██╔═██╗ ██╔══██╗╚═╝
20
21
  ███████╗╚██████╔╝██║ ██║███████╗██║ ██╗██║ ██║██╗
21
22
  ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
22
- δ-Theory v8.0.0
23
+ δ-Theory v8.1.0
23
24
  "Nature is Geometry"
24
25
 
25
26
  ╔══════════════════════════════════════════════════════════════════════════════╗
26
- ║ δ-Theory v8.0.0 — CLI Quick Reference ║
27
+ ║ δ-Theory v8.1.0 — CLI Quick Reference ║
27
28
  ║ "Nature is Geometry" ║
28
29
  ╠══════════════════════════════════════════════════════════════════════════════╣
29
30
  ║ ║
30
31
  ║ INSTALLATION OK! ✓ ║
31
32
  ║ ║
32
33
  ╠══════════════════════════════════════════════════════════════════════════════╣
33
- ║ 🔧 YIELD STRESS
34
+ ║ 🔧 YIELD STRESS (v6.9b)
34
35
  ╠══════════════════════════════════════════════════════════════════════════════╣
35
36
  ║ ║
36
- ║ from core import calc_sigma_y, MATERIALS
37
+ ║ from delta_theory import calc_sigma_y, MATERIALS
37
38
  ║ result = calc_sigma_y(MATERIALS['Fe'], T_K=300) ║
38
39
  ║ print(f"σ_y = {result['sigma_y']:.1f} MPa") ║
39
40
  ║ ║
40
41
  ╠══════════════════════════════════════════════════════════════════════════════╣
41
- ║ 🔄 FATIGUE LIFE
42
+ ║ 🔄 FATIGUE LIFE (v6.9b)
42
43
  ╠══════════════════════════════════════════════════════════════════════════════╣
43
44
  ║ ║
44
- ║ from core import fatigue_life_const_amp, MATERIALS
45
+ ║ from delta_theory import fatigue_life_const_amp, MATERIALS
45
46
  ║ result = fatigue_life_const_amp(MATERIALS['Fe'], sigma_a_MPa=150, ║
46
- ║ sigma_y_tension_MPa=200)
47
+ ║ sigma_y_tension_MPa=200, A_ext=2.5e-4)
47
48
  ║ print(f"N = {result['N_fail']:.2e} cycles") ║
48
49
  ║ ║
49
50
  ║ # 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
51
+ ║ python -m delta_theory.unified_yield_fatigue_v6_9 point --metal Fe \\
52
+ --sigma_a 150 --sigma_y_override 200
52
53
  ║ ║
53
54
  ╠══════════════════════════════════════════════════════════════════════════════╣
54
- ║ 📐 FLC (Forming Limit Curve) NEW in v8.0!
55
+ ║ 📐 FLC v8.17-Mode Discrete Formulation
55
56
  ╠══════════════════════════════════════════════════════════════════════════════╣
56
57
  ║ ║
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}") ║
58
+ ║ from delta_theory import FLCPredictor, predict_flc
64
59
  ║ ║
65
- ║ # Available materials:
66
- SPCC, DP590, Al, SUS304, Ti, Mg_AZ31, SECD-E16, Cu
60
+ ║ # Quick prediction
61
+ eps1 = predict_flc('Cu', 'Plane Strain') # 0.346
67
62
  ║ ║
68
- ╠══════════════════════════════════════════════════════════════════════════════╣
69
- 🔗 FORMING-FATIGUE INTEGRATION — NEW in v8.0!
70
- ╠══════════════════════════════════════════════════════════════════════════════╣
63
+ ║ # Full usage ║
64
+ flc = FLCPredictor()
65
+ ║ flc.add_from_v69('MySteel', flc0=0.28, base_element='Fe') ║
66
+ ║ eps1 = flc.predict('MySteel', 'Uniaxial') ║
71
67
  ║ ║
72
- from core import FormingFatigueIntegrator
73
- integrator = FormingFatigueIntegrator()
68
+ # All 7 modes
69
+ betas, eps1s = flc.predict_curve('Cu')
74
70
  ║ ║
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
71
+ ║ # CLI:
72
+ python -m delta_theory flc Cu # FLC₀ (Plane Strain)
73
+ python -m delta_theory flc Cu all # All 7 modes
74
+ ║ python -m delta_theory flc Cu Uniaxial # Specific mode ║
78
75
  ║ ║
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!) ║
76
+ ║ # Built-in materials:
77
+ Cu, Ti, SPCC, DP590, Al5052, SUS304, Mg_AZ31
83
78
  ║ ║
84
79
  ╠══════════════════════════════════════════════════════════════════════════════╣
85
80
  ║ 🌡️ DBT (Ductile-Brittle Transition) ║
86
81
  ╠══════════════════════════════════════════════════════════════════════════════╣
87
82
  ║ ║
88
- ║ from core import DBTUnified
83
+ ║ from delta_theory import DBTUnified
89
84
  ║ model = DBTUnified() ║
90
85
  ║ result = model.temp_view.find_DBTT(d=30e-6, c=0.005) ║
91
86
  ║ print(f"DBTT = {result['T_star']:.0f} K") ║
92
87
  ║ ║
93
88
  ║ # CLI: ║
94
- ║ python -m core.dbt_unified point --d 30 --c 0.5 --T 300
89
+ ║ python -m delta_theory.dbt_unified point --d 30 --c 0.5 --T 300
95
90
  ║ ║
96
91
  ╠══════════════════════════════════════════════════════════════════════════════╣
97
- ║ 📊 FATIGUE THRESHOLDS (r_th)
92
+ ║ 📊 KEY CONSTANTS
98
93
  ╠══════════════════════════════════════════════════════════════════════════════╣
99
94
  ║ ║
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
95
+ ║ r_th (Fatigue Threshold) τ/σ (Multiaxial)
96
+ ─────────────────────────────────────────────
97
+ ║ BCC: 0.65 (clear limit) BCC: 0.565
98
+ ║ FCC: 0.02 (no limit) FCC: 0.565
99
+ ║ HCP: 0.20 (weak limit) HCP: 0.327-0.565 (T_twin dependent)
105
100
  ║ ║
106
101
  ╠══════════════════════════════════════════════════════════════════════════════╣
107
102
  ║ 📚 MORE INFO ║
108
103
  ╠══════════════════════════════════════════════════════════════════════════════╣
109
104
  ║ ║
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 β ║
105
+ ║ python -m delta_theory info # Detailed module info
106
+ ║ python -m delta_theory flc --help # FLC command help
113
107
  ║ ║
114
108
  ║ Docs: https://github.com/miosync/delta-theory ║
115
109
  ║ PyPI: https://pypi.org/project/delta-theory/ ║
@@ -119,18 +113,19 @@ QUICK_REFERENCE = """
119
113
 
120
114
  DETAILED_INFO = """
121
115
  ╔══════════════════════════════════════════════════════════════════════════════╗
122
- ║ δ-Theory v8.0.0 — Detailed Module Information ║
116
+ ║ δ-Theory v8.1.0 — Detailed Module Information ║
123
117
  ╚══════════════════════════════════════════════════════════════════════════════╝
124
118
 
125
119
  📦 INSTALLED MODULES
126
120
  ═══════════════════════════════════════════════════════════════════════════════
127
121
 
128
- core/
122
+ delta_theory/
129
123
  ├── unified_yield_fatigue_v6_9.py # Yield + Fatigue (v6.9b)
130
- ├── unified_flc_v7.py # FLC + Forming-Fatigue (v7.2/v8.0)
124
+ ├── unified_flc_v8_1.py # FLC 7-mode discrete (v8.1)
131
125
  ├── dbt_unified.py # Ductile-Brittle Transition
132
126
  ├── materials.py # Material database
133
- └── fatigue_redis_api.py # FatigueData-AM2022 API
127
+ ├── banners.py # ASCII art banners
128
+ └── fatigue_redis_api.py # FatigueData-AM2022 API (optional)
134
129
 
135
130
 
136
131
  🔬 THEORY SUMMARY
@@ -143,45 +138,68 @@ DETAILED_INFO = """
143
138
  Λ = 1 → Critical condition (fracture/transition)
144
139
 
145
140
 
146
- 📐 FLC MODEL (v7.2)
141
+ 📐 FLC MODEL v8.1 — 7-Mode Discrete Formulation
147
142
  ═══════════════════════════════════════════════════════════════════════════════
148
143
 
149
- FLC(β) = FLC₀_pure × (1 - η_total) × h(β, R, τ/σ)
144
+ Core Equation:
145
+ ε₁,j = |V|_eff × C_j / R_j
150
146
 
151
- η_total = Free volume consumption:
152
- - η_ss: Solid solution
153
- - η_ppt: Precipitate/martensite
154
- - η_wh: Work hardening (dislocations)
155
- - η_HP: Hall-Petch (grain refinement)
147
+ Localization Correction (frozen):
148
+ C_j = 1 + 0.75β_j + 0.48β_j²
156
149
 
157
- Example: SPCC (90.6% FV) vs DP590 (71.4% FV)
158
- Same crystal, different formability!
150
+ Mixed Resistance:
151
+ R_j = w_σ,j + w_τ,j/(τ/σ) + w_c,j/R_comp
159
152
 
153
+ 7 Standard Modes:
154
+ ┌─────────────────┬────────┬────────┐
155
+ │ Mode │ β │ C_j │
156
+ ├─────────────────┼────────┼────────┤
157
+ │ Uniaxial │ -0.370 │ 0.788 │
158
+ │ Deep Draw │ -0.306 │ 0.815 │
159
+ │ Draw-Plane │ -0.169 │ 0.887 │
160
+ │ Plane Strain │ 0.000 │ 1.000 │ ← FLC₀
161
+ │ Plane-Stretch │ +0.133 │ 1.108 │
162
+ │ Stretch │ +0.247 │ 1.214 │
163
+ │ Equi-biaxial │ +0.430 │ 1.411 │
164
+ └─────────────────┴────────┴────────┘
160
165
 
161
- 🔗 FORMING-FATIGUE (v8.0)
162
- ═══════════════════════════════════════════════════════════════════════════════
166
+ Calibration: FLC₀ (1 point) → All 7 modes predicted!
163
167
 
164
- r_th_eff = r_th_virgin × (1 - η_forming)
165
168
 
166
- "How much fatigue life did you lose when you pressed that part?"
169
+ 🔗 v6.9 INTEGRATION
170
+ ═══════════════════════════════════════════════════════════════════════════════
167
171
 
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
172
+ τ/σ and R_comp from δ-theory v6.9:
173
+
174
+ # Add new material with v6.9 parameters
175
+ flc = FLCPredictor()
176
+ flc.add_from_v69('MySteel', flc0=0.28, base_element='Fe')
177
+ flc.add_from_v69('MgAlloy', flc0=0.25, base_element='Mg', T_twin=0.0)
174
178
 
175
- Critical η: r=0.5 → η_crit=23.1%
176
- (Beyond this, "infinite life" becomes "finite life"!)
179
+ HCP T_twin interpolation:
180
+ T_twin=0.0 twin-dominated (Mg: τ/σ=0.327, R_comp=0.60)
181
+ T_twin=1.0 → slip-dominated (τ/σ=0.565, R_comp=1.00)
177
182
 
178
183
 
179
184
  📊 VALIDATION
180
185
  ═══════════════════════════════════════════════════════════════════════════════
181
186
 
182
- Yield (v5.0): 10 pure metals, 2.6% mean error
187
+ Yield (v6.9b): 10 pure metals, 2.6% mean error
183
188
  Fatigue (v6.10): 2,472 points (5 AM materials), 4-7% error
184
- FLC (v7.2): 36 points (6 materials), 2.7% error
189
+ FLC (v8.1): 49 points (7 materials × 7 modes), 4.7% MAE
190
+
191
+
192
+ 💡 FORMING-FATIGUE (Simple Rule)
193
+ ═══════════════════════════════════════════════════════════════════════════════
194
+
195
+ "曲げたら弱い" — That's it!
196
+
197
+ η = ε_formed / ε_FLC # How much capacity used
198
+ r_th_eff = r_th × (1 - η) # Remaining fatigue threshold
199
+
200
+ 幾何的描像:
201
+ 成形前: ●──●──●──● (r₀)
202
+ 成形後: ●───●───●───● (r > r₀, 千切れそうw)
185
203
 
186
204
 
187
205
  👥 AUTHORS
@@ -196,70 +214,119 @@ DETAILED_INFO = """
196
214
 
197
215
  def cmd_flc(args):
198
216
  """Quick FLC prediction."""
199
- from .unified_flc_v7 import FLCPredictor, FLC_MATERIALS
217
+ from .unified_flc_v8_1 import FLCPredictor, FLC_MATERIALS, MODE_ORDER
200
218
 
201
- if len(args) == 0:
202
- print("Available materials:", ", ".join(FLC_MATERIALS.keys()))
219
+ if len(args) == 0 or args[0] in ['-h', '--help']:
220
+ print("""
221
+ FLC v8.1 Command
222
+ ================
223
+
224
+ Usage:
225
+ python -m delta_theory flc <material> [mode]
226
+
227
+ Arguments:
228
+ material Material name (Cu, Ti, SPCC, DP590, Al5052, SUS304, Mg_AZ31)
229
+ mode 'all' for all modes, or specific mode name (default: Plane Strain)
230
+
231
+ Mode names:
232
+ Uniaxial, Deep Draw, Draw-Plane, Plane Strain,
233
+ Plane-Stretch, Stretch, Equi-biaxial
234
+
235
+ Examples:
236
+ python -m delta_theory flc Cu # FLC₀ only
237
+ python -m delta_theory flc Cu all # All 7 modes
238
+ python -m delta_theory flc SPCC Uniaxial # Specific mode
239
+ python -m delta_theory flc --list # List materials
240
+
241
+ """)
203
242
  return
204
243
 
205
- material = args[0]
206
- beta = float(args[1]) if len(args) > 1 else None
207
-
208
- flc = FLCPredictor()
244
+ if args[0] == '--list':
245
+ print("\nAvailable materials:")
246
+ print("-" * 50)
247
+ for name, mat in FLC_MATERIALS.items():
248
+ print(f" {name:<10} {mat.structure} τ/σ={mat.tau_sigma:.3f} V_eff={mat.V_eff:.4f}")
249
+ return
209
250
 
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
251
+ material = args[0]
252
+ mode = args[1] if len(args) > 1 else 'Plane Strain'
224
253
 
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")
254
+ if material not in FLC_MATERIALS:
255
+ print(f"Error: Unknown material '{material}'")
256
+ print(f"Available: {', '.join(FLC_MATERIALS.keys())}")
228
257
  return
229
258
 
230
- r_applied = float(args[0])
231
- structure = args[1] if len(args) > 1 else 'BCC'
259
+ flc = FLCPredictor()
232
260
 
233
- integrator = FormingFatigueIntegrator()
234
- eta_crit = integrator.critical_eta(r_applied, structure)
261
+ if mode.lower() == 'all':
262
+ # All 7 modes
263
+ print(f"\n{material} FLC Curve (v8.1)")
264
+ print("=" * 50)
265
+ mat = FLC_MATERIALS[material]
266
+ print(f"Structure: {mat.structure}")
267
+ print(f"τ/σ: {mat.tau_sigma:.4f}")
268
+ print(f"R_comp: {mat.R_comp:.2f}")
269
+ print(f"|V|_eff: {mat.V_eff:.4f}")
270
+ print("-" * 50)
271
+ print(f"{'Mode':<15} {'β':>7} {'C_j':>7} {'ε₁':>8}")
272
+ print("-" * 50)
273
+ for m in MODE_ORDER:
274
+ eps1, bd = flc.predict(material, m, include_breakdown=True)
275
+ print(f"{m:<15} {bd['beta']:>7.3f} {bd['C_j']:>7.4f} {eps1:>8.4f}")
276
+ print("-" * 50)
277
+ print(f"FLC₀ = {flc.flc0(material):.4f}")
278
+ else:
279
+ # Single mode
280
+ if mode not in MODE_ORDER:
281
+ print(f"Error: Unknown mode '{mode}'")
282
+ print(f"Available: {', '.join(MODE_ORDER)}")
283
+ return
284
+
285
+ eps1 = flc.predict(material, mode)
286
+ print(f"{material} FLC({mode}) = {eps1:.4f}")
287
+
288
+
289
+ def cmd_add_material(args):
290
+ """Add new material from FLC₀."""
291
+ from .unified_flc_v8_1 import FLCPredictor
235
292
 
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
-
293
+ if len(args) < 3 or args[0] in ['-h', '--help']:
294
+ print("""
295
+ Add Material Command
296
+ ====================
241
297
 
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")
298
+ Usage:
299
+ python -m delta_theory add <name> <flc0> <base_element> [T_twin]
300
+
301
+ Arguments:
302
+ name New material name
303
+ flc0 FLC₀ value (Plane Strain)
304
+ base_element Base element (Fe, Cu, Al, Ti, Mg, etc.)
305
+ T_twin HCP twinning factor 0.0-1.0 (default: 1.0)
306
+
307
+ Examples:
308
+ python -m delta_theory add MySteel 0.28 Fe
309
+ python -m delta_theory add AZ31 0.265 Mg 0.0
310
+ """)
249
311
  return
250
312
 
251
- eta = float(args[0])
252
- structure = args[1] if len(args) > 1 else 'BCC'
313
+ name = args[0]
314
+ flc0 = float(args[1])
315
+ base_element = args[2]
316
+ T_twin = float(args[3]) if len(args) > 3 else 1.0
253
317
 
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]
318
+ flc = FLCPredictor()
319
+ mat = flc.add_from_v69(name, flc0=flc0, base_element=base_element, T_twin=T_twin)
257
320
 
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}%")
321
+ print(f"\nAdded: {name}")
322
+ print("-" * 40)
323
+ print(f" Base element: {base_element}")
324
+ print(f" Structure: {mat.structure}")
325
+ print(f" τ/σ: {mat.tau_sigma:.4f}")
326
+ print(f" R_comp: {mat.R_comp:.2f}")
327
+ print(f" |V|_eff: {mat.V_eff:.4f} (calibrated from FLC₀={flc0})")
328
+ print()
329
+ print(flc.summary(name))
263
330
 
264
331
 
265
332
  def main():
@@ -275,15 +342,13 @@ def main():
275
342
  print(DETAILED_INFO)
276
343
  elif cmd == 'flc':
277
344
  cmd_flc(args[1:])
278
- elif cmd == 'eta':
279
- cmd_eta(args[1:])
280
- elif cmd == 'rth':
281
- cmd_rth(args[1:])
345
+ elif cmd == 'add':
346
+ cmd_add_material(args[1:])
282
347
  elif cmd in ['help', '-h', '--help']:
283
348
  print(QUICK_REFERENCE)
284
349
  else:
285
350
  print(f"Unknown command: {cmd}")
286
- print("Try: python -m core help")
351
+ print("Try: python -m delta_theory help")
287
352
 
288
353
 
289
354
  if __name__ == '__main__':