Re: [Yade-users] [Question #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Leonard confirmed that the question is solved: Thanks Jan Stránský, that solved my question. -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Answered => Solved Leonard confirmed that the question is solved: Hi, Yes, that is a good idea and I am moving to the latest version of Yade. Just because lots of project data have been obtained in the old version, I would like to try whether it is possible to make use of them. Thanks, Leonard -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Open => Answered Jan Stránský proposed the following answer: For python 2, change the "builtin" approach from ### python 3 import builtins builtins.data = data ### to ### both python 3 and python 2 __builtins__.data = data # note: no import ### Cheers Jan -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Jérôme Duriez posted a new comment: With Python 2 and Yade 2018, and considering how fast Yade is evolving, did you consider updating your system ? (sorry for the comment if that's impossible for you) -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Needs information => Open Leonard gave more information on the question: Hi Jan, It is python 2.7.17. Obtained by: In [1]: import sys; print(sys.version) 2.7.17 (default, Nov 28 2022, 18:51:39) [GCC 7.5.0] Thanks Leonard -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Open => Needs information Jan Stránský requested more information: What python version do you use? -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Answered => Open Leonard is still having a problem: Hi Jan and Karol, Thanks for your MWEs. Because I use an old version of Yade (2018.02b), consequently executing the MWE gives error: ValueError: too many values to unpack[1]. Thereby, I need to adapt the MWE to my old verison. I successfully adapted Karol's MWE: # exporter.exportSpheres(ids='all',what=dict(rotation_method_1 = 'b.state.rot()',rotation_method_2 = '(b.state.refOri.conjugate()*b.state.ori).toRotationVector() ')) ## change to exporter.exportSpheres(ids='all',what=[('rotation_method_1','b.state.rot()'),('rotation_method_2','(b.state.refOri.conjugate()*b.state.ori).toRotationVector()')]) But I didn't make it for Jan's MWE. What I tried is: from yade import export import builtins # to store "data" and access them from a string command spheres = [ sphere((0,0,0),1), sphere((3,0,0),1), sphere((6,0,0),1), ] O.bodies.append(spheres) data = [ # e.g. angle 1, 2, 3, ] builtins.data = data # make data "global", visible in export module vtk = export.VTKExporter("test-angle") # vtk.exportSpheres(what=dict(angle="data[b.id]")) ## change it to vtk.exportSpheres(ids='all',what=[('ids','b.id'),('pos','b.state.pos'),('angle','data[b.id]')]) It returns the following error: Traceback (most recent call last): File "/usr/bin/yade", line 182, in runScript execfile(script,globals()) File "Jan_MWE.py", line 22, in vtk.exportSpheres(ids='all',what=[('ids','b.id'),('pos','b.state.pos'),('angle','data[b.id]')]) File "/usr/lib/x86_64-linux-gnu/yade/py/yade/export.py", line 431, in exportSpheres test = eval(command) # ... eval one example to see what type (float, Vector3, Matrix3) the result is ... File "", line 1, in NameError: name 'data' is not defined Could you please give some instructions? Thanks Leonard [1]https://answers.launchpad.net/yade/+question/695966 -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Jan Stránský proposed the following answer: a MWE for a case where you have the computed values ### from yade import export import builtins # to store "data" and access them from a string command spheres = [ sphere((0,0,0),1), sphere((3,0,0),1), sphere((6,0,0),1), ] O.bodies.append(spheres) data = [ # e.g. angle 1, 2, 3, ] builtins.data = data # make data "global", visible in export module vtk = export.VTKExporter("test-angle") vtk.exportSpheres(what=dict(angle="data[b.id]")) ### Cheers Jan -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Open => Answered Karol Brzezinski proposed the following answer: Hi Leonard, I think that you can use 'rot()' method of body state or Jan's proposal in VTKExporter. MVE from yade import export exporter = export.VTKExporter('tmp-') s = O.bodies.append(sphere((0,0,0),1)) #set current state as reference setRefSe3() # set angular velocity O.bodies[s].state.angVel = (0,0,1) # rotate O.run(1000,wait = True) # export exporter.exportSpheres(ids='all',what=dict(rotation_method_1 = 'b.state.rot()',rotation_method_2 = '(b.state.refOri.conjugate()*b.state.ori).toRotationVector() ')) ## Cheers, Karol -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Answered => Open Leonard is still having a problem: Hi Jan, Thanks for your reply. I got the solution for each individual question. But I am not clear how to combine the two. If I understood correctly, for using VTKExporter, it is something like: vtkExporter.exportSpheres(ids='all',what=[('id',"b.id"),('ori','b.state.ori'),('radius',"b.shape.radius")]) It seems that the above code can only save the variables at one state. i.e. not some value calculated from two states, such as the relative rotation angle between state1 and state2. What I have in my mind is: storing the rotation angle (calculated by axis,angle = relOri.toAxisAngle()) into a VTK file. Something like: step1: from the sample at state1 --> output a txt file (lets name it txt1) which has b.ori for each particle. step2: from the sample at state2 --> output a txt file (txt2) which has b.ori for each particle. step3: calculating relOri = state1.ori.conjugate()*state2.ori and axis,angle = relOri.toAxisAngle() by using txt1 and txt2, then I have the angle for each particle. step4: store that angle into a VTK file which can be visualised in paraview Do you have any ideas? Thanks! Leonard -- 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 #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
Question #704551 on Yade changed: https://answers.launchpad.net/yade/+question/704551 Status: Open => Answered Jan Stránský proposed the following answer: Hello, > (1) how to calculate the relative rotation angle of a sphere between two states? see [1]: ### relOri = state1.ori.conjugate()*state2.ori axis,angle = relOri.toAxisAngle() ### Works only for "small rotations". There is a possibility, that the particle may be "rolled" and the "rolled" 2*pi rounds are not counted (orientation is equal). See [1] and links therein for possible solutions. > (2) how to write these information into VTK so that it can be visualised in paraview? use VTKExporter [2] Cheers Jan [1] https://answers.launchpad.net/yade/+question/692057 [2] https://yade-dem.org/doc/yade.export.html#yade.export.VTKExporter -- 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
[Yade-users] [Question #704551]: How to make VTK file of relative particle rotation angle from state1 to state2
New question #704551 on Yade: https://answers.launchpad.net/yade/+question/704551 Hi, I'd like to ask that is it possible to output VTK file of relative particle rotation angle from state1 to state2 by importing samples (or txt files). The motivation is: I carried out triaxial compression test and I have saved samples at many strain levels (e.g., at axial strain 1%, 2% ...). I would like to invesitgate the relative particle rotation angle between any of two states I am interested in, and visualise it in paraview. If it is possible, I would like to ask that (1) how to calculate the relative rotation angle of a sphere between two states? (2) how to write these information into VTK so that it can be visualised in paraview? Thanks Leonard -- 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