← Back to team overview

yade-users team mailing list archive

Re: [Question #246936]: using snapshot engine at certain stresses not at iterperiods

 

Question #246936 on Yade changed:
https://answers.launchpad.net/yade/+question/246936

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Sina,

you can use an approach similar to that proposed in [1]:
- add PyRunner to your O.engines with low iterperiod and with a function
checking a condition, something like:

O.engines = [
  ...
  SnapshotEngine(...,iterPeriod=0,label='snapshoter'), # labeled snapshot
engine. With iterPeriod=0 it is not call from O.engines, but rather from
checker.check() function. You can also define it outside O.engines
  PyRunner(iterPeriod=50,command="checker.check()"),
]

class StressChecker: # hepler class, there are other ways how to do what
you want
  dStress = nextStress = 200e3
  def check(self):
    stress = whatever # e.g. triaxEngine.stress[0] or something like that,
depending on your problem
    if abs(stress) > self.nextStress: # the stress is high enough for
another snapshot
      self.nextStress += self.dStress # set next stress limit
      snapshoter() # by calling an engine it does its action
checker = StressChecker()

if something is not clear or does not work, let me know :-)
cheers
Jan

[1] https://answers.launchpad.net/yade/+question/240225



2014-04-13 13:11 GMT+02:00 Sina Jafari <question246936@xxxxxxxxxxxxxxxxxxxxx
>:

> New question #246936 on Yade:
> https://answers.launchpad.net/yade/+question/246936
>
> Hi all,
> How can I use snapshot engine at certain stresses? I want to save an image
> of interaction network every 200 kPa? would be thankful if you help me with
> that.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.