Floating point exception (core dumped)
Hello,
I was using Ubuntu 18.04 and Yade 2018.02b and the code was running good last year. But several days ago my Ubuntu updated to 20.04 automatically and Yade was also updated to 2020.01a version. Then I found that if I using the same code as in Yade 2018.02b, the particle cloud generated in Yade 2020.01a at different time is not the same. Even I have set the "seed" value in makeCloud command as shown follows, the particle cloud is still changing if I run the code at different time. The code is shown as follows:
sp.makeCloud(
Then I install the Yadedaily, the particle cloud can now be generated completely the same if I run it at different time. However, as simulation goes on, another error shows up, the simulation will ends automatically and the terminal shows "Floating point exception (core dumped)".
I wonder if anyone could help me or give me some suggestions to solve this issue. Is there a bug in "makeCloud" in Yade 2020.01a? Why the Yadedaily will show "Floating point exception (core dumped)"? If I want to make the code works, should I still install the Yade 2018.02b?
Thank you and kind regards,
Yuxuan
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Yuxuan Wen
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
I run this file first:
#------
## length (m), time (s), mass (1kg), force (N), pressure (Pa)
from yade import pack, plot, qt, export, os
##
lx=0.2
ly=0.2
lz=0.14
target_r=0.005 # target r=0.005m=0.5cm, d=0.01m=1cm, l=20d
target_d=2*target_r
target_phi=0.550
target_
num_spheres=
flag=1 # mark time when changing friction
## space for generating particle cloud
thickness=target_d # top and bottom walls' thickness
wallsurfh=target_r # distance between wall surface to the cell
mn=Vector3(
mx=Vector3(
## material properties
density=2650.0 # kg/m3
kn=4e5 # kn/2 is the stiffness of the contact
ks=kn*2.0/7.0
gamma=50.0
cn=4.0/
frict=0
frictnew=26.57 # after stable, change the particle from frictionless to frictional
## insert periodic cell
O.periodic=True
O.cell.
0, 2*ly, 0,
0, 0, wallsurfh+
## insert the walls for consolidation
O.materials.
lowbox=
upbox=O.
## use a SpherePack object to generate a random loose particles packing
O.materials.
sp=pack.
sp.makeCloud(
O.bodies.
msphere=0.0
sphereid=[]
for i in O.bodies:
if i.id>=2:
msphere=
sphereid.
#######
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
PyRunner(
GlobalStiffnes
NewtonIntegrat
PyRunner(
PyRunner(
#PyRunner(
#VTKRecorder(
#qt.SnapshotEn
]
#plot.live=True
plot.plots=
plot.plot()
#O.run()
#######
def servo():
O.bodies[
O.bodies[
if O.cell.size[0] > (lx+1e-8):
rate1=0.1
else:
rate1=0
O.cell.
if O.bodies[
rate2=0.1
else:
rate2=0
vz=rate2*
O.bodies[
O.bodies[
def addPlotData():
V=O.cell.
Vs=msphere/density
n0=0
n1=0
for i in sphereid:
if len(O.bodies[
n0=n0+1
if len(O.bodies[
n1=n1+1
plot.addData(
nsphere=
N0=n0,
N1=n1,
step=O.iter,
t=O.time,
phi=Vs/V,
void=(V-Vs)/Vs,
sxx=utils.
syx=utils.
szx=utils.
exx=O.
eyy=O.
ezz=O.
s_up=
s_low=
Z=avgNumInter
Zm=avgNumInte
Ekine=
Etot=
Eunbal=
# **O.energy converts dictionary-like O.energy to plot.addData arguments
)
plot.saveDataT
def fabricdata():
filename=
f = open(filename,'w')
f.write('id1 id2 x_cp y_cp z_cp n_x n_y n_z Fn_x Fn_y Fn_z Fs_x Fs_y Fs_z ovp\n')
for i in O.interactions:
if not i.isReal: continue
point = i.geom.contactPoint
norm = i.geom.normal
ovp = i.geom.
Fn = i.phys.normalForce
Fs = i.phys.shearForce
f.write('%-8i %-8i %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g\n'
f.close
def finished():
V=O.cell.
Vs=msphere/density
phi=Vs/V
void=(V-Vs)/Vs
Eunbal=
global flag, step1
if (Eunbal<=1e-6 or O.time>
flag=2
step1=O.iter
setContactFri
print ('friction added at '+ str(O.iter))
print ('step=
print ('phi='+str(phi), 'error=
print ('void ratio='+str(void), 'error=
print ('radius=
print ('Unbalanced force = '+str(Eunbal))
elif (Eunbal<=1e-6 or O.time>
fabricdata()
O.save(
print ('Consolidation Finished')
print ('step=
print ('phi='+str(phi), 'error=
print ('void ratio='+str(void), 'error=
print ('radius=
print ('Unbalanced force = '+str(Eunbal))
O.pause()
Revision history for this message
|
#2 |
And then I run the second file. The "
Floating point exception (core dumped)" error will show when running this file:
#------
## length (m), time (s), mass (1kg), force (N), pressure (Pa)
from yade import pack, plot, qt, export, os
O.load(
step0=O.iter
t0=O.time
rate=0.5
velocity=rate*0.1
radius=
diameter=2*radius
## delete 2 up and low boxes
z1=O.bodies[
z2=O.bodies[
thickness=diameter
upzsurf=
lowzsurf=
lx=O.cell.size[0]
ly=O.cell.size[1]
lz=upzsurf-lowzsurf
V=lx*ly*lz
Vs0=O.cell.
O.bodies.
O.bodies.
## record all the sphere's id
spherelist=[]
msphere=0.0
for i in O.bodies: # bodies 0 and 1 are already deleted
spherelist.
msphere=
Vs=msphere/2650.0
## clump the walls
uplist=[]
lowlist=[]
clumplist=[]
for i in O.bodies:
if i.state.pos[2] >= (upzsurf-
uplist.
if i.state.pos[2] <= (lowzsurf+
lowlist.
clumplist=
upclump=
lowclump=
upposy0=
lowposy0=
## record the data of sphere body that is not in the clump walls
shearspherelist=[]
checklist=[]
for i in spherelist:
if i not in uplist and i not in lowlist:
shearsphere
checklist.
checklist.
checklist.
#O.bodies[
#O.bodies[
#O.bodies[
#######
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
PyRunner(
GlobalStiffnes
NewtonIntegrat
PyRunner(
PyRunner(
PyRunner(
PyRunner(
PyRunner(
PyRunner(
]
plot.plots=
plot.plot()
#######
def servo():
O.bodies[
O.bodies[
O.bodies[
def addPlotData():
upforcex=0
upforcey=0
upforcez=0
lowforcex=0
lowforcey=0
lowforcez=0
for i in O.interactions:
if not i.isReal: continue
point = i.geom.contactPoint
norm = i.geom.normal
ovp = i.geom.
Fn = i.phys.normalForce
Fs = i.phys.shearForce
if (i.id1 in uplist and i.id2 not in uplist): # force direction is from id1 to id2
upforcex=
upforcey=
upforcez=
if (i.id1 not in uplist and i.id2 in uplist):
upforcex=
upforcey=
upforcez=
if (i.id1 in lowlist and i.id2 not in lowlist):
lowforcex=
lowforcey=
lowforcez=
if (i.id1 not in lowlist and i.id2 in lowlist):
lowforcex=
lowforcey=
lowforcez=
n0=0
n1=0
for i in shearspherelist:
if len(O.bodies[
n0=n0+1
if len(O.bodies[
n1=n1+1
plot.addData(
N0=n0,
N1=n1,
step=O.iter,
t=O.time,
phi=Vs/V,
void=(V-Vs)/Vs,
sxx=utils.
syx=utils.
szx=utils.
exx=O.
upfx=upforcex, upfy=upforcey, upfz=upforcez,
lowfx=lowforcex, lowfy=lowforcey, lowfz=lowforcez,
upclumpfx=
lowclumpfx=
upvx=
lowvx=
upposx=
lowposx=
Z=avgNumInter
Zm=avgNumInte
nshearsphere=
Ekine=
Etot=
Eunbal=
)
# overall state variables under different step are saved in one file, no loop
plot.saveDataT
plot.saveDataT
#plot.
def veldata():
filename=
f = open(filename,'w')
f.write('id vx vy vz pos_x pos_y pos_z ovp\n')
for i in checklist: # data of all bodies/intrs at each step is saved under a unique file named str(O.iter)
vx=O.
vy=O.
vz=O.
pos_x=
pos_y=
pos_z=
f.write('%-8i %-12g %-12g %-12g %-12g %-12g %-12g\n'
f.close
def fabricdata():
filename1=
f1 = open(filename1,'w')
f1.write('id1 id2 x_cp y_cp z_cp n_x n_y n_z Fn_x Fn_y Fn_z Fs_x Fs_y Fs_z ovp\n')
for i in O.interactions:
if not i.isReal: continue
point = i.geom.contactPoint
norm = i.geom.normal
ovp = i.geom.
Fn = i.phys.normalForce
Fs = i.phys.shearForce
if not (i.id1 in clumplist and i.id2 in clumplist): # the clumplist interactions should be constant
f1.write('%-8i %-8i %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g %-12g\n'
f1.close
filename2=
f2 = open(filename2,'w')
f2.write(
for i in shearspherelist:
if len(O.bodies[
f2.write(
f2.close
filename3=
f3 = open(filename3,'w')
f3.write(
for i in shearspherelist:
if len(O.bodies[
f3.write(
f3.close
def finished():
unbal=
upvely=
upposy=
strain=
if (O.time-
print ('Shearing Finished')
print ('Unbalanced force='+str(unbal))
print ('Shear strain=
O.pause()
Revision history for this message
|
#3 |
Yikes, that's a lot of files. Any chance you can make an MWE [1]?
Revision history for this message
|
#4 |
> I was using Ubuntu 18.04 ... my Ubuntu updated to 20.04 automatically
Maybe "accidentally" instead of "automatically? ("automatic upgrade" does not sound like how Ubuntu (used to?) work)
> If I want to make the code works, should I still install the Yade 2018.02b?
definitely it is an option.
Depending on how you use the Ubuntu (I have there all job and personal data, program settings, ..., would not want to install it from scratch)
> in Yade 2018.02b ... in Yade 2020.01
you have 2 years of development, some behavior may change. Concerning makeCloud and seed, there were some bugs / bug fixing [2].
I guess a significant change is Python 2 -> Python 3, which also may break something in your scripts (e.g. int/float division).
> And then I run the second file. The "Floating point exception (core dumped)" error will show when running this file:
what is a typical running time of the scripts?
"a lot of files" is not a big problem for mere testing.
Of course, debugging and searching for problem solution is completely different topic, where a MWE required by Robert would/should help significantly.
Concerning seed in different versions, see the commit [2], the related bug, date of the commit w.r.t yade versions you use, possibly other history of this part of the file, ......
cheers
Jan
[2] https:/
Revision history for this message
|
#5 |
Hello Robert and Jan,
Thank you so much for the reply!!! Now I have make a MWE version, I delete all irrelevant and post-process commands and run the code to make sure there is no syntax error. I wonder if it is possible that you can help me to take a look? Thank you so much!
I found that the code can be run in Yade 2020.01a without an error, but in Yadedaily the "Floating point exception (core dumped)" error shows up.
The code is shown as follows, there are two files. I run the 1st file and when it completed I run the 2nd file, since I use the O.save() at the end of the 1st file and then use the O.load() at the beginning of the 2nd file. Both the files are in the minimum version. The 1st file will cost you about 1min (virtual time to 1.67s). And then when you run the 2nd file by Yadedaily, the "Floating point exception (core dumped)" error shows up only after a few seconds.
#------
from yade import pack, plot, qt, export, os
##
lx=0.2
ly=0.2
lz=0.14
target_r=0.005 # target r=0.005m=0.5cm, d=0.01m=1cm, l=20d
target_d=2*target_r
target_phi=0.550
target_
num_spheres=
## space for generating particle cloud
thickness=target_d # top and bottom walls' thickness
wallsurfh=target_r # distance between wall surface to the cell
mn=Vector3(
mx=Vector3(
## material properties
density=2650.0 # kg/m3
kn=4e5 # kn/2 is the stiffness of the contact
ks=kn*2.0/7.0
gamma=50.0
cn=4.0/
frict=0
frictnew=26.57 # after stable, change the particle from frictionless to frictional
## insert periodic cell
O.periodic=True
O.cell.
0, 2*ly, 0,
0, 0, wallsurfh+
## insert the walls for consolidation
O.materials.
lowbox=
upbox=O.
## use a SpherePack object to generate a random loose particles packing
O.materials.
sp=pack.
sp.makeCloud(
O.bodies.
#######
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
PyRunner(
GlobalStiffnes
NewtonIntegrat
PyRunner(
]
#######
def servo():
O.bodies[
O.bodies[
if O.cell.size[0] > (lx+1e-8):
rate1=0.5
else:
rate1=0
O.cell.
if O.bodies[
rate2=0.5
else:
rate2=0
vz=rate2*
O.bodies[
O.bodies[
def finished():
if O.time>
O.save(
print ('Consolidation Finished')
O.pause()
#------
from yade import pack, plot, qt, export, os
O.load(
step0=O.iter
t0=O.time
rate=0.5
velocity=rate*0.1
radius=
diameter=2*radius
## delete 2 up and low boxes
z1=O.bodies[
z2=O.bodies[
thickness=diameter
upzsurf=
lowzsurf=
ly=O.cell.size[1]
O.bodies.
O.bodies.
## record all the sphere's id
spherelist=[]
for i in O.bodies: # bodies 0 and 1 are already deleted
spherelist.
## clump the walls
uplist=[]
lowlist=[]
clumplist=[]
for i in O.bodies:
if i.state.pos[2] >= (upzsurf-
uplist.
if i.state.pos[2] <= (lowzsurf+
lowlist.
clumplist=
upclump=
lowclump=
upposy0=
lowposy0=
#######
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
PyRunner(
GlobalStiffnes
NewtonIntegrat
PyRunner(
]
#######
def servo():
O.bodies[
O.bodies[
O.bodies[
def finished():
if (O.time-
print ('Shearing Finished')
O.pause()
Revision history for this message
|
#6 |
I do not have 20.04, so I am out of testing, sorry..
Revision history for this message
|
#7 |
Hello Jan,
The code can be run in Yade 2020.1a, but can not be run correctly in Yadedaily. I wonder if it is possible that you could help me to take a look on Yadedaily. It will not take you much time, for the 1st file is about 1 min, and for the 2nd file is about several seconds.
I know this is a troublesome request and will make you inconvenient, I am deeply sorry!! But I really have no clue on how to solve the issue or debugging. If you could help me to take a look or just give me some clues to solve this problem, I will be much appreciated!! Otherwise I have no choice but to install the Ubuntu 18.04 and Yade 2018.02b again...
Kind Regards,
Yuxuan
Revision history for this message
|
#8 |
On Ubuntu 18.04 using yadedaily (Yade 20210217-
Jan
Revision history for this message
|
#9 |
Thank you so much Jan!! Your comment has strengthen my confidence on Yadedaily. I am using Yadedaily in Ubuntu 20.04 and the "Floating point exception (core dumped)" shows up. So it seems that the error is due to the version of Ubuntu instead of Yadedaily. I will install the Ubuntu 18.04 rightaway, and the problem can be solved.
Thank you so much for you time and patience!
Best Regards,
Yuxuan
Revision history for this message
|
#10 |
Hi,
I confirm segfault on ubuntu20/yadedaily (20210204-
The problem is apparently with InsertionSortCo
I suspect the combination of reloading/
> I will install the Ubuntu 18.04
Oh no... don't do that. Why not Yade 2020.1a if it works for you?
It would be helpful if you could reproduce in a single script where we wouldn't have to click play to see the error (and possibly taking less than minutes to run).
Regards
Bruno
Revision history for this message
|
#11 |
Hi,
The crash was due to erasing just after reloading.
The problem is fixed in source code in [1]. The fix is not yet in yadedaily but it should appear quickly.
If you use a yade version affected by this bug you can workaround with "O.bodies.
Regards
Bruno
Revision history for this message
|
#12 |
Hello Dr. Chareyre,
Thank you so much for your answer and your time on the debugging! I am sorry that I didn't reproduce a single script and reply to you last week. I am devoting in producing the results of simulation and the post-processing for a PPT so that I forgot to produce this single script. I am sorry for the negligence! It is so delightful that I can get your answer and guidance on an problem that I met and couldn't solve! Thank you for your answer and it is so helpful for me to get a deeper understanding on Yade by tracking this bug and debugging process!
Best Regards,
Yuxuan