Error in making Video from simulation

Asked by ehsan benabbas

Hi everybody,

I am using Ubuntu 18.04, and Yade 2019-08-08.git-775ae74

I coded a simple triaxial problem and want to make a video from its 3d view. But I get the following as the output and no video file. When I click on the "play" button, just and error shows up

***************************
output:

ehsan@ehsan:~/Desktop/mycodes/video$ /home/ehsan/yade/install/bin/yade-2019-08-08.git-775ae74 video.py
Welcome to Yade 2019-08-08.git-775ae74
Using python version: 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0]
TCP python prompt on localhost:9000, auth cookie `aedusk'
XMLRPC info provider on http://localhost:21000
Running script video.py
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, Real, Real, int, bool, Real, const std::vector<double>&, const std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 662 spheres were added, although you requested 2000. Trying again with porosity 0.46. The size distribution is being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, Real, Real, int, bool, Real, const std::vector<double>&, const std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 746 spheres were added, although you requested 2000. Trying again with porosity 0.514. The size distribution is being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, Real, Real, int, bool, Real, const std::vector<double>&, const std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 915 spheres were added, although you requested 2000. Trying again with porosity 0.5626. The size distribution is being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, Real, Real, int, bool, Real, const std::vector<double>&, const std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 1086 spheres were added, although you requested 2000. Trying again with porosity 0.60634. The size distribution is being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, Real, Real, int, bool, Real, const std::vector<double>&, const std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 1305 spheres were added, although you requested 2000. Trying again with porosity 0.645706. The size distribution is being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, Real, Real, int, bool, Real, const std::vector<double>&, const std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert non-overlapping sphere to packing. Only 1581 spheres were added, although you requested 2000. Trying again with porosity 0.681135. The size distribution is being scaled down
The constructor with a shareWidget is deprecated, use the regular contructor instead.
/home/ehsan/yade/install/lib/x86_64-linux-gnu/yade-2019-08-08.git-775ae74/py/yade/plot.py:444: MatplotlibDeprecationWarning:
The 'verts' kwarg was deprecated in Matplotlib 3.0 and will be removed in 3.2. Use 'marker' instead.
  scatter=pylab.scatter(scatterPt[0] if not math.isnan(scatterPt[0]) else 0,scatterPt[1] if not math.isnan(scatterPt[1]) else 0,s=scatterSize,color=line.get_color(),**scatterMarkerKw)
<FATAL ERROR> ThreadRunner:30 void ThreadRunner::run(): Exception occured:
InsertionSortCollider.verletDist>0, but unable to locate NewtonIntegrator within O.engines.
<ERROR> yadeWrapper.cpp:655 void pyOmega::wait(): Simulation error encountered.
Traceback (most recent call last):
  File "/home/ehsan/yade/install/bin/yade-2019-08-08.git-775ae74", line 336, in runScript
    execfile(script,globals())
  File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 82, in execfile
    exec_(code, myglobals, mylocals)
  File "video.py", line 98, in <module>
    O.run(5000,True)
RuntimeError: std::exception
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 3D view for help), F10 both, F9 generator, F8 plot. ]]

In [1]: <FATAL ERROR> ThreadRunner:30 void ThreadRunner::run(): Exception occured:
InsertionSortCollider.verletDist>0, but unable to locate NewtonIntegrator within O.engines.

*************************

My code is:

import numpy as np
import math
from yade import pack, plot, qt, export, utils
from datetime import datetime

sp=pack.SpherePack()
mn, mx=Vector3(0,0,0), Vector3(10,10,10)
sp.makeCloud(minCorner=mn,maxCorner=mx,rRelFuzz=0.2,num=2000,porosity=0.4)

O.materials.append(FrictMat(young=15e6,poisson=0.4,frictionAngle=radians(30),density=2600,label='spheres'))
O.materials.append(FrictMat(young=15e6,poisson=0.4,frictionAngle=0,density=0,label='frictionless'))

O.bodies.append([sphere(center,rad,material='spheres') for center, rad in sp])

walls=aabbWalls(thickness=1e-10,material='frictionless')
wallIds=O.bodies.append(walls)

triax=TriaxialCompressionEngine(
 wall_bottom_id=wallIds[2],
 wall_top_id=wallIds[3],
 wall_left_id=wallIds[0],
 wall_right_id=wallIds[1],
 wall_back_id=wallIds[4],
 wall_front_id=wallIds[5],
 internalCompaction=False,
 sigmaIsoCompaction=-50e3,
 sigmaLateralConfinement=-50e3,
 max_vel=10,
 strainRate=0.01,
 label="triax",
)

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
 InteractionLoop(
 [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
 [Ip2_FrictMat_FrictMat_FrictPhys()],
 [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
 triax,
 NewtonIntegrator(damping=0.4)
]

O.engines=O.engines[0:5]+[PyRunner(iterPeriod=20,command='history()',label='recorder')]+O.engines[5:7]
#O.engines=O.engines[0:5]+[PyRunner(command='checkUnbalanced()',realPeriod=2)]+O.engines[5:7]
O.engines=O.engines[0:5]+[VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000)]+O.engines[5:7]
O.engines=O.engines[0:5]+[qt.SnapshotEngine(fileBase='3d-',iterPeriod=200,label='snapshot')]+O.engines[5:7]
O.engines=O.engines[0:5]+[PyRunner(command='finish()',iterPeriod=20000)]+O.engines[5:7]

O.dt=.5*PWaveTimeStep()

qt.View()

def finish():
 makeVideo(snapshot.snapshots,'3d.mpeg',fps=10,bps=10000)
 O.pause()

#rr=yade.qt.Renderer()
#rr.shape=False
#rr.intrPhys=True

def history():
 plot.addData(unbalanced=unbalancedForce(),i=O.iter,**O.energy,
  e11=-triax.strain[0], e22=-triax.strain[1], e33=-triax.strain[2],
  s11=-triax.stress(0)[0], s22=-triax.stress(2)[1], s33=-triax.stress(4)[2],
  Etot=O.energy.total())

#O.trackEnergy=True

def checkUnbalanced():
 if unbalancedForce()<.05:
  O.pause()
  plot.saveDataTxt('bbb.txt.bz2')

for i in O.interactions:
   id1,id2 = i.id1,i.id2
   fn = i.phys.normalForce
   fs = i.phys.shearForce

#plot.plots={'i':('unbalanced'),'i':('s11','s22','s33'),'i':('e11','e22','e33'),'i':(O.energy.keys,None,'Etot')}
plot.plots={'i':('unbalanced'),'i ':('s11','s22','s33'),' i':('e11','e22','e33'),'e22':('s22')}
plot.labels={'unbalanced':'$F_{UB}$' , 's11':'$\sigma_{11}$' , 's22':'$\sigma_{22}$' , 's33':'$\sigma_{33}$' , 'e11':'$\epsilon_{11}$' , 'e22':'$\epsilon_{22}$' , 'e33':'$\epsilon_{33}$'}
#plot.saveGnuplot()

Gl1_Sphere.stripes=True

plot.plot()

O.saveTmp()

O.run(5000,True)
plot.saveDataTxt('results')

#print 'stress difference:', (triax.stress[2]-triax.stress[1])
#print 'mean stress:',(triax.stress[2]+triax.stress[1]+triax.stress[0])/3
#print 'porosity:', porosity()

***********************************

Thank you very much for your help.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
ehsan benabbas
Solved:
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :
#1

How does this error/question differ from [1]?

[1]https://answers.launchpad.net/yade/+question/685279

Revision history for this message
ehsan benabbas (ehsanben) said :
#2

This is the same code with that question but a different question. I posted separately as these are different topics.

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

Hi,

> unable to locate NewtonIntegrator within O.engines.

some error messages might be a bit cryptic, but this one is clear - you do not have NewtonIntegrator in O.engines.

you have O.engines = [...] and just after you do some slicing (which in the end deletes NewtonIntegrator, probably not what you wanted).
Normally such slicing done when you need to modify O.engines during the simulation.
In this case, just put all engines directly in O.engines creation:
###
O.engines = [
   ForceResetter(...),
   ...
   triax,
   NewtonIntegrator(...),
   PyRunner(...),
   PyRunner(...),
   qt.SnapshotEngine(...),
   PyRunner(...),
]
###

cheers
Jan

Revision history for this message
ehsan benabbas (ehsanben) said :
#4

Thank you Jan, that sholved my problem