← Back to team overview

yade-users team mailing list archive

Re: [Question #700903]: How to call the set function again

 

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

    Status: Needs information => Open

孙灿 gave more information on the question:
I'm sorry the information I provided is not accurate enough.
Relevant codes are as follows:
def Output():
    e22=-triax1.strain[1]
    #particle info
    f = open('./pdata/pInfo'+'{:.5f}'.format(e22-ini_e22a), 'w')
    print (('Particle information at Iter %d' % O.iter),file=f)

    f.write('Box position: \n')
    print (('left wall: %.5f %.5f %.5f' % (O.bodies[2].state.pos[0], O.bodies[2].state.pos[1], O.bodies[2].state.pos[2])),file=f)
    print (('right wall: %.5f %.5f %.5f' % (O.bodies[3].state.pos[0], O.bodies[3].state.pos[1], O.bodies[3].state.pos[2])),file=f)
    print (('top wall: %.5f %.5f %.5f' % (O.bodies[1].state.pos[0], O.bodies[1].state.pos[1], O.bodies[1].state.pos[2])),file=f)
    print (('bottom wall: %.5f %.5f %.5f' % (O.bodies[0].state.pos[0], O.bodies[0].state.pos[1], O.bodies[0].state.pos[2])),file=f)
    print (('front wall: %.5f %.5f %.5f' % (O.bodies[5].state.pos[0], O.bodies[5].state.pos[1], O.bodies[5].state.pos[2])),file=f)
    print (('back wall: %.5f %.5f %.5f' % (O.bodies[4].state.pos[0], O.bodies[4].state.pos[1], O.bodies[4].state.pos[2])),file=f)

    f.write('ID x y z radius disx disy disz rotx roty rotz \n')
    for b in O.bodies:
        if isinstance(b.shape, Sphere):
            print (b.id,b.state.pos[0],b.state.pos[1],b.state.pos[2],b.shape.radius,b.state.displ()[0],b.state.displ()[1],b.state.displ()[2],b.state.rot()[0],b.state.rot()[1],b.state.rot()[2],file=f)
            
    f.close()

    #contact info
    g = open('./cdata/cInfo'+'{:.5f}'.format(e22-ini_e22a), 'w')
    print (('Contact information at Iter %d' % O.iter),file=g)
    g.write('ctype id1 id2 nfx nfy nfz tfx tfy tfz \n')
    
    for k in O.interactions:
        if isinstance(O.bodies[k.id1].shape,Sphere) and isinstance(O.bodies[k.id2].shape,Box):
            print ('01',k.id1,k.id2,k.phys.normalForce[0], k.phys.normalForce[1],k.phys.normalForce[2],k.phys.shearForce[0],k.phys.shearForce[1],k.phys.shearForce[2],file=g)
        elif isinstance(O.bodies[k.id1].shape,Box) and isinstance(O.bodies[k.id2].shape,Sphere):
            print ('10',k.id1,k.id2,k.phys.normalForce[0], k.phys.normalForce[1],k.phys.normalForce[2],k.phys.shearForce[0],k.phys.shearForce[1],k.phys.shearForce[2],file=g)
        elif isinstance(O.bodies[k.id1].shape,Sphere) and isinstance(O.bodies[k.id2].shape,Sphere):
            print ('00',k.id1,k.id2,k.phys.normalForce[0], k.phys.normalForce[1],k.phys.normalForce[2],k.phys.shearForce[0],k.phys.shearForce[1],k.phys.shearForce[2],file=g)

    g.close()
Output()


This string of code can get the particle information (ID, radius and coordinates). I only use it to get the particle information before the code runs, and I don't know how to use this string of code again to get the particle information (coordinates).

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.