From 1428f11b6e79719ee7390c589ed6eccf850c8ecd Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 4 Apr 2016 17:07:26 +0100 Subject: [PATCH] rigidBodyDynamics: Added sphere body to simply construction of articulated bodies containing spheres --- src/rigidBodyDynamics/Make/files | 1 + src/rigidBodyDynamics/bodies/sphere/sphere.C | 36 +++++++ src/rigidBodyDynamics/bodies/sphere/sphere.H | 99 +++++++++++++++++++ src/rigidBodyDynamics/bodies/sphere/sphereI.H | 39 ++++++++ 4 files changed, 175 insertions(+) create mode 100644 src/rigidBodyDynamics/bodies/sphere/sphere.C create mode 100644 src/rigidBodyDynamics/bodies/sphere/sphere.H create mode 100644 src/rigidBodyDynamics/bodies/sphere/sphereI.H diff --git a/src/rigidBodyDynamics/Make/files b/src/rigidBodyDynamics/Make/files index 2ae2c197a..4d8c27d48 100644 --- a/src/rigidBodyDynamics/Make/files +++ b/src/rigidBodyDynamics/Make/files @@ -1,5 +1,6 @@ bodies/rigidBody/rigidBody.C bodies/masslessBody/masslessBody.C +bodies/sphere/sphere.C joints/joint/joint.C joints/nullJoint/nullJoint.C diff --git a/src/rigidBodyDynamics/bodies/sphere/sphere.C b/src/rigidBodyDynamics/bodies/sphere/sphere.C new file mode 100644 index 000000000..95d7b020b --- /dev/null +++ b/src/rigidBodyDynamics/bodies/sphere/sphere.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "sphere.H" + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::RBD::sphere::~sphere() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +// ************************************************************************* // diff --git a/src/rigidBodyDynamics/bodies/sphere/sphere.H b/src/rigidBodyDynamics/bodies/sphere/sphere.H new file mode 100644 index 000000000..e1c24e0d3 --- /dev/null +++ b/src/rigidBodyDynamics/bodies/sphere/sphere.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\3 + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::sphere + +Description + +SourceFiles + sphereI.H + sphere.C + +\*---------------------------------------------------------------------------*/ + +#ifndef RBD_sphere_H +#define RBD_sphere_H + +#include "rigidBody.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of Foam classes +class Istream; +class Ostream; + +namespace RBD +{ + +// Forward declaration of friend functions and operators +class sphere; +Ostream& operator<<(Ostream&, const sphere&); + + +/*---------------------------------------------------------------------------*\ + Class sphere Declaration +\*---------------------------------------------------------------------------*/ + +class sphere +: + public rigidBody +{ + +public: + + // Constructors + + //- Construct from name, mass and radius + inline sphere(const word& name, const scalar m, const scalar r); + + + //- Destructor + virtual ~sphere(); + + + // Member Functions + + // IOstream Operators + + //friend Ostream& operator<<(Ostream&, const sphere&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RBD +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "sphereI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/rigidBodyDynamics/bodies/sphere/sphereI.H b/src/rigidBodyDynamics/bodies/sphere/sphereI.H new file mode 100644 index 000000000..557d35348 --- /dev/null +++ b/src/rigidBodyDynamics/bodies/sphere/sphereI.H @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +inline Foam::RBD::sphere::sphere +( + const word& name, + const scalar m, + const scalar r +) +: + rigidBody(name, m, Zero, (2.0/5.0)*m*sqr(r)*I) +{} + + +// ************************************************************************* //