Skip to content

Commit

Permalink
Switched absolute to relative additional radius
Browse files Browse the repository at this point in the history
  • Loading branch information
nicogno committed Aug 2, 2024
1 parent e3227c1 commit 921cfdd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/core/interaction_force.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,19 @@ void InteractionForce::ForceBetweenSpheres(const Agent* sphere_lhs,
Real3* result) const {
const Real3& ref_mass_location = sphere_lhs->GetPosition();
real_t ref_diameter = sphere_lhs->GetDiameter();
real_t ref_iof_coefficient = 0.15;
const Real3& nb_mass_location = sphere_rhs->GetPosition();
real_t nb_diameter = sphere_rhs->GetDiameter();
real_t nb_iof_coefficient = 0.15;

auto c1 = ref_mass_location;
real_t r1 = 0.5 * ref_diameter;
auto c2 = nb_mass_location;
real_t r2 = 0.5 * nb_diameter;
// We take virtual bigger radii to have a distant interaction, to get a
// desired density.
real_t additional_radius =
10.0 * std::min(ref_iof_coefficient, nb_iof_coefficient);
r1 += additional_radius;
r2 += additional_radius;
// desired density. We assume an interaction distance 3% larger then the
// agent's radius
real_t additional_radius_scaling = 1.03;
r1 *= additional_radius_scaling;
r2 *= additional_radius_scaling;
// the 3 components of the vector c2 -> c1
real_t comp1 = c1[0] - c2[0];
real_t comp2 = c1[1] - c2[1];
Expand Down

0 comments on commit 921cfdd

Please sign in to comment.