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

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

1import netdem
2
4
5sim.domain_manager.SetBound(-12, -12, -12, 12, 12, 12)
6sim.domain_manager.GetSelfSubDomain().cell_manager.SetSpacing(0.3, 0.3, 0.3)
7# sim.dem_solver.contact_solver_factory.settings.gjk_use_erosion = True
8
9collision_model = netdem.LinearSpring(2.0e6, 1.0e6, 0.5, 0.3)
10collision_model_ptr = sim.scene.InsertContactModel(collision_model)
11sim.scene.SetNumberOfMaterials(1)
12sim.scene.SetCollisionModel(0, 0, collision_model_ptr)
13
14bond_model = netdem.ParallelBond(2.0e6, 1.0e6, 1.0e6, 1.0e6, 0.3)
15bond_model.label = "bond_model"
16bond_model_ptr = sim.scene.InsertContactModel(bond_model)
17
18stl_vase = netdem.STLModel()
19stl_vase.InitFromSTL("data/particle_template.stl")
20stl_vase.Standardize()
21stl_vase.SetSize(0.2)
22
23# tetmesh = netdem.TetMesh(stl_vase, 0.02)
24# stl_vase = tetmesh.GetSurfaceSTL()
25
26bonded_voronois = netdem.BondedVoronois()
27bonded_voronois.SetBondModel(bond_model_ptr)
28bonded_voronois.InitFromSTL(stl_vase, 20)
29bonded_voronois.SaveAsVTK("tmp/out/shape/bonded_voronois.vtk")
30
31sim.scene.InsertParticle(bonded_voronois)
32# for p in sim.scene.particle_list:
33# p.damp_numerical = 0.7
34
35plane = netdem.Plane(0, 0, -0.5, 0, 0, 1)
36plane_ptr = sim.scene.InsertShape(plane)
37wall = netdem.Wall(plane_ptr)
38sim.scene.InsertWall(wall)
39
40grav = netdem.Gravity()
41grav.Init(sim)
42sim.modifier_manager.Insert(grav)
43sim.modifier_manager.Enable(grav.label)
44
45data_dumper = netdem.DataDumper()
46data_dumper.Init(sim)
47data_dumper.SetRootPath("tmp/out/")
48data_dumper.SetSaveByCycles(1000)
49data_dumper.dump_wall_info = True
50data_dumper.dump_contact_info = True
51data_dumper.dump_mesh = True
52data_dumper.SaveShapeInfoAsSTL()
53sim.modifier_manager.Insert(data_dumper)
54sim.modifier_manager.Enable(data_dumper.label)
55
56sim.dem_solver.timestep = 1.0e-5
57sim.Run(2.0)
A class representing a set of bonded Voronoi cells generated from an STL file.
Definition bonded_voronois.hpp:19
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
A class for representing a plane with a center point and normal vector.
Definition shape_plane.hpp:22
Class for working with STL models.
Definition stl_model.hpp:17
Class for managing a DEM simulation.
Definition simulation.hpp:21
A class representing a wall object in a physics simulation.
Definition wall.hpp:32