From 4dd8b3f247c634cfea00a5c56f060a9bc9c4fe87 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 20 Oct 2017 16:02:43 +0100 Subject: [PATCH] BUG: RBD: restraints: Corrected restraint force transformations The restraints generate either joint-local (tau) or global (fx) forces. At the moment they all generate the latter. This change corrects three of the four restraints so that the forces are in the gobal coordinate system and not the local coordinate system of the body. The problem with this is that the forward dynamics code then transforms most of the forces back to the body local coordinate system. A better solution would be to associate restraints which are more sensibly defined in a local frame with the joints instead of the bodies, and return the forces as part of the tau variable. --- .../linearAxialAngularSpring/linearAxialAngularSpring.C | 4 ++-- src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C | 4 ++-- .../sphericalAngularDamper/sphericalAngularDamper.C | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C b/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C index 379a69c4f4..277de2ecf9 100644 --- a/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C +++ b/src/rigidBodyDynamics/restraints/linearAxialAngularSpring/linearAxialAngularSpring.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -133,7 +133,7 @@ void Foam::RBD::restraints::linearAxialAngularSpring::restrain } // Accumulate the force for the restrained body - fx[bodyIndex_] += spatialVector(moment, Zero); + fx[bodyIndex_] += model_.X0(bodyID_).T() & spatialVector(moment, Zero); } diff --git a/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C b/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C index b15c39cb4d..e397a87ee5 100644 --- a/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C +++ b/src/rigidBodyDynamics/restraints/linearDamper/linearDamper.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ void Foam::RBD::restraints::linearDamper::restrain } // Accumulate the force for the restrained body - fx[bodyIndex_] += spatialVector(Zero, force); + fx[bodyIndex_] += model_.X0(bodyID_).T() & spatialVector(Zero, force); } diff --git a/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C b/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C index 441bfafc1f..44806465a3 100644 --- a/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C +++ b/src/rigidBodyDynamics/restraints/sphericalAngularDamper/sphericalAngularDamper.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ void Foam::RBD::restraints::sphericalAngularDamper::restrain } // Accumulate the force for the restrained body - fx[bodyIndex_] += spatialVector(moment, Zero); + fx[bodyIndex_] += model_.X0(bodyID_).T() & spatialVector(moment, Zero); }