← Back to team overview

yade-users team mailing list archive

Re: Simulation in displacement control

 

2010/4/19 Václav Šmilauer <eudoxos@xxxxxxxx>

>
> > Oh yes, I think it is best to force displacements than apply forces in
> > this case. I try.
> Watch out to not forget to set velocities when you apply displacement.
> Some classes (like ScGeom) use velocities. (JumpChangeSe3 takes care of
> that btw)
>

hi Vaclav,
thanks for suggestions. I included JumpChangeSe3 engine, I set velocities, I
applied a displacement but when I run the script I get

terminate called without an active exception
Aborted

I attach the script, although it is very basic I cannot see the error. Do
you?
cheers

>
> v
>
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> More help   : https://help.launchpad.net/ListHelp
>
#!/usr/local/bin/yade-trunk -x
# -*- coding: utf-8 -*-
# -*- encoding=utf-8 -*-

# Script to test a sphere-sphere interaction in displacement control

from yade import utils

#__________________________________________________________________
# geometry
r1,r2=1e-2,1e-2 # radii [m]
p1,p2=[0,0,0],[r1+r2,0,0] # center positions [m]

#__________________________________________________________________
# material
young=600.0e6 # [N/m^2]
poisson=0.6 
density=2.60e3 # [kg/m^3]
frictionAngle=26 # [°]

# append geometry and material
O.materials.append(FrictMat(young=young,poisson=poisson,density=density,frictionAngle=frictionAngle))
# set both bodies as non-dynamic since we use JumpChangeSe3 engine (see documentation)
O.bodies.append(utils.sphere(p1,r1,dynamic=False,wire=True)) # body id=0 
O.bodies.append(utils.sphere(p2,r2,dynamic=False,wire=True)) # body id=1

#__________________________________________________________________
# phys
#A=4.30e-20 # [J/m^2]
#D=0.3e-9 # [m]

#__________________________________________________________________
# list of engines
O.engines=[
	JumpChangeSe3(subscribedBodies=[1],deltaSe3=(Vector3(-1e-6,0,0),Quaternion().IDENTITY),setVelocities=True),
	ForceResetter(),
	BoundDispatcher([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
	InsertionSortCollider(),
	InteractionDispatchers(
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_MindlinPhys()],
		[Law2_ScGeom_MindlinPhys_Mindlin()]
	),
	NewtonIntegrator(damping=0.0),
	PeriodicPythonRunner(iterPeriod=1,command='myAddPlotData()')
]

#__________________________________________________________________
# time step
O.dt=.2*utils.PWaveTimeStep()
O.saveTmp('init')

#__________________________________________________________________
from yade import qt
qt.View()
qt.Controller()

#__________________________________________________________________
# plot some results
from math import *
from yade import plot

plot.plots={'un':('Fn',)}

def myAddPlotData():
	i=O.interactions[0,1]
	plot.addData(Fn=i.phys.normalForce[0],
		un=(r1+r2)-(O.bodies[1].state.pos[0]-O.bodies[0].pos[0]))	

# We will have:
# 1) data in graphs (if you call plot.plot())
# 2) data in file (if you call plot.saveGnuplot('/home/chia/Desktop/Output/out')
# 3) data in memory as plot.data['un'], plot.data['fn'], etc. under the labels they were saved






Follow ups

References