Commit 1206b7c4 authored by Christian Jakob's avatar Christian Jakob Committed by Anton Gladky

move all model examples to example folder, fixed all examples, that are not in test folder

parent f6b3e38e
......@@ -21,11 +21,11 @@ frictionAngle=26 # [°]
# Append geometry and material
O.materials.append(FrictMat(young=young,poisson=poisson,density=density,frictionAngle=frictionAngle))
O.bodies.append(utils.box(center=center,extents=extents,dynamic=False,wire=True)) # body id=0
O.bodies.append(utils.sphere(p2,r2,dynamic=True,wire=True)) # body id=1
O.bodies.append(utils.box(center=center,extents=extents,fixed=True,wire=True)) # body id=0
O.bodies.append(utils.sphere(p2,r2,fixed=True,wire=True)) # body id=1
m_sphere=O.bodies[1].state.mass
O.bodies[0].state.mass=m_sphere # set the mass of the box the same as the mass of the sphere
O.bodies[1].state.blockedDOFs=['rx','ry','rz'] # block particles rotations
O.bodies[1].state.blockedDOFs='XYZ' # block particles rotations
#__________________________________________________________________
# list of engines
......@@ -44,9 +44,9 @@ O.engines=[
#__________________________________________________________________
# define contact damping coefficients
contactLaw.betan=0.5 # normal direction
contactLaw.betas=0.0 # shear direction
contactLaw.useDamping=True
damping.betan=0.5 # normal direction
damping.betas=0.0 # shear direction
damping.useDamping=True
#__________________________________________________________________
# time step
......@@ -78,10 +78,10 @@ def myAddPlotData():
O.run(1000,True)
# Now test the shear direction, having previously obtained a constant normal overlapping
contactLaw.betas=0.5
damping.betas=0.5
force.force=(-20,5,0) # assign a force also in the shear direction
O.run(1000,True)
plot.plot()
plot.plot(subPlots=False)
# NOTE about the results:
# In the graphs, you will see the behaviour both of the normal and shear force. As expected from the damped solution, their values oscillate around the equilibrium position, which is eventually reached after few iterations.
......
......@@ -19,8 +19,8 @@ O.engines=[
]
from yade import utils
scale=.1
O.bodies.append(utils.facet([[scale,0,0],[-scale,-scale,0],[-scale,scale,0]],dynamic=False,color=[1,0,0]))
O.bodies.append(utils.sphere([0,0,.99*scale],1*scale,color=[0,1,0],wire=True,dynamic=False))
O.bodies.append(utils.facet([[scale,0,0],[-scale,-scale,0],[-scale,scale,0]],fixed=True,color=[1,0,0]))
O.bodies.append(utils.sphere([0,0,.99*scale],1*scale,color=[0,1,0],wire=True,fixed=True))
O.dt=.4*utils.PWaveTimeStep()
from yade import qt
......
......@@ -10,13 +10,12 @@ O.engines=[
]),
IPhysDispatcher([Ip2_FrictMat_FrictMat_FrictPhys()]),
ElasticContactLaw(),
GravityEngine(gravity=(0,0,-9.81)),
RotationEngine(subscribedBodies=[1],rotationAxis=(1,0,0),angularVelocity=.01),
RotationEngine(subscribedBodies=[0],rotationAxis=(1,1,1),angularVelocity=-.02),
NewtonIntegrator(damping=.2)
RotationEngine(ids=[1],rotationAxis=(1,0,0),angularVelocity=.01),
RotationEngine(ids=[0],rotationAxis=(1,1,1),angularVelocity=-.02),
NewtonIntegrator(damping=.2,gravity=(0,0,-9.81))
]
from yade import utils
O.bodies.append(utils.sphere([0,0,0],1,dynamic=False,color=[1,0,0],wire=True))
O.bodies.append(utils.sphere([0,0,0],1,fixed=True,color=[1,0,0],wire=True))
O.bodies.append(utils.sphere([0,sqrt(2),sqrt(2)],1,color=[0,1,0],wire=True))
O.dt=.01*utils.PWaveTimeStep()
......
-9.81 2400 10 18.6013
......@@ -17,12 +17,11 @@ O.engines=[
[Ip2_FrictMat_FrictMat_FrictPhys(),],
[Law2_ScGeom_FrictPhys_CundallStrack(),]
),
GravityEngine(gravity=(0,0,gravity)), ## here we use the 'gravity' parameter
PyRunner(iterPeriod=100,command='myAddPlotData()',label='plotDataCollector'),
NewtonIntegrator(damping=0.4)
NewtonIntegrator(damping=0.4,gravity=(0,0,gravity))## here we use the 'gravity' parameter
]
O.bodies.append([
utils.box([0,50,0],extents=[1,50,1],dynamic=False,color=[1,0,0]),
utils.box([0,50,0],extents=[1,50,1],fixed=True,color=[1,0,0]),
utils.sphere([0,0,10],1,color=[0,1,0])
])
......@@ -41,5 +40,6 @@ O.run(20000,True)
# write some results to a common file
# (we rely on the fact that 2 processes will not write results at exactly the same time)
# 'a' means to open for appending
file('multi.out','a').write('%s %g %g %g %g\n'%(O.tags['description'],gravity,density,initialSpeed,O.bodies[1].state.pos[1]))
#file('multi.out','a').write('%s %g %g %g %g\n'%(O.tags['description'],gravity,density,initialSpeed,O.bodies[1].state.pos[1]))
file('multi.out','a').write('%g %g %g %g\n'%(gravity,density,initialSpeed,O.bodies[1].state.pos[1]))
print 'gnuplot',plot.saveGnuplot(O.tags['id'])
......@@ -7,20 +7,24 @@ Young = 7e6
Poisson = 0.2
Density=2700
# Append a material
mat=O.materials.append(FrictMat(young=Young,poisson=Poisson,density=Density,frictionAngle=26))
O.bodies.append([
utils.sphere([0,0,0.6],0.25,young=Young,poisson=Poisson,density=Density),
utils.facet([[-0.707,-0.707,0.1],[0,1.414,0],[1.414,0,0]],dynamic=False,color=[1,0,0],young=Young,poisson=Poisson),
utils.facet([[0,1.414,0],[1.414,0,0],[0.707,0.707,-2.0]],dynamic=False,color=[1,0,0],young=Young,poisson=Poisson)])
utils.sphere([0,0,0.6],0.25,material=mat),
utils.facet([[-0.707,-0.707,0.1],[0,1.414,0],[1.414,0,0]],dynamic=False,color=[1,0,0],material=mat),
utils.facet([[0,1.414,0],[1.414,0,0],[0.707,0.707,-2.0]],dynamic=False,color=[1,0,0],material=mat)])
## Engines
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
IGeomDispatcher([Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()]),
IPhysDispatcher([MacroMicroElasticRelationships()]),
ElasticContactLaw(),
GravityEngine(gravity=(0,0,-10)),
NewtonIntegrator(damping=.3)
InteractionLoop(
[Ig2_Facet_Sphere_Dem3DofGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
),
NewtonIntegrator(damping=.3,gravity=(0,0,-10))
]
## Timestep
......@@ -30,8 +34,8 @@ O.saveTmp()
try:
from yade import qt
renderer=qt.Renderer()
renderer['Body_wire']=True
renderer['Interaction_physics']=True
renderer.wire=True
renderer.intrPhys=True
qt.Controller()
except ImportError: pass
......@@ -17,57 +17,65 @@
sign=-1
#
## PhysicalParameters
Young = 7e6
Poisson = 0.2
Density=2700
# Append a material
mat=O.materials.append(FrictMat(young=Young,poisson=Poisson,density=Density,frictionAngle=26))
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(
[ef2_Facet_Sphere_Dem3DofGeom()],
[Ig2_Facet_Sphere_Dem3DofGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_Dem3DofGeom_FrictPhys_Basic()],
[Law2_Dem3DofGeom_FrictPhys_CundallStrack()],
),
GravityEngine(gravity=(0,0,-10),label='gravitator'),
NewtonIntegrator(damping=.3),
NewtonIntegrator(damping=.3,gravity=(0,0,-10),label='integrator'),
PyRunner(iterPeriod=4000,command='setGravity()'),
]
O.bodies.append([
utils.facet([[-1,-1,0],[1,-1,0],[0,1,0]],dynamic=False,color=[1,0,0],young=1e3),
utils.sphere([0,0,sign*.49999],radius=.5,young=1e3,wire=True,density=1),
utils.facet([[-1,-1,0],[1,-1,0],[0,1,0]],fixed=True,color=[1,0,0],material=mat),
utils.sphere([0,0,sign*.49999],radius=.5,wire=True,material=mat),
])
O.timingEnabled=True
O.saveTmp()
O.dt=1e-4
print '** virgin dispatch matrix:'
O.engines[3].lawDispatcher.dump()
O.engines[2].lawDispatcher.dispMatrix()
print '** class indices'
for c in 'Dem3DofGeom','Dem3DofGeom_FacetSphere','Dem3DofGeom_SphereSphere':
print eval(c)().classIndex,c
#for c in 'Dem3DofGeom','Dem3DofGeom_FacetSphere','Dem3DofGeom_SphereSphere':
# print eval(c)().classIndex,c
O.run(1000,True)
print '** used dispatch matrix'
O.engines[3].lawDispatcher.dump()
O.engines[2].lawDispatcher.dispMatrix()
def setGravity():
gz=gravitator["gravity"][2]
gravitator["gravity"]=[0,0,1.05*gz]
gz=integrator.gravity[2]
integrator.gravity=[0,0,1.05*gz]
if abs(gz)>=2500:
print "Gravity reset & slow down"
O.dt=1e-6;
gravitator["gravity"]=[0,0,0]
integrator.gravity=[0,0,0]
if abs(gz)>0: print gz
try:
from yade import qt
renderer=qt.Renderer()
renderer['Interaction_geometry']=True
renderer.intrGeom=True
qt.Controller()
except ImportError: pass
if 0:
from yade import timing
O.run(100000,True)
timing.stats()
timing.reset()
O.loadTmp()
O.run(100000,True)
timing.stats()
from yade import timing
O.run(100000,True)
timing.stats()
timing.reset()
O.loadTmp()
O.run(100000,True)
timing.stats()
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment