4import matplotlib.pyplot
as plt
6sys.path.append(
"../build/tools/pyMoDELib")
9simulationDir=os.path.abspath(
"../tutorials/uniformLoadController")
10ddBase=pyMoDELib.DefectiveCrystalBase(simulationDir)
13microstructureGenerator=pyMoDELib.MicrostructureGenerator(ddBase)
14spec=pyMoDELib.ShearLoopIndividualSpecification()
15spec.slipSystemIDs=[0,6]
16spec.loopRadii=[27.0e-8,27.0e-8]
17spec.loopCenters=np.array([[0.0,0.0,0.0],[0.0,0.0,0.0]])
19microstructureGenerator.addShearLoopIndividual(spec)
21microstructureGenerator.writeConfigFiles(0)
24defectiveCrystal=pyMoDELib.DefectiveCrystal(ddBase)
25defectiveCrystal.initializeConfiguration(microstructureGenerator.configIO)
29xMax=ddBase.mesh.xMax();
30xMin=ddBase.mesh.xMin();
33x=np.linspace(xMin[0], xMax[0], num=n)
34y=np.linspace(xMin[1], xMax[1], num=n)
35z=0.5*(xMin[2]+xMax[2])
36points = np.zeros((0, 3))
38for i
in range(0,x.size):
39 for j
in range(0,y.size):
40 pnt=np.array([x[i],y[j],z])
41 points=np.vstack((points, pnt))
43u=defectiveCrystal.displacement(points)
44s=defectiveCrystal.stress(points)
50for i
in range(0,x.size):
51 for j
in range(0,y.size):
58plt.imshow(u1,origin=
'lower',cmap=
'jet')
64plt.imshow(s11,origin=
'lower',cmap=
'jet')