yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #18986
[Question #678494]: Segmentation fault (core dumped) O.bodies.append
New question #678494 on Yade:
https://answers.launchpad.net/yade/+question/678494
Hi,
I'm trying to build up a simulation for direct shear test. However, whenever I try to run the script, an error comes out "segmentation fault (core dumped)". I noticed that other researchers had asked similar question in Launchpad, but I still can't find a solution to my problem here. If this script of mine is working properly, the sequence of simulation should be as follow:
create periodic box > generate spheres > delete periodic box > create shear box > move bottom shear box
I hope to get some advice on how to solve this problem of mine.
Thank you and regards,
Nicholas Ng
***My script is as follow:
==========================================================================================
# create shear box with shear gap
# from direct_shear_test_209.py
from yade import pack,qt,plot
O=Omega()
# ===================add material for DE particles=============================================
O.materials.append(FrictMat(young = 1E7, poisson = 0.25, frictionAngle = 0.6, density = 2650))
# add material for side walls
O.materials.append(FrictMat(young = 1E7, poisson = 0.25, frictionAngle = 0.0, density = 2650))
# add material for top and bottom walls
O.materials.append(FrictMat(young = 1E7, poisson = 0.25, frictionAngle = 0.8, density = 2650))
# =============================================================================================
# ========================================================
# size of the periodic shear box
p_L_x, p_L_y, p_L_z = 0.03, 0.01, 0.01
# size of the shear box
# L_y is half the height of shear box
L_x, L_y, L_z = 0.03, 0.01/2, 0.01
gap=0.00065
half_gap=gap/2
# ==========================================================
# ===================add sphere parameters======================
sp=pack.SpherePack()
min_corner = Vector3(0,0,0)
max_corner = Vector3(L_x,L_y*2,L_z)
psd_sizes = [0.000075,0.00015,0.0003,0.0006,0.00118,0.00236]
psd_sizes_10 = [0.00075,0.0015,0.003,0.006,0.0118,0.0236]
radius_mean = 0.002/2
psd_cumm = [0,0.22,0.32,0.51,0.95,1.0]
r_relFuzz = 0.2
# ===============================================================
# ==============add velocity parameter=================
direction_left = Vector3(-1,0,0)
velocity = 0.005
# =====================================================
##=============================== now define boxes============================================
# lower part, left wall
left_low_center, left_low_extents = (0, L_y/2-half_gap, L_z/2), (0, L_y/2, L_z/2)
# lower part, right wall
right_low_center, right_low_extents = (L_x, L_y/2-half_gap, L_z/2), (0, L_y/2, L_z/2)
# bottom wall
bot_center, bot_extents = (L_x/2, -half_gap, L_z/2), (L_x/2, 0, L_z/2)
# lower part, behind wall
behind_low_center, behind_low_extents = (L_x/2, L_y/2-half_gap, 0), (L_x/2, L_y/2, 0)
# lower part, front wall
front_low_center, front_low_extents = (L_x/2, L_y/2-half_gap, L_z), (L_x/2, L_y/2, 0)
# upper part, left wall
left_upper_center, left_upper_extents = (0, 3*L_y/2+half_gap, L_z/2), (0, L_y/2, L_z/2)
# upper part, right wall
right_upper_center, right_upper_extents = (L_x, 3*L_y/2+half_gap, L_z/2), (0,L_y/2, L_z/2)
# top wall
top_center, top_extents = (L_x/2, 2*L_y+half_gap, L_z/2), (L_x/2, 0, L_z/2)
# upper part, behind wall
behind_upper_center, behind_upper_extents=(L_x/2,3*L_y/2+half_gap,0),(L_x/2,L_y/2, 0)
# upper part, front wall
front_upper_center, front_upper_extents = (L_x/2, 3*L_y/2+half_gap,L_z), (L_x/2,L_y/2, 0)
## generate two additional panels at the middle height of the sample to avoid
# particles from falling out during shearing, the two panels will be expanded
# following shearing process.
# left panel
# left_panel_center, left_panel_extents = (0, L_y, L_z/2), (0, 0, L_z/2)
# right panel
# right_panel_center, right_panel_extents = (L_x, L_y , L_z/2), (0, 0, L_z/2)
left_panel_center, left_panel_extents = (-L_x/4, L_y+half_gap, L_z/2), (L_x/4, 0, L_z/2)
right_panel_center, right_panel_extents = (5*L_x/4, L_y-half_gap, L_z/2), (L_x/4, 0, L_z/2)
# =============================================================================================
# =========================add periodic box=================
O.periodic=True
O.cell.hSize=Matrix3(p_L_x, 0, 0,
0 ,p_L_y*2, 0,
0, 0, p_L_z)
# ==========================================================
#======================= append spheres to bodies=============================
sp=pack.SpherePack()
# sp.makeCloud(minCorner=min_corner,maxCorner=max_corner,psdSizes=psd_sizes,psdCumm=psd_cumm,distributeMass=True)
sp.makeCloud(minCorner=min_corner,maxCorner=max_corner,rMean=radius_mean,distributeMass=True,num=200,periodic=True)
# sp.toSimulation()
O.bodies.append([sphere(s[0],s[1]) for s in sp])
# =============================================================================
# ===========================add engines=================================================
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=.05*radius_mean),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
#PeriTriaxController(maxUnbalanced=0.01,relStressTol=0.02,goal=[-1e4,-1e4,0],stressMask=3,globUpdate=5,maxStrainRate=[1.,1.,1.],doneHook='triaxDone()',label='triax'),
#using cell inertia
NewtonIntegrator(damping=.2),
# PyRunner(command='addPlotData()',iterPeriod=100),
# qt.SnapshotEngine(fileBase='/home/nng/Shared/DST/from Irfaan/direct_shear_test_208/Snapshot_208b',label='snapper',iterPeriod=100),
# generate top wall after iter 50,000
PyRunner(command='deletePeriodicBox()', realPeriod=5, label='checker')
]
O.dt=1e-5*PWaveTimeStep()
# O.run();
# qt.View()
# =======================================================================================
# ===============define function to delete periodic box=============
def deletePeriodicBox():
O.periodic=False
print("Successfully delete periodic box!")
checker.command='generateShearBox()'
# =================================================================
# ===================now add walls to simulation========================================
def generateShearBox():
global leftBox_low
leftBox_low = utils.box(center = left_low_center, extents = left_low_extents, fixed = True, wire = True, material = O.materials[1])
rightBox_low = utils.box(center = right_low_center, extents = right_low_extents, fixed = True, wire = True, material=O.materials[1])
botBox = utils.box(center = bot_center, extents=bot_extents, fixed = True, wire = True, material=O.materials[2])
behindBox_low = utils.box(center = behind_low_center, extents = behind_low_extents, fixed = True, wire = True, material=O.materials[1])
frontBox_low = utils.box(center = front_low_center, extents = front_low_extents, fixed = True, wire = True, material=O.materials[1])
leftBox_upper = utils.box(center = left_upper_center, extents = left_upper_extents, fixed = True, wire = True, material=O.materials[1])
rightBox_upper = utils.box(center = right_upper_center, extents = right_upper_extents , fixed=True, wire = True, material=O.materials[1])
topBox = utils.box(center=top_center, extents = top_extents, fixed = True, wire = True, material=O.materials[2])
behindBox_upper = utils.box( center = behind_upper_center, extents = behind_upper_extents , fixed=True,wire=True,material=O.materials[1])
frontBox_upper = utils.box( center = front_upper_center, extents = front_upper_extents, fixed=True,wire=True,material=O.materials[1])
leftPanel = utils.box( center = left_panel_center, extents = left_panel_extents, fixed=True,wire=True)
rightPanel = utils.box( center = right_panel_center, extents = right_panel_extents, fixed=True,wire=True)
# add to O.bodies
leftBox_low_id = O.bodies.append(leftBox_low)
rightBox_low_id = O.bodies.append(rightBox_low)
botBox_id = O.bodies.append(botBox)
behindBox_low_id = O.bodies.append(behindBox_low)
frontBox_low_id = O.bodies.append(frontBox_low)
leftBox_upper_id = O.bodies.append(leftBox_upper)
rightBox_upper_id = O.bodies.append(rightBox_upper)
topBox_id = O.bodies.append(topBox)
behindBox_upper_id = O.bodies.append(behindBox_upper)
frontBox_upper_id = O.bodies.append(frontBox_upper)
leftPanel_id = O.bodies.append(leftPanel)
rightPanel_id = O.bodies.append(rightPanel)
print("Successfully generate shear box!")
checker.command='shearing()'
# ========================================================================================
def shearing():
# O.engines=O.engines+[TranslationEngine(ids=[leftBox_low_id,rightBox_low_id],translationAxis=direction_left,velocity=velocity,label="boxTranslation")]
O.bodies[1].state.vel=Vector3(-velocity,0,0)
O.bodies[2].state.vel=Vector3(-velocity,0,0)
O.bodies[3].state.vel=Vector3(-velocity,0,0)
O.bodies[4].state.vel=Vector3(-velocity,0,0)
O.bodies[5].state.vel=Vector3(-velocity,0,0)
O.bodies[12].state.vel=Vector3(-velocity,0,0)
--
You received this question notification because your team yade-users is
an answer contact for Yade.