yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #24131
Re: [Question #693455]: addForce didnt work for facet
Question #693455 on Yade changed:
https://answers.launchpad.net/yade/+question/693455
Status: Answered => Open
onyourself is still having a problem:
hi,
> depneding on "to see" is a bad approach. The only way how to be sure
is NOT checking 3D view, the only way how to be sure are the numbers in
the model.
got it. then i change my code as you suggest(print(f.state.pos)). the
positions printed twice are the same. please help me figure out why. i
try my best to minimize my code.
############################################
from yade.gridpfacet import *
from yade import pack, plot
from random import random
from numpy import *
import math
import os
#parameters
rParticle = 0.14e-3#diameter0.28
rRelFuzz=.0005
mi,ma = (-500e-3,0.,0.),(500e-3,0,250e-3)
length = 10e-3,
width = int(1000e-3),
height = int(250e-3),
# prestress
preStress = -3e9,
# facets division
nw = int(240)
nh = int(150)
#meterials########
frictMat = O.materials.append(FrictMat(
young=4.0e6,poisson=.3,frictionAngle=26,density=910e+6
))
facets = []
nw2 = (250)
nh = (50)
width = 1000e-3
height = 250e-3
for r in xrange(nw2):
for h in xrange(nh):
v11 = Vector3( -.5*width + (r+0)*width/nw2, 5e-3, 0 )
v12 = Vector3( -.5*width + (r+1)*width/nw2, 5e-3, 0 )
v13 = Vector3( -.5*width + (r+1)*width/nw2, -5e-3, 0 )
v14 = Vector3( -.5*width + (r+0)*width/nw2, -5e-3, 0 )
#print (v11, v12, v13, v14)
f11 = facet((v11,v12,v13),color=(0,0,1),material=frictMat)
f12 = facet((v11,v13,v14),color=(0,0,1),material=frictMat)
v21 = Vector3( +.5*width, -5e-3, height*(h+0)/float(nh) )
v22 = Vector3( +.5*width, 5e-3, height*(h+0)/float(nh) )
v23 = Vector3( +.5*width, 5e-3, height*(h+1)/float(nh) )
v24 = Vector3( +.5*width, -5e-3, height*(h+1)/float(nh) )
#print (v21, v22, v23, v24)
f21 = facet((v21,v22,v23),color=(0,0,1),material=frictMat)
f22 = facet((v21,v23,v24),color=(0,0,1),material=frictMat)
v31 = Vector3( +.5*width - (r+0)*width/nw2, +5e-3, 250e-3 )
v32 = Vector3( +.5*width - (r+1)*width/nw2, +5e-3, 250e-3 )
v33 = Vector3( +.5*width - (r+1)*width/nw2, -5e-3, 250e-3 )
v34 = Vector3( +.5*width - (r+0)*width/nw2, -5e-3, 250e-3 )
#print (v31, v32, v33, v34)
f31 = facet((v31,v32,v33),color=(0,0,1),material=frictMat)
f32 = facet((v31,v33,v34),color=(0,0,1),material=frictMat)
v41 = Vector3( -.5*width, -5e-3, height*(h+0)/float(nh) )
v42 = Vector3( -.5*width, 5e-3, height*(h+0)/float(nh) )
v43 = Vector3( -.5*width, 5e-3, height*(h+1)/float(nh) )
v44 = Vector3( -.5*width, -5e-3, height*(h+1)/float(nh) )
#print (v41, v42, v43, v44)
f41 = facet((v41,v42,v43),color=(0,0,1),material=frictMat)
f42 = facet((v41,v43,v44),color=(0,0,1),material=frictMat)
facets.extend((f11,f12,f21,f22,f31,f32,f41,f42))
O.bodies.append(facets)
mass = O.bodies[0].state.mass
for f in facets:
f.state.mass = mass
f.shape.color=(200,255,240)
#f.state.blockedDOFs = 'XYZz'
# apply prestress to facets
#def addForces():
preStress = -3e9
for f in facets:
n = f.shape.normal
a = f.shape.area
O.forces.addF(f.id,preStress*a*n)
#O.forces.setPermF(f.id,preStress*a*n)
#
print "force"
O.engines=[
ForceResetter(),
InsertionSortCollider([
#Bo1_Box_Aabb(),
Bo1_Sphere_Aabb(),
Bo1_GridConnection_Aabb(),
Bo1_Facet_Aabb(),
]),
InteractionLoop([
Ig2_Sphere_Sphere_ScGeom(),
#Ig2_Box_Sphere_ScGeom(),
Ig2_GridNode_GridNode_GridNodeGeom6D(),
Ig2_Sphere_GridConnection_ScGridCoGeom(),
Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
Ig2_Facet_Sphere_ScGeom(),
],
[
Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False), # internal cylinder physics
Ip2_FrictMat_FrictMat_FrictPhys() # physics for external interactions, i.e., cylinder-cylinder, sphere-sphere, cylinder-sphere
#Ip2_FrictMat_CpmMat_FrictPhys(),
],
[
Law2_ScGeom_FrictPhys_CundallStrack(), # contact law for sphere-sphere
Law2_ScGridCoGeom_FrictPhys_CundallStrack(), # contact law for cylinder-sphere
Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), # contact law for "internal" cylinder forces
Law2_GridCoGridCoGeom_FrictPhys_CundallStrack() # contact law for cylinder-cylinder interaction
#Law2_ScGeom_CpmPhys_Cpm(),
]
),
GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'),
#triax,
#TriaxialStateRecorder(iterPeriod=100,file='WallStresses'+table.key),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1,label='newton'),
#PyRunner(iterPeriod=1,command="addForces()"),
PyRunner(command='plotAddData()',iterPeriod=10),
#PyRunner(iterPeriod=20,command='history()',label='recorder'),
]
facet1 = facets[0] # or any other valid index
print(facet1.state.pos)
O.step()
print(facet1.state.pos) # should be different from the first one
#####################################################
--
You received this question notification because your team yade-users is
an answer contact for Yade.