This is an example of how to use the netdem library.
1import sys
2import os
3import math
4
5dir_path = os.path.dirname(os.path.realpath(__file__))
6sys.path.append(dir_path + "/../../build/lib/")
7import netdem
8
10sim.domain_manager.SetBound(-0.6, -0.6, -0.6, 0.6, 0.6, 0.6)
11sim.domain_manager.SetCellSpacing(0.1, 0.1, 0.1)
12
13sim.dem_solver.contact_solver_factory.settings.solver_type \
14 = netdem.ContactSolverSettings.SolverType.sdf
15sim.dem_solver.contact_solver_factory.settings.sdf_potential_type = 0
16
18cnt_model_prt = sim.scene.InsertContactModel(cnt_model)
19sim.scene.SetNumberOfMaterials(1)
20sim.scene.SetCollisionModel(0, 0, cnt_model_prt)
21
23sim.scene.InsertShape(sphere)
24
25shape_list = sim.scene.GetShapes()
27particle_list = pack_generator.GetGridPack(
28 0.2, 0.2, 0.1, 0, 0, 0.05, 5, 5, 3, shape_list)
29for p in particle_list:
30 p.SetVelocity(0, 0, -0.6)
31 p.SetDensity(2650e3)
32 p.damp_numerical = 0.7
33
35wall_box.ImportToScene(sim.scene)
36sim.scene.RemoveWall(sim.scene.wall_list[5])
37
39tri_mesh.InitFromSTL("examples/10_cone_penetration/cone_cad.stl")
40tri_mesh.MakeConvex()
41tri_mesh.AlignAxes()
42tri_mesh.SetSize(0.01)
43trimesh_ptr = sim.scene.InsertShape(tri_mesh)
44
46grav.Init(sim)
47sim.modifier_manager.Insert(grav)
48sim.modifier_manager.Enable(grav.label)
49
51data_dumper.Init(sim)
52data_dumper.SetRootPath("tmp/cone_penetration/out/")
53data_dumper.SetSaveByCycles(100)
54data_dumper.dump_wall_info = True
55data_dumper.SaveShapeInfoAsSTL()
56sim.modifier_manager.Insert(data_dumper)
57sim.modifier_manager.Enable(data_dumper.label)
58
59for i in range(1):
60 sim.scene.InsertParticle(particle_list)
61 sim.Run(0.1)
62
64cone.SetDensity(7650e3)
65cone.SetPosition(0, 0, 0.2)
66cone.SetRodrigues(math.radians(90), 0, 1, 0)
67sim.scene.InsertParticle(cone)
68
69sim.Run(2.0)
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
A class for generating packs of particles.
Definition gen_pack.hpp:16
Definition particle.hpp:26
Class for managing a DEM simulation.
Definition simulation.hpp:21
A class representing a sphere.
Definition shape_sphere.hpp:17
A class representing a triangular mesh in 3D space.
Definition shape_trimesh.hpp:23
A class for generating a box of six walls.
Definition gen_wall_box_plane.hpp:23