Question #696759 on Yade changed:
https://answers.launchpad.net/yade/+question/696759

    Status: Answered => Open

weijie is still having a problem:
Hi Jan, and thank you again.

>If you insist on automatic interaction creation, you need O.step (or
similar) before changing poly1.material.

After I added O. step (), I found the error of material type doesn't respond to 
body.The script and error see[*].
If I want to create the initial cohesive contact manually and then reset 
material ,the method is  like below?
##
createInteraction(poly1.id,poly2.id)
O.run(1,True)
poly1.material=FrictMat
ss2sc.interactionDetectionFactor=1.

>You can hack it by creating the walls made of polyhedron.
Walls created by utils.wall will still move at the same speed after contacting 
with other bodies.How to make the wall created by polyhedron move in the same 
speed after colliding?

Best regards
Jie

[*]script:
###########
from __future__ import print_function
from yade import polyhedra_utils,qt
concrete = CpmMat(
        young = 24e9,
        poisson =  .2,
        frictionAngle = atan(0.8),
        epsCrackOnset = 1e-4,
        relDuctility =30,
        sigmaT = 3.5e6,
)
concreteId = O.materials.append(concrete)
poly1= polyhedra_utils.polyhedra(material=concrete,size=(1,1,1),seed=5) 
O.bodies.append(poly1)
poly1.state.pos = (0,0,0)
m=FrictMat(density=1000,young=1e5,poisson=0.5,frictionAngle=radians(20))
O.materials.append(m)

######### Create wall
wallThickness = 0.1
length = 1.5
height = 1.5
vC 
=((-0.5*length,0.5*wallThickness,0.5*height),(0.5*length,0.5*wallThickness,0.5*height),(0.5*length,0.5*wallThickness,-0.5*height),(-0.5*length,0.5*wallThickness,-0.5*height),(-0.5*length,-0.5*wallThickness,0.5*height),(0.5*length,-0.5*wallThickness,0.5*height),(0.5*length,-0.5*wallThickness,-0.5*height),(-0.5*length,-0.5*wallThickness,-0.5*height))
vD=((-0.5*length,0.5*wallThickness,0.5*height),(0.5*length,0.5*wallThickness,0.5*height),(0.5*length,0.5*wallThickness,-0.5*height),(-0.5*length,0.5*wallThickness,-0.5*height),(-0.5*length,-0.5*wallThickness,0.5*height),(0.5*length,-0.5*wallThickness,0.5*height),(0.5*length,-0.5*wallThickness,-0.5*height),(-0.5*length,-0.5*wallThickness,-0.5*height))
bC = polyhedra_utils.polyhedra(material=m,v=vC,color=[0,0.5,1])
bC.state.pos = [0,0.45*length,0]
bD = polyhedra_utils.polyhedra(material=m,v=vD,color=[0,0.5,1])
bD.state.pos = [0,-0.45*length,0]
O.bodies.append((bC,bD))
v=0.1
bC.state.vel = (0,-v,0)
bD.state.vel = (0,+v,0)

O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Polyhedra_Aabb()]),
    InteractionLoop(
        [Ig2_Polyhedra_Polyhedra_ScGeom()],
        [Ip2_CpmMat_CpmMat_CpmPhys(),Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_CpmPhys_Cpm(),Law2_ScGeom_FrictPhys_CundallStrack()],
    ),
    NewtonIntegrator(),
]

O.dt = 0.  #run one iteration
O.step()
poly1.material=m  #change material
O.dt = 1e-6
##########################
error:
    O.step()
RuntimeError: Body #0: Body::material type CpmMat doesn't correspond to 
Body::state type State (should be CpmState instead).

-- 
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     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to