Function1s::omega: New user convenience class to handle the input of time-varying rotational speed

Description
    User convenience class to handle the input of time-varying rotational speed
    in rad/s if \c omega is specified or rpm if \c rpm is specified.

Usage
    For specifying the rotational speed in rpm of an MRF zone:
    \verbatim
        MRF
        {
            cellZone    rotor;

            origin     (0 0 0);
            axis       (0 0 1);

            rpm        60;
        }
    \endverbatim
    or the equivalent specified in rad/s:
    \verbatim
        MRF
        {
            cellZone    rotor;

            origin     (0 0 0);
            axis       (0 0 1);

            rpm        6.28319;
        }
    \endverbatim
    or for a tabulated ramped rotational speed of a solid body:
    \verbatim
        mover
        {
            type            motionSolver;

            libs            ("libfvMeshMovers.so" "libfvMotionSolvers.so");

            motionSolver    solidBody;

            cellZone        innerCylinder;

            solidBodyMotionFunction  rotatingMotion;

            origin      (0 0 0);
            axis        (0 1 0);

            rpm         table
            (
                (0    0)
                (0.01  6000)
                (0.022  6000)
                (0.03  4000)
                (100   4000)
            );
        }
    \endverbatim

The following classes have been updated to use the new Function1s::omega class:
    solidBodyMotionFunctions::rotatingMotion
    MRFZone
    rotatingPressureInletOutletVelocityFvPatchVectorField
    rotatingTotalPressureFvPatchScalarField
    rotatingWallVelocityFvPatchVectorField

and all tutorials using these models and BCs updated to use rpm where appropriate.
This commit is contained in:
Henry Weller
2022-08-12 16:52:04 +01:00
parent 26a8e20763
commit 2da5edec29
27 changed files with 398 additions and 111 deletions

View File

@ -101,6 +101,7 @@ primitives/functions/Function1/squarePulse/squarePulse.C
primitives/functions/Function1/Table/tableBase.C primitives/functions/Function1/Table/tableBase.C
primitives/functions/Function1/Table/TableReader/makeTableReaders.C primitives/functions/Function1/Table/TableReader/makeTableReaders.C
primitives/functions/Function1/unknownTypeFunction1/unknownTypeFunction1.C primitives/functions/Function1/unknownTypeFunction1/unknownTypeFunction1.C
primitives/functions/Function1/omega/omega.C
primitives/functions/Function2/makeFunction2s.C primitives/functions/Function2/makeFunction2s.C

View File

@ -0,0 +1,91 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 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 "omega.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1s::omega::omega()
:
rpm_(false),
omegaFactor_(1)
{}
Foam::Function1s::omega::omega(const dictionary& dict)
:
rpm_(dict.found("rpm")),
omegaFactor_(rpm_ ? constant::mathematical::pi/30.0 : 1),
omega_
(
rpm_
? Function1<scalar>::New("rpm", dict)
: Function1<scalar>::New("omega", dict)
)
{}
Foam::Function1s::omega::omega(const omega& o)
:
rpm_(o.rpm_),
omegaFactor_(o.omegaFactor_),
omega_(o.omega_, false)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::Function1s::omega::read(const dictionary& dict)
{
rpm_ = dict.found("rpm");
omegaFactor_ = rpm_ ? constant::mathematical::pi/30.0 : 1;
omega_.reset
(
rpm_
? Function1<scalar>::New("rpm", dict).ptr()
: Function1<scalar>::New("omega", dict).ptr()
);
return true;
}
void Foam::Function1s::omega::write(Ostream& os) const
{
writeEntry(os, omega_());
}
// * * * * * * * * * * * * * * * IOstream Functions * * * * * * * * * * * * //
void Foam::Function1s::writeEntry(Ostream& os, const omega& o)
{
o.write(os);
}
// ************************************************************************* //

View File

@ -0,0 +1,178 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 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::Function1s::omega
Description
User convenience class to handle the input of time-varying rotational speed
in rad/s if \c omega is specified or rpm if \c rpm is specified.
Usage
For specifying the rotational speed in rpm of an MRF zone:
\verbatim
MRF
{
cellZone rotor;
origin (0 0 0);
axis (0 0 1);
rpm 60;
}
\endverbatim
or the equivalent specified in rad/s:
\verbatim
MRF
{
cellZone rotor;
origin (0 0 0);
axis (0 0 1);
rpm 6.28319;
}
\endverbatim
or for a tabulated ramped rotational speed of a solid body:
\verbatim
mover
{
type motionSolver;
libs ("libfvMeshMovers.so" "libfvMotionSolvers.so");
motionSolver solidBody;
cellZone innerCylinder;
solidBodyMotionFunction rotatingMotion;
origin (0 0 0);
axis (0 1 0);
rpm table
(
(0 0)
(0.01 6000)
(0.022 6000)
(0.03 4000)
(100 4000)
);
}
\endverbatim
See also
Foam::Function1s
SourceFiles
omega.C
\*---------------------------------------------------------------------------*/
#ifndef omega_H
#define omega_H
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1s
{
/*---------------------------------------------------------------------------*\
Class omega Declaration
\*---------------------------------------------------------------------------*/
class omega
{
// Private Data
//- True if the input specification is rpm rather than omega
bool rpm_;
//- 1 for omega, pi/30 for rpm
scalar omegaFactor_;
//- The omega function
autoPtr<Function1<scalar>> omega_;
public:
// Constructors
//- Construct null
omega();
//- Construct from dictionary
omega(const dictionary& dict);
//- Copy constructor
omega(const omega&);
// Member Functions
//- Update omega function from given dictionary
bool read(const dictionary& dict);
//- Return value for time t
inline scalar value(const scalar t) const;
//- Return the integral between times t1 and t2
inline scalar integral
(
const scalar t1,
const scalar t2
) const;
//- Write data to dictionary stream
void write(Ostream& os) const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const omega&) = delete;
};
void writeEntry(Ostream& os, const omega& a);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Function1s
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "omegaI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::Function1s::omega::value(const scalar t) const
{
return omegaFactor_*omega_->value(t);
}
inline Foam::scalar Foam::Function1s::omega::integral
(
const scalar t1,
const scalar t2
) const
{
return omegaFactor_*omega_->integral(t1, t2);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,7 +57,7 @@ Foam::solidBodyMotionFunctions::rotatingMotion::rotatingMotion
solidBodyMotionFunction(SBMFCoeffs, runTime), solidBodyMotionFunction(SBMFCoeffs, runTime),
origin_(SBMFCoeffs_.lookup("origin")), origin_(SBMFCoeffs_.lookup("origin")),
axis_(SBMFCoeffs_.lookup("axis")), axis_(SBMFCoeffs_.lookup("axis")),
omega_(Function1<scalar>::New("omega", SBMFCoeffs_)) omega_(SBMFCoeffs_)
{} {}
@ -72,13 +72,13 @@ Foam::solidBodyMotionFunctions::rotatingMotion::~rotatingMotion()
Foam::septernion Foam::septernion
Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const
{ {
scalar t = time_.value(); const scalar t = time_.value();
// Rotation around axis // Rotation around axis
scalar angle = omega_->integral(0, t); const scalar angle = omega_.integral(0, t);
quaternion R(axis_, angle); const quaternion R(axis_, angle);
septernion TR(septernion(-origin_)*R*septernion(origin_)); const septernion TR(septernion(-origin_)*R*septernion(origin_));
DebugInFunction << "Time = " << t << " transformation: " << TR << endl; DebugInFunction << "Time = " << t << " transformation: " << TR << endl;
@ -93,10 +93,7 @@ bool Foam::solidBodyMotionFunctions::rotatingMotion::read
{ {
solidBodyMotionFunction::read(SBMFCoeffs); solidBodyMotionFunction::read(SBMFCoeffs);
omega_.reset omega_.read(SBMFCoeffs);
(
Function1<scalar>::New("omega", SBMFCoeffs_).ptr()
);
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,9 +40,7 @@ SourceFiles
#include "solidBodyMotionFunction.H" #include "solidBodyMotionFunction.H"
#include "primitiveFields.H" #include "primitiveFields.H"
#include "point.H" #include "omega.H"
#include "Function1.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,7 +66,7 @@ class rotatingMotion
const vector axis_; const vector axis_;
//- Angular velocity (rad/sec) //- Angular velocity (rad/sec)
autoPtr<Function1<scalar>> omega_; Function1s::omega omega_;
public: public:

View File

@ -29,7 +29,6 @@ License
#include "volFields.H" #include "volFields.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "geometricOneField.H" #include "geometricOneField.H"
#include "Scale.H"
#include "faceSet.H" #include "faceSet.H"
#include "syncTools.H" #include "syncTools.H"
@ -226,25 +225,7 @@ Foam::MRFZone::MRFZone
cellSet_(mesh, coeffs_, fvCellSet::selectionModeType::cellZone), cellSet_(mesh, coeffs_, fvCellSet::selectionModeType::cellZone),
origin_(coeffs_.lookup("origin")), origin_(coeffs_.lookup("origin")),
axis_(coeffs_.lookup("axis")), axis_(coeffs_.lookup("axis")),
omega_ omega_(coeffs_)
(
coeffs_.found("omega")
? Function1<scalar>::New("omega", coeffs_)
: autoPtr<Function1<scalar>>
(
new Function1s::Scale<scalar>
(
"omega",
Function1s::Constant<scalar>
(
"piby30",
constant::mathematical::pi/30.0
),
Function1s::Constant<scalar>("1", 1),
Function1<scalar>::New("rpm", coeffs_)()
)
)
)
{ {
axis_ = axis_/mag(axis_); axis_ = axis_/mag(axis_);
setMRFFaces(); setMRFFaces();
@ -255,7 +236,7 @@ Foam::MRFZone::MRFZone
Foam::vector Foam::MRFZone::Omega() const Foam::vector Foam::MRFZone::Omega() const
{ {
return omega_->value(mesh_.time().userTimeValue())*axis_; return omega_.value(mesh_.time().userTimeValue())*axis_;
} }

View File

@ -42,7 +42,7 @@ SourceFiles
#include "fvCellSet.H" #include "fvCellSet.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "Function1.H" #include "omega.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -82,7 +82,7 @@ class MRFZone
vector axis_; vector axis_;
//- Angular velocity (rad/sec or rpm) //- Angular velocity (rad/sec or rpm)
autoPtr<Function1<scalar>> omega_; Function1s::omega omega_;
// Private Member Functions // Private Member Functions

View File

@ -24,9 +24,9 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "rotatingPressureInletOutletVelocityFvPatchVectorField.H" #include "rotatingPressureInletOutletVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -34,7 +34,7 @@ void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::
calcTangentialVelocity() calcTangentialVelocity()
{ {
const scalar t = this->db().time().userTimeValue(); const scalar t = this->db().time().userTimeValue();
const scalar omega = omega_->value(t); const scalar omega = omega_.value(t);
const vectorField tangentialVelocity const vectorField tangentialVelocity
( (
@ -58,8 +58,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
: :
pressureInletOutletVelocityFvPatchVectorField(p, iF), pressureInletOutletVelocityFvPatchVectorField(p, iF),
origin_(), origin_(),
axis_(Zero), axis_(Zero)
omega_()
{} {}
@ -74,7 +73,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
pressureInletOutletVelocityFvPatchVectorField(p, iF, dict), pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
origin_(dict.lookup("origin")), origin_(dict.lookup("origin")),
axis_(dict.lookup("axis")), axis_(dict.lookup("axis")),
omega_(Function1<scalar>::New("omega", dict)) omega_(dict)
{ {
calcTangentialVelocity(); calcTangentialVelocity();
} }
@ -92,7 +91,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
pressureInletOutletVelocityFvPatchVectorField(pvf, p, iF, mapper), pressureInletOutletVelocityFvPatchVectorField(pvf, p, iF, mapper),
origin_(pvf.origin_), origin_(pvf.origin_),
axis_(pvf.axis_), axis_(pvf.axis_),
omega_(pvf.omega_, false) omega_(pvf.omega_)
{ {
calcTangentialVelocity(); calcTangentialVelocity();
} }
@ -108,7 +107,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
pressureInletOutletVelocityFvPatchVectorField(pvf, iF), pressureInletOutletVelocityFvPatchVectorField(pvf, iF),
origin_(pvf.origin_), origin_(pvf.origin_),
axis_(pvf.axis_), axis_(pvf.axis_),
omega_(pvf.omega_, false) omega_(pvf.omega_)
{ {
calcTangentialVelocity(); calcTangentialVelocity();
} }
@ -125,7 +124,7 @@ void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write
writeEntry(os, "phi", phiName()); writeEntry(os, "phi", phiName());
writeEntry(os, "origin", origin_); writeEntry(os, "origin", origin_);
writeEntry(os, "axis", axis_); writeEntry(os, "axis", axis_);
writeEntry(os, omega_()); writeEntry(os, omega_);
writeEntry(os, "value", *this); writeEntry(os, "value", *this);
} }

View File

@ -37,7 +37,8 @@ Usage
tangentialVelocity | tangential velocity field | no | tangentialVelocity | tangential velocity field | no |
origin | origin of rotation in Cartesian co-ordinates | yes| origin | origin of rotation in Cartesian co-ordinates | yes|
axis | axis of rotation | yes | axis | axis of rotation | yes |
omega | angular velocity of the frame [rad/s] | yes | omega | angular velocity of the frame [rad/s] | no |
rpm | angular velocity of the frame [rpm] | no |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -49,12 +50,11 @@ Usage
tangentialVelocity uniform (0 0 0); tangentialVelocity uniform (0 0 0);
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 100; rpm 100;
} }
\endverbatim \endverbatim
The \c omega entry is a Function1 type, able to describe time varying The \c omega or \c rpm entries are Function1 of time, see Foam::Function1s.
functions.
Note: Note:
Sign conventions: Sign conventions:
@ -76,7 +76,7 @@ SourceFiles
#include "fvPatchFields.H" #include "fvPatchFields.H"
#include "pressureInletOutletVelocityFvPatchVectorField.H" #include "pressureInletOutletVelocityFvPatchVectorField.H"
#include "Function1.H" #include "omega.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -99,8 +99,8 @@ class rotatingPressureInletOutletVelocityFvPatchVectorField
//- Axis of the rotation //- Axis of the rotation
vector axis_; vector axis_;
//- Angular velocity of the frame //- Angular velocity of the frame (rad/sec)
autoPtr<Function1<scalar>> omega_; Function1s::omega omega_;
// Private Member Functions // Private Member Functions

View File

@ -40,8 +40,7 @@ rotatingTotalPressureFvPatchScalarField
: :
totalPressureFvPatchScalarField(p, iF), totalPressureFvPatchScalarField(p, iF),
origin_(), origin_(),
axis_(Zero), axis_(Zero)
omega_()
{} {}
@ -56,7 +55,7 @@ rotatingTotalPressureFvPatchScalarField
totalPressureFvPatchScalarField(p, iF, dict), totalPressureFvPatchScalarField(p, iF, dict),
origin_(dict.lookup("origin")), origin_(dict.lookup("origin")),
axis_(dict.lookup("axis")), axis_(dict.lookup("axis")),
omega_(Function1<scalar>::New("omega", dict)) omega_(dict)
{} {}
@ -72,7 +71,7 @@ rotatingTotalPressureFvPatchScalarField
totalPressureFvPatchScalarField(psf, p, iF, mapper), totalPressureFvPatchScalarField(psf, p, iF, mapper),
origin_(psf.origin_), origin_(psf.origin_),
axis_(psf.axis_), axis_(psf.axis_),
omega_(psf.omega_, false) omega_(psf.omega_)
{} {}
@ -86,7 +85,7 @@ rotatingTotalPressureFvPatchScalarField
totalPressureFvPatchScalarField(psf, iF), totalPressureFvPatchScalarField(psf, iF),
origin_(psf.origin_), origin_(psf.origin_),
axis_(psf.axis_), axis_(psf.axis_),
omega_(psf.omega_, false) omega_(psf.omega_)
{} {}
@ -100,7 +99,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
} }
const scalar t = this->db().time().userTimeValue(); const scalar t = this->db().time().userTimeValue();
const scalar omega = omega_->value(t); const scalar omega = omega_.value(t);
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
@ -124,7 +123,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::write(Ostream& os) const
totalPressureFvPatchScalarField::write(os); totalPressureFvPatchScalarField::write(os);
writeEntry(os, "origin", origin_); writeEntry(os, "origin", origin_);
writeEntry(os, "axis", axis_); writeEntry(os, "axis", axis_);
writeEntry(os, omega_()); writeEntry(os, omega_);
} }

View File

@ -39,7 +39,8 @@ Usage
p0 | static pressure reference | yes | p0 | static pressure reference | yes |
origin | origin of rotation in Cartesian co-ordinates | yes| origin | origin of rotation in Cartesian co-ordinates | yes|
axis | axis of rotation | yes | axis | axis of rotation | yes |
omega | angular velocity of the frame [rad/s] | yes | omega | angular velocity of the frame [rad/s] | no |
rpm | angular velocity of the frame [rpm] | no |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -55,12 +56,11 @@ Usage
p0 uniform 1e5; p0 uniform 1e5;
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 100; rpm 100;
} }
\endverbatim \endverbatim
The \c omega entry is a Function1 type, able to describe time varying The \c omega or \c rpm entries are Function1 of time, see Foam::Function1s.
functions.
See also See also
Foam::totalPressureFvPatchScalarField Foam::totalPressureFvPatchScalarField
@ -75,7 +75,7 @@ SourceFiles
#define rotatingTotalPressureFvPatchScalarField_H #define rotatingTotalPressureFvPatchScalarField_H
#include "totalPressureFvPatchScalarField.H" #include "totalPressureFvPatchScalarField.H"
#include "Function1.H" #include "omega.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -98,8 +98,8 @@ class rotatingTotalPressureFvPatchScalarField
//- Axis of the rotation //- Axis of the rotation
vector axis_; vector axis_;
//- Angular velocity of the frame //- Angular velocity of the frame (rad/sec)
const autoPtr<Function1<scalar>> omega_; Function1s::omega omega_;
public: public:

View File

@ -39,8 +39,7 @@ rotatingWallVelocityFvPatchVectorField
: :
fixedValueFvPatchField<vector>(p, iF), fixedValueFvPatchField<vector>(p, iF),
origin_(), origin_(),
axis_(Zero), axis_(Zero)
omega_(0)
{} {}
@ -55,7 +54,7 @@ rotatingWallVelocityFvPatchVectorField
fixedValueFvPatchField<vector>(p, iF, dict, false), fixedValueFvPatchField<vector>(p, iF, dict, false),
origin_(dict.lookup("origin")), origin_(dict.lookup("origin")),
axis_(dict.lookup("axis")), axis_(dict.lookup("axis")),
omega_(Function1<scalar>::New("omega", dict)) omega_(dict)
{ {
if (dict.found("value")) if (dict.found("value"))
{ {
@ -84,7 +83,7 @@ rotatingWallVelocityFvPatchVectorField
fixedValueFvPatchField<vector>(pvf, p, iF, mapper), fixedValueFvPatchField<vector>(pvf, p, iF, mapper),
origin_(pvf.origin_), origin_(pvf.origin_),
axis_(pvf.axis_), axis_(pvf.axis_),
omega_(pvf.omega_, false) omega_(pvf.omega_)
{} {}
@ -98,7 +97,7 @@ rotatingWallVelocityFvPatchVectorField
fixedValueFvPatchField<vector>(pvf, iF), fixedValueFvPatchField<vector>(pvf, iF),
origin_(pvf.origin_), origin_(pvf.origin_),
axis_(pvf.axis_), axis_(pvf.axis_),
omega_(pvf.omega_, false) omega_(pvf.omega_)
{} {}
@ -112,7 +111,7 @@ void Foam::rotatingWallVelocityFvPatchVectorField::updateCoeffs()
} }
const scalar t = this->db().time().userTimeValue(); const scalar t = this->db().time().userTimeValue();
const scalar omega = omega_->value(t); const scalar omega = omega_.value(t);
// Calculate the rotating wall velocity from the specification of the motion // Calculate the rotating wall velocity from the specification of the motion
const vectorField Up const vectorField Up
@ -134,7 +133,7 @@ void Foam::rotatingWallVelocityFvPatchVectorField::write(Ostream& os) const
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
writeEntry(os, "origin", origin_); writeEntry(os, "origin", origin_);
writeEntry(os, "axis", axis_); writeEntry(os, "axis", axis_);
writeEntry(os, omega_()); writeEntry(os, omega_);
writeEntry(os, "value", *this); writeEntry(os, "value", *this);
} }

View File

@ -35,7 +35,8 @@ Usage
Property | Description | Required | Default value Property | Description | Required | Default value
origin | origin of rotation in Cartesian co-ordinates | yes| origin | origin of rotation in Cartesian co-ordinates | yes|
axis | axis of rotation | yes | axis | axis of rotation | yes |
omega | angular velocity of the frame [rad/s] | yes | omega | angular velocity of the frame [rad/s] | no |
rpm | angular velocity of the frame [rpm] | no |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -45,11 +46,11 @@ Usage
type rotatingWallVelocity; type rotatingWallVelocity;
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 100; rpm 100;
} }
\endverbatim \endverbatim
The \c omega entry is a Function1 of time, see Foam::Function1s. The \c omega or \c rpm entries are Function1 of time, see Foam::Function1s.
See also See also
Foam::fixedValueFvPatchField Foam::fixedValueFvPatchField
@ -64,7 +65,7 @@ SourceFiles
#define rotatingWallVelocityFvPatchVectorField_H #define rotatingWallVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"
#include "Function1.H" #include "omega.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -88,7 +89,7 @@ class rotatingWallVelocityFvPatchVectorField
vector axis_; vector axis_;
//- Rotational speed //- Rotational speed
autoPtr<Function1<scalar>> omega_; Function1s::omega omega_;
public: public:

