This is an example of how to use the netdem library.
#include <iostream>
#include <unordered_map>
using namespace std;
int MembraneCase(int argc, char **argv) {
int self_rank, total_rank;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &self_rank);
MPI_Comm_size(MPI_COMM_WORLD, &total_rank);
cnt_model_0.label = "particle_&_wall";
cnt_model_1.label = "membrane";
auto particle_list = PackGenerator::GetGridPack(
for (auto &p : particle_list) {
p.SetDensity(2650e3);
p.SetVelocity(0, 0, -0.6);
p.damp_numerical = 0.7;
}
auto plane_bot =
Plane(0, 0, -0.05, 0, 0, 1);
plane_bot.SetExtent(0.1);
auto wall_bot =
Wall(plane_bot_ptr);
membrane_wall.neo_k = 6.94e6;
membrane_wall.neo_mu = 5.21e6;
membrane_wall.density = 500e3;
membrane_wall.damp_coef = 0.7;
membrane_wall.timestep = 1.0e-5;
membrane_wall.enable_deformation = false;
membrane_wall.dump_info = true;
membrane_wall.Init(sim);
membrane_wall.SetRootPath("tmp/out_tri_comp/");
membrane_wall.SetSaveByCycles(100);
auto membrane_wall_ptr =
static_cast<MembraneWall *
>(modifier_ptr);
for (auto &w : membrane_wall_ptr->wall_list) {
w->material_type = 1;
}
grav.Init(sim);
data_dumper.Init(sim);
data_dumper.SetRootPath("tmp/out_tri_comp/");
data_dumper.SetSaveByCycles(100);
data_dumper.dump_contact_info = true;
data_dumper.dump_wall_info = true;
for (int i = 0; i < 20; i++) {
}
if (p_ptr->pos[2] > 0.05 - 0.5 * p_ptr->shape->GetSize()) {
}
}
auto plane_top =
Plane(0, 0, 0.05, 0, 0, -1);
plane_top.SetExtent(0.1);
auto wall_top =
Wall(plane_top_ptr);
membrane_wall_ptr->SetDimensions(0.025, 0.10);
for (int i = 0; i < membrane_wall_ptr->nodes.size(); i++) {
if (abs(membrane_wall_ptr->nodes[i][2] + 0.5 * membrane_wall_ptr->height) <
1.0e-4 ||
abs(membrane_wall_ptr->nodes[i][2] - 0.5 * membrane_wall_ptr->height) <
1.0e-4) {
membrane_wall_ptr->SetBCNodalVelocity(i, 0, 0, 0, 1, 1, 1);
}
}
membrane_wall_ptr->enable_deformation = true;
for (int i = 0; i < 10; i++) {
membrane_wall_ptr->SetPressure(-1.0e4 * (i + 1));
}
disp_control.Init(sim);
disp_control.SetWall({wall_top_ptr->id});
disp_control.SetVelocity(0, 0, -0.001);
for (int i = 0; i < membrane_wall_ptr->nodes.size(); i++) {
if (abs(membrane_wall_ptr->nodes[i][2] - 0.5 * membrane_wall_ptr->height) <
1.0e-4) {
membrane_wall_ptr->SetBCNodalVelocity(i, 0, 0, -0.001, 1, 1, 1);
}
}
delete sim;
MPI_Finalize();
return 0;
}
double timestep
Definition dem_solver.hpp:42
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
void SetBound(double bmin_x, double bmin_y, double bmin_z, double bmax_x, double bmax_y, double bmax_z)
Sets the lower and upper bounds of the domain.
Definition domain_manager.cpp:83
void SetCellSpacing(double s_x, double s_y, double s_z)
Sets the spacing between cells in each dimension.
Definition domain_manager.cpp:105
void SetDecomposition(int num_div_x, int num_div_y, int num_div_z)
Sets the number of domain divisions in each dimension.
Definition domain_manager.cpp:96
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 used to model a membrane wall in a DEM simulation.
Definition membrane_wall.hpp:14
Modifier * Insert(Modifier *e)
Inserts new modifier into the simulation.
Definition modifier_manager.cpp:17
void Enable(std::string const &label)
Enables a modifier in the simulation.
A class for representing a plane with a center point and normal vector.
Definition shape_plane.hpp:22
ContactModel * InsertContactModel(const ContactModel *const cm_ptr)
Insert a contact model into this scene.
Definition scene.cpp:290
Vec3d gravity_coef
The gravity acceleration vector applied to all particles in this scene.
Definition scene.hpp:65
void SetNumberOfMaterials(int num)
Set the number of materials in this scene and initialize the contact lookup table accordingly.
Definition scene.cpp:346
Shape * InsertShape(const Shape *const s_ptr)
Insert a single shape into this scene.
Definition scene.cpp:19
VecXT< Particle * > particle_list
A list of pointers to all particles that belong to this sub-domain (scene).
Definition scene.hpp:93
void SetCollisionModel(int mat_type_1, int mat_type_2, ContactModel *const cnt_model)
Set the collision model between two materials.
Definition scene.cpp:397
Particle * InsertParticle(const Particle *const p_ptr)
Insert a single particle into this scene.
Definition scene.cpp:76
VecXT< Shape * > GetShapes()
Return a vector of pointers to all shapes in this scene.
Definition scene.cpp:316
Wall * InsertWall(const Wall *const w_ptr)
Insert a single wall into this scene.
Definition scene.cpp:194
void RemoveParticle(Particle *p_ptr)
Remove the given particle from this scene.
Definition scene.cpp:238
Class for managing a DEM simulation.
Definition simulation.hpp:21
DEMSolver dem_solver
Implements DEM algorithms to solve the scene.
Definition simulation.hpp:47
void Run(double time)
Runs the simulation for a specified period of time.
Definition simulation.cpp:28
DomainManager domain_manager
Manager for domain and sub-domain calculations.
Definition simulation.hpp:31
ModifierManager modifier_manager
Manages add-on features (i.e., customized evaluations not hard-coded in the DEM calculation cycle).
Definition simulation.hpp:53
Scene scene
Contains and manages basic DEM objects (e.g., shapes, particles, walls) for a DEM simulation.
Definition simulation.hpp:42
A class representing a sphere.
Definition shape_sphere.hpp:17
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
Definition bond_entry.hpp:7