Skip to content

Commit 91afa5c

Browse files
Update octree.h
1 parent 7f3ed13 commit 91afa5c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/gravity/octree.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ inline void bhAccel(Octree* node, const Particle& p, real theta, real& ax, real&
100100
real dist = std::sqrt(r2 + real(1e-20));
101101

102102
real eps = nextSoftening(node->size, node->m, dist);
103-
if (p.type == 1) eps *= real(2.0);
103+
if (p.type == 1) {
104+
eps = std::max(eps, 2.0 * node->size / std::pow(node->m / p.m, 1.0/3));
105+
}
104106

105107
real r2_soft = r2 + eps*eps;
106108
real dist_soft = std::sqrt(r2_soft);

0 commit comments

Comments
 (0)