← Back to team overview

yade-users team mailing list archive

Re: [Question #224169]: [Triaxial Test] Tracking analysis process: Print iteration + stop condition

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,


I'm running YADE via SSH connection on a server at my insitut, since this
> is SSH I cannot see at what iteration the calculation is currently at (via
> the grapĥic interface, I often track the process through this way), because
> via SHH connection the Controller Windows can not start it seems. So can
> anyone tell me what functor in YADE that allow us to call out the current
> iteration that the program is currently calculate? (I want to check via
> iPython console).
>

Do you log out during the simulation, or not? if not, you can use PyRunner
[1] for this purpose:

O.engines = [
  ...
  PyRunner(iterPeriod=50,command="print O.iter"), # change 50 to desired
frequency of prints
]

If you log out during simulation, you can write the iteration to a file
(and open this file to see at what iteration your simulation is), again
using PyRunner.


>
> Another question that concern this , how can I put a stop condition for
> the process, I want the analysis process to stop when the axial deformation
> (epsilon_2, reaches 50%). I read it in the YADE documentation (page 34, 35
> in the PDF version) but it doesn't help me much.
>
> Here is my code: http://pastebin.com/cBuyM0P4
> And here Is what I think I should do:
>
> while triax.strain[1]<0.5
>   O.run()
>

either you can use slightly modified version of the solution you proposed (
O.run() itself would run forever.. ):

while triax.strain[1] < 0.5:
  O.run(50,True) # or equivalently O.run(50); O.wait(), see [3]

or you can use solution [2] (again using PyRunner :-):
O.engines = [
  ...
  PyRunner(iterPeriod=50,command="if triax.strain[1] < 0.5: O.pause()"),
]


>
> If so, where to put it, I think I should put it at line L123? I tried it
> but when I tested at my local terminal, it seems to work but the terminal
> stucked and I could not check other data via iPython like normal. (the line
> start with Yade [1] etc... I don't know how to explain better).  I want to
> apply this condition, but I still want the iPython available to track
> whenever I want. How can I do that?
>

concerning "stucked terminal": you are still inside while loop (inside your
script) and no IPython is started until the script is finished.
( O.run() itself would cause the script to finish, as O.run() runs in c++,
but it returns to python imediatelly and continues executing python
commands. Therefore normally you would use O.run(); O.wait() pair. )

HTH
good luck
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.PyRunner
[2] https://yade-dem.org/doc/user.html#stop-conditions
[3] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Omega.run

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