Segmentation fault (core dumped) when increasing the GridConnection number

Asked by Wang Yaqiong

I have a question when generating the geogrid sample.

When I increased the number of nodes (e.g., "nbL" from 10 to 60), the "Segmentation fault " appears in the terminal. I have confirmed that the program woks normally if only unidirectional ribs are generated.

My script is attched below:
___________________________________________________________________
# -*- encoding=utf-8 -*-
from builtins import zip
from builtins import range
from yade.gridpfacet import *
from yade import pack,ymport,export,geom,bodiesHandling, plot,utils,qt
import pylab
import matplotlib; matplotlib.rc('axes',grid=True)

#### tensile control
leftTensilePos = 0.002
rightTensilePos = 0.098
O.engines = [
        ForceResetter(),
        InsertionSortCollider([
                Bo1_GridConnection_Aabb(),
        ]),
        InteractionLoop(
                [Ig2_GridNode_GridNode_GridNodeGeom6D()], [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True, setCohesionOnNewContacts=False)],
                [Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]
        ),
        NewtonIntegrator(gravity=(0, 0, -10), damping=0.1, label='newton'),
        #VTKRecorder(iterPeriod=10000, recorders=['spheres','facets','boxes','stress','colors','intr'], fileName='vtkrecorder/p1-'),
        PyRunner(command='history()',iterPeriod=1),
        PyRunner(command='plotAddData1()',iterPeriod=100),

]

spherematid = O.materials.append(
        CohFrictMat(
                young=1.74e9,#1.74e9,
                alphaKr=2,
                alphaKtw=2,
                poisson=0.5,
                density=800,
                frictionAngle=radians(10),
                normalCohesion=9e9,
                shearCohesion=9e9,
                momentRotationLaw=True,
                label='spheremat'
        )
)
print('spherematid',spherematid)
### Parameters of a rectangular grid ###

L = 2.1 #length [m] aperture size = 30 mm, grid_gap=35 mm
l = 2.1 #width [m]
nbL =60 #number of grids for the length [#]
nbl =60 #number of grids for the width [#]
nbLL = nbL+1
nbll = nbl+1 #number of nodes for the width
rrr = 0.0025 #L / 100. #radius
color = [255. / 255., 102. / 255., 0. / 255.]
nodesIds1 = []
#Create all nodes first :
for i in range(0, nbLL):
 for j in range(0, nbll):
  nodesIds1.append(O.bodies.append(gridNode([i * L / nbL, j * l / nbl, 0], rrr, wire=True, fixed=False, material='spheremat', color=color)))

#print(nodesIds[:-1])
ConnectionIds1 = []
#Create connection between the nodes
for i in range(0, len(nodesIds1)):
 for j in range(i + 1, len(nodesIds1)):
  dist = (O.bodies[i].state.pos - O.bodies[j].state.pos).norm()
  if (dist <= l / nbl * 1.01):
   ConnectionIds1.append(O.bodies.append(gridConnection(i, j, rrr, color=color))) #
print(ConnectionIds1)
leftNode1 = [O.bodies[s] for s in nodesIds1 if O.bodies[s].state.pos[0]<leftTensilePos] #left node
rightNode1 = [O.bodies[s] for s in nodesIds1 if O.bodies[s].state.pos[0]>rightTensilePos]#right node

for s in leftNode1:
 s.shape.color = (1,0,0)
 s.dynamic = False

vel = 0

def history():
 for s in leftNode1:
  s.shape.color = (1,0,0)
  s.state.blockedDOFs = 'xyzXYZ'
  s.state.vel = (-vel,0,0)

def plotAddData1():
 f_leftNode1 = sum(O.forces.f(b.id)[0] for b in leftNode1)
 f_rightNode1 = sum(O.forces.f(b.id)[0] for b in rightNode1)

 f_both1 = .5*(-f_rightNode1+f_leftNode1)
 f1 =f_leftNode1
 strain1 = (rightNode1[0].state.displ()[0] - leftNode1[0].state.displ()[0]) / (mx-mm)*100 #[%]
 height1=rightNode1[0].state.refPos[2]-rightNode1[0].state.pos[2]
 plot.addData(
  i = O.iter,
  f_both1 = f_both1,
  height1 = height1,
  strain1 = strain1,
 )

plot.plots = { 'i':('height1',), }

plot.plot()
O.dt = 0.5*PWaveTimeStep()
O.saveTmp()
qt.View()

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Wang Yaqiong (wangyaqiong) said :
#1

I found that if I change "O.saveTmp()" into “O.run()”, no "segmentation fault" is printed and the program works well.

The problem seems to be fixed.

But I don't know that's why.

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

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

Probably because the problem was in O.saveTmp(), and if you do not use it, the problem has no way to occure..
Cheers
Jan