output complete microstructure and texture info instead of limiting to grainIDs used in geometry
This commit is contained in:
parent
0c1fe236b4
commit
4dfd59a9e2
|
@ -276,29 +276,29 @@ for name in filenames:
|
||||||
grid = np.vstack(meshgrid2(x, y, z)).reshape(3,-1).T
|
grid = np.vstack(meshgrid2(x, y, z)).reshape(3,-1).T
|
||||||
indices = laguerreTessellation(grid, coords, weights, grains, options.nonperiodic, options.cpus)
|
indices = laguerreTessellation(grid, coords, weights, grains, options.nonperiodic, options.cpus)
|
||||||
|
|
||||||
# --- write header ---------------------------------------------------------------------------------
|
# --- write header ------------------------------------------------------------------------
|
||||||
|
|
||||||
grainIDs = np.intersect1d(grainIDs,indices)
|
usedGrainIDs = np.intersect1d(grainIDs,indices)
|
||||||
info['microstructures'] = len(grainIDs)
|
info['microstructures'] = len(usedGrainIDs)
|
||||||
|
|
||||||
if info['homogenization'] == 0: info['homogenization'] = options.homogenization
|
if info['homogenization'] == 0: info['homogenization'] = options.homogenization
|
||||||
|
|
||||||
damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))),
|
damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))),
|
||||||
'size x y z: %s'%(' x '.join(map(str,info['size']))),
|
'size x y z: %s'%(' x '.join(map(str,info['size']))),
|
||||||
'origin x y z: %s'%(' : '.join(map(str,info['origin']))),
|
'origin x y z: %s'%(' : '.join(map(str,info['origin']))),
|
||||||
'homogenization: %i'%info['homogenization'],
|
'homogenization: %i'%info['homogenization'],
|
||||||
'microstructures: %i%s'%(info['microstructures'],
|
'microstructures: %i%s'%(info['microstructures'],
|
||||||
(' out of %i'%NgrainIDs if NgrainIDs != info['microstructures'] else '')),
|
(' out of %i'%NgrainIDs if NgrainIDs != info['microstructures'] else '')),
|
||||||
])
|
])
|
||||||
|
|
||||||
config_header = []
|
config_header = []
|
||||||
formatwidth = 1+int(math.log10(info['microstructures']))
|
formatwidth = 1+int(math.log10(NgrainIDs))
|
||||||
|
|
||||||
phase = options.phase * np.ones(info['microstructures'],'i')
|
phase = options.phase * np.ones(NgrainIDs,'i')
|
||||||
if int(options.secondphase*info['microstructures']) > 0:
|
if int(options.secondphase*info['microstructures']) > 0:
|
||||||
phase[0:int(options.secondphase*info['microstructures'])] += 1
|
phase[0:int(options.secondphase*info['microstructures'])] += 1 # alter fraction 'options.secondphase' of used grainIDs
|
||||||
randomSeed = int(os.urandom(4).encode('hex'), 16) if options.randomSeed is None \
|
randomSeed = options.randomSeed if options.randomSeed \
|
||||||
else options.randomSeed # random seed for second phase
|
else int(os.urandom(4).encode('hex'), 16) # random seed for second phase
|
||||||
np.random.seed(randomSeed)
|
np.random.seed(randomSeed)
|
||||||
np.random.shuffle(phase)
|
np.random.shuffle(phase)
|
||||||
config_header += ['# random seed (phase shuffling): {}'.format(randomSeed)]
|
config_header += ['# random seed (phase shuffling): {}'.format(randomSeed)]
|
||||||
|
@ -312,7 +312,7 @@ for name in filenames:
|
||||||
if hasEulers:
|
if hasEulers:
|
||||||
config_header += ['<texture>']
|
config_header += ['<texture>']
|
||||||
for ID in grainIDs:
|
for ID in grainIDs:
|
||||||
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
|
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
|
||||||
config_header += ['[Grain%s]'%(str(ID).zfill(formatwidth)),
|
config_header += ['[Grain%s]'%(str(ID).zfill(formatwidth)),
|
||||||
'(gauss)\tphi1 %g\tPhi %g\tphi2 %g\tscatter 0.0\tfraction 1.0'%tuple(eulers[eulerID])
|
'(gauss)\tphi1 %g\tPhi %g\tphi2 %g\tscatter 0.0\tfraction 1.0'%tuple(eulers[eulerID])
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue