Commit 5ecde8d9 authored by mattijs's avatar mattijs
Browse files

new solidBodyMotionFunctions

parent 98c3d099
......@@ -14,5 +14,7 @@ $(solidBodyMotionFunctions)/SKA/SKA.C
$(solidBodyMotionFunctions)/linearMotion/linearMotion.C
$(solidBodyMotionFunctions)/rotationMotion/rotationMotion.C
$(solidBodyMotionFunctions)/multiMotion/multiMotion.C
$(solidBodyMotionFunctions)/oscillatingMotion/oscillatingMotion.C
$(solidBodyMotionFunctions)/rockingMotion/rockingMotion.C
LIB = $(FOAM_LIBBIN)/libdynamicFvMesh
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "oscillatingMotion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(oscillatingMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
oscillatingMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::oscillatingMotion::oscillatingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
)
:
solidBodyMotionFunction(SBMFCoeffs, runTime)
{
read(SBMFCoeffs);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::oscillatingMotion::~oscillatingMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion
Foam::solidBodyMotionFunctions::oscillatingMotion::transformation() const
{
scalar t = time_.value();
const vector displacement = amplitude_*sin(omega_*t);
quaternion R(0, 0, 0);
septernion TR(septernion(displacement)*R);
Info<< "solidBodyMotionFunctions::oscillatingMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::oscillatingMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
SBMFCoeffs_.lookup("amplitude") >> amplitude_;
SBMFCoeffs_.lookup("omega") >> omega_;
return true;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::solidBodyMotionFunctions::oscillatingMotion
Description
SolidBodyMotionFvMesh 6DoF motion function. Oscillating displacement.
SourceFiles
oscillatingMotion.C
\*---------------------------------------------------------------------------*/
#ifndef oscillatingMotion_H
#define oscillatingMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class oscillatingMotion Declaration
\*---------------------------------------------------------------------------*/
class oscillatingMotion
:
public solidBodyMotionFunction
{
// Private data
//- Amplitude
vector amplitude_;
//- Radial velocity
scalar omega_;
// Private Member Functions
//- Disallow copy construct
oscillatingMotion(const oscillatingMotion&);
//- Disallow default bitwise assignment
void operator=(const oscillatingMotion&);
public:
//- Runtime type information
TypeName("oscillatingMotion");
// Constructors
//- Construct from components
oscillatingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
);
// Destructor
virtual ~oscillatingMotion();
// Member Functions
//- Return the solid-body motion transformation septernion
virtual septernion transformation() const;
//- Update properties from given dictionary
virtual bool read(const dictionary& SBMFCoeffs);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "rockingMotion.H"
#include "addToRunTimeSelectionTable.H"
#include "mathConstants.H"
using namespace Foam::constant::math;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(rockingMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
rockingMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::rockingMotion::rockingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
)
:
solidBodyMotionFunction(SBMFCoeffs, runTime)
{
read(SBMFCoeffs);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::rockingMotion::~rockingMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion
Foam::solidBodyMotionFunctions::rockingMotion::transformation() const
{
scalar t = time_.value();
vector eulerAngles = amplitude_*sin(omega_*t);
// Convert the rotational motion from deg to rad
eulerAngles *= pi/180.0;
quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z());
septernion TR(septernion(CofG_)*R*septernion(-CofG_));
Info<< "solidBodyMotionFunctions::rockingMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::rockingMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
SBMFCoeffs_.lookup("CofG") >> CofG_;
SBMFCoeffs_.lookup("amplitude") >> amplitude_;
SBMFCoeffs_.lookup("omega") >> omega_;
return true;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::solidBodyMotionFunctions::rockingMotion
Description
SolidBodyMotionFvMesh 6DoF motion function. Oscillating rotation.
SourceFiles
rockingMotion.C
\*---------------------------------------------------------------------------*/
#ifndef rockingMotion_H
#define rockingMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class rockingMotion Declaration
\*---------------------------------------------------------------------------*/
class rockingMotion
:
public solidBodyMotionFunction
{
// Private data
//- Centre of gravity
point CofG_;
//- Amplitude
vector amplitude_;
//- Radial velocity
scalar omega_;
// Private Member Functions
//- Disallow copy construct
rockingMotion(const rockingMotion&);
//- Disallow default bitwise assignment
void operator=(const rockingMotion&);
public:
//- Runtime type information
TypeName("rockingMotion");
// Constructors
//- Construct from components
rockingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
);
// Destructor
virtual ~rockingMotion();
// Member Functions
//- Return the solid-body motion transformation septernion
virtual septernion transformation() const;
//- Update properties from given dictionary
virtual bool read(const dictionary& SBMFCoeffs);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -34,14 +34,25 @@ solidBodyMotionFvMeshCoeffs
}
}
// Box rotates on rotating table
//// Box rotates on rotating table
//rotatingBox
//{
// solidBodyMotionFunction rotationMotion;
// rotationMotionCoeffs
// {
// CofG (0 0 0);
// radialVelocity (720 0 0); // degrees/s
// }
//}
// Box rocking on rotating table
rotatingBox
{
solidBodyMotionFunction rotationMotion;
rotationMotionCoeffs
solidBodyMotionFunction rockingMotion;
rockingMotionCoeffs
{
CofG (0 0 0);
radialVelocity (720 0 0); // degrees/s
omega 40; // rad/s
amplitude (45 0 0); // 45 degrees max tilt
}
}
}
......
......@@ -24,7 +24,7 @@ regions
(
boxToCell
{
box ( -100 -100 -100 ) ( 100 -0.02 100);
box ( -100 -100 -100 ) ( 100 100 -0.0025);
fieldValues ( volScalarFieldValue alpha1 1 );
}
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment