Problem about material

Asked by xjin

I write a code like this:
----------------------------------------------------------------------------------------------
O.reset()

density=float(1600)
young=100e6
po=0.4
frictionAngle= float(atan(0.32))
sigmaT=1e3
epsCrackOnset=1e-4
relDuctility=30
globals()['density']=locals()['density']
globals()['young']=locals()['young']
globals()['po']=locals()['po']
globals()['frictionAngle']=locals()['frictionAngle']
globals()['sigmaT']=locals()['sigmaT']
globals()['epsCrackOnset']=locals()['epsCrackOnset']
globals()['relDuctility']=locals()['relDuctility']

density1=8000
young1=209e9
po1=0.29
frictionAngle1=float(atan(0.7))
globals()['density1']=locals()['density1']
globals()['young1']=locals()['young1']
globals()['po1']=locals()['po1']
globals()['frictionAngle1']=locals()['frictionAngle1']

qiu=O.materials.append(CpmMat(density=density,young=young,poisson=po,frictionAngle=frictionAngle,sigmaT=sigmaT,epsCrackOnset=epsCrackOnset,relDuctility=relDuctility,label='qiu'))

dao=O.materials.append(FrictMat(density=density1,young=young1,poisson=po1,frictionAngle=frictionAngle1,label='dao'))

O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=15))
O.bodies.append(facet([(0,0,0),(1,1,0),(1,0,0)]))
O.bodies.append(facet([(0,0,0),(1,1,0),(0,1,0)]))
O.bodies.append(facet([(0,0,1),(1,1,1),(1,0,1)]))
O.bodies.append(facet([(0,0,1),(1,1,1),(0,1,1)]))

Nb1=len(O.bodies)
globals()['Nb1']=locals()['Nb1']

from yade import pack
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,.8),rMean=.08)
sp.toSimulation()

Nb2=len(O.bodies)
globals()['Nb2']=locals()['Nb2']

for i in xrange(0,Nb1):
O.bodies[i].material=O.materials[dao]

for i in xrange(Nb1,Nb2):
O.bodies[i].material=O.materials[qiu]

O.bodies[8].state.vel=(0,0,0.1)
O.bodies[9].state.vel=(0,0,0.1)
O.bodies[10].state.vel=(0,0,-0.1)
O.bodies[11].state.vel=(0,0,-0.1)

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
[Ip2_CpmMat_CpmMat_CpmPhys(),Ip2_FrictMat_CpmMat_FrictPhys(),Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_CpmPhys_Cpm(),Law2_ScGeom_FrictPhys_CundallStrack()]),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),

]
O.dt=0.05*PWaveTimeStep()

-------------------------------------------------------------------------------------------------

when I run it, I ge the message:

 FATAL /home/dj/yade/trunk/core/ThreadRunner.cpp:30 run: Exception occured:
Body #12: Body::material type CpmMat doesn't correspond to Body::state type State (should be CpmState instead).

 Could you give me some suggestion?Thanks a lot!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

The error message suggests your Body #12 (with 12 as id) has a CpmMat material but a state attribute [1] of the generic State type/class [2].
This is not accepted as bodies with CpmMat should have a state attribute of the derived/inherited/more specialized CpmState class [3]

Once you check my guess is true (asking for O.bodies[12].state and .material) the question is "how to consistently define a CpmState for bodies with CpmMat" which I do not know the answer for, being not familiar with concrete particle model.

Other answers will thus probably be necessary, and with this respect it's somewhat inconvenient you did not provide us with a real MinimumWE [4] ;-)

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Body.state
[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.State
[3] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.CpmState
[4] https://yade-dem.org/wiki/Howtoask

Revision history for this message
Best Jan Stránský (honzik) said :
#2

Hello,

do not change the material of spheres, i.e. delete these lines
###
for i in xrange(0,Nb1):
  O.bodies[i].material=O.materials[dao]
for i in xrange(Nb1,Nb2):
  O.bodies[i].material=O.materials[qiu]
###

Instead, specify the material when particles are created:
###
# material=dao not needed as lastly appended material is used by default
O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=15,material=dao))
O.bodies.append(facet([(0,0,0),(1,1,0),(1,0,0)],material=dao))
...
sp.toSimulation(material=qiu)
###

cheers
Jan

PS: change of particle material is of course possible, but might need something more, as you experienced

Revision history for this message
xjin (jpeng22) said :
#3

Thanks Jan Stránský, that solved my question.