← Back to team overview

yade-users team mailing list archive

Re: [Question #658905]: I need to simulate uniaxial compaction

 

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

Nima Goudarzi gave more information on the question:
 Sorry mohsen. Attached please find the code. Please ignore the one I sent you in the last email.
Thanks
Nima


    On Tuesday, October 17, 2017, 5:10:23 PM CDT, Nima Goudarzi <question658905@xxxxxxxxxxxxxxxxxxxxx> wrote:  
 
 Your question #658905 on Yade changed:
https://answers.launchpad.net/yade/+question/658905

    Status: Answered => Open

You are still having a problem:
 Hi Mohsen,
Thanks sincerely for your hint. I tried to implement what you said for odeometric-like approach with no success. I'm bringing this part of my code. If possible please take a look to see if you can fix it.
from yade.pack import *from yade import utilsfrom yade import exportfrom yade import plotn_s = 2000n_band = 26# For now I'm using Sobieski's PSD. I need to change it to my own PSD latertargetPorosity= 0.422##################################################   Particle Size Distribution   ##################################################psdSizes=[5.8598400e+00,5.8761600e+00,5.8924800e+00,5.9088000e+00,5.9251200e+00,5.9414400e+00,5.9577600e+00,5.9740800e+00,5.9904000e+00,6.0067200e+00,6.0230400e+00,6.0393600e+00,6.0556800e+00,6.0720000e+00,6.0883200e+00,6.1046400e+00,6.1209600e+00,6.1372800e+00,6.1536000e+00,6.1699200e+00,6.1862400e+00,6.2025600e+00,6.2188800e+00,6.2352000e+00,6.2515200e+00,6.2678400e+00]psdCumm=[0.0,8.4945735e-05,3.5804112e-04,1.1512195e-03,3.2324246e-03,8.1658647e-03,1.8731095e-02,3.9172232e-02,7.4902028e-02,1.3132521e-01,2.1182373e-01,3.1558203e-01,4.3640887e-01,5.6352779e-01,6.8435463e-01,7.8811293e-01,8.6861145e-01,9.2503463e-01,9.6076443e-01,9.8120556e-01,9.9177079e-01,9.9670423e-01,9.9878544e-01,9.9957862e-01,9.9985171e-01,1.0]
i = 0while i < n_band:    psdSizes[i]=psdSizes[i]/1000. #scaling from [mm] to [m]    print "\r psdSizes:",i,psdSizes[i]    i = i +1
#If the bed volume is defined, then the average diameter of particles (when the target porosity is reached) is the same like in the measurement###########################################################   facetBox   ############################################################ Compaction will be in Y-Directionl = 3.5e-3h = 7.1e-3vol = l*h*l# You maybe don't need this if you use compaction from the top of the sample (using plate)
mn = Vector3(0,0,0)mx = Vector3(l,l,h/5)
O.materials.append(FrictMat(young=5e6,poisson=0.5,frictionAngle=0,density=0,label='walls'))O.materials.append(FrictMat(young=5e6,poisson=0.5,frictionAngle=radians(30),density=2600,label='spheres'))O.bodies.append(geom.facetBox((l/2,l/2,h/2),(l/2,l/2,h/2),wallMask=31,material='walls'))# This will be an open-top boxsp = yade._packSpheres.SpherePack()sp.makeCloud(mn,mx,psdSizes=psdSizes,psdCumm=psdCumm,num=n_s,distributeMass=1)O.bodies.append([sphere(s[0],s[1],material='spheres') for s in sp])Porosity = voxelPorosity(200,mn,mx)print "\r Porosity: ",Porosity,O.engines=[   ForceResetter(),   # sphere, facet, wall   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),   InteractionLoop(      # the loading plate is a wall, we need to handle sphere+sphere, sphere+facet, sphere+wall      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],      [Ip2_FrictMat_FrictMat_FrictPhys()],      [Law2_ScGeom_FrictPhys_CundallStrack()]   ),   NewtonIntegrator(gravity=(0,0,-9.81),damping=0.5),   # the label creates an automatic variable referring to this engine   # we use it below to change its attributes from the functions called   PyRunner(command='checkUnbalanced()',realPeriod=2,label='checker'),]O.dt=.5*PWaveTimeStep()
def checkUnbalanced():   # at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing is stable   if O.iter<5000: return    # the rest will be run only if unbalanced is < .1 (stabilized packing)   if unbalancedForce()>.1: return    # add plate at the position on the top of the packing   # the maximum finds the z-coordinate of the top of the topmost particle   O.bodies.append(wall(max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)]),axis=2,sense=-1))   global plate        # without this line, the plate variable would only exist inside this function   plate=O.bodies[-1]  # the last particles is the plate   # Wall objects are "fixed" by default, i.e. not subject to forces   # prescribing a velocity will therefore make it move at constant velocity (downwards)   plate.state.vel=(0,0,-.1)   # start plotting the data now, it was not interesting before   O.engines=O.engines+[PyRunner(command='addPlotData()',iterPeriod=200)]   # next time, do not call this function anymore, but the next one (unloadPlate) instead   checker.command='unloadPlate()'def unloadPlate():   # if the force on plate exceeds maximum load, start unloading   maxz=max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])   mx=maxz# Iknow this doesn't work   Por_osity=voxelPorosity(200,mn,mx)   if Por_osity <targetPorosity:      plate.state.vel=(0,0,0)
Thanks so much,
Nima

    On Tuesday, October 10, 2017, 1:04:19 AM CDT, mohsen <question658905@xxxxxxxxxxxxxxxxxxxxx> wrote:  
 
 Your question #658905 on Yade changed:
https://answers.launchpad.net/yade/+question/658905

    Status: Open => Answered

mohsen proposed the following answer:
>>Do you know how I can stop the plate (if I follow the Odeometric
approach ) when I reach to a specific porosity. I don’t use
triaxialStressController in this case. I can compact the layer but I
can’t stop the plate by target porosity criterion.

you can use:


        Por_osity=voxelPorosity(200,mn,mx)
        if Por_osity<targetPorosity:
            plate.state.vel=(0,0,0)

Be careful you should define mn and mx for each layer specifically. maxz would help to define mx:
        maxz=max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])

>>If we resolve this, I need to know how to save and load the final position in my main triaxial script:
Saving:
# creating a list with position and radius of particles
ParticlePos=[]
for b in O.bodies:
    if isinstance(b.shape,Sphere):
        ParticlePos.append([b.state.pos,b.shape.radius])

#saving the position and radius of particles
with open(str(ParticlePos.txt","wb") as f:
    pickle.dump(ParticlePos,f)

Nw Then you have a text file with position and radius of particles
Loading:
ParticlePos=[]
with open("ParticlePos.txt","rb") as f:
    ParticlePos=pickle.load(f)


Generating spheres:

while i+1<len(ParticlePos):
    # here you can optomize your grid network
    i=i+1
    c,r=ParticlePos[i]
    s = utils.sphere(c,r,material=labelS)
    O.bodies.append(s)

>>Is it possible to compact layers by triaxial goal in one direction while all other walls are deactivated?:
I think defining a plate is easier since you need to compact several layers. But you can compact the total specimen by deactivating all of wall except the desired one.


Mohsen

-- 
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/658905/+confirm?answer_id=6

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/658905

You received this question notification because you asked the question.

You received this question notification because you asked the question.

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