sixDoFRigidBodyState: Moved to src to avoid build order problems
Resolves bug-report https://bugs.openfoam.org/view.php?id=2707
This commit is contained in:
@ -9,6 +9,5 @@ wmake $targetType forces
|
||||
wmake $targetType lagrangian
|
||||
wmake $targetType utilities
|
||||
wmake $targetType solvers
|
||||
wmake $targetType sixDoFRigidBodyState
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
sixDoFRigidBodyState.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libsixDoFRigidBodyState
|
||||
@ -1,11 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/sixDoFRigidBodyMotion/lnInclude \
|
||||
-I$(LIB_SRC)/OpenFOAM/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
@ -1,153 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 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 "sixDoFRigidBodyState.H"
|
||||
#include "dynamicMotionSolverFvMesh.H"
|
||||
#include "sixDoFRigidBodyMotionSolver.H"
|
||||
#include "unitConversion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(sixDoFRigidBodyState, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
sixDoFRigidBodyState,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::sixDoFRigidBodyState::sixDoFRigidBodyState
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name)
|
||||
{
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::sixDoFRigidBodyState::~sixDoFRigidBodyState()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::sixDoFRigidBodyState::read(const dictionary& dict)
|
||||
{
|
||||
fvMeshFunctionObject::read(dict);
|
||||
angleFormat_ = dict.lookupOrDefault<word>("angleFormat", "radians");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::sixDoFRigidBodyState::writeFileHeader(const label)
|
||||
{
|
||||
OFstream& file = this->file();
|
||||
|
||||
writeHeader(file, "Motion State");
|
||||
writeHeaderValue(file, "Angle Units", angleFormat_);
|
||||
writeCommented(file, "Time");
|
||||
|
||||
file<< tab
|
||||
<< "centreOfRotation" << tab
|
||||
<< "centreOfMass" << tab
|
||||
<< "rotation" << tab
|
||||
<< "velocity" << tab
|
||||
<< "omega" << endl;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::sixDoFRigidBodyState::execute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::sixDoFRigidBodyState::write()
|
||||
{
|
||||
logFiles::write();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const dynamicMotionSolverFvMesh& mesh =
|
||||
refCast<const dynamicMotionSolverFvMesh>(obr_);
|
||||
|
||||
const sixDoFRigidBodyMotionSolver& motionSolver_ =
|
||||
refCast<const sixDoFRigidBodyMotionSolver>(mesh.motion());
|
||||
|
||||
const sixDoFRigidBodyMotion& motion = motionSolver_.motion();
|
||||
|
||||
vector rotationAngle
|
||||
(
|
||||
quaternion(motion.orientation()).eulerAngles(quaternion::XYZ)
|
||||
);
|
||||
|
||||
vector angularVelocity(motion.omega());
|
||||
|
||||
if (angleFormat_ == "degrees")
|
||||
{
|
||||
rotationAngle.x() = radToDeg(rotationAngle.x());
|
||||
rotationAngle.y() = radToDeg(rotationAngle.y());
|
||||
rotationAngle.z() = radToDeg(rotationAngle.z());
|
||||
|
||||
angularVelocity.x() = radToDeg(angularVelocity.x());
|
||||
angularVelocity.y() = radToDeg(angularVelocity.y());
|
||||
angularVelocity.z() = radToDeg(angularVelocity.z());
|
||||
}
|
||||
|
||||
writeTime(file());
|
||||
file()
|
||||
<< tab
|
||||
<< motion.centreOfRotation() << tab
|
||||
<< motion.centreOfMass() << tab
|
||||
<< rotationAngle << tab
|
||||
<< motion.v() << tab
|
||||
<< angularVelocity << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,146 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 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/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::sixDoFRigidBodyState
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
Writes the 6-DoF motion state.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
sixDoFRigidBodyState
|
||||
{
|
||||
type sixDoFRigidBodyState;
|
||||
libs ("libsixDoFRigidBodyState.so");
|
||||
angleFormat degrees;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: sixDoFRigidBodyState | yes |
|
||||
angleFormat | degrees or radians | no | radian
|
||||
\endtable
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
|
||||
SourceFiles
|
||||
sixDoFRigidBodyState.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef sixDoFRigidBodyState_H
|
||||
#define sixDoFRigidBodyState_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sixDoFRigidBodyState Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class sixDoFRigidBodyState
|
||||
:
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
// Private data
|
||||
|
||||
word angleFormat_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
sixDoFRigidBodyState(const sixDoFRigidBodyState&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const sixDoFRigidBodyState&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- overloaded writeFileHeader from writeFile
|
||||
virtual void writeFileHeader(const label i = 0);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("sixDoFRigidBodyState");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
sixDoFRigidBodyState
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~sixDoFRigidBodyState();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the sixDoFRigidBodyState data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual bool execute();
|
||||
|
||||
//- Write the sixDoFRigidBodyState
|
||||
virtual bool write();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user