Re: [Yade-users] [Question #677994]: save the height sphere in file

2019-02-08 Thread Launchpad Janitor
Question #677994 on Yade changed:
https://answers.launchpad.net/yade/+question/677994

Status: Open => Expired

Launchpad Janitor expired the question:
This question was expired because it remained in the 'Open' state
without activity for the last 15 days.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #677994]: save the height sphere in file

2019-01-23 Thread sebbah
Question #677994 on Yade changed:
https://answers.launchpad.net/yade/+question/677994

Status: Answered => Open

sebbah is still having a problem:
thank you Jan , I really appreciate for answer me .
you are right , saving height in each time step is not a good idea .

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #677994]: save the height sphere in file

2019-01-23 Thread Robert Caulk
Question #677994 on Yade changed:
https://answers.launchpad.net/yade/+question/677994

Robert Caulk posted a new comment:
Also helpful for Yade newcomers [1]

[1]https://yade-dem.org/doc/tutorial.html

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #677994]: save the height sphere in file

2019-01-22 Thread Jan Stránský
Question #677994 on Yade changed:
https://answers.launchpad.net/yade/+question/677994

Status: Open => Answered

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

1)
> Any ideas why it doesn't work?

Your script has errors.
I have tried your code with
NameError: name 't' is not defined
Yade/Python console usually tells you where in the script the problem is

I also don't see any definition of 'T' and 'height'..

O.bodies.state.pos[2] would also result in error..

2)
Yade reads python script line by line and executes what is read. In your case, 
it would open the file just once

There are several approaches to achieve what you want, e.g. using plot. module 
[1]
###
O.engines = [
   ...
   PyRunner(iterPeriod=1,command="plotAddData()") # maybe also initRun=True
]

def plotAddData():
   plot.addData(
  t = O.time, # or whatever you want
  height = O.bodies[0].state.pos[2],
   )
   # plot.saveDataTxt("height.txt")
   # you can also save the file each time step, but I don't like the idea :-)
   # alternativelly you can define another PyRunner saveing data e.g. each 100 
iterations...

O.run(1000,True) # or something like that
plot.saveDataTxt("height.txt")
###

or, e.g., "manually"
###
with open("height.txt") as f: # I **personally** prefer this syntax to 
f=open(...)/f.close
   for i in range(1000):
  O.step()
  f.write("{:e} {:e}\n".format(O.time,O.bodies[0].state.pos[2]) # I 
**personally** prefer .format over % operator
###

cheers
Jan

[1] https://yade-dem.org/doc/user.html#tracking-variables

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp