← Back to team overview

yade-users team mailing list archive

Re: [Question #270775]: yade -x option

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
See my first answer, using O.run(), -x option works exactly as it should =
exiting just after O.run() is called without running anything :-) to run
all the simulation and exit after it is finished, you have several options:

1)
your original script, just run it:
O.run(someVeryBigNumber,True) # will wait for O.pause() from PyRunner to
finish the script

2)
nSteps = int(finalTime/O.dt) # if you have constant O.dt and known total
simulation time 1.0e-7
O.run(nSteps,True)

3)
def stopCond():
   if O.time<1e-7: # or another condition
      return False
   else:
      # do the finishing here
      fe.close()
      fp.close()
      yade.timing.stats()
      ft.close()
      return True
while not stopCond():
   O.run(50,True) # you can choose any number instead of 50

4) like 3)
def stopCond():
   if O.time<1e-7:
      return False
   return True
while not stopCond():
   O.run(50,True)
# do the finishing here
fe.close()
fp.close()
yade.timing.stats()
ft.close()


cheers
Jan



2015-08-26 19:02 GMT+02:00 ipemath
<question270775@xxxxxxxxxxxxxxxxxxxxx>:

> Question #270775 on Yade changed:
> https://answers.launchpad.net/yade/+question/270775
>
>     Status: Answered => Open
>
> ipemath is still having a problem:
> Sorry for the ill formed question
>
> I run the simulation using O.run. Now to stop the simulation I use a
> subroutine which is called inside O.engine using PyRunner. I am adding
> the snippet of that subroutine below
>
> PyRunner(initRun=True,iterPeriod=50,command='stopCond()')
>
>
> def stopCond():
>         if(O.time>1.0e-7):
>                 fe.close()
>                 fp.close()
>                 yade.timing.stats()
>                 ft.close()
>                 O.pause()
>
> so in this case if I use yade-x option none of the data get written to
> the file and timing stats are not printed out. I actually want the
> control to come back terminal after the simulation.
>
> --
> 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.