← 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

    Status: Answered => Open

Fu zuoguang is still having a problem:
Dear Jan Stránsky :
    I am sorry for not giving all details of my script for you, so all the incorrect scripts are as folllw:
### 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=4e6,ks=4e6,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 = 0.01,strainRate2 = 0.01,
)
# 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():
    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()
       O.loadTmp('qw')
 
### control flow ###
# particles generation
O.periodic=1
O.cell.setBox(7,7,7)
sp=pack.SpherePack()
sp.makeCloud((0,0,.5),(7,7,.5),rMean=-1,rRelFuzz=0,num=800,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=.1),
	PyRunner(command='checkUnbalanced()',iterPeriod=200)
]
# calculation steps defination
O.dt = 2e-4
O.run()
#########################################################################################
O.loadTmp('qw')
triax01=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 = False,stressControl_3 = True,
	computeStressStrainInterval =10,
	sigma_iso = 1.25e5,
	sigma1 = 1.25e5,
	sigma2 = 1.25e5,
#	sigma3 = 1.25e5,
	strainRate1 = 0.001,strainRate2 = 0.15,
)
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),
	triax01,
	NewtonIntegrator(damping=.1),
]
# calculation steps defination
O.dt = 2e-4
O.run(10000,True)

(1).The python shell provide me an error warning that can be expressed as that:
"terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
what():  boost::lock_error
Aborted (core dumped)"
But I divide this script into two parts in order to inheriting initial state to the second-step simulation and the second part of this script starts with "O.loadTmp('qw')". It's worth mentioning that I copy all the details of the second script and paste them to YADE shell instead of making them be read by YADE shell directly. So it can work well. I do not know why this phenomenon appear.

(2).I need to do post-processing with third-party software after the simulation task is over. So it is essential for me to record all the variables I want to get in a independent txt, of which the framework is like(I want to get the displacement field of specimen):
"particles' id   X-cord   Y-cord   X-cord  radius disp-1  disp-2  disp-3" 
I failed to find any example for "disp" getting, please tell me how to write the py script for this purpose.

(3).The color of particles is randomly assigned in the process of particles generation accord to my script and I can hardly distinguish the statement of particles after simulation stopped. So I 
intend to define theirs color in special needs and the first step of this work is to define appropriate partition of specimen. Is this can be achieved in YADE and how can I do to accomplish it?

Seeking your help!

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