Skip to content

Commit 9c60c1d

Browse files
committed
Truely no longer allow infinite velocities
1 parent 835178d commit 9c60c1d

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/DEM/APIPrivate.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,12 @@ void DEMSolver::setSimParams() {
11481148
}
11491149
DEME_DEBUG_PRINTF("%u contact wildcards are in the force model.", nContactWildcards);
11501150

1151+
// Error-out velocity should be no smaller than the max velocity we can expect
1152+
if (threshold_error_out_vel < m_approx_max_vel) {
1153+
// Silently bring down m_approx_max_vel
1154+
m_approx_max_vel = threshold_error_out_vel;
1155+
}
1156+
11511157
dT->setSimParams(nvXp2, nvYp2, nvZp2, l, m_voxelSize, m_binSize, nbX, nbY, nbZ, m_boxLBF, m_user_box_min,
11521158
m_user_box_max, G, m_ts_size, m_expand_factor, m_approx_max_vel, m_expand_safety_multi,
11531159
m_expand_base_vel, m_force_model->m_contact_wildcards, m_force_model->m_owner_wildcards,

src/kernel/DEMMiscKernels.cu

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// DEM misc. kernels
22
#include <DEM/Defines.h>
3+
#include <DEMHelperKernels.cuh>
34

45
__global__ void markOwnerToChange(deme::notStupidBool_t* idBool,
56
float* ownerFactors,
@@ -42,7 +43,12 @@ __global__ void computeMarginFromAbsv(deme::DEMSimParams* simParams,
4243
if (ownerID < n) {
4344
float absv = granData->marginSize[ownerID];
4445
unsigned int my_family = granData->familyID[ownerID];
45-
if (absv > simParams->approxMaxVel || (!isfinite(absv))) {
46+
if (!isfinite(absv)) {
47+
// May produce messy error messages, but it's still good to know what entities went wrong
48+
DEME_ABORT_KERNEL("Absolute velocity for ownerID %llu is not finite. This happened at time %.9g.\n",
49+
static_cast<unsigned long long>(ownerID), simParams->timeElapsed);
50+
}
51+
if (absv > simParams->approxMaxVel) {
4652
absv = simParams->approxMaxVel;
4753
}
4854
// User-specified extra margin also needs to be added here. This marginSize is used for bin--sph or bin--tri

0 commit comments

Comments
 (0)