yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #21696
Re: [Question #688060]: Extracting micro variables from Triaxial test
Question #688060 on Yade changed:
https://answers.launchpad.net/yade/+question/688060
Status: Open => Answered
Jan Stránský proposed the following answer:
1) plot module is not suitable for this kind of savings (also the usage
in the script is wrong)
"for i in O.interactions" was there to show how to "get" the data (as
asked in another question), not meant that it works without any
modification.
To save data of all interactions, I propose creating a list of data and than save it, something like (not tested):
###
data = []
for i in O.interactions:
fn = i.phys.normalForce
fs = i.phys.shearForce
cp = i.geom.contactPoint
normal = i.geom.normal
b1,b2 = [O.bodies[id] for id in (i.id1,i.id2)]
p1,p2 = [b.state.pos for b in (b1,b2)]
branch = p2 - p1
cp,normal,branch,fn,fs = [tuple(v) for v in (cp,normal,branch,fn,fs)] # Vector3 -> tuple
d = dict(cp=cp,normal=normal,branch=branch,fn=fn,fs=fs)
# new data contains the information, you can save it e.g. as JSON
import json
with open("interactions.json","w") as f:
json.dump(data,f)
###
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.