Re: [Yade-users] [Question #690935]: makeVideo
Question #690935 on Yade changed: https://answers.launchpad.net/yade/+question/690935 Jan Stránský proposed the following answer: Hello, > The error is something like : please always provide as specific information as possible, not "something like", but the complete error [1]. I have tried the code, and the error says that the problem is at makeVideo function. The error message is a bit cryptic, but says something about mencoder (a linux external program). It was not installed on my system. After sudo apt install mencoder the example works as expected > It is as if the finish() function is not correctly read is is read correctly, but the error is inside the function, so it exits at makeVideo, before executing O.pause() > I'm wondering if it is possible to make snapshots and videos of a graph For sure it is possible somehow, but **personally** I would do this in the post-processing stage. One option is to use yade :-) loading the data in a cycle, in each cycle deleting the unwanted part, plot the desired data and save the figure. Having series of pictures, making movie should be trivial. (**personally** I would do also the graphics postprocessing externally in Paraview) cheers Jan [1] https://www.yade-dem.org/wiki/Howtoask -- 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 #690935]: makeVideo
Question #690935 on Yade changed: https://answers.launchpad.net/yade/+question/690935 Status: Open => Answered Bruno Chareyre proposed the following answer: Hi, > I'm wondering if it is possible to make snapshots and videos of a graph plotted with the command plot.addData Behind addData is just matplotlib, so you can just use standard 'save' functions from there. Something like plt.savefig("snapshot"+str(O.iter)+".png") Bruno -- 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 #690935]: makeVideo
New question #690935 on Yade: https://answers.launchpad.net/yade/+question/690935 Hello everyone! I'm trying to understand how the makeVideo command works. I just copied and paste the code "3d postprocessing" explained here: https://yade-dem.org/doc/tutorial-examples.html However, my code instead of stopping at iterPeriod=2 continues going on, giving error but continuing saving the snapshots and not making the video. It is as if the finish() function is not correctly read. The error is something like : OSError Traceback (most recent call last) /usr/bin/yade in () /usr/bin/yade in finish() 41 # snapshot is label of qt.SnapshotEngine 42 # the 'snapshots' attribute contains list of all saved files ---> 43 makeVideo(snapshot.snapshots,'3d.mpeg',fps=10,bps=1) 44 O.pause() 45 .(continues)... I'm executing the code inside a folder that is on the desktop. I don't know if the problem could be related to the directory. I have another issue. I'm wondering if it is possible to make snapshots and videos of a graph plotted with the command plot.addData. I'd like to have two different evolving videos, a first one from the simulation and a second one from the graph. I'm not very practical about YADE so, please, I'd glad if you give me a very understandable answer. =) Thank you! Paolo -- 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 #690928]: How to efficiently convert polyhedrons to potential blocks in batches?
New question #690928 on Yade: https://answers.launchpad.net/yade/+question/690928 Dear all, I have created many different polyhedrons of different sizes in makeCloud, how can I convert them in batch without error? In my MWS below, I found that only one polyhedron was converted, and the shape of this polyhedron was wrong. Thanks in advance. Jie Below is my script: from yade import polyhedra_utils,pack,plot,utils,export,qt import numpy as np import math import random import os #--- #Material n = PolyhedraMat(young=7.2e7,poisson=.2,density=2.5e3) powderDensity = 2500 O.materials.append(FrictMat(young=-1,poisson=-1,frictionAngle=radians(0.0),density=powderDensity,label='frictionless')) #--- #Dimensions meanSize = 0.05 wallThickness = 0.5*meanSize distanceToCentre = 0.01 lengthOfBase = 0.250 heightOfBase = 0.600 #--- #Make Cloud sp=pack.SpherePack() mn,mx=Vector3(-0.5*(lengthOfBase-wallThickness),0.5*meanSize,-0.5*(lengthOfBase-wallThickness)),Vector3(0.5*(lengthOfBase-wallThickness),0.5*heightOfBase,0.5*(lengthOfBase-wallThickness)) R=sqrt(3.0)*distanceToCentre sp.makeCloud(mn,mx,psdSizes=[distanceToCentre,2*distanceToCentre],psdCumm=(0.1,1),num=500) for center,radius in sp: b=Body() b.mask=1 color=Vector3(random.random(),random.random(),random.random()) b=polyhedra_utils.polyhedra(material=n,size=(2*radius,radius,radius),color=color) b.state.pos =center #s[0] stores center b.state.ori = Quaternion((random.random(),random.random(),random.random()),random.random()) #s[2] O.bodies.append(b) def dvalue(vecn1,pp1): dd1=1*(vecn1[0]*pp1[0]+vecn1[1]*pp1[1]+vecn1[2]*pp1[2]) return dd1 for b in O.bodies: aa=[] bb=[] cc=[] dd=[] if not isinstance(b.shape,Polyhedra): # skip non-polyhedra bodies continue vs = [b.state.ori*v for v in b.shape.v] # vertices in global coords face2=b.shape.GetSurfaces() id1=0 while id12: vec1=vs[face11[2]]-vs[face11[1]]; vec1.normalize() vec2=vs[face11[0]]-vs[face11[1]]; vec2.normalize() #Normalize this object in-place. vects=vec1.cross(vec2); vects.normalize() dvalue2=dvalue(vects,vs[face11[0]]) # Some dvalue2 values return equal to 0. Check this part of your script once more. dv=dvalue2 #dv=dvalue2-chosenR aa.append(vects[0]) bb.append(vects[1]) cc.append(vects[2]) dd.append(dv) id1=id1+1 print(dd) r=min(np.array(dd)/2) print(r) bbb=Body() bbb.aspherical=True wire=False color=[125,2,1] highlight=True bbb.shape=PotentialBlock(k=0.0, r=r, R=0.0, a=aa, b=bb, c=cc, d=np.array(dd)-r) utils._commonBodySetup(bbb, bbb.shape.volume, bbb.shape.inertia,material='frictionless', pos=bbb.shape.position, fixed=False) bbb.state.ori=bbb.shape.orientation bbb.state.pos = [0,0.5,0] O.bodies.append(bbb) from yade import qt v=qt.View() O.saveTmp() -- 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 #690925]: corrupted double-linked list
New question #690925 on Yade: https://answers.launchpad.net/yade/+question/690925 Hi all, I am running my Yade model. when the Yade model is small (8000 particles), the code works well. But when the same model has 100 particles, I get the following error: corrupted double-linked list Aborted (core dumped) Can anyone help me understand why I get this error? The model compiles well, but when the first iteration is solved, the error appears. Thank you for your help. MY CODE: #MATERIAL PROPERTIES intR = 0.20 #connectivity parameter DENS = 2500.00 #Density (kg/mm^3) YOUNG = 1800.00 #Young's modulus (N/mm^2) FRICT = 18.00 #Friction angle (degrees) ALPHA = 0.20 #Poisson's ratio TENS = 100.00 #Tensile strength (N/mm^2) COH = 1000.00 #Shear strength (N/mm^2) mn,mx=Vector3(-0.50,-0.50,-0.50),Vector3(100.50,86.525190,86.236515) # corners of the initial packing #CREATING NODES with open('Nodes.txt') as f: Nodes = [[float(x) for x in line.split()] for line in f] O.materials.append(JCFpmMat(type=1,density=DENS,young=YOUNG,poisson=ALPHA,frictionAngle=radians(FRICT),tensileStrength=TENS,cohesion=COH,label='mat1')) walls=aabbWalls([mn,mx],thickness=0,material='mat1') wallIds=O.bodies.append(walls) # PARTICLES for i in range(100): if Nodes[i][3] == 1: O.bodies.append([ sphere(center=(Nodes[i][0],Nodes[i][1],Nodes[i][2]),radius=0.50,color = (1,0,0),material='mat1'),]) else: O.bodies.append([ sphere(center=(Nodes[i][0],Nodes[i][1],Nodes[i][2]),radius=0.50,color = (0,1,0),material='mat1'),]) nbSpheres = 100.00 # PRINTING from yade import plot from pprint import pprint # SIMULATION LOOP O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intR)], [Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1)], [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM()] ), GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.5, defaultDt=utils.PWaveTimeStep()), DFNFlowEngine(dead=1,label="flow"), NewtonIntegrator(damping= 0.80), PyRunner(command='BreakingBonds()',iterPeriod=1), PyRunner(command='Writting()',iterPeriod= 500), ] #WRITTING RESULTS number = 0 def Writting(): global number number = number + 1 f= open("Info%d.txt" %(number),"w+") f.write("%5.10f \n" % (O.time)) f.write("%5.10f \n" % (flow.getPorePressure((50.000,43.013,42.868 for i in range (2): f.write("%5.10f \n" % (SaveDataNodes[i][0])) f.close() def history(): plot.addData(t=O.time,p=flow.getPorePressure((50.000,43.013,42.868))) #Apply Qin (volume flow rate) in the center of the model. flow.dead = 0 flow.defTolerance=0.3 flow.meshUpdateInterval=1 flow.useSolver=3 flow.permeabilityFactor=1 flow.viscosity=10 flow.bndCondIsPressure=[1,1,1,1,1,1] flow.bndCondValue=[0,0,0,0,0,0] flow.boundaryUseMaxMin=[0,0,0,0,0,0] O.dt= 0.001000 O.dynDt=False ti = O.time O.engines=O.engines+[PyRunner(iterPeriod=2,command='history()')] O.engines=O.engines+[PyRunner(iterPeriod=1,command='Pumping()')] def Pumping(): if O.time<(ti+0.2): flow.imposeFlux(Vector3(50.000,43.013,42.868),-1.00) else: flow.imposeFlux(Vector3(50.000,43.013,42.868),0) def BreakingBonds(): global Bonds0 CurrentBonds = 0 for ii in O.interactions: CurrentBonds+=1 if Bonds0 > CurrentBonds: Bonds0 = CurrentBonds print("BROKEN!") print(O.time) Writting() #PLOTTING plot.plots={'t':('p')} plot.plot() #CREATING CONNECTIVITY with open('Connectivity.txt') as f: Connectivity = [[int(x) for x in line.split()] for line in f] #CREATING INTERACTIONS for i in range(5905449): if Connectivity[i][2] == 1: createInteraction(Connectivity[i][0],Connectivity[i][1]) Connectivity.clear() #CREATING SAVEDATA with open('SaveDataNodes.txt') as f: SaveDataNodes = [[int(x) for x in line.split()] for line in f] #BOUND COUNT Bonds0=0 for i in O.interactions: Bonds0+=1 print (Bonds0) -- 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