Question #215877 on Yade changed: https://answers.launchpad.net/yade/+question/215877
Status: Answered => Open Giulia Macaro is still having a problem: Hello, I have run more tx tests with only 5,000 spheres: I've restarted the computer, launched the test, and I have not opened any other program (not even a folder, firefox, mouse, or music). After 3 hours of running with 4 out of 8 cores, the total memory usage increased from 11.13 to 11.51% (compared with the previous 22 to 32% which I had while running other programs). At the end of the test, after 18 hours, the memory arrived up to 14.29%, which is considerably less than before. It not a sceintific way, but it gives an idea of what is happening. Some observations: - As soon as I start using the pc for other stuff, the memory used by Yade starts increasing faster - Have you noticed the same behaviour? - It is good news, I assume, that the memory does not increase much if I don't run anything else. But why, while I run other programs, does the memory used by Yade increase? I am now trying to do the same (not using the pc at all) with the large simulation (which crashed with SIGKILL before). Can I decide how much memory Yade can use? Is there any command similar to -j4 given for the number of cores? Here is the script of the large simulation. It took me 3 or 4 days only to settle the packing, and other 4 days in debug mode until it crashed. Thanks for any suggestion Giulia #!/usr/bin/python # -*- coding: utf-8 -*- from yade import pack,log,params,timing,plot if utils.runningInBatch()==False: from yade import qt import os,sys,matplotlib import numpy as np from math import * from yade import * quick=False #----------------------------------------------------------------------- # D I M E N S I O N S passing = [0, 5.72, 24.26, 35.07, 45.38, 55.17, 70.10, 79.58, 90.19, 100.0] diameters= [0.600, 0.632, 0.710, 0.770, 0.810, 0.850, 0.940, 1.000, 1.060, 1.200] radii = []; PSDup = 4 for i in range(len(diameters)): radii.append(diameters[i]*0.5e-3*PSDup) Rmin = 0.632*0.5e-3*PSDup Rmax = 1.200*0.5e-3*PSDup AvgRadius= .400e-3*PSDup Dpipe = 50e-3 # (m) pipe diameter # Initial packing dim0 = 5*2*AvgRadius dim1 = 9*Dpipe dim2 = 4*Dpipe extra = 1*Dpipe # clearance between the packing and the periodic cell # way of roughly estimating the initial packing poroi = 0.76 porof = 0.5 nSph = int((1-porof)*(dim0*dim1*dim2)/(4/3*pi*AvgRadius**3))# approximate nSph to get the desired final packing hi = nSph*(4/3*pi*AvgRadius**3)/((1-poroi)*dim0*dim1) # initial height of the packing # Periodic cell dimensions cell0 = dim0 cell1 = dim1+2*extra cell2 = hi+2*extra # Corners of the initial packing (in sp.particleSD) minCorner = (0,extra,extra) maxCorner = (dim0,extra+dim1,extra+hi) #----------------------------------------------------------------------- maxUnbalancedForce = 0.05 dporoMax = 0.001 dhppMax = 0.001 Damping = 0.5 #----------------------------------------------------------------------- # M A T E R I A L S O.materials.append( FrictMat(density=2650,young=70e10,poisson=0.3,frictionAngle=radians(0), label='bottomFloorMat')) O.materials.append( FrictMat(density=2650,young=70e10,poisson=0.3,frictionAngle=radians(0), label='rightWallMat')) O.materials.append( FrictMat(density=2650,young=70e10,poisson=0.3,frictionAngle=radians(0), label='leftWallMat')) O.materials.append( FrictMat(density=2650,young=70e09,poisson=0.3,frictionAngle=radians(26), label='sandMat')) O.materials.append( FrictMat(density=7850,young=20e10,poisson=0.3,frictionAngle=radians(26*2/3),label='pipeMat')) #----------------------------------------------------------------------- # G E O M E T R Y n0 = 3; n1 = 5; n2 = 10 # lat direction 0; lat direction 1; vert direction 2 deltah0 = dim0/n0; deltah1 = dim1/n1; deltav = hi/n2 #""" # ~~~ Periodic cell ~~~ O.periodic = True O.cell.setBox(Vector3(cell0,cell1,cell2)) # set size of the cell (rectangular) # ~~~ Wall ~~~ # bottom floor si = 1./n1; sj = 1./n0 for i in range(0,n1): for j in range(0,n0): x1 = (j*sj*cell0,extra*1.0+i*si*(extra*0.0+dim1),extra); x2 = (j*sj*cell0,extra*1.0+(i+1)*si*(extra*0.0+dim1),extra); x3 = ((j+1)*sj*cell0,extra*1.0+(i+1)*si*(extra*0.0+dim1),extra); x4 = ((j+1)*sj*cell0,extra*1.0+i*si*(extra*0.0+dim1),extra) O.bodies.append([utils.facet([x1,x2,x3],wire=False,fixed=True,material='bottomFloorMat'),utils.facet([x1,x3,x4],wire=False,fixed=True,material='bottomFloorMat'),]) # right wall si = 1./n2; sj = 1./n0 for i in range(0,n2): for j in range(0,n0): x1 = (j*sj*cell0,extra,extra+i*si*hi); x2 = ((j+1)*sj*cell0,extra,extra+i*si*hi); x3 = ((j+1)*sj*cell0,extra,extra+(i+1)*si*hi); x4 = ((j)*sj*cell0,extra,extra+(i+1)*si*hi) O.bodies.append([utils.facet([x1,x2,x3],fixed=True,material='rightWallMat'),utils.facet([x1,x3,x4],fixed=True,material='rightWallMat'),]) # left wall si=1./n2;sj=1./n0 for i in range(0,n2): for j in range(0,n0): x1 = (j*sj*cell0,extra+dim1,extra+i*si*hi); x2 = ((j+1)*sj*cell0,extra+dim1,extra+i*si*hi); x3 = ((j+1)*sj*cell0,extra+dim1,extra+(i+1)*si*hi); x4 = ((j)*sj*cell0,extra+dim1,extra+(i+1)*si*hi) O.bodies.append([utils.facet([x1,x2,x3],fixed=True,material='leftWallMat'),utils.facet([x1,x3,x4],fixed=True,material='leftWallMat'),]) # ~~~ Particles ~~~ sp=pack.SpherePack() sp.particleSD(minCorner,maxCorner,rMean=AvgRadius,periodic=False,name="",numSph=nSph,radii=radii,passing=passing) packing = [utils.sphere(s[0],s[1],material='sandMat') for s in sp] O.bodies.append(packing) #""" #----------------------------------------------------------------------- # bodies ids ids_bottomFloor=[]; ids_leftWall=[]; ids_rightWall=[]; ids_sand=[] for b in O.bodies: if b.material.label=='bottomFloorMat': ids_bottomFloor.append(b.id) elif b.material.label=='leftWallMat': ids_leftWall.append(b.id) elif b.material.label=='rightWallMat': ids_rightWall.append(b.id) elif b.material.label=='sandMat': ids_sand.append(b.id) #----------------------------------------------------------------------- # E N G I N E S O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),],allowBiggerThanPeriod=True), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),], [Ip2_FrictMat_FrictMat_MindlinPhys (gamma=0.0,betan=0,betas=0),], [Law2_ScGeom_MindlinPhys_Mindlin (includeAdhesion=False,preventGranularRatcheting=True,includeMoment=True,label='contactLaw'),] ), TranslationEngine(velocity=0,translationAxis=[0,0,1],ids=[0],dead=True,label='tEng'), GravityEngine (gravity= (0,0,0), label='gravEng'), NewtonIntegrator (damping= Damping, label='newton'), PyRunner(command='gravityfunction(-9.81)',iterPeriod=50000, label='gravityfunc'), PyRunner(command='deposition()', iterPeriod=1000, dead=False, label='mainfunction'), ] #----------------------------------------------------------------------- flag = 1 O.dt=0.5*utils.PWaveTimeStep() #----------------------------------------------------------------------- # F U N C T I O N S def deposition(): fName = sys._getframe().f_code.co_name global flag if quick==False: if O.iter<1e7: return if gravEng.gravity[2]!=-9.81: return if 2*O.interactions.countReal()*1./len(O.bodies)<=1: return mainfunction.command='waitForDeposition()' poro_prev = poroi; poro_curr = poroi; dporo = poroi def waitForDeposition(): fName = sys._getframe().f_code.co_name global poro_prev,poro_curr,dporo poro_prev = poro_curr poro_curr = porosityfunction() dporo = poro_prev-poro_curr if utils.unbalancedForce()<maxUnbalancedForce and dporo<=dporoMax: mainfunction.command = 'depositionEnd()' def depositionEnd(): global flag fName = sys._getframe().f_code.co_name if flag==1: flag=2 newton.damping = 0.0 mainfunction.command = 'waitForDeposition()' return if flag==2: if utils.unbalancedForce()<maxUnbalancedForce and dporo<=dporoMax: flag=3 if flag==3: generatePipe() flag=5 if flag==4: mainfunction.command='pipeDeposition()' if flag==5: O.engines[3].velocity=0 O.engines[3].ids = [pipe.id] O.engines[3].dead = False colorSpheres(htop()/20) mainfunction.command = 'loading()' def colorSpheres(beta): for bi in ids_sand: bzp=(O.bodies[bi].state.pos[2]-extra)//beta if bzp%2==0: O.bodies[bi].shape.color=Vector3(0/255.,250.0/255.,154.0/255.) else: O.bodies[bi].shape.color=Vector3(1.0,0.0,0.0) loadVel=-0.05 def loading(): global flag, zpp0,wpp, flagInt,loadVel,normEmbedment, vStar,xpp0 fName = sys._getframe().f_code.co_name if flag==5: O.engines[3].velocity = loadVel; flag=6 flagInt=0 if flag==6: for i in ids_sand: if flagInt==0: try: int=O.interactions[i,pipe.id] if int.isReal==True: zpp0 = pipe.state.pos[2] xpp0=0 flagInt = 1 flag = 7 except StandardError: int=0 if flag==7: wpp = zpp0-pipe.state.pos[2] normEmbedment = -(zpp0-pipe.state.pos[2])/Dpipe, if abs(wpp)/Dpipe>=0.5: O.pause() #----------------------------------------------------------------------- # P I P E z_cyl=float('nan') def generatePipe(): wasRunning=True if O.running==True else False if wasRunning==True:O.pause() fName = sys._getframe().f_code.co_name global pipe, z_cyl, ids_pipe radius_cyl = Dpipe/2 z_cyl = extra+htop()+radius_cyl center_cyl = Vector3(dim0/2.0,extra+2.5*Dpipe,z_cyl) length_cyl = dim0*2. radius_sph = dim0/2*0.9 z_sph = extra+htop()+radius_sph center_sph = Vector3(dim0/2.0,extra+dim1/2,z_sph) pipe = utils.sphere(center=center_sph, radius=radius_sph,material='pipeMat', fixed=False, color=(0,0,1)) pipe.state.blockedDOFs='xXYZ' O.bodies.append(pipe) pipe.dynamic= False ids_pipe = pipe.id if wasRunning==True:O.run() def pipeInteractions(): global pipeInt pipeInt=[] for i in O.interactions: if i.id2==pipe.id: pipeInt.append(i.id1) return pipeInt def htop(): # height from the bottom floor top=0 for itop in ids_sand: if O.bodies[itop].state.pos[2]>top: top=O.bodies[itop].state.pos[2] return (top-extra) def porosityfunction(): global currPoro volPack=htop()*dim0*dim1 volSph=utils.getSpheresVolume() currPoro=(volPack-volSph)/volPack return currPoro def gravityfunction(g0): nSteps=100 if quick==False else 1 dg=g0*1.0/nSteps temp=gravEng.gravity[2] if temp<=g0: gravEng.gravity=(0,0,-9.81) else: gravEng.gravity=(0,0,temp+dg) #----------------------------------------------------------------------- O.trackEnergy=True O.timingEnabled=True # to enable timing services O.saveTmp() #----------------------------------------------------------------------- -- You received this question notification because you are a member of yade-users, which 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