Skip to content

Commit 340108f

Browse files
committed
Slightly modify a demo
1 parent 2b6c469 commit 340108f

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/DEM/API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ class DEMSolver {
16711671
bool collect_force_in_force_kernel = false;
16721672

16731673
// Error-out avg num contacts
1674-
float threshold_error_out_num_cnts = 100.;
1674+
float threshold_error_out_num_cnts = 300.;
16751675

16761676
// Integrator type
16771677
TIME_INTEGRATOR m_integrator = TIME_INTEGRATOR::EXTENDED_TAYLOR;

src/demo/DEMdemo_MeshFalling.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ int main() {
5252
std::vector<std::shared_ptr<DEMTracker>> trackers;
5353

5454
// Random number generator for variations
55-
std::random_device rd;
56-
std::mt19937 gen(rd());
55+
const unsigned int seed = 12345u;
56+
std::mt19937 gen(seed);
5757
std::uniform_real_distribution<> pos_dist(-0.1, 0.1);
5858
std::uniform_real_distribution<> rot_dist(-0.2, 0.2);
59-
std::uniform_real_distribution<> scale_dist(0.8, 2.4); // Scale variation
59+
std::uniform_real_distribution<> scale_dist(0.8, 2.0); // Scale variation
6060
std::uniform_int_distribution<> mesh_type_dist(0, 3); // 4 mesh types
6161

6262
for (int i = 0; i < num_particles_x; i++) {
@@ -98,6 +98,8 @@ int main() {
9898
} else if (mesh_type == 2) {
9999
// Cone (height ~1, radius ~1 in mesh)
100100
particle = DEMSim.AddWavefrontMeshObject((GET_DATA_PATH() / "mesh/cone.obj").string(), mat_box);
101+
// Unit cone's CoM is at this location...
102+
particle->InformCentroidPrincipal(make_float3(0, 0, 3. / 4.), make_float4(0, 0, 0, 1));
101103
float scale = base_size * scale_dist(gen);
102104
particle->Scale(scale);
103105

@@ -165,19 +167,14 @@ int main() {
165167
DEMSim.WriteMeshFile(out_dir / meshfilename);
166168

167169
// Print some statistics
168-
int particles_settled = 0;
169170
float avg_height = 0.0;
170171
for (size_t k = 0; k < trackers.size(); k++) {
171172
float3 pos = trackers[k]->Pos();
172173
avg_height += pos.z;
173-
if (pos.z < 2.0) { // Consider particles below 2m as settled
174-
particles_settled++;
175-
}
176174
}
177175
avg_height /= trackers.size();
178176

179177
std::cout << " Average height: " << avg_height << " m" << std::endl;
180-
std::cout << " Particles settled: " << particles_settled << " / " << trackers.size() << std::endl;
181178

182179
DEMSim.ShowMemStats();
183180
std::cout << "----------------------------------------" << std::endl;

0 commit comments

Comments
 (0)