New question #652261 on Yade:
https://answers.launchpad.net/yade/+question/652261

what i did is use another softeware in Windows system to send a strain to Yade, 
and then Yade will send back the stress. so you cannnot test it only using 
Yade. However, the question i faced is that no matter how i change the young of 
balls, the stress are all the same in the beginning steps.
the STAIN at the beginning steps are:
[0,0,0]
[0,0,0]
[1e-7,0,0]
[0,1e-7,0]
[0,0,1e-7]

i have tested the young:     
b.material.young = 1.0001*17e10
17e10
17e5


the code in YADE is:


arrcc =[0]*3  # last step strain(commit)
arrtt =[0]*3  # last step strain(trail)
scc=[0]*3 # last step stress
orst=1   # initialize the orginal save document(trial)
check=[0]*1
check[0]=0

# load the identical package
O.load('/tmp/cccc.gz')  # only load the package, because the O.cell.velGrad is 
not compatible with the peri3dcontroller eigine


#O.periodic=True   ### note!!!  add
O.dt=1e-8 

# see the example of peri3dcontroller, 1.5 is used to speed up the computation
EnlargeFactor=1.5 
EnlargeFactor=1.0
O.engines=[
        ForceResetter(),
        
InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=EnlargeFactor,label='bo1s')]),
        InteractionLoop(
                
[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=EnlargeFactor,label='ig2ss')],
                [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
        NewtonIntegrator(),
        
#VTKRecorder(fileName='3dsecond-vtk-',recorders=['all','cpm'],iterPeriod=4999),

]

O.cell.velGrad=utils.Matrix3(0,0,0,0,0,0,0,0,0)
O.step()
bo1s.aabbEnlargeFactor=ig2ss.interactionDetectionFactor=1.               # 
O.step and change 1.5 back to 1. , because the concrete model is developed in 
the 1. environment




def response(msg):
        # change the form of message
        aa = msg.split(',')     # aa[0]:judge(11trial 22commit)    
aa[1-3]:current strain
        global arrcc
        global arrtt
        global scc
        global orst



        print aa[0]            
        print aa[1]
        print aa[2]
        print aa[3]
        arr=[0]*3                # change form, the current strain
        judge=[0]*1              # judge the state, commit or trial
        judge[0]= string.atoi(aa[0])
        
        if judge[0]==11:
                print "This is set trial strain"
                for b in O.bodies:
                        b.material.young = 1.0001*17e10

                if orst==1:
                        print "orst1"
                        orst=2
                        for i in range(0,3):
                                arr[i] = string.atof(aa[i+1])         # noted, 
start from i+1
                                arr[i] = arr[i]/100000000           # because 
the send message can't reach the wanted precise                   

                        ag = [0]*3               #  current - last   ie. the 
changed strain
                        ag[0] = arr[0] - arrcc[0]
                        ag[1] = arr[1] - arrcc[1]
                        ag[2] = arr[2] - arrcc[2]
                        ns=100 
                        dstrain = utils.Matrix3(ag[0],ag[2],0,0,ag[1],0,0,0,0)  
    # the goal strain xx xy xz, yx yy yz, zx zy zz                              
           
                        O.cell.velGrad=dstrain/(ns*O.dt)
                        O.run(ns,True)                                          
     
                        stressValue=utils.getStress()
                        stressxx=stressValue[0,0]                               
    # the return stress xx
                        stressyy=stressValue[1,1]                               
    # the return stress yy
                        stressxy=(stressValue[0,1]+stressValue[1,0])/2          
    # the return stress xy = (xy + yx)/2
                        
                        scc[0]=stressxx                # the former error, miss 
the save of the former stress!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                        scc[1]=stressyy
                        scc[2]=stressxy
                        
                        arrtt[0]=arr[0]          # update the trial strain
                        arrtt[1]=arr[1]
                        arrtt[2]=arr[2]
                        O.saveTmp('first')              # initialize the 
orginal save document(trial)   
                else:
                        O.loadTmp('first')
                        print "orst2"                   
                        for i in range(0,3):
                                arr[i] = string.atof(aa[i+1])
                                arr[i] = arr[i]/100000000           # because 
the send message can't reach the wanted precise 
                        print "arr"
                        print arr[0]  #xx
                        print arr[1]  #yy
                        print arr[2]  #xy
                        ag = [0]*3               #  current - last   ie. the 
changed strain
                        ag[0] = arr[0] - arrcc[0]
                        ag[1] = arr[1] - arrcc[1]
                        ag[2] = arr[2] - arrcc[2]
                        print "ag"
                        print ag[0]
                        print ag[1]
                        print ag[2]

        
                        # decide whether need to compute
                        if check[0] == 1 and ag[0]==0 and ag[1]==0 and ag[2]==0:
                                stressxx = scc[0]
                                stressyy = scc[1]
                                stressxy = scc[2]
                                
                        else:
                                check[0] = 1 
                                ns=100
                                dstrain = 
utils.Matrix3(ag[0],ag[2],0,0,ag[1],0,0,0,0)      # the goal strain xx xy xz, 
yx yy yz, zx zy zz
                                O.cell.velGrad=dstrain/(ns*O.dt)
                                O.run(ns,True)                                  
             

                        stressValue=utils.getStress()
                        stressxx=stressValue[0,0]                               
    # the return stress xx
                        stressyy=stressValue[1,1]                               
    # the return stress yy
                        stressxy=(stressValue[0,1]+stressValue[1,0])/2          
    # the return stress xy = (xy + yx)/2

                msg=str(stressxx)+','+str(stressyy)+','+str(stressxy)
                print msg
                print 'transformation'
                print O.cell.trsf                                           # 
the goal strain
                c.send(msg)



while True:
        msg = c.recv(1024)           # get the message (strain)
        print addr, ' >> ', msg
        response(msg)



-- 
You received this question notification because your team yade-users 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