New question #656498 on Yade: https://answers.launchpad.net/yade/+question/656498
Hi everyone, I've got an issue in my simulation. I want to change the properties of a WirePhys interaction during the simulation. I thought about two options to do this : - Deleting the existing interaction and changing the existing Wiremat for a new one with the wanted properties. But in this case, the new interaction (added with "createInteraction(id1,id2)") is not taken into account in the simulation (the interaction exist during 1 step and then disappear). Maybe you have a idea why ? But let's concentrate on the second option. - The second option I tried is directly change the properties in the WirePhys by modifying "O.interactions[id1,id2].phys.displForceValues". But in this case, the new properties are not taken. You can see it in this little script below. Have you any idea how to solve this ? I put my script of the second option below, Thank you, Loïc ############################################################################## # encoding: utf-8 from yade import qt, plot from yade.gridpfacet import * import gts, os, locale, sys import numpy as np O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom()], [Ip2_WireMat_WireMat_WirePhys()], [Law2_ScGeom_WirePhys_WirePM()]), NewtonIntegrator(gravity=(0,0,0),damping=0.1,label='newton'), PyRunner(initRun=False,iterPeriod=1500, nDo = 2,command='modif()'), PyRunner(initRun=True,iterPeriod=1000,command='addPlotData()'),] RWire = 0.012 SSvalues = [(5.16,1.54e8),(130,1.67e8),(103280,3.9e12)] Wiremat = O.materials.append(WireMat(young=1e9, poisson=0.3,frictionAngle=radians(10),density=1000,isDoubleTwist=False,diameter=2*RWire,strainStressValues=SSvalues)) Wire = [] Wire.extend([ O.bodies.append(utils.sphere([0,-RWire,0],RWire,wire=False,fixed=False,material=Wiremat)), O.bodies.append(utils.sphere([0,+RWire,0],RWire,wire=False,fixed=False,material=Wiremat))]) O.bodies[Wire[1]].state.blockedDOFs='xyzXYZ' O.bodies[Wire[0]].state.vel[1]=-0.05 O.bodies[Wire[0]].state.blockedDOFs='xyzXYZ' plot.plots={'U':('F')} plot.plot(noShow=False, subPlots=False) v=qt.Controller() v=qt.View() rr = qt.Renderer() rr.intrAllWire = True O.dt = 1e-5 O.saveTmp() O.run() def addPlotData(): F = O.forces.f(Wire[0])[1] U = O.bodies[Wire[0]].state.pos[1] - O.bodies[Wire[0]].state.refPos[1] plot.addData(U=-U*1000, F=F/1000 ) def modif(): O.pause() NewFD = [ (-0.179,-100000), (-3.12,-105000), (-2500,-1.4e9),] print NewFD[0] print NewFD[1] print NewFD[2] O.interactions[Wire[0],Wire[1]].phys.displForceValues[1] = NewFD[0] O.interactions[Wire[0],Wire[1]].phys.displForceValues[2] = NewFD[1] O.interactions[Wire[0],Wire[1]].phys.displForceValues[3] = NewFD[2] print O.interactions[Wire[0],Wire[1]].phys.displForceValues[1] print O.interactions[Wire[0],Wire[1]].phys.displForceValues[2] print O.interactions[Wire[0],Wire[1]].phys.displForceValues[3] -- 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