diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
index cc7405fa68..307c32488a 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
+++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
@@ -59,6 +59,12 @@ Foam::dynamicMotionSolverFvMesh::~dynamicMotionSolverFvMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+const Foam::motionSolver& Foam::dynamicMotionSolverFvMesh::motion() const
+{
+ return motionPtr_();
+}
+
+
bool Foam::dynamicMotionSolverFvMesh::update()
{
fvMesh::movePoints(motionPtr_->newPoints());
diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H
index e5b03dc609..5c36dc13fc 100644
--- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H
+++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -84,6 +84,9 @@ public:
// Member Functions
+ //- Return the motionSolver
+ const motionSolver& motion() const;
+
//- Update the mesh for both mesh motion and topology change
virtual bool update();
};
diff --git a/src/functionObjects/sixDoFRigidBodyState/Make/files b/src/functionObjects/sixDoFRigidBodyState/Make/files
new file mode 100644
index 0000000000..a734265fbf
--- /dev/null
+++ b/src/functionObjects/sixDoFRigidBodyState/Make/files
@@ -0,0 +1,3 @@
+sixDoFRigidBodyState.C
+
+LIB = $(FOAM_LIBBIN)/libsixDoFRigidBodyState
diff --git a/src/functionObjects/sixDoFRigidBodyState/Make/options b/src/functionObjects/sixDoFRigidBodyState/Make/options
new file mode 100644
index 0000000000..2d77c5dda4
--- /dev/null
+++ b/src/functionObjects/sixDoFRigidBodyState/Make/options
@@ -0,0 +1,11 @@
+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
diff --git a/src/functionObjects/sixDoFRigidBodyState/sixDoFRigidBodyState.C b/src/functionObjects/sixDoFRigidBodyState/sixDoFRigidBodyState.C
new file mode 100644
index 0000000000..dd7dde334d
--- /dev/null
+++ b/src/functionObjects/sixDoFRigidBodyState/sixDoFRigidBodyState.C
@@ -0,0 +1,153 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / 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 .
+
+\*---------------------------------------------------------------------------*/
+
+#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("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(obr_);
+
+ const sixDoFRigidBodyMotionSolver& motionSolver_ =
+ refCast(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;
+}
+
+
+// ************************************************************************* //
diff --git a/src/functionObjects/sixDoFRigidBodyState/sixDoFRigidBodyState.H b/src/functionObjects/sixDoFRigidBodyState/sixDoFRigidBodyState.H
new file mode 100644
index 0000000000..731a2909ed
--- /dev/null
+++ b/src/functionObjects/sixDoFRigidBodyState/sixDoFRigidBodyState.H
@@ -0,0 +1,146 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / 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 .
+
+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
+
+// ************************************************************************* //
diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C
index cacc1c8a9c..af71cd7467 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C
+++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C
@@ -158,6 +158,13 @@ Foam::sixDoFRigidBodyMotionSolver::~sixDoFRigidBodyMotionSolver()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+const Foam::sixDoFRigidBodyMotion&
+Foam::sixDoFRigidBodyMotionSolver::motion() const
+{
+ return motion_;
+}
+
+
Foam::tmp
Foam::sixDoFRigidBodyMotionSolver::curPoints() const
{
diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H
index c7ca01f29f..b599c42562 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H
+++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.H
@@ -59,7 +59,7 @@ class sixDoFRigidBodyMotionSolver
{
// Private data
- //- Six dof motion object
+ //- Six DoF motion object
sixDoFRigidBodyMotion motion_;
wordReList patches_;
@@ -127,6 +127,9 @@ public:
// Member Functions
+ //- Return the six DoF motion object
+ const sixDoFRigidBodyMotion& motion() const;
+
//- Return point location obtained from the current motion field
virtual tmp curPoints() const;
diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict
index 14e648d568..940a829522 100644
--- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict
+++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/controlDict
@@ -49,4 +49,14 @@ adjustTimeStep yes;
maxCo 0.9;
+functions
+{
+ sixDoFRigidBodyState
+ {
+ type sixDoFRigidBodyState;
+ libs ("libsixDoFRigidBodyState.so");
+ angleFormat degrees;
+ }
+}
+
// ************************************************************************* //