[Triaxial Test] Tracking analysis process: Print iteration + stop condition

Asked by Hien Nguyen

Hi all,
-----------------------------
Info:
Ubuntu 11.10
Yade Daily latest version
-----------------------------

I'm modelling triaxial test
Allow me to ask one stupid question.
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).

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()

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?

Thanks for your help!!

Hien

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Hien Nguyen
Solved:
Last query:
Last reply:
Revision history for this message
Christian Jakob (jakob-ifgt) said :
#1

Hi,

> since this is SSH I cannot see at what iteration the calculation is currently at

You can try to login with "ssh -X" (since the server provides graphical stuff)

Hope it helps,

Christian.

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

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

Revision history for this message
Klaus Thoeni (klaus.thoeni) said :
#3

Hi Hien,

when running scripts on a server I usually use yade's batch mode even if I am just running a script with fixed parameters. Instead of calling yade I call yade-batch. You might have to slightly adapt your script so that you can run it in batch mode (don't use qt module), i.e.

O.bodies.append(box(center=[0,0,0],extents=[.5,.5,.5],color=[0,0,1],fixed=True))
O.bodies.append(sphere([0,0,2],1,color=[0,1,0]))
typedEngine("NewtonIntegrator").gravity=(0,0,-9.81)
typedEngine("NewtonIntegrator").damping=0.1
O.run(2000000,True)
O.wait()
print 'some printout!'

Then I run: nohup yade-batch script.py > script.log &

With nuhup you can even log out and the simulation will still run. If you look at your log file script.log (yade-batch will also create an other one) you can find something like this: http://localhost:9080 shows batch summary

You can use the command line browser lynx to show the summary which shows you at which iteration your simulation is, just type: lynx localhost:9080

HTH
Klaus

Revision history for this message
Hien Nguyen (giahien) said :
#4

Wow, awesome advices I got here, thank you very much.

Christian Jakob, that does the trick, and if I remote from window via PuttY and Xming, just turn on the X11 option, thanks for your hint about the "X factor" :)
Jan Stránský: I prefer the O.run(50); O.wait(), I tried it and it worked as I wished, and thank for the explanation about the while loop.
Klaus Thoeni: much thanks, it looks useful, I'll definitely use it, I concerned a little: with yade-daily, it will be yade-daily-batch, right? Anyway I'll try to figure it out. Bookmarked your suggestion.

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

Just to complete the variety of possible solutions (if in the future
somebody find it useful), see [1,2]
cheers
Jan

[1] https://answers.launchpad.net/yade/+question/224356
[2] https://yade-dem.org/doc/user.html#python-prompt

2013/3/14 Nguyen Hien <email address hidden>

> Question #224169 on Yade changed:
> https://answers.launchpad.net/yade/+question/224169
>
> Status: Answered => Solved
>
> Nguyen Hien confirmed that the question is solved:
> Wow, awesome advices I got here, thank you very much.
>
> Christian Jakob, that does the trick, and if I remote from window via
> PuttY and Xming, just turn on the X11 option, thanks for your hint about
> the "X factor" :)
> Jan Stránský: I prefer the O.run(50); O.wait(), I tried it and it worked
> as I wished, and thank for the explanation about the while loop.
> Klaus Thoeni: much thanks, it looks useful, I'll definitely use it, I
> concerned a little: with yade-daily, it will be yade-daily-batch, right?
> Anyway I'll try to figure it out. Bookmarked your suggestion.
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>