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

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

1import netdem
2
3# simulation settings. units: mm, 1000 kg, N, s
5sim.domain_manager.SetBound(-16, -16, -16, 16, 16, 16)
6sim.domain_manager.SetCellSpacing(0.6, 0.6, 0.6)
7
8# contact settings
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
14cnt_model = netdem.LinearSpring(2.0e4, 1.0e4, 0.5, 0.0)
15cnt_model_ptr = sim.scene.InsertContactModel(cnt_model)
16sim.scene.SetNumberOfMaterials(1)
17sim.scene.SetCollisionModel(0, 0, cnt_model_ptr)
18
19# create a particle and two walls
20trimesh = netdem.TriMesh()
21trimesh.InitFromSTL("data/sphere.stl")
22trimesh.AlignAxes()
23trimesh.SetSize(2.0)
24
25plane_1 = netdem.Plane(0, 0, 1.0, 0, 0, -1)
26plane_2 = netdem.Plane(0, 0, -1.0, 0, 0, 1)
27
28trimesh_ptr = sim.scene.InsertShape(trimesh)
29plane_1_ptr = sim.scene.InsertShape(plane_1)
30plane_2_ptr = sim.scene.InsertShape(plane_2)
31
32p = netdem.Particle(trimesh_ptr)
33p.SetDensity(2650e-6)
34
35w_1 = netdem.Wall(plane_1_ptr)
36w_2 = netdem.Wall(plane_2_ptr)
37
38sim.scene.InsertParticle(p)
39sim.scene.InsertWall(w_1)
40sim.scene.InsertWall(w_2)
41
42# save results
43data_dumper = netdem.DataDumper()
44data_dumper.Init(sim)
45data_dumper.SetRootPath("tmp/out/")
46data_dumper.SetSaveByCycles(100)
47data_dumper.SaveShapeInfoAsSTL()
48data_dumper.dump_shape_info = True
49data_dumper.dump_wall_info = True
50data_dumper.dump_contact_info = True
51sim.modifier_manager.Insert(data_dumper)
52sim.modifier_manager.Enable(data_dumper.label)
53
54# breakage modifier
55breakage_analysis = netdem.BreakageAnalysisPD()
56breakage_analysis.Init(sim)
57breakage_analysis.SetRootPath("tmp/out/")
58breakage_analysis.SetParticleFromScene()
59breakage_analysis.SetExecuteByCycles(1000)
60
61breakage_analysis.pd_dem_coupler.mesh_res = 30
62breakage_analysis.pd_dem_coupler.loading_steps = 1000
63breakage_analysis.pd_dem_coupler.fragment_vol_limit = 0.001
64
65strength_params = breakage_analysis.pd_dem_coupler.strength_params
66strength_params.ref_size = 2.0
67strength_params.ref_energy_release_rate = 30e-3
68strength_params.min_breakable_size = 1.9
69
70material_params = breakage_analysis.pd_dem_coupler.material_params
71material_params.density = 2650e-6
72material_params.youngs_modulus = 100e3
73material_params.poissons_ratio = 0.15
74
75sim.modifier_manager.Insert(breakage_analysis)
76sim.modifier_manager.Enable(breakage_analysis.label)
77
78# add deformation drived loading for top wall
79disp_control = netdem.WallMotionControl()
80disp_control.Init(sim)
81disp_control.SetWall([0])
82disp_control.SetVelocity(0, 0, -0.02)
83sim.modifier_manager.Insert(disp_control)
84sim.modifier_manager.Enable(disp_control.label)
85
86# run the simulation
87sim.dem_solver.timestep = 1.0e-4
88sim.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
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