yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #14903
[Question #632448]: How to plot energy variables, breaks and contacts in a JCFpm model?
New question #632448 on Yade:
https://answers.launchpad.net/yade/+question/632448
Hi all,
I want to plot from energy variables (e.g. dissipated energy, kinetic energy and etc), kind of contacts (cohesive and frictional), and shear and tension breaks in specific period of time-steps in trunk-master/examples/jointedCohesiveFrictionalPM/gravityLoading.py example. How can I get it?
As second question, is there any way to save this variables to text files directly (without plotting)?
Any help would be appreciated.
Best regards,
Yashar
here is a part of my script that it isn't work correctly for my opinions:
O.trackEnergy=True
interactionRadius=1.1 # to set initial contacts to larger neighbours
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Facet_Aabb(),Bo1_Sphere_Aabb(aabbEnlargeFactor=interactionRadius,label='is2aabb'),]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=interactionRadius,label='ss2d3dg'),Ig2_Facet_Sphere_ScGeom()],
[Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,label='interactionPhys')],
[Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(smoothJoint=smoothContact,recordCracks=True,label='interactionLaw')]
),
GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.8),
PyRunner(iterPeriod=1000,initRun=False,command='jointStrengthDegradation()'),
VTKRecorder(iterPeriod=1000,initRun=True,fileName=(output+'-'),recorders=['spheres','velocity','intr','jcfpm','cracks','bstresses','all']),
PyRunner(iterPeriod=500,initRun=True,command='addPlotData()',label='energy'),
PyRunner(iterPeriod=500,initRun=True,command='recorder()'),
PyRunner(iterPeriod=10,initRun=True,command='dataCollector()'),
NewtonIntegrator(damping=0.7,gravity=(0.,-9.82,0.)),
]
#### dataCollector
plot.plots={'iterations':('p',)}
def dataCollector():
R=O.bodies[refPoint]
plot.addData(v=R.state.vel[1],p=R.state.pos[1]-p0,iterations=O.iter,t=O.realtime)
plot.saveDataTxt(output)
####energy (it's the global energy plotting command that I've founded it!)
def addPlotData():
# each item is given a names, by which it can be the unsed in plot.plots
# the **O.energy converts dictionary-like O.energy to plot.addData arguments
plot.addData(i=O.iter,unbalanced=unbalancedForce(),**O.energy)
plot.saveDataTxt('/home/yashar/Desktop/Untitled Folder/energy.txt')
####recorder()
tensCks=shearCks=cks=cks0=0
def recorder():
global tensCks, shearCks
tensCks=0
shearCks=0
for o in O.bodies:
if isinstance(o.shape,Sphere):
tensCks+=o.state.tensBreak
shearCks+=o.state.shearBreak
yade.plot.addData({ 't':O.time,'i':O.iter,'tc':tensCks,'sc':shearCks,'unbF':utils.unbalancedForce()})
plot.saveDataTxt('/home/yashar/Desktop/Untitled Folder/intrs.txt')
#### joint strength degradation
stableIter=2000
stableVel=0.001
degrade=True
def jointStrengthDegradation():
global degrade
if degrade and O.iter>=stableIter and abs(O.bodies[refPoint].state.vel[1])<stableVel :
print '!joint cohesion total degradation!', ' | iteration=', O.iter
degrade=False
for i in O.interactions:
if i.phys.isOnJoint :
if i.phys.isCohesive:
i.phys.isCohesive=False
i.phys.FnMax=0.
i.phys.FsMax=0.
#### YADE windows
from yade import qt
v=qt.Controller()
v=qt.View()
#### time step definition (low here to create cohesive links without big changes in the assembly)
O.dt=0.1*utils.PWaveTimeStep()
#### set cohesive links with interaction radius>=1
O.step();
O.bodies.append(facet([( 0.5, 0.15,-0.5),( 0.5,0.15, 0.5),( -0.5, 0.15, -0.5)],wire=True,material=mat))
O.bodies.append(facet([( -0.5, 0.15,-0.5),( -0.5,0.15, 0.5),( 0.5, 0.15, 0.5)],wire=True,material=mat))
O.bodies[-1].blockedDOF='xyzXYZ'
O.bodies[-2].blockedDOF='xyzXYZ'
=
ss2d3dg.interactionDetectionFactor=-1.
is2aabb.aabbEnlargeFactor=-1.
#### RUN!!!
O.dt=-0.1*utils.PWaveTimeStep()
O.run(maxIter)
--
You received this question notification because your team yade-users is
an answer contact for Yade.