← Back to team overview

yade-users team mailing list archive

Re: [Question #224128]: How to learn and start a 2D simulation in YADE

 

Question #224128 on Yade changed:
https://answers.launchpad.net/yade/+question/224128

Fu zuoguang gave more information on the question:
Dear Jan Stránsky and Bruno Chareyre:
     Thanks for helping me last time, now I can successfully achieve the initial state determination in my 2D Simulation with this script:

### fundamental details of application ###
# filename: initial-state.py
# unicode: UTF-8 
from yade import pack,qt,plot

### prescribing variables ###
# material defination
spheremat = O.materials.append(ViscElMat(kn=4e5,ks=4e5,cn=.0,cs=.0,density=1500,frictionAngle=25.565))
wallmat = O.materials.append(ViscElMat(kn=1e8,ks=1e8,cn=.0,cs=.0,density=2600,frictionAngle=25.565))
# wallIds defination
mn,mx=Vector3(0,0,0),Vector3(7,7,1)
wallIds=O.bodies.append(utils.aabbWalls([mn,mx],thickness=.01,material=wallmat))
# ThreeDTriaxialEngine defination
triax=ThreeDTriaxialEngine(
	wall_bottom_id=wallIds[2],wall_top_id=wallIds[3],
	wall_left_id=wallIds[0],wall_right_id=wallIds[1],
	wall_back_id=wallIds[4],wall_front_id=wallIds[5],
	wall_front_activated = False,wall_back_activated = False,
	internalCompaction=False, 
	stressControl_1 = True, stressControl_2 = True,stressControl_3 = True,
	computeStressStrainInterval =10,
	sigma_iso = 1.25e5,
	sigma1 = 1.25e5,
	sigma2 = 1.25e5,
	sigma3 = 1.25e5,
	strainRate1 = .02,strainRate2 = .02,
)
# Simulation controller defination 
unb=unbalancedForce()
meanS=(triax.stress(triax.wall_right_id)[0]+triax.stress(triax.wall_top_id)[1])/2

### functions defination ###
def checkUnbalanced():
    unb=unbalancedForce()
    meanS=(triax.stress(triax.wall_right_id)[0]+triax.stress(triax.wall_top_id)[1])/2
    q=unb
    r=abs(meanS-triax.sigma_iso)/triax.sigma_iso
    if q<0.01 and r<1e-5:
         O.pause()

### control flow ###
# particles generation
O.periodic=1
O.cell.setBox(7,7,1)
sp=pack.SpherePack()
sp.makeCloud((0,0,.5),(7,7,.5),rMean=.145,rRelFuzz=0,num=300,periodic=True)
sp.toSimulation(material=spheremat)
O.periodic=0
# blockedDOFs
for b in O.bodies:
	if isinstance(b.shape,Sphere):
		 b.state.blockedDOFs='zXY'
# Simulation defination
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Wall_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
		[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
		[Law2_ScGeom_ViscElPhys_Basic()]
	),
	GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
	triax,
	NewtonIntegrator(damping=.2),
	PyRunner(command='checkUnbalanced()',iterPeriod=200)
]
# calculation steps defination
O.dt = 2e-4
O.run()
### ends ###

     It is a great step in my process of studying YADE, but now I still have two questions to ask, which are as follow:
(1). I have made a little changes in"### functions defination ###"as that I move

"unb=unbalancedForce()
meanS=(triax.stress(triax.wall_right_id)[0]+triax.stress(triax.wall_top_id)[1])/2
q=unb
r=abs(meanS-triax.sigma_iso)/triax.sigma_iso"

from"### functions defination ###" to "# Simulation controller
defination" and the script transform into

"# Simulation controller defination 
unb=unbalancedForce()
meanS=(triax.stress(triax.wall_right_id)[0]+triax.stress(triax.wall_top_id)[1])/2
q=unb
r=abs(meanS-triax.sigma_iso)/triax.sigma_iso
### functions defination ###
def checkUnbalanced():
     if q<0.01 and r<1e-5:
         O.pause()".
         
The simulation can not auto-pause when it obtains the check condition. I don not know why and seek your help!

(2).I have borrowed the method of particles generation Professor Bruno
Chareyre last time gave me, which is that:

"O.periodic=1
O.cell.setBox(7,7,1)
sp=pack.SpherePack()
sp.makeCloud((0,0,.5),(7,7,.5),rMean=-1,RelFuzz=0,num=300,periodic=True)
O.bodies.append([utils.sphere(s[0],s[1]) for s in sp])"

after using it for calculation, the shell bring me the error warning:
"FATAL /build/buildd/yade-0.80.1/pkg/common/InsertionSortCollider.cpp:459 spatialOverlapPeri: Body #1 spans over half of the cell size 1 (axis=1, min=-1.75, max=-1.25, span=0.5, see flag allowBiggerThanPeriod)
FATAL /build/buildd/yade-0.80.1/core/ThreadRunner.cpp:31 run: Exception occured:
/build/buildd/yade-0.80.1/pkg/common/InsertionSortCollider.cpp: Body larger than half of the cell size encountered."
 
I don not know why and seek your help!

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.