How to save Data in a txt or Gnuplot file
Dear all,
I am new to YADE and still have some difficulties. I have written a very simple script. However, I would like to save my plot data into a txt-file (I only wanna save the information about the Penetration Depth (PD) and the normal Stiffness (Kn2), so I can plot them later). I tried working with a PyRunner, but somehow it's not working. Can anybody please help me with that? Below you find my working example.
Thanks a lot,
Soje
!/usr/bin/env python
# encoding: utf-8
from yade import utils, plot, qt
o = Omega()
# Physical parameters
fr = 0.5;rho=2000
tc = 0.0001;
en = 0.7; et = 0.4;
cn = 0.186; cs = 0.186
kn =1000; ks =0.849e-3
tc = 0.0001;
o.dt = 0.1*tc
Rad = 2.0e-3
# Add material
mat1 = O.materials.
mat2 = O.materials.
# Add spheres
id1 = O.bodies.
id2 = O.bodies.
bodyList = []
for b in O.bodies:
bodyList.
id3 = O.bodies.
# Import box's geometry
O.bodies.
# Add engines
o.engines = [
ForceResetter(),
InsertionSort
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
NewtonIntegra
DeformControl(),
PyRunner(
PyRunner(
PyRunner(
PyRunner(
]
#Function change Kn
def ChangeKn():
pairs = [(i.id1,i.id2) for i in O.interactions]
for i in range(0,2,1):
kn2 = O.bodies[
O.bodies[i].mat = ViscElMat(
if kn2 <= 0.3:
changeK.dead = True
O.interaction
for id1,id2 in pairs: utils.createInt
#Funtion create Clumps
def CreateClumps():
kn2 = O.bodies[0].mat.kn
if kn2 <= 0.3:
if not O.bodies[
idClump = O.bodies.
# Data History and save for Gnuplot
def ExportPara():
plot.addData(
plot.addData(kn2 = O.bodies[
plot.saveDataT
# Function to add data to plot
def addPlotData():
pos1 = (O.bodies[
PD=O.
kn2 = O.bodies[0].mat.kn
plot.
plot.plots=
plot.plot()
O.run(1)
qt.View()
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Katja for more information if necessary.