View File

@ -34,7 +34,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 6.2832; // rad/s
rpm 60;
} }
stator stator
@ -47,7 +48,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 0 -1); axis (0 0 -1);
omega 6.2832; // rad/s
rpm 60;
} }
}; };
} }

View File

@ -28,7 +28,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (1 0 0); axis (1 0 0);
omega 6.2832;
rpm 60;
} }

View File

@ -28,7 +28,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 1 0); axis (0 1 0);
omega 158; // rad/s
rpm 1500;
} }

View File

@ -26,7 +26,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 6.2832; // rad/s
rpm 60;
} }

View File

@ -25,9 +25,10 @@ boundaryField
type rotatingWallVelocity; type rotatingWallVelocity;
axis (0 1 0); axis (0 1 0);
origin (0 0 0); origin (0 0 0);
omega constant 13.2; // 2.1 rev/s rpm 126;
value uniform (0 0 0); value uniform (0 0 0);
} }
vessel vessel
{ {
type noSlip; type noSlip;

View File

@ -50,7 +50,7 @@ boundaryField
type rotatingWallVelocity; type rotatingWallVelocity;
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega constant -5; rpm -50;
value $internalField; value $internalField;
} }

View File

@ -28,7 +28,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega -5; // 5 rad/s
rpm -50;
} }

