The question about Peri3dController

Asked by liukeqi

Hi, everyone
  I want to use the engine Peri3dController to reach the goal state, but I suffered some question. I used the identical initial condition, and used two ways to reach the same goal of strain, but I got different results. The first way is that I used the stressMask=0b011100 and goal=(0,-8e-4,0,0,0,0) and nSteps = 8000 to compute once. The second way is that I used the stressMask=0b011100 and goal=(0,-4e-4,0,0,0,0) and nSteps = 4000 to compute twice by using strain=p3d.strain(imitating the example peri3dController_triaxialCompression.py ). I thought that the final goal is same, and the rate of applied strain is also same (goal/nSteps), so the final stress should be same, too, should not it? But the final stress is different! The following is my code, can you give me some suggestions? Thank you.

##################################### The initial condition
#!/usr/bin/python # This is server.py file
import string
from yade import plot,qt
from yade.pack import *
from yade import pack, plot

O.materials.append(CpmMat(young=150e9,frictionAngle=atan(0.8),poisson=.2,sigmaT=500e8,epsCrackOnset=1e-6,relDuctility=80000))

initSize=1.2

sp=pack.randomPeriPack(radius=.05,initSize=Vector3(initSize,initSize,initSize))

sp.toSimulation()

O.save('/tmp/tt.gz')

################################# The first way, using goal=-8e-4 and nSteps=8000 to compute once
#!/usr/bin/python # This is server.py file
import string
from yade import plot,qt
from yade.pack import *
from yade import pack, plot

loadFile='/tmp/tt.gz'
O.load(loadFile)

O.dt=PWaveTimeStep()/2

plot.plots={'ex':('sx',)}
def plotAddData():
 plot.addData(
  sx=p3d.stress[1],
  ex=p3d.strain[1],
 )

EnlargeFactor=1.5
EnlargeFactor=1.0
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=EnlargeFactor,label='bo1s')]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=EnlargeFactor,label='ig2ss')],
  [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
 NewtonIntegrator(),
 Peri3dController(

       nSteps=8000, # how many time steps the simulation will last
       # after reaching nSteps do doneHook action
       doneHook='print "Simulation with Peri3dController finished."; O.pause()',

       # the prescribed path (step,value of stress/strain) can be defined in absolute values

       # or in relative values

       # if the goal value is 0, the absolute stress/strain values are always considered (step values remain relative)plot.plots={'ex':('sx',)}

       # if ##Path is not explicitly defined, it is considered as linear function between (0,0) and (nSteps,goal)
       # as in yzPath and xyPath
       # the relative values are really relative (zxPath gives the same - except of the sign from goal value - result as yyPath)

       # variables used in the first step
       label='p3d'
       ),
 PyRunner(command='plotAddData()',iterPeriod=1),
]

p3d.stressMask=0b011100 # prescribed ex,ey,sz,syz,ezx,sxy; e..strain; s..stress
p3d.goal=(0,-0.008,0,0,0,0) #xx, yy, zz, yz, zx, xy
O.step()
bo1s.aabbEnlargeFactor=ig2ss.interactionDetectionFactor=1.
O.run(); O.wait()

print "p3d.stress[0]"
print p3d.stress[0]
print "p3d.stress[1]"
print p3d.stress[1]
print "p3d.stress[5]"
print p3d.stress[5]

plot.saveDataTxt('8000.txt')
plot.plot(subPlots=False)

####################################### The second way, using goal=-4e-4 and nSteps=4000 and strain=p3d.strain to compute twice
#!/usr/bin/python # This is server.py file
import string
from yade import plot,qt
from yade.pack import *
from yade import pack, plot

loadFile='/tmp/tt.gz'
O.load(loadFile)

O.dt=PWaveTimeStep()/2

plot.plots={'ex':('sx',)}
def plotAddData():
 plot.addData(
  sx=p3d.stress[1],
  ex=p3d.strain[1],
 )

