/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/linearMotion/linearMotion.C
https://gitlab.com/johnvarv/OpenFOAM-3.0.x · C · 98 lines · 47 code · 21 blank · 30 comment · 0 complexity · b814371f9d41d11eb2d1aa1b5604a3d5 MD5 · raw file
- /*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2015 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 <http://www.gnu.org/licenses/>.
- \*---------------------------------------------------------------------------*/
- #include "linearMotion.H"
- #include "addToRunTimeSelectionTable.H"
- // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
- namespace Foam
- {
- namespace solidBodyMotionFunctions
- {
- defineTypeNameAndDebug(linearMotion, 0);
- addToRunTimeSelectionTable
- (
- solidBodyMotionFunction,
- linearMotion,
- dictionary
- );
- }
- }
- // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
- Foam::solidBodyMotionFunctions::linearMotion::linearMotion
- (
- const dictionary& SBMFCoeffs,
- const Time& runTime
- )
- :
- solidBodyMotionFunction(SBMFCoeffs, runTime)
- {
- read(SBMFCoeffs);
- }
- // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
- Foam::solidBodyMotionFunctions::linearMotion::~linearMotion()
- {}
- // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
- Foam::septernion
- Foam::solidBodyMotionFunctions::linearMotion::transformation() const
- {
- scalar t = time_.value();
- // Translation of centre of gravity with constant velocity
- const vector displacement = velocity_*t;
- quaternion R(0, 0, 0);
- septernion TR(septernion(displacement)*R);
- Info<< "solidBodyMotionFunctions::linearMotion::transformation(): "
- << "Time = " << t << " transformation: " << TR << endl;
- return TR;
- }
- bool Foam::solidBodyMotionFunctions::linearMotion::read
- (
- const dictionary& SBMFCoeffs
- )
- {
- solidBodyMotionFunction::read(SBMFCoeffs);
- SBMFCoeffs_.lookup("velocity") >> velocity_;
- return true;
- }
- // ************************************************************************* //