View File

@ -28,13 +28,14 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 1 0); axis (0 1 0);
omega table
rpm table
( (
(0 0) (0 0)
(0.01 628) (0.01 6000)
(0.022 628) (0.022 6000)
(0.03 419) (0.03 4000)
(100 419) (100 4000)
); );
} }

View File

@ -25,7 +25,7 @@ boundaryField
type rotatingWallVelocity; type rotatingWallVelocity;
axis (0 1 0); axis (0 1 0);
origin (0 0 0); origin (0 0 0);
omega constant 13.2; // 2.1 rev/s rpm 126;
value uniform (0 0 0); value uniform (0 0 0);
} }
vessel vessel

View File

@ -34,7 +34,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 6.2832; // rad/s
rpm 60;
} }
stator stator
@ -47,7 +48,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 0 -1); axis (0 0 -1);
omega 6.2832; // rad/s
rpm 60;
} }
}; };
} }

View File

@ -41,7 +41,7 @@ mover
{ {
origin (0 0.02 0); origin (0 0.02 0);
axis (0 0 1); axis (0 0 1);
omega 18.8945578; rpm 180;
} }
} }
} }

View File

@ -32,22 +32,10 @@ mover
{ {
origin (0 0.1 0); origin (0 0.1 0);
axis (0 0 1); axis (0 0 1);
omega 6.2832; // rad/s rpm 60;
} }
} }
//// Box rotates on rotating table
//rotatingBox
//{
// solidBodyMotionFunction rotatingMotion;
// rotatingMotionCoeffs
// {
// origin (0 0 0);
// axis (1 0 0);
// omega 12.5664; // rad/s
// }
//}
// Tube rocking on rotating table // Tube rocking on rotating table
rotatingBox rotatingBox
{ {
@ -55,8 +43,8 @@ mover
oscillatingRotatingMotionCoeffs oscillatingRotatingMotionCoeffs
{ {
origin (0 0 0); origin (0 0 0);
omega 40; // rad/s
amplitude (45 0 0); // 45 degrees max tilt amplitude (45 0 0); // 45 degrees max tilt
omega 40; // rad/s
} }
} }
} }

View File

@ -28,7 +28,8 @@ mover
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega 6.2832; // rad/s
rpm 60;
} }