EnlargeFactor=1.5
EnlargeFactor=1.0
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=EnlargeFactor,label='bo1s')]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=EnlargeFactor,label='ig2ss')],
  [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
 NewtonIntegrator(),
 Peri3dController(

       nSteps=4000, # how many time steps the simulation will last
       # after reaching nSteps do doneHook action
       doneHook='print "Simulation with Peri3dController finished."; O.pause()',

       # the prescribed path (step,value of stress/strain) can be defined in absolute values

       # or in relative values

       # if the goal value is 0, the absolute stress/strain values are always considered (step values remain relative)plot.plots={'ex':('sx',)}

       # if ##Path is not explicitly defined, it is considered as linear function between (0,0) and (nSteps,goal)
       # as in yzPath and xyPath
       # the relative values are really relative (zxPath gives the same - except of the sign from goal value - result as yyPath)

       # variables used in the first step
       label='p3d'
       ),
 PyRunner(command='plotAddData()',iterPeriod=1),
]

p3d.stressMask=0b011100 # prescribed ex,ey,sz,syz,ezx,sxy; e..strain; s..stress
p3d.goal=(0,-0.004,0,0,0,0) #xx, yy, zz, yz, zx, xy
O.step()
bo1s.aabbEnlargeFactor=ig2ss.interactionDetectionFactor=1.
O.run(); O.wait()

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.0)]),
    InteractionLoop(
     [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.0)],
     [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
    NewtonIntegrator(),
    Peri3dController(
           # Vector6 of prescribed final values (xx,yy,zz, yz,zx,xy)
          stressMask=0b011100, # prescribed ex,ey,sz,syz,ezx,sxy;
          nSteps=4000, # how many time steps the simulation will last
          # after reaching nSteps do doneHook action
          doneHook='print "Simulation with Peri3dController finished."; O.pause()',

          # the prescribed path (step,value of stress/strain) can be defined in absolute values

          # or in relative values

          # if the goal value is 0, the absolute stress/strain values are always considered (step values remain relative)

          # if ##Path is not explicitly defined, it is considered as linear function between (0,0) and (nSteps,goal)
          # as in yzPath and xyPath
          # the relative values are really relative (zxPath gives the same - except of the sign from goal value - result as yyPath)

          # variables used in the first step
          label='p3d',
          strain=p3d.strain
          ),
    PyRunner(command='plotAddData()',iterPeriod=1),

   ]

p3d.goal=(0,-0.004,0,0,0,0)
print p3d.goal
O.run();O.wait()

print "p3d.stress[0]"
print p3d.stress[0]
print "p3d.stress[1]"
print p3d.stress[1]
print "p3d.stress[5]"
print p3d.stress[5]

plot.saveDataTxt('4000.txt')
plot.plot(subPlots=False)

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

According to the doc of Peri3dController, strain goal values are here really strain (and not strain rates like in TriaxialStressController).

Hence, your two final states sound different to me in terms of strain (a discrepancy in terms of stress is thus not surprizing).

Revision history for this message
Best Jan Stránský (honzik) said :
#2

Hello,
sorry for late answer.

The stresses are pretty similar (the nonzero stresses differ 1 and 2 %).

After its creation, Peri3dController uses some rough estimations at the
beginning (to prescribe strain such that stress values are the prescribed
one), so especially if the material is not elastic any more (like after
4000 steps in your case), it behaves slightly differently than ongoing 8000
simulation, so you get slightly different final stresses.

If you prescribe all deformations (stressMask=0), you get almost the same
results in both cases (O.iter is 8000 in one and 8002 in the other example,
so the simulations are not exactly the same anyway)
If some stresses are prescibed, you get some differences

cheers
Jan

2016-07-24 9:52 GMT+02:00 liukeqi <email address hidden>:

