ValueError: cannot convert float NaN to integer
hi
I encounter this problem "ValueError: cannot convert float NaN to integer" when running my script about "2D triax"…i get that "There should be a warning if mass = 0.0 and fixed = False ..." just dont know how to correct it, below is my code.
#######
from yade.gridpfacet import *
from yade import pack, plot
from random import random
import numpy as np
from numpy import *
import math
#parameters
rParticle = 0.14e-3#
rRelFuzz=.0005
mi,ma = (0.,0.,
#nCyls,nSphs = 8000,28216
frictionAngleSph=30
frictionAngleCyl=30
#meterials########
O.materials.
O.materials.
O.materials.
O.materials.
## create walls around the packing
walls=aabbWalls
wallIds=
##sphere
sp = yade.pack.
sp.makeCloud(
#psdSizes=
spheres=
print "cheers"
for i in O.bodies:
i.state.
i.shape.
num=0
vol=0
mass=0
area=0
for b in O.bodies:
if isinstance(
r=
x=
y=
z=
ID=b.id
num+=1
#vol+
mass+
area+=np.pi*r**2
print 'num,mass,voidRatio =',num,
length=6e-3
rfiber=0.023e-3/2
fibre_mass=
Xw=0.5*1e-2 # fiber content
numFiber=
print "the numer of fibres =",int(numFiber)
Ne=int(
print 'Ne=',Ne
nodesIds=[]
cylIds=[]
numFibre=0
#target_
target_num=1200
deleted_sphere=0
####fiberfilewrite
fiberwr=
cylNodes=[]
for n in range(2000):
if numFibre<
random.seed()
l_x=random.
l_z=random.
x0=l_x
z0=l_z
u1 = random.random()
u2 = random.random()*pi
u3 = random.random()*pi
a = sqrt(1-u1)
b = sqrt(u1)
t=((a*
cosphi=
sinphi=
hx=length*cosphi
hz=length*sinphi
x1=x0+hx
y1=0
z1=z0+hz
if 0<x1<1000e-3 and 0<z1<250e-3 and 0<x0<1000e-3 and 0<z0<250e-3:
if len(cylNodes)<=1:
fiberwr.
cylNodes.
numFibre+=1
vertices=[]
for i in range(0, Ne+1):
px=
vertices.
cylinderCon
print "+1"
else:
valid=True
#print len(cylNodes)
for c in cylNodes:
#if(
#and max(x0,
#and max(c[1]
#and max(z0,
x12=(x1-x0)
z12=(z1-z0)
x13=(c[0]-x0)
z13=(c[1]-z0)
x14=(c[2]-x0)
z14=(c[3]-z0)
cross1=
cross2=
x34=c[2]-c[0]
z34=c[3]-c[1]
x23=c[0]-x1
z23=c[1]-z1
x24=c[2]-x1
z24=c[3]-z1
cross3=
cross4=
if(
and cross3*cross4<=0):
valid=False
print "next"
break
if valid:
fiberwr.
cylNodes.
numFibre+=1
#print "++1"
vertices=[]
for i in range(0, Ne+1):
px=
vertices.
cylinderCo
###spherefil
####
sphwr=
for b in O.bodies:
if isinstance(
if r>0.012e-3:
ID=b.id
k=
#
A=k
B=-1
C=z0-k*x0
#if (A*x+B*
if abs(k*x-
#else:
sphwr.
sphwr.close()
####
fiberwr.close()
print 'numFibre , deleted_sphere =',numFibre, deleted_sphere
triax=TriaxialS
## TriaxialStressC
## this control of boundary conditions was used for instance in http://
# maxMultiplier=
# finalMaxMultipl
thickness = 0,
## switch stress/strain control using a bitmask. What is a bitmask, huh?!
## Say x=1 if stess is controlled on x, mask = x*1 + y*2 + z*4
## "100" (1) means "x", "110" (3) means "x and y", "111" (7) means "x and y and z", etc.
stressMask = 2,
goal1=-0.9,
goal2=0,
goal3=-0.9,
internalCompac
)
O.engines=[
ForceResetter(),
InsertionSortC
Bo1_Box_Aabb(),
Bo1_Sphere_
Bo1_GridConne
]),
InteractionLoop([
Ig2_Sphere_
Ig2_Box_
Ig2_GridNode_
Ig2_Sphere_
Ig2_GridConne
],
[
Ip2_CohFrictM
Ip2_FrictMat_
],
[
Law2_
Law2_
Law2_
Law2_
]
),
GlobalStiffnes
#triax,
#TriaxialState
NewtonIntegrat
]
#######
### APPLYING CONFINING PRESSURE ###
#######
#the value of (isotropic) confining stress defines the target stress to be applied in all three directions
triax.goal1=
triax.goal2=0
Gl1_Sphere.
yade.qt.
print triax.porosity
#######
it is mainly about generating spheres and cylinders(fibers) then delete objects if they interact each other."ValueError: cannot convert float NaN to integer" occurs when i click the run button. thanks so much if anyone can help!!!!!!!!
xxxe
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Hanying Zhang for more information if necessary.