Position of particles become NaN after using Break Function
Hi everyone, I’m trying to use Break Function in a three-axis simulation, but I always get an error after doing Clump replacement: numpy.linalg.
from yade import pack,plot
from bf import stressTensor, checkFailure, replaceSphere, evalClump
import time
readParamsFromT
key='4e5'
)
from yade.params.table import *
starttime=
unknownOk=True
#Parameters
young=8e8
poisson=0.05
density=2810
num_spheres=1000
rMean=0.18
msgoal=-10e3
msdegree=
finalFricDegree
rate=-0.002#Shear rate (% / s)
mskr=float(
finalkr=
ktw=0
mn,mx=Vector3(
stabilityThresh
#Particle breaking control parameters
radius_ratio = 3
tension_
compressive_
wei_V0= (pi * (0.45)**3) * 4 / 3
wei_P=0.63
wei_m=2.2
discretization = 20
ifweibull=True
relative_gap = 0
grow_radius = 1
max_scale = 5
initial_
count_broken_
#min_radius_
#Create a material (density unit:Kg/ m ^ 3)
O.materials.
sp=SpherePack()
#Making Ball
sp.makeCloud(
rMean=rMean,
minCorner=mn,
maxCorner=mx,
rRelFuzz=.33,
num=num_spheres,
#porosity=
)
sp.toSimulation()
## Create boundaries around the Bodies
O.materials.
walls=aabbWalls
wallIds=
triax=TriaxialS
wall_bottom_
wall_top_
wall_left_
wall_right_
wall_back_
wall_front_
internalCompac
stressMask=7,
goal1=msgoal,
goal2=msgoal,
goal3=msgoal,
maxMultiplier=1. + 1e-4, # spheres growing factor (fast growth)
finalMaxMultip
max_vel=1,#(m/s)
label="triax",
#thickness=0,
)
cbcontroller=
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
krot=mskr,
ktwist=ktw,
)
],
[Law2_
includeMomen
)]
),
GlobalStiffnes
triax,
PyRunner(
cbcontroller,
NewtonIntegrat
]
O.trackEnergy = True
## a function saving variables
def history():
plot.addData(
e11=
ev=100*
s11=
s22=
s33=
diffstress=
Etot=
i=O.iter,
**O.energy
)
plot.plots={
'i':('
'i ':('s11'
' i':(O.energy.
'e22':
}
def updateFile(file):
"""
mod record txt for OrigionLab
"""
import re
f=open(file, "r", encoding="utf-8")
l=f.readlines()
l[0]=re.
del l[1]
f=open(
f.writelines(l)
f.close()
def clumpUpdate(
mn_box=
mx_box=
outer_
global count_broken_
for i in range(
len(O.bodies)
):
b = O.bodies[i]
if not b == None:
if isinstance(b.shape, Clump):
clump_broken = evalClump(
b.id,
radius_ratio,
tension_
compressi
outer_
max_
grow_
relative_
discretiz
weibull=True,
wei_
wei_P=wei_P,
wei_m=wei_m
)
# refresh time step
if clump_broken:
count_
print('Broken particles:
def mainlogic():
#stage 1
cbcontroller.
while 1:
O.run(1000, True)
unb=unbalance
print('Stage 1 :unbalanced force:{:.3},mean Stress:
if unb<stabilityTh
print("### Stage 1 Complete! Balls Created ###")
break
midtime=
print('time spended:
relRadList2 = [.5, 1, .5]
relPosList2 = [[1, 0, 0], [0, 0, 0], [-1, 0, 0]]
templates = []
templates.
#replace by 10%
O.bodies.
triax.goal2=msgoal
triax.goal1=msgoal
triax.goal3=msgoal
#stage 2
while 1:
O.run(1000, True)
unb=unbalance
print('Stage 2 :unbalanced force:{:.3},mean Stress:
if unb<stabilityTh
print("### Stage 2 Complete! Clumps Created ###")
break
print('time spended:
midtime=
cbcontroller.
#Isotropic loading
compressgoal=
triax.
triax.
triax.
triax.
compFricDegree=0
setContactFric
while 1:
O.run(1000, True)
#the global unbalanced force on dynamic bodies, thus excluding boundaries, which are not at equilibrium
unb=unbalance
print('Isotropic loading:unbalanced force:{:.3},mean Stress:
if unb<stabilityTh
break
print("### Isotropic loading Complete ###")
triax.
setContactFric
plot.plot()
#set stress control on x and z, we will impose strain rate on y
triax.stressMask = 5
#now goal2 is the target strain rate
triax.goal2=rate
# we define the lateral stresses during the test, here the same 10kPa as for the initial confinement.
triax.
triax.
triax.
triax.
triax.
for i in O.interactions:
i.phys.kr=finalkr
while 1:
O.run(1000, True)
print('Partial stress:
if -triax.
break
plot.saveDataT
updateFile(
mainlogic()
I have searched online for similar problems, but I couldn’t find any solution. Any help or suggestion would be greatly appreciated. Thank you in advance.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Karol Brzezinski
- Solved:
- Last query:
- Last reply: