This is an example of how to use the netdem library.
1import netdem
2
3
5sim.domain_manager.SetBound(-16, -16, -16, 16, 16, 16)
6sim.domain_manager.SetCellSpacing(0.6, 0.6, 0.6)
7
8
9sim.dem_solver.contact_solver_factory.settings.solver_type = (
10 netdem.ContactSolverSettings.SolverType.sdf
11)
12sim.dem_solver.contact_solver_factory.settings.sdf_potential_type = 0
13
15cnt_model_ptr = sim.scene.InsertContactModel(cnt_model)
16sim.scene.SetNumberOfMaterials(1)
17sim.scene.SetCollisionModel(0, 0, cnt_model_ptr)
18
19
21trimesh.InitFromSTL("data/particle_template.stl")
22trimesh.Decimate(200)
23trimesh.AlignAxes()
24trimesh.SetSize(1.0)
25
28
29trimesh_ptr = sim.scene.InsertShape(trimesh)
30plane_1_ptr = sim.scene.InsertShape(plane_1)
31plane_2_ptr = sim.scene.InsertShape(plane_2)
32
34p.SetDensity(2650e-6)
35
38
39sim.scene.InsertParticle(p)
40sim.scene.InsertWall(w_1)
41sim.scene.InsertWall(w_2)
42
43
45grav.Init(sim)
46sim.modifier_manager.Insert(grav)
47sim.modifier_manager.Enable(grav.label)
48sim.scene.gravity_coef = [0, 0, -9.81e-3]
49
50
52data_dumper.Init(sim)
53data_dumper.SetRootPath("tmp/out/")
54data_dumper.SetSaveByCycles(1000)
55data_dumper.SaveShapeInfoAsSTL()
56data_dumper.dump_shape_info = True
57data_dumper.dump_wall_info = True
58data_dumper.dump_contact_info = True
59sim.modifier_manager.Insert(data_dumper)
60sim.modifier_manager.Enable(data_dumper.label)
61
62
64breakage_analysis.Init(sim)
65breakage_analysis.SetRootPath("tmp/out/")
66breakage_analysis.SetParticleFromScene()
67breakage_analysis.SetExecuteByCycles(10000)
68
69breakage_analysis.pd_dem_coupler.mesh_res = 30
70breakage_analysis.pd_dem_coupler.loading_steps = 1000
71breakage_analysis.pd_dem_coupler.fragment_vol_limit = 0.01
72
73strength_params = breakage_analysis.pd_dem_coupler.strength_params
74strength_params.ref_size = 2.0
75strength_params.ref_energy_release_rate = 30e-3
76strength_params.min_breakable_size = 0.95
77
78material_params = breakage_analysis.pd_dem_coupler.material_params
79material_params.density = 2650e-6
80material_params.youngs_modulus = 15e3
81material_params.poissons_ratio = 0.15
82
83settings = breakage_analysis.pd_dem_coupler.pd_sim.settings
84settings.loading_radius_factor = 2.5
85
86sim.modifier_manager.Insert(breakage_analysis)
87sim.modifier_manager.Enable(breakage_analysis.label)
88
89
91disp_control.Init(sim)
92disp_control.SetWall([0])
93disp_control.SetVelocity(0, 0, -0.1)
94sim.modifier_manager.Insert(disp_control)
95sim.modifier_manager.Enable(disp_control.label)
96
97
98sim.dem_solver.timestep = 1.0e-5
99sim.Run(1.0)
A modifier class for performing breakage analysis on particles.
Definition breakage_analysis_pd.hpp:17
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
Definition particle.hpp:26
A class for representing a plane with a center point and normal vector.
Definition shape_plane.hpp:22
Class for managing a DEM simulation.
Definition simulation.hpp:21
A class representing a triangular mesh in 3D space.
Definition shape_trimesh.hpp:23
A class representing a wall object in a physics simulation.
Definition wall.hpp:32
A class used to control the displacement of walls in a DEM simulation.
Definition wall_motion_control.hpp:16