what happened in the first O.step()

Asked by zhou qian on 2019-04-12

Hi:
I defined a periotric cell and found that in the first step, the trsf didn't change.
Here are the codes,
import libyade

from libyade import*
from libyade import utils, pack, Matrix3, Vector3, Vector3
import datetime

def randomPeriPack(radius,initSize,seed):
 O.switchScene(); O.resetThisScene()
 sp=pack.SpherePack()
 O.periodic=True
 O.cell.setBox(initSize)
 sp.makeCloud(Vector3().Zero,O.cell.refSize,radius,0.,-1,True,seed=seed)
 O.engines=[
  ForceResetter(),
  InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=.05*radius),
  InteractionLoop(
   [Ig2_Sphere_Sphere_ScGeom()],
   [Ip2_FrictMat_FrictMat_FrictPhys()],
   [Law2_ScGeom_FrictPhys_CundallStrack()]),
  PeriIsoCompressor(charLen=2*radius,stresses=[-100e9,-1e8],maxUnbalanced=1e-2,doneHook='O.pause();',globalUpdateInt=20,keepProportions=True),
  NewtonIntegrator(damping=.8)
 ]
 O.materials.append(FrictMat(young=30e9,frictionAngle=.1,poisson=.3,density=1e3))
 for s in sp: O.bodies.append(utils.sphere(s[0],s[1]))
 O.dt=utils.PWaveTimeStep()
 O.timingEnabled=True
 O.run(); O.wait()
 for b in O.bodies: b.state.pos = O.cell.wrap(b.state.pos)
 ret=pack.SpherePack()
 ret.fromSimulation()
 O.switchScene()
 return ret

O.materials.append(FrictMat(young=5e8,frictionAngle=.6,poisson=.3,density=1e7))
sp = randomPeriPack(.01,.1*Vector3.Ones,10)
sp.toSimulation()
O.engines = [
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.5,label='is2aabb')],allowBiggerThanPeriod=True),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.5,label='ss2d3dg')],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]),
 NewtonIntegrator(damping=.2),
]
O.dt = 0.0002
#O.step()
is2aabb.aabbEnlargeFactor = 1.
ss2d3dg.interactionDetectionFactor = 1.

dstrain = Matrix3(0,0,0,0,0,0,0,0,-0.002)
trsf1 = O.cell.trsf
I = Matrix3.Identity
trsf2 = dstrain + I
print(trsf2)

O.cell.velGrad = dstrain/100/O.dt

O.step()
print(O.cell.trsf)
O.step()
print(O.cell.trsf)

I think the second output should be (1,0,0,0,1,0,0,0,0.99998),
but the second output is (1,0,0,0,1,0,0,0,0.99998) and the trsf starts to change in the next O.step()
1.What happend in the first O.step()?
2.If I use O.run(5), it only run 4 steps?

Yours,
Joe

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Chareyre
Solved:
2019-04-13
Last query:
2019-04-13
Last reply:
2019-04-12
Best Chareyre (bruno-chareyre-9) said : #1

Indeed. In order to avoid very complex corner cases (since every engine can
change it and depends on it) I decided that the assigned velocity gradient
would be taken into account only at the next step.
You can maybe force it with prevVelGrad.
Bruno

Le ven. 12 avr. 2019 19:22, zhou qian <email address hidden>
a écrit :

> New question #680215 on Yade:
> https://answers.launchpad.net/yade/+question/680215
>
> Hi:
> I defined a periotric cell and found that in the first step, the trsf
> didn't change.
> Here are the codes,
> import libyade
>
> from libyade import*
> from libyade import utils, pack, Matrix3, Vector3, Vector3
> import datetime
>
> def randomPeriPack(radius,initSize,seed):
> O.switchScene(); O.resetThisScene()
> sp=pack.SpherePack()
> O.periodic=True
> O.cell.setBox(initSize)
>
> sp.makeCloud(Vector3().Zero,O.cell.refSize,radius,0.,-1,True,seed=seed)
> O.engines=[
> ForceResetter(),
>
> InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=.05*radius),
> InteractionLoop(
> [Ig2_Sphere_Sphere_ScGeom()],
> [Ip2_FrictMat_FrictMat_FrictPhys()],
> [Law2_ScGeom_FrictPhys_CundallStrack()]),
>
> PeriIsoCompressor(charLen=2*radius,stresses=[-100e9,-1e8],maxUnbalanced=1e-2,doneHook='O.pause();',globalUpdateInt=20,keepProportions=True),
> NewtonIntegrator(damping=.8)
> ]
>
> O.materials.append(FrictMat(young=30e9,frictionAngle=.1,poisson=.3,density=1e3))
> for s in sp: O.bodies.append(utils.sphere(s[0],s[1]))
> O.dt=utils.PWaveTimeStep()
> O.timingEnabled=True
> O.run(); O.wait()
> for b in O.bodies: b.state.pos = O.cell.wrap(b.state.pos)
> ret=pack.SpherePack()
> ret.fromSimulation()
> O.switchScene()
> return ret
>
>
> O.materials.append(FrictMat(young=5e8,frictionAngle=.6,poisson=.3,density=1e7))
> sp = randomPeriPack(.01,.1*Vector3.Ones,10)
> sp.toSimulation()
> O.engines = [
> ForceResetter(),
>
> InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.5,label='is2aabb')],allowBiggerThanPeriod=True),
> InteractionLoop(
>
> [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.5,label='ss2d3dg')],
> [Ip2_FrictMat_FrictMat_FrictPhys()],
> [Law2_ScGeom_FrictPhys_CundallStrack()]),
> NewtonIntegrator(damping=.2),
> ]
> O.dt = 0.0002
> #O.step()
> is2aabb.aabbEnlargeFactor = 1.
> ss2d3dg.interactionDetectionFactor = 1.
>
> dstrain = Matrix3(0,0,0,0,0,0,0,0,-0.002)
> trsf1 = O.cell.trsf
> I = Matrix3.Identity
> trsf2 = dstrain + I
> print(trsf2)
>
> O.cell.velGrad = dstrain/100/O.dt
>
> O.step()
> print(O.cell.trsf)
> O.step()
> print(O.cell.trsf)
>
> I think the second output should be (1,0,0,0,1,0,0,0,0.99998),
> but the second output is (1,0,0,0,1,0,0,0,0.99998) and the trsf starts to
> change in the next O.step()
> 1.What happend in the first O.step()?
> 2.If I use O.run(5), it only run 4 steps?
>
> Yours,
> Joe
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>
>
>

zhou qian (zhoug15) said : #2

Thanks Chareyre, that solved my question.