Introduction
Introduction Statistics Contact Development Disclaimer Help
tcollapse.py - sphere - GPU-based 3D discrete element method algorithm with opt…
git clone git://src.adamsgaard.dk/sphere
Log
Files
Refs
LICENSE
---
tcollapse.py (2587B)
---
1 #!/usr/bin/env python
2
3 # Import sphere functionality
4 import sphere
5
6 ### EXPERIMENT SETUP ###
7 initialization = True
8 collapse = True
9 rendering = True
10 plots = True
11
12 # Number of particles
13 np = 1e4
14
15 # Common simulation id
16 sim_id = 'collapse'
17
18 ### INITIALIZATION ###
19
20 # New class
21 init = sphere.sim(np = np, nd = 3, nw = 0, sid = sim_id + '-init')
22
23 # Set radii
24 init.generateRadii(mean = 0.1)
25
26 # Use default params
27 init.defaultParams(
28 k_n = 1.0e6, k_t = 1.0e6, # normal and tangential stif…
29 gamma_n = 100.0, gamma_t = 100.0, # normal and tangential visc…
30 mu_s = 0.3, mu_d = 0.3) # static and dynamic frictio…
31
32 # Initialize positions in random grid (also sets world size)
33 hcells = np**(1.0/3.0)
34 init.initRandomGridPos(gridnum = numpy.array([hcells, hcells, 1e9]))
35
36 # Choose the tangential contact model
37 # 1) Visco-frictional (somewhat incorrect, fast computations)
38 # 2) Elastic-viscous-frictional (more correct, slow computations in dense
39 # packings)
40 init.contactmodel[0] = 1
41
42 # Add gravitational acceleration
43 init.g[2] = -10.0
44
45 # Set duration of simulation, automatically determine timestep, etc.
46 init.initTemporal(total = 10.0)
47
48 if (initialization == True):
49
50 # Run sphere
51 init.run(dry = True)
52 init.run()
53
54 if (plots == True):
55 # Make a graph of energies
56 init.visualize('energy', savefig=True, outformat='png')
57
58 ### COLLAPSE ###
59
60 # New class
61 coll = sphere.sim(np = init.np, nw = init.nw, sid = sim_id)
62
63 # Read last output file of initialization step
64 lastf = status(sim_id + '-init')
65 coll.readbin('../output/' + sim_id + '-init.output{:0=5}.bin'.format(las…
66 verbose = False)
67
68 # Setup collapse experiment by moving the +x boundary and resizing the g…
69 resizefactor = 3
70 coll.L[0] = coll.L[0]*resizefactor # world length in x-direction (0)
71 coll.num[0] = coll.num[0]*resizefactor # neighbor search grid in x (0)
72
73 # Reduce the height of the world and grid
74 coll.adjustUpperWall()
75
76 # Set duration of simulation, automatically determine timestep, set the …
77 # file interval.
78 coll.initTemporal(total = 5.0, file_dt = 0.10)
79
80 if (collapse == True):
81
82 # Run sphere
83 coll.run(dry = True)
84 coll.run()
85
86 if (plots == True):
87 # Make a graph of the energies
88 init.visualize('energy', savefig=True, outformat='png')
89
90 if (rendering == True):
91 # Render images with raytracer with linear velocity as the color…
92 print('Rendering images with raytracer')
93 coll.render(method = 'vel', max_val = 1.0, verbose = False)
94 coll.video()
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.