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

Fu zuoguang gave more information on the question:
Dear Jan Stránský and Bruno Chareyre:
     Thanks for helping me last time, so in order to achieve "clumps in 2D 
simulation", I should try my best to test "particles-generation from PFC to 
YADE", but at the beginning of this task, I failed to import the "particles 
information.txt" to YADE and the question can be described as that:
(1). There is a "particles information.txt" recording the basic infomation 
about the particles with the format "x_y_z_r", there is nothing wrong in it.
(2). I employ these orders "O.bodies.append(ymport.text('qq.txt'))" to make a 
correct importing.
(3). After importing finished(all the particles can be recogized by YADE),I 
wanna start my 2D-simulation but fail, because all the particles disaapear at 
the beginning of simulation, so I can see nothing but the walls in screen. 
(4). there may be something wrong in my script, since the importing order can 
be sucessfully used in examples provided by YADE.
I don know where is wrong and seek your help!(all script and sphere.txt are 
below)

Filename='2D-simulation-vertex'
from yade import pack,os,utils,ymport

################################# preprocessing for simulation 
##########################################  
### prescribing variables and functions for simulation controller ###
# material defination
spheremat = 
O.materials.append(FrictMat(poisson=0.5,density=2500,young=1e10,frictionAngle=0.5))
wallmat = 
O.materials.append(FrictMat(poisson=0.5,density=0,young=1e10,frictionAngle=0))
# walls defination
mn,mx=Vector3(0,0,0),Vector3(0.06,0.06,0.1)
wallids=O.bodies.append(utils.aabbWalls([mn,mx],thickness=.00001,material=wallmat))
# ThreeDTriaxialEngine defination for initial-state determination(the first 
calculation step)
triax01=TriaxialStressController(
        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, 
        stressMask=7,
        goal1=30000,
        goal2=30000,
        goal3=30000,
        max_vel=5,
)
# ThreeDTriaxialEngine defination for triaxial compression(the second 
calculation step)
triax02=TriaxialStressController(
        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, 
        stressMask = 5,
        goal2=-100,
        goal1=30000,
        goal3=30000,
)
################################# control flow for simulation 
##########################################  
# particles generation
O.periodic=1
O.cell.setBox(0.06,0.06,0.06)
sp=pack.SpherePack()
O.bodies.append(ymport.text('sphere.txt'))
sp.toSimulation(material=spheremat)
# determining colors for particles in different aeras of the cell
for b in O.bodies:
    if isinstance(b.shape,Sphere):
         pos = b.state.pos
         if pos[0] <0.03 and pos[1] < 0.03: b.shape.color = (1,0,0)       # 
area 1
         elif pos[0] >= 0.03 and pos[1] <0.03: b.shape.color = (0,1,0)    # 
area 2
         elif pos[0] >= 0.03 and pos[1] >= 0.03: b.shape.color = (0,0,1)  # 
area 3
         elif pos[0] < 0.03 and pos[1] >= 0.03: b.shape.color = (0,10,1)  # 
area 4
         else: b.shape.pos = (1,1,0)        
O.periodic=0
# blockedDOFs
for b in O.bodies:
        if isinstance(b.shape,Sphere):
                 b.state.blockedDOFs='zXY'
# Simulation assembly for the first step
O.engines=[
        ForceResetter(),
        
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb(),Bo1_Wall_Aabb()]),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
                [Ip2_FrictMat_FrictMat_FrictPhys()],
                [Law2_ScGeom_FrictPhys_CundallStrack()]
        ),
        
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
        triax01,
        NewtonIntegrator(damping=.1),
        PyRunner(command='resultfirst()',iterPeriod=1000)
]
# first step of simulation startting with a correct inheriting for the next step
O.dt=utils.PWaveTimeStep()
def resultfirst():
        f = file("/home/fzg/fu/result-first-01.dat",'w')
        wall_left = O.bodies[0].state.pos[0]
        wall_right = O.bodies[1].state.pos[0]
        wall_bottom = O.bodies[2].state.pos[1]
        wall_top = O.bodies[3].state.pos[1]
        wall_back = O.bodies[4].state.pos[2]
        wall_front = O.bodies[5].state.pos[2]
        x_dimension = wall_right - wall_left
        y_dimension = wall_top - wall_bottom
        #z_dimension = wall_front - wall_back
        area = x_dimension * y_dimension
        porosity = (area-sum(pi*b.shape.radius**2 for b in O.bodies if 
isinstance(b.shape,Sphere)))/area
        print porosity
#       f.write('%-16g %-16g %-16g %-16g 
\n'%(area,porosity,x_dimension,y_dimension)),
#       f.close()
O.run(30000,True)
O.wait()

sphere.txt:
0.019 0.001 0.05 0.0008
0.021 0.001 0.05 0.0008
0.023 0.001 0.05 0.0008
0.025 0.001 0.05 0.0008
0.027 0.001 0.05 0.0008
0.029 0.001 0.05 0.0008
0.031 0.001 0.05 0.0008
0.033 0.001 0.05 0.0008
0.035 0.001 0.05 0.0008
0.037 0.001 0.05 0.0008
0.039 0.001 0.05 0.0008
0.041 0.001 0.05 0.0008
0.043 0.001 0.05 0.0008
0.045 0.001 0.05 0.0008
0.047 0.001 0.05 0.0008
0.049 0.001 0.05 0.0008
0.051 0.001 0.05 0.0008
0.053 0.001 0.05 0.0008
0.055 0.001 0.05 0.0008
0.057 0.001 0.05 0.0008
0.059 0.001 0.05 0.0008
0.001 0.003 0.05 0.0008
0.003 0.003 0.05 0.0008
0.005 0.003 0.05 0.0008

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

_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to