c = reff * sqrt(gamma * pi / (2.0 * YoungEff)) # Solve the algebraic equation symbolically frac = 0.333333333333333333333333333333333333333333333333333 common = (9 * c + sqrt(3 * (27 * c**2 - 4 * b**3)))**frac x = b * (2.0 / 3.0)**frac / common + common / (18**frac) # Compute contact yield radius ay = x * x # Return yielding contact radius return ay * ay / reff - sqrt(2.0 * pi * gamma * ay / YoungEff) System = Analyzer.System("traj-tapping.dump") data = [] for ts in System: Neigh = Analyzer.Neighbors(System.Particles) overlaps, indices = Neigh.overlaps[:, 0], Neigh.overlaps[:, 1:] # Extract radii of all particles radii = System.Particles.radius ny = 0 for contact, index in enumerate(indices): # Get the two particle (in contact) indices i, j = index
import scipy.spatial from PyGran import Analyzer from numpy import arange, array import os Gran = Analyzer.System(Particles='traj.dump') # Go to last frame Gran.goto(-1) # Create a new class containing particles between z=0 and z=1e-3 Particles = Gran.Particles Particles = Particles[Particles.z <= 1e-3 & Particles.z >= 0] # Set image resolution and size resol = 1.24e-6 # microns/pixel size = (512, 512) for i, z in enumerate(arange(0, Particles.z.max() + resol, resol)): zmin, zmax = z, z + resol output = 'output/poured{}.bmp'.format(i)) Analyzer.imaging.slice(Particles, zmin, zmax, 'z', size, resol, output)
natoms = 10 radius = 1 data['natoms'] = natoms * natoms * natoms data['id'] = arange(data['natoms']) data['x'], data['y'], data['z'] = zeros(data['natoms']), zeros( data['natoms']), zeros(data['natoms']) data['id'] = arange(data['natoms']) count = 0 for i in range(natoms): for j in range(natoms): for k in range(natoms): data['x'][count] = (2.0 * i + ((j + k) % 2)) * radius data['y'][count] = (sqrt(3.) * (j + 1.0 / 3.0 * (k % 2))) * radius data['z'][count] = (2.0 * sqrt(6.0) / 3.0 * k) * radius count += 1 data['radius'] = ones(data['natoms']) * radius data['timestep'] = 0 data['box'] = ([data['x'].min(), data['x'].max()], [data['y'].min(), data['y'].max()], [data['z'].min(), data['z'].max()]) Particles = Analyzer.Particles(data=data, units='micro') System = Analyzer.System(Particles=Particles) System.Particles.write('hpc.dump') print System.Particles.density(1)
c = reff * sqrt(gamma * pi / (2. * YoungEff)) # Solve the algebraic equation symbolically frac = 0.333333333333333333333333333333333333333333333333333 common = (9*c + sqrt(3*(27*c**2 - 4*b**3)))**frac x = b * (2.0/3.0)**frac / common + common / (18**frac) # Compute contact yield radius ay = x*x # Return yielding contact radius return ay*ay/reff - sqrt(2. * pi * gamma * ay / YoungEff) System = Analyzer.System('/run/media/abimanso/Disk-2/Papers/DEM-XRCT/Sim-Data/Stearic-acid/Tapping/traj/traj-tapping.dump') data = [] for ts in System: Neigh = Analyzer.Neighbors(System.Particles) overlaps, indices = Neigh.overlaps[:,0], Neigh.overlaps[:,1:] # Extract radii of all particles radii = System.Particles.radius ny = 0 for contact, index in enumerate(indices): # Get the two particle (in contact) indices i,j = index
c = reff * sqrt(gamma * pi / (2. * YoungEff)) # Solve the algebraic equation symbolically frac = 0.333333333333333333333333333333333333333333333333333 common = (9 * c + sqrt(3 * (27 * c**2 - 4 * b**3)))**frac x = b * (2.0 / 3.0)**frac / common + common / (18**frac) # Compute contact yield radius ay = x * x # Return yielding contact radius return ay * ay / reff - sqrt(2. * pi * gamma * ay / YoungEff) System = Analyzer.System('traj-tapping.dump') data = [] for ts in System: Neigh = Analyzer.Neighbors(System.Particles) overlaps, indices = Neigh.overlaps[:, 0], Neigh.overlaps[:, 1:] # Extract radii of all particles radii = System.Particles.radius ny = 0 for contact, index in enumerate(indices): # Get the two particle (in contact) indices i, j = index
from PyGran import Analyzer import matplotlib.pylab as plt from numpy import array # Create a PyGran System from a dump file (default si units) System = Analyzer.System(Particles='/home/levnon/Desktop/flow/output/traj/traj*.dump') # Timestep used in simulation (s) dt = 1e-6 # Skip empty frames System.skip() # Extract bed height + timesteps data = array([[ts * dt,System.Particles.z.max()] for ts in System]) # Plot bed height (mm) vs time (ms) plt.plot(data[:,0] * 1e3, data[:,1] * 1e3, '-o') plt.xlabel('Time (ms)') plt.ylabel('Height (mm)') plt.grid(linestyle=':') plt.show()
from PyGran import Analyzer from PyGran.Materials import glass System = Analyzer.System('traj.dump') System.goto(-1) Neigh = Analyzer.Neighbors(System.Particles) overlaps, i, j = Neigh.overlaps print Neigh.filter()