← Back to team overview

yade-users team mailing list archive

[Question #673023]: setting initial velocity

 

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

hi i still need your help. Sorry for the time i will take. 

i'm trying to move my surface (is built by facets). i tried with translation engine but i saw that this engine gives a costant velocity for all the simulation lenght. I would like to set only the initial velocity. I try to build a function to reach this goal :

def inizio():
     if O.iter < 2:
       for i in range(1,27459) :
           O.bodies[i].state.vel=(-18,0,0)

########################
i set O.iter < 2 in way to have this velocity (18 m/s) only for the first two iteractions, but even at 200 iters i still have the same velocity. I try to explain better: this surface must hit a soil and be stopped after some seconds (friction and dissipation). What happened is: the surface pass through the soil without changing his velocity. I see the soil's spheres moving due to the impact, but the surface doesn't "feel" it. I already set the contact sphere-sphere and Facet-sphere, so i think  Yade is setting at each iteraction the same velocity. 

IS it a problem with contacts? or is it a problem with the velocity definition? 

i post my script : 

#####################################
#####################################

from yade import pack, plot
from yade import export, ymport
from yade import utils

####################
#### LOAD FACETS ###
####################

def readFacet(line,**kw): # read one facet from line.
   nums = [float(w) for w in line.split()] # convert line to 9 numbers
   v1,v2,v3 = nums[0:3], nums[3:6], nums[6:9] # split them to 3 vertices
   return facet((v1,v2,v3),**kw) # creates and returns facet
def loadFacets(fName): # load facets from a file
   with open(fName) as f:
      lines = f.readlines()
   return [readFacet(line) for line in lines] # convert lines to facets


################################
#### SALVA POSIZIONE FACETS ####
################################

def saveFacet(f,facet): # save one facet as 9 coordinates (3 vertices)
   vs = facet.shape.vertices # vertices in local coord system
   vs = [facet.state.pos + facet.state.ori*v for v in vs] # vertices in global coord system
   line = " ".join(" ".join(str(e) for e in v) for v in vs)
   f.write(line+"\n")
def saveFacets(fName): # save all facets
   facets = [b for b in O.bodies if isinstance(b.shape,Facet)] # list of facets in simulation
   with open(fName,"w") as f: # save them to a file
      for facet in facets:
         saveFacet(f,facet)

#####################################
#####################################
#####################################

facets = loadFacets("./AEREO.txt")
lista=O.bodies.append(facets)


################
##box material#####
################

idCA=FrictMat(density=2227,frictionAngle=radians(0.5),label='CA',young=30e9,poisson=0.15)
O.materials.append(idCA)

############################

cassone = loadFacets("./posizione_cassone_finale.txt")
O.bodies.append(cassone)

############################

#################
##soil material##
#################

idSoil=FrictMat(density=1500,frictionAngle=radians(29),label='soil',young=11277647.5,poisson=0.21)	
O.materials.append(idSoil)

############################

spheres = ymport.text("./POSIZIONE_FINALE_SFERE.txt",color=(0,0,1))
O.bodies.append(spheres)

###################
###################
###################

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
 #TranslationEngine(translationAxis=(-1,0,0),velocity=18,ids=lista,label='trans'),
 NewtonIntegrator(gravity=(0,0,-9.81),damping=0),
 PyRunner(command='inizio()',iterPeriod=1),
]

################
####funzioni####
################

def inizio():
     if O.iter < 2:
       for i in range(1,27459) :
           O.bodies[i].state.vel=(-18,0,0)


O.dt=0.8*PWaveTimeStep()
O.run()
#############################
#############################

thanks for your time.

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