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

Robert Caulk proposed the following answer:
Hello,

No, you cannot use randomDensePack to do this. But you can very easily
replicate randomDensePack action by increasing particle radii yourself
according to the stresses on the walls.

Add a pyrunner to your engines list:

PyRunner(command='addStress()',dead=1,iterPeriod=10,label='loadSample')

Then add the following function to your script:

## Set mn,mx. They should be the values you used to create the aabbWalls. 
'walls' should be a list of the ids of your walls. 
multiplier = 1.001

def addStress():
        global multiplier
        preStress = 5e3
        maxMultiplier=1.001
        growParticles(multiplier)
        pressure = 0

        for i in walls:
                f = O.bodies[i]
                a = mn[0]*mn[1] 
                force = O.forces.f(f.id,sync=True)
                pressure = pressure + np.linalg.norm(force)/a 

        stabCoeff = abs((abs(pressure/len(walls))-preStress)/preStress)
        facetStress = abs(pressure/len(walls))
        print('unbalanced force:',unbalancedForce(),'avg top pressure 
',facetStress ,'stability coeff ',stabCoeff)
        multiplier = 1+(preStress-facetStress)/preStress * (maxMultiplier-1.)
        if multiplier <= 0.95: multiplier=0.95
        print('multiplier adjusted up to ', multiplier)

        if stabCoeff<0.001: 
            print('packing finished, export it to file ;)')
            loadSample.dead = 1
            O.pause()


I hope it is obvious that this should not be active during any scientific 
simulation, this is just to achieve a dense packing. Best practice would be to 
export this packing to file using export.textExt() and then import that packing 
into whatever you need to do. I leave the export/import up to you as homework 
;).

Cheers,

Robert

-- 
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     : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to