← Back to team overview

yade-users team mailing list archive

Re: [Question #611087]: I got a wrong damage ratio

 

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

    Status: Open => Answered

Robert Caulk proposed the following answer:
Hello Huihuang,

I recommend you read the final post of that thread more closely ;-). You
[i]want[/i] to initialize numBroCohBonds to zero each time, because each
time this function is called you are cycling through all of the
interactions and summing all the brokenbonds.

Maybe you misunderstood what I was recommending. Here it is:

def damageRatio():
    global numBroCohBonds
    numBroCohBonds=0
    for br in O.interactions:
        if br.phys.cohesionBroken==False:
         continue
        numBroCohBonds+=1 # calculate broken bonds
    damageRatio=numBroCohBonds/float(sumCohBonds)
    print sumCohBonds,numBroCohBonds
    plot.saveDataTxt('data/damageratio.txt')

Best,

Robert

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