Fixing rare precision error in Tsuji damping
This commit is contained in:
@ -130,6 +130,8 @@ void GranSubModDampingTsuji::init()
|
||||
|
||||
double GranSubModDampingTsuji::calculate_forces()
|
||||
{
|
||||
damp_prefactor = damp * sqrt(gm->meff * gm->Fnormal / gm->delta);
|
||||
// in case argument < 0 due to precision issues
|
||||
double sqrt1 = MAX(0, gm->meff * gm->Fnormal / gm->delta);
|
||||
damp_prefactor = damp * sqrt(sqrt1);
|
||||
return -damp_prefactor * gm->vnnr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user