← Back to team overview

yade-users team mailing list archive

[Question #688164]: Recording Force and Position

 

New question #688164 on Yade:
https://answers.launchpad.net/yade/+question/688164

Hi,

I am want to run a simulation where I have two balls. I want to record the force and the displacment of one of the balls (O.bodies[1]) using plot.addData. Currently, I can store the time at every 1000 iterations. What do I add to " plot.addData(t=O.time) " so that it can also record the force (x, y, and z) and the displacement (x, y, and z) for (O.bodies[1]).

Thanks!




# PARTICLES
O.bodies.append([
	# fixed: particle's position in space will not change (support)
	sphere(center=(0,0,0),radius=0.5,fixed=True),
	# this particles is free, subject to dynamics
	sphere((0,0,2),radius=0.5)
])
O.bodies[0].state.density = 5
O.bodies[1].state.density = 5 

# BOUNDARY CONDITION
O.bodies[1].state.blockedDOFs =  "z"
O.bodies[1].state.vel = (0,0,-1)

# FUNCTIONAL COMPONENTS
# 1
def myFunction():
        print("Hello")
	#print("dsdsHello")
# 2
def addPlotData():
        plot.addData(t=O.time) #HERE


#PRINTING
from yade import plot
from pprint import pprint


# SIMULATION LOOP
O.engines=[
	
	#PyRunner(command='myFunction()',iterPeriod=100),
	PyRunner(command='addPlotData()',iterPeriod=1000),
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom()],        # collision geometry
		[Ip2_FrictMat_FrictMat_FrictPhys()], # collision "physics"
		[Law2_ScGeom_FrictPhys_CundallStrack()]   # contact law -- apply forces 	
),
	# Apply gravity force to particles. damping: numerical dissipation of energy.
	NewtonIntegrator(gravity=(0,0,0),damping=0.1),
	PyRunner(command='addPlotData()',iterPeriod=20),         # call the addPlotData function every 20 iterations
]

#TIME STEP
O.dt=.5e-4*PWaveTimeStep()

# SAVE SIMULATION
O.saveTmp()

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.