NetDEM v1.0
Loading...
Searching...
No Matches
single_cubic_bp.py

This is an example of how to use the netdem library.

1import sys
2import os
3
4dir_path = os.path.dirname(os.path.realpath(__file__))
5sys.path.append(dir_path + "/../../build/lib/")
6import netdem
7
8# units: mm, 1000 kg, N, s
10sim.domain_manager.SetBound(-12, -12, -12, 12, 12, 12)
11sim.domain_manager.SetCellSpacing(1.0, 1.0, 1.0)
12
13cnt_model = netdem.LinearSpring(1.4e4, 0.7e4, 0.3, 0.0)
14cnt_model_prt = sim.scene.InsertContactModel(cnt_model)
15sim.scene.SetNumberOfMaterials(1)
16sim.scene.SetCollisionModel(0, 0, cnt_model_prt)
17
18bond_model = netdem.ParallelBond(1.4e4, 0.7e4, 7.0e4, 3.5e4, 0.01)
19bond_model.label = "bond_model"
20bond_model_ptr = sim.scene.InsertContactModel(bond_model)
21
22bonded_spheres = netdem.BondedSpheres()
23bonded_spheres.SetBondModel(bond_model_ptr)
24bonded_spheres.InitFromGrid(-2.5, -2.5, -2.5, 5.0, 5.0, 5.0, 0.25)
25bonded_spheres.MakePorosity(0.2)
26sim.scene.InsertParticle(bonded_spheres)
27
28sim.scene.SetGravity(0, 0, -9.81e-3)
29for p in sim.scene.particle_list:
30 p.SetDensity(2650)
31
32wall_box = netdem.WallBoxPlane(10, 10, 5.0, 0, 0, 0)
33wall_box.ImportToScene(sim.scene)
34
35grav = netdem.Gravity()
36grav.Init(sim)
37sim.modifier_manager.Insert(grav)
38sim.modifier_manager.Enable(grav.label)
39
40data_dumper = netdem.DataDumper()
41data_dumper.Init(sim)
42data_dumper.SetRootPath("tmp/out/")
43data_dumper.SetSaveByCycles(100)
44data_dumper.dump_contact_info = True
45data_dumper.dump_wall_info = True
46data_dumper.SaveShapeInfoAsSTL()
47sim.modifier_manager.Insert(data_dumper)
48sim.modifier_manager.Enable(data_dumper.label)
49
50# add deformation drived loading for top wall
51disp_control = netdem.WallMotionControl()
52disp_control.Init(sim)
53disp_control.SetWall([5])
54disp_control.SetVelocity(0, 0, -0.25)
55sim.modifier_manager.Insert(disp_control)
56sim.modifier_manager.Enable(disp_control.label)
57
58sim.Run(2.0)
A class representing a sphere bonded to other spheres through contact pairs.
Definition bonded_spheres.hpp:18
A class used to dump particle data into vtk files. This is a post-modifier, which will be executed at...
Definition data_dumper.hpp:12
A class used to apply gravity to particles in a DEM simulation.
Definition gravity.hpp:10
Contact model that uses linear spring elements to evaluate contact forces and moments.
Definition model_linear_spring.hpp:16
Contact model that evaluates forces and moments between two particles using parallel bond models.
Definition model_parallel_bond.hpp:15
Class for managing a DEM simulation.
Definition simulation.hpp:21
A class for generating a box of six walls.
Definition gen_wall_box_plane.hpp:23
A class used to control the displacement of walls in a DEM simulation.
Definition wall_motion_control.hpp:16