4import matplotlib.pyplot
as plt
6sys.path.append(
"../../build/tools/pyMoDELib")
8sys.path.append(
"../../python/")
9from modlibUtils
import *
12simulationDir=os.path.abspath(
".")
15ddBase=pyMoDELib.DefectiveCrystalBase(simulationDir)
17cs_SI=ddBase.poly.cs_SI
18configIO=pyMoDELib.DefectiveCrystalConfigIO(simulationDir+
'/config')
19defectiveCrystal=pyMoDELib.DefectiveCrystal(ddBase)
20dislocationNetwork=defectiveCrystal.dislocationNetwork()
22times=
getFarray(F,Flabels,
'time [b/cs]')*b_SI/cs_SI/3600
30for k
in range(0,len(runIDs)):
34 defectiveCrystal.initializeConfiguration(configIO)
35 networkLengthTuple=dislocationNetwork.networkLength()
36 dislocationDensity.append((networkLengthTuple[0]+networkLengthTuple[1]+networkLengthTuple[2]+networkLengthTuple[3])/ddBase.mesh.volume()/b_SI/b_SI)
37 for loopID
in dislocationNetwork.loops():
38 loop=dislocationNetwork.loops().getRef(loopID)
39 planeID=loop.glidePlane.planeBaseID()
40 loopTypes.append(np.trace(loop.averagePlasticDistortion())<0.0)
41 r=np.sqrt(loop.slippedArea()/np.pi)*b_SI*1.0e9
43 loopTimes.append(time)
44 loopPlanes.append(planeID)
48loopTimes = np.array(loopTimes)
49loopRaii = np.array(loopRaii)
50loopPlanes = np.array(loopPlanes)
51loopTypes = np.array(loopTypes)
55 (0, 1):
"basal vacancy",
56 (0, 0):
"basal interstitial",
57 (1, 1):
"prismatic vacancy",
58 (1, 0):
"prismatic interstial",
59 (2, 1):
"prismatic vacancy",
60 (2, 0):
"prismatic interstial",
61 (3, 1):
"prismatic vacancy",
62 (3, 0):
"prismatic interstial",
66unique_strings = sorted(list(set(mapping.values())))
67cmap = plt.colormaps[
'plasma']
68string_colors = {string:
cmap(i / max(1, len(unique_strings) - 1))
69 for i, string
in enumerate(unique_strings)}
72fig, axs = plt.subplots(1,1)
74for string_s
in unique_strings:
76 string_mask = np.zeros(len(loopRaii), dtype=bool)
78 for (pk, tk), mapped_string
in mapping.items():
79 if mapped_string == string_s:
81 string_mask |= (loopPlanes == pk) & (loopTypes == tk)
84 axs.scatter(loopTimes[string_mask], loopRaii[string_mask],
85 color=string_colors[string_s],
89plt.legend(loc=
"upper right", markerscale=2)
90fig.savefig(
"loopRadii.pdf", bbox_inches=
'tight', format=
'pdf')
98fig, axs = plt.subplots(1,1)
99axs.plot(times,dislocationDensity,0.1,color=
'k')
100axs.set_xlabel(
'time [hours]')
101axs.set_ylabel(
'dislocation density [1/m^2]')
102fig.savefig(
"density.pdf", bbox_inches=
'tight', format=
'pdf')
getStringInFile(fileName, variable)
getFarray(F, Flabels, label)