@@ -197,42 +197,43 @@ def from_table(table: Table,*,
197
197
Examples
198
198
--------
199
199
>>> import damask
200
- >>> import damask. ConfigMaterial as cm
200
+ >>> from damask import ConfigMaterial as cm
201
201
>>> t = damask.Table.load('small.txt')
202
202
>>> t
203
- 3:pos pos pos 4:qu qu qu qu phase homog
204
- 0 0 0 0 0.19 0.8 0.24 -0.51 Aluminum SX
205
- 1 1 0 0 0.8 0.19 0.24 -0.51 Steel SX
206
- 2 1 1 0 0.8 0.19 0.24 -0.51 Steel SX
203
+ 3:pos pos pos 4:qu qu qu qu phase homog
204
+ 0 0 0 0 1.0 0.0 0.0 0.0 Aluminum SX
205
+ 1 1 0 0 0.0 1.0 0.0 0.0 Steel SX
206
+ 2 1 1 0 0.0 1.0 0.0 0.0 Steel SX
207
+
207
208
>>> cm.from_table(t,O='qu',phase='phase',homogenization='homog')
208
- material:
209
- - constituents:
210
- - O: [0.19, 0.8, 0.24, -0.51]
211
- v: 1.0
212
- phase: Aluminum
213
- homogenization: SX
214
- - constituents:
215
- - O: [0.8, 0.19, 0.24, -0.51]
216
- v: 1.0
217
- phase: Steel
218
- homogenization: SX
219
209
homogenization: {SX: null}
220
210
phase: {Aluminum: null, Steel: null}
211
+ material:
212
+ - constituents:
213
+ - phase: Aluminum
214
+ O: [1.0, 0.0, 0.0, 0.0]
215
+ v: 1.0
216
+ homogenization: SX
217
+ - constituents:
218
+ - phase: Steel
219
+ O: [0.0, 1.0, 0.0, 0.0]
220
+ v: 1.0
221
+ homogenization: SX
221
222
222
223
>>> cm.from_table(t,O='qu',phase='phase',homogenization='single_crystal')
223
- material:
224
- - constituents:
225
- - O: [0.19, 0.8, 0.24, -0.51]
226
- v: 1.0
227
- phase: Aluminum
228
- homogenization: single_crystal
229
- - constituents:
230
- - O: [0.8, 0.19, 0.24, -0.51]
231
- v: 1.0
232
- phase: Steel
233
- homogenization: single_crystal
234
224
homogenization: {single_crystal: null}
235
225
phase: {Aluminum: null, Steel: null}
226
+ material:
227
+ - constituents:
228
+ - phase: Aluminum
229
+ O: [1.0, 0.0, 0.0, 0.0]
230
+ v: 1.0
231
+ homogenization: single_crystal
232
+ - constituents:
233
+ - phase: Steel
234
+ O: [0.0, 1.0, 0.0, 0.0]
235
+ v: 1.0
236
+ homogenization: single_crystal
236
237
237
238
"""
238
239
kwargs = {}
@@ -463,74 +464,113 @@ def material_add(self,*,
463
464
>>> import damask
464
465
>>> m = damask.ConfigMaterial()
465
466
>>> m = m.material_add(phase = ['Ferrite','Martensite','Ferrite'],
466
- ... O = damask.Rotation.from_random(3),
467
+ ... O = damask.Rotation.from_random(3,rng_seed=20191102 ),
467
468
... homogenization = 'SX')
468
469
>>> m
470
+ homogenization: {SX: null}
471
+ phase: {Ferrite: null, Martensite: null}
469
472
material:
470
473
- constituents:
471
- - O: [0.577764, -0.146299, -0.617669, 0.513010]
474
+ - phase: Ferrite
475
+ O: [0.0047, -0.9582, 0.1084, 0.2645]
472
476
v: 1.0
473
- phase: Ferrite
474
477
homogenization: SX
475
478
- constituents:
476
- - O: [0.184176, 0.340305, 0.737247, 0.553840]
479
+ - phase: Martensite
480
+ O: [0.9147, -0.1907, 0.2901, -0.2068]
477
481
v: 1.0
478
- phase: Martensite
479
482
homogenization: SX
480
483
- constituents:
481
- - O: [0.47925185, -0.04294454, 0.78760173, -0.3849116 ]
484
+ - phase: Ferrite
485
+ O: [0.1068, -0.4427, 0.1369, 0.8797]
482
486
v: 1.0
483
- phase: Ferrite
484
487
homogenization: SX
485
- homogenization: {SX: null}
486
- phase: {Ferrite: null, Martensite: null}
487
488
488
- Create hundred materials that each approximate a duplex stainless steel microstructure
489
+ Create five materials that each approximate a duplex stainless steel microstructure
489
490
with three austenite and one relatively bigger ferrite grain of random orientation each:
490
491
492
+ >>> import numpy as np
491
493
>>> import damask
492
494
>>> m = damask.ConfigMaterial()
493
- >>> m = m.material_add(phase = np.array(['Austenite']*3+['Ferrite']),
494
- ... O = damask.Rotation.from_random((100,4)),
495
- ... v = np.array([0.2]*3+[0.4]),
495
+ >>> N_materials = 5
496
+ >>> m = m.material_add(phase = np.array([['Austenite']*3+['Ferrite']]),
497
+ ... O = damask.Rotation.from_random((N_materials,4),rng_seed=20191102),
498
+ ... v = np.array([[0.2]*3+[0.4]]),
496
499
... homogenization = 'Taylor')
497
500
>>> m
498
- material:
499
- - constituents:
500
- - v: 0.2
501
- phase: Austenite
502
- O: [0.46183665006602664, 0.2215160420973196, -0.5594313187331139, 0.6516702781083836]
503
- - v: 0.2
504
- phase: Austenite
505
- O: [0.11321658382410027, 0.6354079414360444, 0.00562701344273936, 0.7638108992590535]
506
- - v: 0.2
507
- phase: Austenite
508
- O: [0.050991978809077604, 0.8069522034362003, -0.11352928955610851, -0.5773552285027659]
509
- - v: 0.4
510
- phase: Ferrite
511
- O: [0.9460076150721788, 0.15880754622367604, -0.0069841062241482385, -0.28249066842661014]
512
- homogenization: Taylor
513
- .
514
- .
515
- .
516
- - constituents:
517
- - v: 0.2
518
- phase: Austenite
519
- O: [0.12531400788494199, -0.18637769037997565, 0.31737548053338394, -0.9213210951197429]
520
- - v: 0.2
521
- phase: Austenite
522
- O: [0.37453930577161404, -0.33529507696450805, -0.3266564259130028, -0.800370601162502]
523
- - v: 0.2
524
- phase: Austenite
525
- O: [0.035776891752713764, -0.720706371010592, -0.4540438656728926, -0.5226342017569017]
526
- - v: 0.4
527
- phase: Ferrite
528
- O: [0.6782596727966124, -0.20800082041703685, -0.138636083554039, 0.6909989227925536]
529
- homogenization: Taylor
530
-
531
501
homogenization: {Taylor: null}
532
-
533
502
phase: {Austenite: null, Ferrite: null}
503
+ material:
504
+ - constituents:
505
+ - phase: Austenite
506
+ v: 0.2
507
+ O: [0.004702411137213036, -0.9582446864633862, 0.1084379916089085, 0.2645490694937509]
508
+ - phase: Austenite
509
+ v: 0.2
510
+ O: [0.9147097460704486, -0.19068436891182194, 0.29014401444532145, -0.20678975501215882]
511
+ - phase: Austenite
512
+ v: 0.2
513
+ O: [0.10677819003833185, -0.4427133706883004, 0.13690394495734726, 0.879693468999888]
514
+ - phase: Ferrite
515
+ v: 0.4
516
+ O: [0.8664338002923555, 0.04448357787828491, -0.4945927532088464, 0.05188149461403649]
517
+ homogenization: Taylor
518
+ - constituents:
519
+ - phase: Austenite
520
+ v: 0.2
521
+ O: [0.5621873738314133, 0.0028841916095125584, -0.817023371343172, -0.1281009321680984]
522
+ - phase: Austenite
523
+ v: 0.2
524
+ O: [0.1566777437467901, -0.8117282158019414, 0.5096142534839398, 0.23841707348975383]
525
+ - phase: Austenite
526
+ v: 0.2
527
+ O: [0.3559036203819333, 0.1946923701552408, 0.058744995087853975, -0.9121274689178566]
528
+ - phase: Ferrite
529
+ v: 0.4
530
+ O: [0.467387781713959, -0.35644325887489176, 0.8031986430613528, 0.09679258489963502]
531
+ homogenization: Taylor
532
+ - constituents:
533
+ - phase: Austenite
534
+ v: 0.2
535
+ O: [0.4399087544327661, 0.12802483830067418, -0.8257167208737983, 0.32906203886337354]
536
+ - phase: Austenite
537
+ v: 0.2
538
+ O: [0.12410381094181624, -0.5125024631828828, -0.8493860709598213, 0.021972068647108236]
539
+ - phase: Austenite
540
+ v: 0.2
541
+ O: [0.03909373022192218, 0.4596226773046959, 0.42809626138739537, 0.7771436583738773]
542
+ - phase: Ferrite
543
+ v: 0.4
544
+ O: [0.737821660605232, 0.38809925187040367, -0.012129167758963711, 0.5521331824196455]
545
+ homogenization: Taylor
546
+ - constituents:
547
+ - phase: Austenite
548
+ v: 0.2
549
+ O: [0.4924738838478857, -0.0534798919571679, -0.6570981342247908, 0.5681825559468784]
550
+ - phase: Austenite
551
+ v: 0.2
552
+ O: [0.13073521303792138, 0.2534173177988532, -0.9582490914178947, -0.021133998872519554]
553
+ - phase: Austenite
554
+ v: 0.2
555
+ O: [0.1633346595899539, 0.6775968809652247, -0.07127256805012916, -0.71351557581203]
556
+ - phase: Ferrite
557
+ v: 0.4
558
+ O: [0.7658044627436773, -0.5327872540278646, 0.1102330397070761, 0.34282640467772235]
559
+ homogenization: Taylor
560
+ - constituents:
561
+ - phase: Austenite
562
+ v: 0.2
563
+ O: [0.25814496892598815, -0.6159961898524933, -0.5080223627084379, 0.543896265930874]
564
+ - phase: Austenite
565
+ v: 0.2
566
+ O: [0.8497433829153472, 0.4264182767672584, 0.05570674517418605, -0.3049596612218108]
567
+ - phase: Austenite
568
+ v: 0.2
569
+ O: [0.5146112784760113, 0.529467219604771, 0.661078636611197, 0.13347183839881469]
570
+ - phase: Ferrite
571
+ v: 0.4
572
+ O: [0.18430893147208752, 0.012407731059331692, -0.5551804816056372, -0.8109567798802285]
573
+ homogenization: Taylor
534
574
535
575
"""
536
576
dim = {'O' :(4 ,),'V_e' :(3 ,3 ,)}
0 commit comments