O.load

Asked by jamespaul

Hi,

I use 'Periodic triaxial test' from document.I add O.O.save('a.yade.bz2');O.saveTmp() at the end.And in another script.I want to use O.load to start another compression,but the particles shown are the initial, uncompressed cloud.Look forward for your answer.

James

The first script:

# encoding: utf-8

sigmaIso=-1e5

from yade import pack, qt, plot

O.periodic=True
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(2,2,2),rMean=.1,rRelFuzz=.3,periodic=True)
sp.toSimulation()

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),
 PeriTriaxController(label='triax',
  goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7,
  dynCell=True,maxStrainRate=(10,10,10),
  maxUnbalanced=.1,relStressTol=1e-3,
  doneHook='triaxFinished()'
 ),
 NewtonIntegrator(damping=.2),
 PyRunner(command='addPlotData()',iterPeriod=100),
]
O.dt=.5*PWaveTimeStep()

def triaxFinished():
 print 'Finished'
 O.pause()

O.save('a.yade.bz2')
O.saveTmp()

###########################
My second script:

# encoding: utf-8
from yade import pack, qt, plot

O.load('a.yade.bz2')

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
Jan Stránský (honzik) said :
#1

> but the particles shown are the initial, uncompressed cloud.

well, you saved "the initial, uncompressed cloud", so this is expected behavior :-)
Add some compression before saving and Yade will save the compressed state.
cheers
Jan

Revision history for this message
jamespaul (jamespauljames) said :
#2

Thanks Jan,

>Add some compression before saving.

Sorry,i'm too stupid.How do I add it?
I finished running my program because it printed 'finished'.Is it 'compression before saving'?

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

> I finished running my program because it printed 'finished'.Is it 'compression before saving'?

No, before saving there is no compression.. Just read the script as a computer would do..

> sigmaIso=-1e5
>
> from yade import pack, qt, plot
>
> O.periodic=True
> sp=pack.SpherePack()
> sp.makeCloud((0,0,0),(2,2,2),rMean=.1,rRelFuzz=.3,periodic=True)
> sp.toSimulation()

creates "the initial, uncompressed cloud"

> O.engines=[
> ForceResetter(),
> InsertionSortCollider([Bo1_Sphere_Aabb()]),
> InteractionLoop(
> [Ig2_Sphere_Sphere_ScGeom()],
> [Ip2_FrictMat_FrictMat_FrictPhys()],
> [Law2_ScGeom_FrictPhys_CundallStrack()]
> ),
> PeriTriaxController(label='triax', goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7, dynCell=True,maxStrainRate=(10,10,10), maxUnbalanced=.1,relStressTol=1e-3, doneHook='triaxFinished()'
 ),
> NewtonIntegrator(damping=.2),
> PyRunner(command='addPlotData()',iterPeriod=100),
> ]

define O.engines

> O.dt=.5*PWaveTimeStep()

define O.dt

> def triaxFinished():
> print 'Finished'
> O.pause()

define a function

> O.save('a.yade.bz2')
> O.saveTmp()

so until now there is just creation of "the initial, uncompressed cloud" and definitions, no compression..
Yade saves the state, prior any compression, in fact prior anything, just saving "the initial, uncompressed cloud"..

Probably you want something like O.run(...) or something like that before saving..
In this case, note that just O.run() jumps to O.save directly, so it should be O.run(...,True) or O.run(); O.wait() or putting the save in PyRunner with sufficient condition, or ...........

Jan

Revision history for this message
jamespaul (jamespauljames) said :
#4

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