> New question #303013 on Yade:
> https://answers.launchpad.net/yade/+question/303013
>
> Hi, everyone
> I want to use the engine Peri3dController to reach the goal state, but I
> suffered some question. I used the identical initial condition, and used
> two ways to reach the same goal of strain, but I got different results. The
> first way is that I used the stressMask=0b011100 and goal=(0,-8e-4,0,0,0,0)
> and nSteps = 8000 to compute once. The second way is that I used the
> stressMask=0b011100 and goal=(0,-4e-4,0,0,0,0) and nSteps = 4000 to compute
> twice by using strain=p3d.strain(imitating the example
> peri3dController_triaxialCompression.py ). I thought that the final goal is
> same, and the rate of applied strain is also same (goal/nSteps), so the
> final stress should be same, too, should not it? But the final stress is
> different! The following is my code, can you give me some suggestions?
> Thank you.
>
> ##################################### The initial condition
> #!/usr/bin/python # This is server.py file
> import string
> from yade import plot,qt
> from yade.pack import *
> from yade import pack, plot
>
>
> O.materials.append(CpmMat(young=150e9,frictionAngle=atan(0.8),poisson=.2,sigmaT=500e8,epsCrackOnset=1e-6,relDuctility=80000))
>
> initSize=1.2
>
>
> sp=pack.randomPeriPack(radius=.05,initSize=Vector3(initSize,initSize,initSize))
>
> sp.toSimulation()
>
> O.save('/tmp/tt.gz')
>
> ################################# The first way, using goal=-8e-4 and
> nSteps=8000 to compute once
> #!/usr/bin/python # This is server.py file
> import string
> from yade import plot,qt
> from yade.pack import *
> from yade import pack, plot
>
> loadFile='/tmp/tt.gz'
> O.load(loadFile)
>
> O.dt=PWaveTimeStep()/2
>
> plot.plots={'ex':('sx',)}
> def plotAddData():
> plot.addData(
> sx=p3d.stress[1],
> ex=p3d.strain[1],
> )
>
> EnlargeFactor=1.5
> EnlargeFactor=1.0
> O.engines=[
> ForceResetter(),
>
> InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=EnlargeFactor,label='bo1s')]),
> InteractionLoop(
>
> [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=EnlargeFactor,label='ig2ss')],
> [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
> NewtonIntegrator(),
> Peri3dController(
>
> nSteps=8000,
> # how many time steps the simulation will last
> # after reaching
> nSteps do doneHook action
> doneHook='print
> "Simulation with Peri3dController finished."; O.pause()',
>
> # the prescribed
> path (step,value of stress/strain) can be defined in absolute values
>
> # or in relative
> values
>
> # if the goal
> value is 0, the absolute stress/strain values are always considered (step
> values remain relative)plot.plots={'ex':('sx',)}
>
> # if ##Path is not
> explicitly defined, it is considered as linear function between (0,0) and
> (nSteps,goal)
> # as in yzPath and
> xyPath
> # the relative
> values are really relative (zxPath gives the same - except of the sign from
> goal value - result as yyPath)
>
>
> # variables used
> in the first step
> label='p3d'
> ),
> PyRunner(command='plotAddData()',iterPeriod=1),
> ]
>
>
>
> p3d.stressMask=0b011100 # prescribed ex,ey,sz,syz,ezx,sxy;
> e..strain; s..stress
> p3d.goal=(0,-0.008,0,0,0,0) #xx, yy, zz, yz, zx, xy
> O.step()
> bo1s.aabbEnlargeFactor=ig2ss.interactionDetectionFactor=1.
> O.run(); O.wait()
>
>
> print "p3d.stress[0]"
> print p3d.stress[0]
> print "p3d.stress[1]"
> print p3d.stress[1]
> print "p3d.stress[5]"
> print p3d.stress[5]
>
>
> plot.saveDataTxt('8000.txt')
> plot.plot(subPlots=False)
>
>
> ####################################### The second way, using goal=-4e-4
> and nSteps=4000 and strain=p3d.strain to compute twice
> #!/usr/bin/python # This is server.py file
> import string
> from yade import plot,qt
> from yade.pack import *
> from yade import pack, plot
>
>
> loadFile='/tmp/tt.gz'
> O.load(loadFile)
>
>
> O.dt=PWaveTimeStep()/2
>
> plot.plots={'ex':('sx',)}
> def plotAddData():
> plot.addData(
> sx=p3d.stress[1],
> ex=p3d.strain[1],
> )
>
> EnlargeFactor=1.5
> EnlargeFactor=1.0
> O.engines=[
> ForceResetter(),
>
> InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=EnlargeFactor,label='bo1s')]),
> InteractionLoop(
>
> [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=EnlargeFactor,label='ig2ss')],
> [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
> NewtonIntegrator(),
> Peri3dController(
>
> nSteps=4000,
> # how many time steps the simulation will last
> # after reaching
> nSteps do doneHook action
> doneHook='print
> "Simulation with Peri3dController finished."; O.pause()',
>
> # the prescribed
> path (step,value of stress/strain) can be defined in absolute values
>
> # or in relative
> values
>
> # if the goal
> value is 0, the absolute stress/strain values are always considered (step
> values remain relative)plot.plots={'ex':('sx',)}
>
> # if ##Path is not
> explicitly defined, it is considered as linear function between (0,0) and
> (nSteps,goal)
> # as in yzPath and
> xyPath
> # the relative
> values are really relative (zxPath gives the same - except of the sign from
> goal value - result as yyPath)
>
>
> # variables used
> in the first step
> label='p3d'
> ),
> PyRunner(command='plotAddData()',iterPeriod=1),
> ]
>
>
>
> p3d.stressMask=0b011100 # prescribed ex,ey,sz,syz,ezx,sxy;
> e..strain; s..stress
> p3d.goal=(0,-0.004,0,0,0,0) #xx, yy, zz, yz, zx, xy
> O.step()
> bo1s.aabbEnlargeFactor=ig2ss.interactionDetectionFactor=1.
> O.run(); O.wait()
>
>
>
> O.engines=[
> ForceResetter(),
>
> InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=1.0)]),
> InteractionLoop(
>
> [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=1.0)],
>
> [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
> NewtonIntegrator(),
> Peri3dController(
>
> # Vector6 of prescribed final values (xx,yy,zz, yz,zx,xy)
>
> stressMask=0b011100, # prescribed ex,ey,sz,syz,ezx,sxy;
>
> nSteps=4000, # how many time steps the simulation
> will last
>
> # after reaching nSteps do doneHook action
>
> doneHook='print "Simulation with Peri3dController finished.";
> O.pause()',
>
>
> # the prescribed path (step,value of stress/strain) can be defined in
> absolute values
>
>
> # or in relative values
>
>
> # if the goal value is 0, the absolute stress/strain values are
> always considered (step values remain relative)
>
>
> # if ##Path is not explicitly defined, it is considered as linear
> function between (0,0) and (nSteps,goal)
>
> # as in yzPath and xyPath
>
> # the relative values are really relative (zxPath gives the same -
> except of the sign from goal value - result as yyPath)
>
>
>
> # variables used in the first step
>
> label='p3d',
>
> strain=p3d.strain
>
> ),
>
> PyRunner(command='plotAddData()',iterPeriod=1),
>
> ]
>
> p3d.goal=(0,-0.004,0,0,0,0)
> print p3d.goal
> O.run();O.wait()
>
>
>
>
> print "p3d.stress[0]"
> print p3d.stress[0]
> print "p3d.stress[1]"
> print p3d.stress[1]
> print "p3d.stress[5]"
> print p3d.stress[5]
>
>
> plot.saveDataTxt('4000.txt')
> plot.plot(subPlots=False)
>
>
>
>
> --
> 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
>

Revision history for this message
liukeqi (891979456-h) said :
#3

Thanks Jan Stránský, that solved my question.