Permalink
Browse files

solidBodyMotionFunctions: Changed CofG to origin where appropriate an…

…d support run-time selectable omega specification in rotatingMotion
  • Loading branch information...
1 parent f8fe353 commit 7078b10802b10e2434ae4e24fee559f51eeb8084 Henry committed Jul 29, 2013
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -73,7 +73,7 @@ Foam::solidBodyMotionFunctions::axisRotationMotion::transformation() const
{
scalar t = time_.value();
- // Rotation around centre of gravity (in radians)
+ // Rotation origin (in radians)
vector omega
(
t*degToRad(radialVelocity_.x()),
@@ -83,7 +83,7 @@ Foam::solidBodyMotionFunctions::axisRotationMotion::transformation() const
scalar magOmega = mag(omega);
quaternion R(omega/magOmega, magOmega);
- septernion TR(septernion(CofG_)*R*septernion(-CofG_));
+ septernion TR(septernion(origin_)*R*septernion(-origin_));
Info<< "solidBodyMotionFunctions::axisRotationMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
@@ -99,7 +99,7 @@ bool Foam::solidBodyMotionFunctions::axisRotationMotion::read
{
solidBodyMotionFunction::read(SBMFCoeffs);
- SBMFCoeffs_.lookup("CofG") >> CofG_;
+ SBMFCoeffs_.lookup("origin") >> origin_;
SBMFCoeffs_.lookup("radialVelocity") >> radialVelocity_;
return true;
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -57,8 +57,8 @@ class axisRotationMotion
{
// Private data
- //- Centre of gravity
- point CofG_;
+ //- Origin
+ point origin_;
//- Rotational velocity (deg/s)
vector radialVelocity_;
@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -82,7 +82,7 @@ transformation() const
eulerAngles *= pi/180.0;
quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z());
- septernion TR(septernion(CofG_)*R*septernion(-CofG_));
+ septernion TR(septernion(origin_)*R*septernion(-origin_));
Info<< "solidBodyMotionFunctions::oscillatingRotatingMotion::"
<< "transformation(): "
@@ -99,7 +99,7 @@ bool Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::read
{
solidBodyMotionFunction::read(SBMFCoeffs);
- SBMFCoeffs_.lookup("CofG") >> CofG_;
+ SBMFCoeffs_.lookup("origin") >> origin_;
SBMFCoeffs_.lookup("amplitude") >> amplitude_;
SBMFCoeffs_.lookup("omega") >> omega_;
@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -57,7 +57,7 @@ class oscillatingRotatingMotion
// Private data
//- Centre of gravity
- point CofG_;
+ point origin_;
//- Amplitude
vector amplitude_;
@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -54,10 +54,11 @@ Foam::solidBodyMotionFunctions::rotatingMotion::rotatingMotion
const Time& runTime
)
:
- solidBodyMotionFunction(SBMFCoeffs, runTime)
-{
- read(SBMFCoeffs);
-}
+ solidBodyMotionFunction(SBMFCoeffs, runTime),
+ origin_(SBMFCoeffs_.lookup("origin")),
+ axis_(SBMFCoeffs_.lookup("axis")),
+ omega_(DataEntry<scalar>::New("omega", SBMFCoeffs_))
+{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
@@ -73,16 +74,11 @@ Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const
{
scalar t = time_.value();
- // Motion around a centre of gravity
-
- // Rotation around centre of gravity (in degrees)
- vector eulerAngles = radialVelocity_*t;
-
- // Convert the rotational motion from deg to rad
- eulerAngles *= pi/180.0;
+ // Rotation around axis
+ vector eulerAngles = omega_->integrate(0, t)*axis_;
quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z());
- septernion TR(septernion(CofG_)*R*septernion(-CofG_));
+ septernion TR(septernion(origin_)*R*septernion(-origin_));
Info<< "solidBodyMotionFunctions::rotatingMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
@@ -98,8 +94,10 @@ bool Foam::solidBodyMotionFunctions::rotatingMotion::read
{
solidBodyMotionFunction::read(SBMFCoeffs);
- SBMFCoeffs_.lookup("CofG") >> CofG_;
- SBMFCoeffs_.lookup("radialVelocity") >> radialVelocity_;
+ omega_.reset
+ (
+ DataEntry<scalar>::New("omega", SBMFCoeffs_).ptr()
+ );
return true;
}
@@ -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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -25,8 +25,10 @@ Class
Foam::solidBodyMotionFunctions::rotatingMotion
Description
- SolidBodyMotionFvMesh 6DoF motion function. Constant
- velocity rotation around CoG.
+ SolidBodyMotionFvMesh 6DoF motion function.
+
+ The rotation is defined by an origin and axis of rotation and an angular
+ speed.
SourceFiles
rotatingMotion.C
@@ -39,6 +41,8 @@ SourceFiles
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
+#include "DataEntry.H"
+#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -57,11 +61,14 @@ class rotatingMotion
{
// Private data
- //- Centre of gravity
- point CofG_;
+ //- Origin of the axis
+ const vector origin_;
+
+ //- Axis vector
+ const vector axis_;
- //- Rotational velocity (deg/s)
- vector radialVelocity_;
+ //- Angular velocty (rad/sec)
+ autoPtr<DataEntry<scalar> > omega_;
// Private Member Functions
@@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
-| \\ / O peration | Version: 2.2.1 |
+| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@@ -33,7 +33,7 @@ outerInlet
meshMotionProperties
{
- radialVelocity (0 0 1440); // deg/s
+ omega 25; // rad/s
}
#include "${FOAM_CASE}/constant/boundaryConditions"
@@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
-| \\ / O peration | Version: 2.2.1 |
+| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@@ -26,8 +26,9 @@ solidBodyMotionFvMeshCoeffs
solidBodyMotionFunction rotatingMotion;
rotatingMotionCoeffs
{
- CofG (0 0 0);
- radialVelocity $:meshMotionProperties.radialVelocity;
+ origin (0 0 0);
+ axis (0 0 1);
+ omega $:meshMotionProperties.omega;
}
}
@@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
-| \\ / O peration | Version: 2.2.1 |
+| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@@ -26,8 +26,9 @@ solidBodyMotionFvMeshCoeffs
solidBodyMotionFunction rotatingMotion;
rotatingMotionCoeffs
{
- CofG (0 0 0);
- radialVelocity (0 0 360); // deg/s
+ origin (0 0 0);
+ axis (0 0 1);
+ omega 6.2832; // rad/s
}
}
@@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
-| \\ / O peration | Version: 2.2.1 |
+| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@@ -26,8 +26,9 @@ solidBodyMotionFvMeshCoeffs
solidBodyMotionFunction rotatingMotion;
rotatingMotionCoeffs
{
- CofG (0 0 0);
- radialVelocity (0 9000 0); // deg/s
+ origin (0 0 0);
+ axis (0 1 0);
+ omega 158; // rad/s
}
}
@@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
-| \\ / O peration | Version: 2.2.x |
+| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@@ -26,8 +26,9 @@ solidBodyMotionFvMeshCoeffs
solidBodyMotionFunction rotatingMotion;
rotatingMotionCoeffs
{
- CofG (0 0 0);
- radialVelocity (0 0 -288); // deg/s -> 5 rad/s -> 48 rpm
+ origin (0 0 0);
+ axis (0 0 1);
+ omega -5; // 5 rad/s
}
}
@@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
-| \\ / O peration | Version: 2.2.1 |
+| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@@ -29,8 +29,9 @@ solidBodyMotionFvMeshCoeffs
solidBodyMotionFunction rotatingMotion;
rotatingMotionCoeffs
{
- CofG (0 0.1 0);
- radialVelocity (0 0 360); // degrees/s
+ origin (0 0.1 0);
+ axis (0 0 1);
+ omega 6.2832; // rad/s
}
}
@@ -40,17 +41,19 @@ solidBodyMotionFvMeshCoeffs
// solidBodyMotionFunction rotatingMotion;
// rotatingMotionCoeffs
// {
- // CofG (0 0 0);
- // radialVelocity (720 0 0); // degrees/s
+ // origin (0 0 0);
+ // axis (1 0 0);
+ // omega 12.5664; // rad/s
// }
//}
+
// Tube rocking on rotating table
rotatingBox
{
solidBodyMotionFunction oscillatingRotatingMotion;
oscillatingRotatingMotionCoeffs
{
- CofG (0 0 0);
+ origin (0 0 0);
omega 40; // rad/s
amplitude (45 0 0); // 45 degrees max tilt
}

0 comments on commit 7078b10

Please sign in to comment.