~yade-dev/yade/trunk

« back to all changes in this revision

Viewing changes to scripts/test/peri3dController_triaxialCompression.py

  • Committer: jakob at tu-freiberg
  • Date: 2012-03-12 14:52:28 UTC
  • Revision ID: jakob@ifgt.tu-freiberg.de-20120312145228-epa2srwt96k4qq1r
move all model examples to example folder, fixed all examples, that are not in test folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# peri3dController_triaxialCompression.py
2
 
# script, that explains funcionality and input parameters of Peri3dController on the example of
3
 
# triaxial compression.
4
 
#   Firstly, a hydrostatic preassure is applied, then a strain along z axis is increasing
5
 
# while x- and y- stress is constant
6
 
#   The simulation is run on rotated cell to enable localization and strain softening
7
 
# (you can also try simulation with command sp.toSimulation() with no rotation,
8
 
# in this case there is almost no difference, but in script peri3dController_shear,
9
 
# the cell rotation has significant effect)
10
 
 
11
 
from yade import pack,plot,qt
12
 
 
13
 
# define material
14
 
O.materials.append(FrictMat())
15
 
 
16
 
# create periodic assembly of particles
17
 
initSize=1.2
18
 
sp=pack.randomPeriPack(radius=.05,initSize=Vector3(initSize,initSize,initSize),memoizeDb='/tmp/packDb.sqlite')
19
 
angle=0
20
 
rot=Matrix3(cos(angle),0,-sin(angle), 0,1,0, sin(angle),0,cos(angle))
21
 
sp.toSimulation(rot=rot)
22
 
 
23
 
# plotting 
24
 
plot.live=False
25
 
plot.plots={'iter':('sx','sy','sz','syz','szx','sxy',),'iter_':('ex','ey','ez','eyz','ezx','exy',),'ez':('sz',)}
26
 
def plotAddData():
27
 
        plot.addData(
28
 
                iter=O.iter,iter_=O.iter,
29
 
                sx=p3d.stress[0],sy=p3d.stress[1],sz=p3d.stress[2],
30
 
                syz=p3d.stress[3],szx=p3d.stress[4],sxy=p3d.stress[5],
31
 
                ex=p3d.strain[0],ey=p3d.strain[1],ez=p3d.strain[2],
32
 
                eyz=p3d.strain[3],ezx=p3d.strain[4],exy=p3d.strain[5],
33
 
        )
34
 
 
35
 
O.dt=utils.PWaveTimeStep()/2
36
 
 
37
 
# define the first part of simulation, hydrostatic compression
38
 
O.engines=[
39
 
        ForceResetter(),
40
 
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
41
 
        InteractionLoop(
42
 
                [Ig2_Sphere_Sphere_Dem3DofGeom()],
43
 
                [Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_Dem3DofGeom_FrictPhys_CundallStrack()]),
44
 
        NewtonIntegrator(),
45
 
        Peri3dController(       goal=(-1e7,-1e7,-1e7, 0,0,0), # Vector6 of prescribed final values
46
 
                                                        stressMask=0b000111,
47
 
                                                        nSteps=500,
48
 
                                                        doneHook='print "Hydrostatic load reached."; O.pause()',
49
 
                                                        youngEstimation=.5e9, # needed, when only nonzero prescribed values are stress
50
 
                                                        maxStrain=.5,
51
 
                                                        label='p3d'
52
 
                                                        ),
53
 
        PyRunner(command='plotAddData()',iterPeriod=1),
54
 
]
55
 
O.run(); O.wait()
56
 
 
57
 
# second part, z-axis straining and constant transversal stress
58
 
O.engines=[
59
 
        ForceResetter(),
60
 
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
61
 
        InteractionLoop(
62
 
                [Ig2_Sphere_Sphere_Dem3DofGeom()],
63
 
                [Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_Dem3DofGeom_FrictPhys_CundallStrack()]),
64
 
        NewtonIntegrator(),
65
 
        Peri3dController(       goal=(-1e7,-1e7,-4e-1, 0,0,0), # Vector6 of prescribed final values
66
 
                                                        stressMask=0b000011,
67
 
                                                        nSteps=1000,
68
 
                                                        xxPath=[(0,1),(1,1)], # the first (time) zero defines the initial value of stress considered nonzero
69
 
                                                        yyPath=[(0,1),(1,1)],
70
 
                                                        doneHook='print "Simulation with Peri3dController finished."; O.pause()',
71
 
                                                        maxStrain=.5,
72
 
                                                        label='p3d',
73
 
                                                        strain=p3d.strain, # continue from value reached in previous part
74
 
                                                        stressIdeal=Vector6(-1e7,-1e7,0, 0,0,0), # continue from value reached in previous part
75
 
                                                        ),
76
 
        PyRunner(command='plotAddData()',iterPeriod=1),
77
 
]
78
 
O.run();O.wait()
79
 
plot.plot()