About plotting the histogram for distribution of interaction directions

Asked by hjz

Dear all,
       I am conducting periodic-triaxial tests with YADE and intending to plot the rose histograms for distribution of interaction directions during the triaxial compression test. I know the utils.plotDirecitons will do the work. But it only displays figures of distribution of interaction directions. Now, I want to get the specific interaction direction data which may be saved in a text file. And then I could plot the histograms using the output data by myself. But I don't know how to export the interaction direction data. Could you have any advice to me how to get the data and plot the rose histograms.
Regards,
hjz

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Best Jan Stránský (honzik) said :
#1

Hello,

> Could you have any advice to me how to get the data

something like this?
###
with open(outFile,'w') as f:
   for i in O.interactions:
      n = i.geom.normal
      pd = i.geom.penetrationDepth
      fn = i.phys.normalForce.norm()
      f.write('{} {} {} {} {}\n'.format(nx,ny,nz,pf,fn))
###

for plotting, gnuplot with polar plotting can be used [1]. For more info, please provide more information about what you want to achive and what "specific interaction direction data", ideally with a MWE of a complete simulation up to just before to be saved and postprocessed.

cheers
Jan

[1] http://www.gnuplot.info/demo/polar.html

Revision history for this message
hjz (1341132388-4) said :
#2

Jan,
      Thanks for your help very much. That little code solved my problem.
       Besides that question, I also want to know whether we can convert the vtk files, which save the interaction information of the whole system, into text files. So the interaction information saved in the vtk file could be used to plot some figures with other software, such as gnuplot.

Sincerely
hjz

Revision history for this message
hjz (1341132388-4) said :
#3

Thanks Jan Stránský, that solved my question.

Revision history for this message
Chareyre (bruno-chareyre-9) said :
#4

Hi, you could simply write i.geom.normal into the text file for all
interactions. It should be enough for all kinds of statistical analysis.
Bruno

Le 10 juil. 2017 7:45 AM, "hjz" <email address hidden> a
écrit :

New question #647299 on Yade:
https://answers.launchpad.net/yade/+question/647299

Dear all,
       I am conducting periodic-triaxial tests with YADE and intending to
plot the rose histograms for distribution of interaction directions during
the triaxial compression test. I know the utils.plotDirecitons will do the
work. But it only displays figures of distribution of interaction
directions. Now, I want to get the specific interaction direction data
which may be saved in a text file. And then I could plot the histograms
using the output data by myself. But I don't know how to export the
interaction direction data. Could you have any advice to me how to get the
data and plot the rose histograms.
Regards,
hjz

--
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 : <email address hidden>
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp

Revision history for this message
Chareyre (bruno-chareyre-9) said :
#5

I did not see the previous answers, sorry.
B

Le 13 juil. 2017 3:55 PM, Bruno Chareyre <bruno.chareyre@3sr-grenoble.fr> a
écrit :

> New question #647299 on Yade:
> https://answers.launchpad.net/yade/+question/647299
>
> Dear all,
> I am conducting periodic-triaxial tests with YADE and intending to
> plot the rose histograms for distribution of interaction directions during
> the triaxial compression test. I know the utils.plotDirecitons will do the
> work. But it only displays figures of distribution of interaction
> directions. Now, I want to get the specific interaction direction data
> which may be saved in a text file. And then I could plot the histograms
> using the output data by myself. But I don't know how to export the
> interaction direction data. Could you have any advice to me how to get the
> data and plot the rose histograms.
> Regards,
> hjz
>
> --
> 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 : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>
>

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

> I also want to know whether we can convert the vtk files, which save the interaction information of the whole system, into text files.

vtk files are text files themselves ;-) but yes, it is possible to convert them to a different format. vtk has its own but well defined structure, see [1].
cheers
Jan

[1] http://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf